File name
Commit message
Commit date
File name
Commit message
Commit date
09-14
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
import type { Metadata } from 'next';
import { verifySession } from '@/lib/auth/dal';
import { fetchCommonCodes } from '@/lib/data/repositories/common-code-repository';
import { fetchMerchantDetails } from '@/lib/data/repositories/merchant-detail-repository';
import { CODE_GROUP } from '@/lib/domain/common-code';
import {
parseMerchantDetailQuery,
todayIsoDate,
} from '@/lib/domain/merchant-detail-query';
import { MerchantDetailList } from './_components/merchant-detail-list';
export const metadata: Metadata = { title: '가맹몰 상세 관리' };
export const dynamic = 'force-dynamic';
interface PageProps {
searchParams: Promise<Record<string, string | string[] | undefined>>;
}
export default async function Page({ searchParams }: PageProps) {
await verifySession();
const query = parseMerchantDetailQuery(await searchParams);
const [{ items, totalCount }, categories] = await Promise.all([
fetchMerchantDetails(query),
fetchCommonCodes(CODE_GROUP.merchantType),
]);
const totalPages = Math.max(1, Math.ceil(totalCount / query.pageSize));
const currentPage = Math.min(query.page, totalPages);
return (
<MerchantDetailList
items={items}
categories={categories}
query={query}
currentPage={currentPage}
totalPages={totalPages}
totalCount={totalCount}
today={todayIsoDate()}
/>
);
}