feat: 사이트 게시 이력 api 작업

This commit is contained in:
2025-04-03 11:40:00 +09:00
parent 6df605a184
commit e3454e11d5
10 changed files with 203 additions and 17 deletions
@@ -0,0 +1,27 @@
import type { PageableList, PageableParams } from "@/shared/model";
export interface PostingParams extends PageableParams {
pstgTrgtNo: number;
}
export interface Post {
siteId: string;
siteNm: string;
pstgTypeCd: string;
pstgTypeNm: string;
pstgTrgtNo: number;
pstgBgngDt: string;
pstgEndDt: string;
pstgPrdSeCd: string;
pstgPrdSeNm: string;
delYn: string;
}
export interface WithModePostData extends Post {
mode: string;
}
export interface PostService {
getPostingHistory: (params: PostingParams) => Promise<PageableList<Post>>;
requestPosting: (data: WithModePostData[]) => Promise<Post[]>;
}
@@ -0,0 +1,44 @@
"use client";
import dayjs from "dayjs";
import { type ColumnDef } from "@tanstack/react-table";
import { Checkbox } from "@common/components/ui";
import { type Post } from "./posting-interface";
export const columns: ColumnDef<Post>[] = [
{
id: "select",
header: ({ table }) => (
<Checkbox
checked={table.getIsAllPageRowsSelected()}
onClick={(e) => e.stopPropagation()}
onCheckedChange={(checked) =>
table.toggleAllPageRowsSelected(!!checked)
}
className="h-4 w-4 rounded border-gray-300"
/>
),
cell: ({ row }) => (
<Checkbox
checked={row.getIsSelected()}
onClick={(e) => e.stopPropagation()}
onCheckedChange={(checked) => row.toggleSelected(!!checked)}
className="h-4 w-4 rounded border-gray-300"
/>
),
},
{
accessorKey: "siteNm",
header: "사이트",
},
{
accessorKey: "pstgPrdSeNm",
header: "게시기간",
cell: ({ row }) => {
const pstgPrdSeNm = row.original.pstgPrdSeNm;
const pstgBgngDt = row.original.pstgBgngDt;
const pstgEndDt = row.original.pstgEndDt;
return `${pstgPrdSeNm} (${dayjs(pstgBgngDt).format("YYYY-MM-DD")} ~ ${dayjs(pstgEndDt).format("YYYY-MM-DD")})`;
},
},
];