rename: role authorization 엔티티 생성
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
import { client } from "@/shared/api";
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import type {
|
||||
RoleAuthorizationsService,
|
||||
RoleAuthorizationsParams,
|
||||
RoleAuthorizationsList,
|
||||
RoleAuthorizationsData,
|
||||
RoleAuthorizations,
|
||||
} from "../model/role-authorizations-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 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();
|
||||
@@ -1,45 +0,0 @@
|
||||
import { z } from "zod";
|
||||
import type { PageableList, PageableParams } from "@/shared/model";
|
||||
|
||||
export interface RoleAuthorizationsParams extends PageableParams {
|
||||
keywordType?: string;
|
||||
keyword?: string;
|
||||
authorizationNo?: string;
|
||||
}
|
||||
|
||||
export interface RoleAuthorizations {
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
roleContent: string;
|
||||
useYn: string;
|
||||
authorizationNo: number;
|
||||
authYn: string;
|
||||
}
|
||||
|
||||
export const roleAuthorizationsSchema = z.object({
|
||||
roleId: z.string(),
|
||||
authorizationNo: z.number(),
|
||||
authYn: z.string(),
|
||||
});
|
||||
|
||||
export const roleAuthorizationsFormSchema = z.object({
|
||||
roleAuthorizations: z.array(roleAuthorizationsSchema),
|
||||
});
|
||||
|
||||
export type RoleAuthorizationsList = PageableList<RoleAuthorizations>;
|
||||
export type RoleAuthorizationsData = z.infer<typeof roleAuthorizationsSchema>[];
|
||||
export type RoleAuthorizationsFormData = z.infer<
|
||||
typeof roleAuthorizationsFormSchema
|
||||
>;
|
||||
|
||||
export interface RoleAuthorizationsService {
|
||||
getRoleAuthorizationsList: (
|
||||
params: RoleAuthorizationsParams,
|
||||
) => Promise<RoleAuthorizationsList>;
|
||||
createRoleAuthorizations: (
|
||||
data: RoleAuthorizationsData,
|
||||
) => Promise<RoleAuthorizations>;
|
||||
updateRoleAuthorizations: (
|
||||
data: RoleAuthorizationsData,
|
||||
) => Promise<RoleAuthorizations>;
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
import type { ColumnDef } from "@tanstack/react-table";
|
||||
import type { UseFormReturn } from "react-hook-form";
|
||||
import { Checkbox } from "@common/components";
|
||||
import type { RoleAuthorizations } from "./role-authorizations-interface";
|
||||
import type { RoleAuthorizationsFormData } from "./role-authorizations-interface";
|
||||
import type {
|
||||
RoleAuthorizations,
|
||||
RoleAuthorizationsFormData,
|
||||
} from "@/entities/role-authorization";
|
||||
|
||||
export const createColumns = (
|
||||
form: UseFormReturn<RoleAuthorizationsFormData>,
|
||||
|
||||
@@ -28,13 +28,13 @@ import {
|
||||
import { ENDPOINT } from "@/shared/config";
|
||||
import { useAlertStore } from "@/shared/lib/use-alert-store";
|
||||
import {
|
||||
RoleAuthorizationsApi,
|
||||
roleAuthorizationsFormSchema,
|
||||
type RoleAuthorizationsFormData,
|
||||
type RoleAuthorizationsData,
|
||||
} from "../model/role-authorizations-interface";
|
||||
} from "@/entities/role-authorization";
|
||||
import { createColumns } from "../model/role-authorizations-table-columns";
|
||||
import type { Authorizations } from "@/entities/authorization";
|
||||
import { RoleAuthorizationsApi } from "../api/role-authorizations-service";
|
||||
|
||||
type ManagementAuthorityDialogProps = {
|
||||
authorizationNo?: string;
|
||||
|
||||
Reference in New Issue
Block a user