56 lines
1.6 KiB
TypeScript
56 lines
1.6 KiB
TypeScript
import { client } from "@/shared/api";
|
|
import { ENDPOINT } from "@/shared/config";
|
|
import type {
|
|
RoleAuthorizationsService,
|
|
RoleAuthorizationsParams,
|
|
RoleAuthorizationsList,
|
|
RoleAuthorizationsData,
|
|
RoleAuthorizations,
|
|
WithRoleIdRoleAuthorizationsParams,
|
|
RoleAuthorizationsByRoleIdList,
|
|
} from "../model/role-authorization-interface";
|
|
|
|
export class RoleAuthorizationsApiService implements RoleAuthorizationsService {
|
|
public async getRoleAuthorizationsList(
|
|
params: RoleAuthorizationsParams,
|
|
): Promise<RoleAuthorizationsList> {
|
|
const response = await client.get<RoleAuthorizationsList>(
|
|
`${ENDPOINT.USER_SERVICE.ROLE_AUTHORIZATIONS}/api`,
|
|
{ params },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async getRoleAuthorizationsListByRoleId(
|
|
params: WithRoleIdRoleAuthorizationsParams,
|
|
): Promise<RoleAuthorizationsByRoleIdList> {
|
|
const response = await client.get<RoleAuthorizationsByRoleIdList>(
|
|
`${ENDPOINT.USER_SERVICE.ROLE_AUTHORIZATIONS}`,
|
|
{ params },
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async createRoleAuthorizations(
|
|
data: RoleAuthorizationsData,
|
|
): Promise<RoleAuthorizations> {
|
|
const response = await client.post<RoleAuthorizations>(
|
|
`${ENDPOINT.USER_SERVICE.ROLE_AUTHORIZATIONS}`,
|
|
data,
|
|
);
|
|
return response.data;
|
|
}
|
|
|
|
public async updateRoleAuthorizations(
|
|
data: RoleAuthorizationsData,
|
|
): Promise<RoleAuthorizations> {
|
|
const response = await client.put<RoleAuthorizations>(
|
|
`${ENDPOINT.USER_SERVICE.ROLE_AUTHORIZATIONS}`,
|
|
data,
|
|
);
|
|
return response.data;
|
|
}
|
|
}
|
|
|
|
export const RoleAuthorizationsApi = new RoleAuthorizationsApiService();
|