59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
import { Injectable } from '@angular/core';
|
|
import { Observable } from 'rxjs';
|
|
import { environment } from 'src/environments/environment';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class SystemProfileFieldManagementService {
|
|
|
|
private apiUrl = environment.apiUrl + '/profiles/system';
|
|
|
|
constructor(private http: HttpClient) { }
|
|
|
|
/**
|
|
* Get system profile fields with pagination
|
|
* @param page Page number (default: 0)
|
|
* @param size Page size (default: 10)
|
|
*/
|
|
getSystemProfileFields(page: number = 0, size: number = 10): Observable<any> {
|
|
let params = new HttpParams()
|
|
.set('page', page.toString())
|
|
.set('size', size.toString());
|
|
return this.http.get<any>(this.apiUrl, { params });
|
|
}
|
|
|
|
/**
|
|
* Get a specific system profile field by name
|
|
* @param name Field name
|
|
*/
|
|
getByName(name: string): Observable<any> {
|
|
return this.http.get<any>(`${this.apiUrl}/${name}`);
|
|
}
|
|
|
|
/**
|
|
* Update a system profile field
|
|
* @param systemProfileField System profile field object
|
|
*/
|
|
update(systemProfileField: any): Observable<any> {
|
|
return this.http.post<any>(this.apiUrl, systemProfileField);
|
|
}
|
|
|
|
/**
|
|
* Update multiple system profile fields
|
|
* @param systemProfileFields Array of system profile field objects
|
|
*/
|
|
updateList(systemProfileFields: any[]): Observable<any[]> {
|
|
return this.http.post<any[]>(`${this.apiUrl}/list`, systemProfileFields);
|
|
}
|
|
|
|
/**
|
|
* Delete a system profile field
|
|
* @param name Field name
|
|
*/
|
|
deleteByName(name: string): Observable<void> {
|
|
return this.http.delete<void>(`${this.apiUrl}/${name}`);
|
|
}
|
|
}
|