56 lines
1.3 KiB
TypeScript
56 lines
1.3 KiB
TypeScript
import { z } from "zod";
|
|
import type { PageableList, PageableParams } from "@/shared/model";
|
|
|
|
export interface CommentParams extends PageableParams {
|
|
keywordType?: string;
|
|
keyword?: string;
|
|
pstNo: number;
|
|
delYn?: string;
|
|
}
|
|
|
|
export interface Comment {
|
|
cmntEvl: number;
|
|
pstNo: number;
|
|
cmntNo: number;
|
|
cmntCn: string;
|
|
wrtrNm: string;
|
|
regDt: string;
|
|
rgtr: string;
|
|
mdfcnDt: string;
|
|
mdfr: string;
|
|
delYn: string;
|
|
}
|
|
|
|
export const commentFormSchema = z.object({
|
|
pstNo: z.number(),
|
|
cmntCn: z.string(),
|
|
wrtrNm: z.string().nullish(),
|
|
cmntPswd: z.string(),
|
|
cmntEvl: z.number().nullish(),
|
|
});
|
|
|
|
export const commentUpdateFormSchema = commentFormSchema.omit({
|
|
pstNo: true,
|
|
});
|
|
|
|
export type CommentList = PageableList<Comment>;
|
|
export type CommentFormData = z.infer<typeof commentFormSchema>;
|
|
export type CommentUpdateFormData = z.infer<typeof commentUpdateFormSchema>;
|
|
|
|
export interface CommentService {
|
|
getComments(params: CommentParams): Promise<CommentList>;
|
|
createComment(data: CommentFormData): Promise<Comment>;
|
|
updateComment(
|
|
bbsId: number,
|
|
pstNo: number,
|
|
cmntNo: number,
|
|
data: CommentUpdateFormData,
|
|
): Promise<Comment>;
|
|
deleteComment(
|
|
bbsId: number,
|
|
pstNo: number,
|
|
cmntNo: number,
|
|
cmntPswd: string,
|
|
): Promise<Comment>;
|
|
}
|