36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import { Inject, Injectable } from "@angular/core";
|
|
import { UserRep } from "../models/user-management.api.models";
|
|
import { ApiService } from "./user-management.api.service";
|
|
import { HttpClient, HttpParams } from "@angular/common/http";
|
|
import { ApiResult } from "../models/api.response.model";
|
|
import { Observable } from "rxjs";
|
|
|
|
@Injectable({
|
|
providedIn: "root"
|
|
})
|
|
export class UserRepService extends ApiService<UserRep> {
|
|
constructor(http: HttpClient, @Inject('USER_REP_URL') private userRepUri: string) {
|
|
super(http, userRepUri)
|
|
}
|
|
|
|
override getAll(withUser: boolean = false, withRepGroup: boolean = false, withRightGroup: boolean = false, withRepUser: boolean = false, userId?: number): Observable<ApiResult<UserRep[]>> {
|
|
let params = new HttpParams();
|
|
if (withUser) {
|
|
params = params.set('withUser', withUser);
|
|
}
|
|
if (withRepGroup) {
|
|
params = params.set('withRepGroup', withRepGroup);
|
|
}
|
|
if (withRightGroup) {
|
|
params = params.set('withRightGroup', withRightGroup);
|
|
}
|
|
if (withRepUser) {
|
|
params = params.set('withRepUser', withRepUser);
|
|
}
|
|
if (userId) {
|
|
params = params.set('userId', userId)
|
|
}
|
|
|
|
return this.http.get<ApiResult<UserRep[]>>(`${this.baseUrl}`, { params: params, withCredentials: true });
|
|
}
|
|
} |