All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.app.core.services.database-admin.service.ts Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { environment } from '@env/environment';

@Injectable({
  providedIn: 'root'
})
export class DatabaseAdminService {

  private adminUrl = '/api/v1/admin/database';

  constructor(private http: HttpClient) { }

  execute(statement: string, database: string = 'jdbc'): Observable {
    return this.http.post(environment.backend + this.adminUrl + '/execute/' + database, statement);
  }

  paginate(statement: string, database: string = 'jdbc', pageNumber: number = 1, elementPerPage: number = 5): Observable {
    return this.http.post(environment.backend + this.adminUrl + '/paginate/' + database,
      {
        pageNumber: pageNumber,
        elementPerPage: elementPerPage,
        wrappedRequest: statement
      });
  }
}