260716_01_ENH: 본 서버에서 기동 후 중간 테스트를 위한 커밋

This commit is contained in:
2026-07-16 09:12:57 +09:00
parent c710a60beb
commit 36c7b41191
29 changed files with 864 additions and 532 deletions

View File

@@ -36,6 +36,7 @@ import {
type ListFilter,
type ListFilterTarget,
type listHeader,
type ListSearchUiState,
ListResetMode,
type ListResetScope,
type ListUploadRequest,
@@ -64,6 +65,15 @@ const downloadArrayBuffer = (buffer: ArrayBuffer, filename: string, type = 'appl
downloadFile(new Blob([buffer], { type }), filename)
}
const createEmptySearchUiState = (): ListSearchUiState => ({
searchText: '',
searchContactResult: [],
searchInterviewResult: [],
searchSurveyResult: [],
filterRows: [],
sorting: [],
})
const ListManagePage = () => {
const router = useRouter()
const mounted = useMounted()
@@ -75,6 +85,8 @@ const ListManagePage = () => {
const [messageSendMode, setMessageSendMode] = useState<MessageSendMode>('email')
const [selectedRows, setSelectedRows] = useState<ListTableRow[]>([])
const [currentListFilter, setCurrentListFilter] = useState<ListFilter>(() => createEmptyListFilter())
const [filterSummary, setFilterSummary] = useState<string[]>([])
const [searchUiState, setSearchUiState] = useState<ListSearchUiState>(createEmptySearchUiState)
const [listRefreshKey, setListRefreshKey] = useState(0)
const [pagination, setPagination] = useState<PaginationState>({ pageIndex: 0, pageSize: 25 })
const [restoredVisit, setRestoredVisit] = useState<LastListVisit | null>(null)
@@ -155,7 +167,13 @@ const ListManagePage = () => {
const handleStartContact = (row: ListTableRow) => {
const sid = String(row.sid ?? '')
setLastListVisit({ prjctIdx, sid, pageIndex: pagination.pageIndex, pageSize: pagination.pageSize })
setLastListVisit({
prjctIdx,
sid,
pageIndex: pagination.pageIndex,
pageSize: pagination.pageSize,
...searchUiState,
})
router.push(`/list/contact?sid=${encodeURIComponent(sid)}`)
}
@@ -171,10 +189,11 @@ const ListManagePage = () => {
const handleResetConfirm = async (payload: { target: ListFilterTarget; scope: ListResetScope }) => {
const listFilter = buildTargetFilter(payload.target)
await resetListMutation.mutateAsync({
const resetCount = await resetListMutation.mutateAsync({
resetMode: payload.scope === 'result-and-history' ? ListResetMode.HIST : ListResetMode.ALL,
listFilter,
})
alert(`${resetCount}건 삭제 되었습니다.`)
refreshList()
}
@@ -262,6 +281,7 @@ const ListManagePage = () => {
enableBatchEdit={canManageList}
refreshKey={listRefreshKey}
onCurrentFilterChange={setCurrentListFilter}
onFilterSummaryChange={setFilterSummary}
onSelectedRowsChange={setSelectedRows}
onRowClick={!canManageList ? handleStartContact : undefined}
onRowDoubleClick={canManageList ? handleStartContact : undefined}
@@ -271,12 +291,14 @@ const ListManagePage = () => {
: undefined
}
onPaginationChange={setPagination}
initialSearchState={restoredForThisProject}
onSearchStateChange={setSearchUiState}
focusRowId={restoredForThisProject?.sid}
/>
{canManageList && (
<>
<ListResetDialog onConfirm={handleResetConfirm} />
<ListResetDialog filterSummary={filterSummary} onConfirm={handleResetConfirm} />
<ListUploadDialog
onUpload={handleUploadConfirm}
onDownloadTemplate={handleDownloadTemplate}
@@ -288,12 +310,13 @@ const ListManagePage = () => {
headerRows={headerManageRows}
/>
<ListHeaderManageDialog prjctIdx={prjctIdx} rows={headerManageRows} onConfirm={handleHeaderManageConfirm} />
<ListDownloadDialog mode={downloadMode} onDownload={handleDownloadConfirm} />
<ListDownloadDialog mode={downloadMode} filterSummary={filterSummary} onDownload={handleDownloadConfirm} />
<MessageSendDialog
mode={messageSendMode}
listHeaders={headerManageRows}
currentFilter={currentListFilter}
selectedRows={selectedRows}
filterSummary={filterSummary}
onSent={refreshList}
/>
<MessageHistoryDialog />

View File

@@ -219,7 +219,7 @@ const UserManagePage = () => {
columns={columns}
data={viewList}
isClient={true}
selectMode='single'
selectMode='none'
defaultPageSize={10}
pageSizeOptions={[10, 20, 30, 50]}
getRowId={(row) => row.userId} // row.id = userId

View File

@@ -1,53 +0,0 @@
import {NextRequest, NextResponse} from "next/server";
import {RouteContext} from "@/types/common";
import {createNotihubApi} from "@/lib/http-server";
import {errorToResponse} from "@kri/common/http";
import type {BulkSendCreateRequest, BulkSendResponse, SendRequestBulk} from "@kri/common/noti-hub";
type MessageSendChannel = "sms" | "email";
const isSendChannel = (value: string): value is MessageSendChannel => value === "sms" || value === "email";
export const PUT = async (req: NextRequest, context: RouteContext) => {
try {
const {slug = []} = await context.params;
const [action, channel] = slug;
const notihubApi = await createNotihubApi();
if (action === "create-bulk" && channel && isSendChannel(channel)) {
const body: BulkSendCreateRequest | null = await req.json().catch(() => null);
if (!body) {
return NextResponse.json({message: "요청 바디가 없습니다."}, {status: 400});
}
const result = await notihubApi.put<string>(`/send-${channel}/create/bulk`, body);
return NextResponse.json(result, {status: 200});
}
return NextResponse.json({message: "Not found"}, {status: 404});
} catch (error: unknown) {
return errorToResponse(error);
}
};
export const POST = async (req: NextRequest, context: RouteContext) => {
try {
const {slug = []} = await context.params;
const [action, channel] = slug;
const notihubApi = await createNotihubApi();
if (action === "bulk" && channel && isSendChannel(channel)) {
const body: SendRequestBulk | null = await req.json().catch(() => null);
if (!body) {
return NextResponse.json({message: "요청 바디가 없습니다."}, {status: 400});
}
const result = await notihubApi.post<BulkSendResponse>(`/send-${channel}/bulk`, body);
return NextResponse.json(result, {status: 200});
}
return NextResponse.json({message: "Not found"}, {status: 404});
} catch (error: unknown) {
return errorToResponse(error);
}
};