diff --git a/apps/common/features/src/widgets/post/ui/post-page.tsx b/apps/common/features/src/widgets/post/ui/post-page.tsx index 509087b68..7aaa390fc 100644 --- a/apps/common/features/src/widgets/post/ui/post-page.tsx +++ b/apps/common/features/src/widgets/post/ui/post-page.tsx @@ -44,7 +44,9 @@ function PostPage({ bbsId }: { bbsId: string }) { const thumbRefs = useRef>(new Map()); const [tableSort, setTableSort] = useState(""); - const [postParams, setPostParams] = useState({ + const [keywordType, setKeywordType] = useState("title"); + const [keyword, setKeyword] = useState(""); + const [searchParams, setSearchParams] = useState({ keywordType: "title", keyword: "", }); @@ -58,7 +60,7 @@ function PostPage({ bbsId }: { bbsId: string }) { queryKey: [ENDPOINT.BOARD_SERVICE.POSTS_USER, bbsId, bbsInfo], queryFn: () => PostApi.getPostList(parseInt(bbsId), { - ...postParams, + ...searchParams, upndFixYn: bbsInfo?.upndFixUseYn, }), select: (data) => { @@ -79,10 +81,16 @@ function PostPage({ bbsId }: { bbsId: string }) { isLoading, refetch, } = useQuery({ - queryKey: [ENDPOINT.BOARD_SERVICE.POSTS_USER, bbsId, pagination, tableSort], + queryKey: [ + ENDPOINT.BOARD_SERVICE.POSTS_USER, + bbsId, + searchParams, + pagination, + tableSort, + ], queryFn: () => PostApi.getPostList(parseInt(bbsId), { - ...postParams, + ...searchParams, ansUseYn: bbsInfo?.ansUseYn, page: pagination.pageIndex, size: pagination.pageSize, @@ -128,7 +136,29 @@ function PostPage({ bbsId }: { bbsId: string }) { const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - refetch(); + setPagination({ + ...pagination, + pageIndex: 0, + }); + setSearchParams({ + ...searchParams, + keywordType, + keyword, + }); + }; + + const handleReset = () => { + setKeywordType("title"); + setKeyword(""); + setPagination({ + ...pagination, + pageIndex: 0, + }); + setSearchParams({ + ...searchParams, + keywordType: "title", + keyword: "", + }); }; const handleRowClick = (row: Post) => { @@ -141,12 +171,7 @@ function PostPage({ bbsId }: { bbsId: string }) {
- @@ -157,15 +182,21 @@ function PostPage({ bbsId }: { bbsId: string }) { - setPostParams({ ...postParams, keyword: e.target.value }) - } + value={keyword} + onChange={(e) => setKeyword(e.target.value)} className="h-[3.2rem] w-[24rem] rounded-sm !text-[1.3rem]" /> +
diff --git a/apps/cs/src/pages/popup/api/popup-service.ts b/apps/cs/src/pages/popup/api/popup-service.ts index b82d5f473..cff4cb55e 100644 --- a/apps/cs/src/pages/popup/api/popup-service.ts +++ b/apps/cs/src/pages/popup/api/popup-service.ts @@ -41,6 +41,10 @@ export class PopupApiService implements PopupService { validatedData, ); } + + public async deletePopup(popupSn: number): Promise { + await client.delete(`${ENDPOINT.CMS_SERVICE.POPUPS}/${popupSn}`); + } } export const PopupApi = new PopupApiService(); diff --git a/apps/cs/src/pages/popup/model/popup-interface.ts b/apps/cs/src/pages/popup/model/popup-interface.ts index 6952d873f..c565df8ca 100644 --- a/apps/cs/src/pages/popup/model/popup-interface.ts +++ b/apps/cs/src/pages/popup/model/popup-interface.ts @@ -68,4 +68,5 @@ export interface PopupService { getPopupInfo(popupSn: number): Promise; createPopup(data: PopupFormData): Promise; updatePopup(popupSn: number, data: PopupUpdateFormData): Promise; + deletePopup(popupSn: number): Promise; } diff --git a/apps/cs/src/pages/popup/ui/modify-page.tsx b/apps/cs/src/pages/popup/ui/modify-page.tsx index fed70cbbb..cffce11bd 100644 --- a/apps/cs/src/pages/popup/ui/modify-page.tsx +++ b/apps/cs/src/pages/popup/ui/modify-page.tsx @@ -52,6 +52,13 @@ function ModifyPage({ popupSn }: { popupSn: number }) { }, }); + const { mutateAsync: deletePopup } = useMutationWrapper({ + mutationFn: () => PopupApi.deletePopup(popupSn), + onSuccess: () => { + alert("삭제되었습니다.", router.back); + }, + }); + const { mutateAsync: savePostingHistory } = useMutationWrapper({ mutationFn: (data: PostPayload[]) => PostingApi.savePosting(data), onSuccess: () => { @@ -101,7 +108,12 @@ function ModifyPage({ popupSn }: { popupSn: number }) {

팝업 수정

- +
diff --git a/apps/cs/src/pages/popup/ui/popup-form.tsx b/apps/cs/src/pages/popup/ui/popup-form.tsx index 8e1e5783f..3147542ed 100644 --- a/apps/cs/src/pages/popup/ui/popup-form.tsx +++ b/apps/cs/src/pages/popup/ui/popup-form.tsx @@ -32,7 +32,7 @@ const Editor = dynamic( type PopupFormProps = { form: UseFormReturn; - popupSn?: string; + popupSn?: number; handleSave: (data: T) => Promise; handleDelete?: () => Promise; }; diff --git a/apps/cs/src/pages/schedule/api/schedule-service.ts b/apps/cs/src/pages/schedule/api/schedule-service.ts index b333b43f4..c7e2c8806 100644 --- a/apps/cs/src/pages/schedule/api/schedule-service.ts +++ b/apps/cs/src/pages/schedule/api/schedule-service.ts @@ -34,6 +34,10 @@ class ScheduleApiService implements ScheduleService { ): Promise { await client.put(`${ENDPOINT.CMS_SERVICE.SCHEDULES}/${schdlSn}`, data); } + + public async deleteSchedule(schdlSn: number): Promise { + await client.delete(`${ENDPOINT.CMS_SERVICE.SCHEDULES}/${schdlSn}`); + } } export const ScheduleApi = new ScheduleApiService(); diff --git a/apps/cs/src/pages/schedule/model/schedule-interface.ts b/apps/cs/src/pages/schedule/model/schedule-interface.ts index 98b6a703a..d9e942424 100644 --- a/apps/cs/src/pages/schedule/model/schedule-interface.ts +++ b/apps/cs/src/pages/schedule/model/schedule-interface.ts @@ -71,4 +71,5 @@ export interface ScheduleService { getScheduleInfo(schdlSn: number): Promise; createSchedule(data: ScheduleFormData): Promise; updateSchedule(schdlSn: number, data: ScheduleUpdateFormData): Promise; + deleteSchedule(schdlSn: number): Promise; } diff --git a/apps/cs/src/pages/schedule/ui/modify-page.tsx b/apps/cs/src/pages/schedule/ui/modify-page.tsx index e8f55534b..8b0a07a86 100644 --- a/apps/cs/src/pages/schedule/ui/modify-page.tsx +++ b/apps/cs/src/pages/schedule/ui/modify-page.tsx @@ -35,6 +35,16 @@ function ModifyPage({ schdlSn }: { schdlSn: string }) { }, }); + const { mutateAsync: deleteSchedule } = useMutationWrapper({ + mutationFn: () => ScheduleApi.deleteSchedule(parseInt(schdlSn)), + onSuccess: () => { + queryClient.invalidateQueries({ + queryKey: [ENDPOINT.CMS_SERVICE.SCHEDULES], + }); + alert("일정이 삭제되었습니다.", router.back); + }, + }); + const form = useForm({ resolver: zodResolver(scheduleUpdateFormSchema), values: { @@ -57,7 +67,12 @@ function ModifyPage({ schdlSn }: { schdlSn: string }) {

스케줄 수정

- +
); } diff --git a/apps/cs/src/pages/survey/api/survey-service.ts b/apps/cs/src/pages/survey/api/survey-service.ts index 6db4ea52d..66b57561c 100644 --- a/apps/cs/src/pages/survey/api/survey-service.ts +++ b/apps/cs/src/pages/survey/api/survey-service.ts @@ -45,6 +45,10 @@ export class SurveyApiService implements SurveyService { await client.put(`${ENDPOINT.CMS_SERVICE.SURVEY}/${srvySn}`, data); } + public async deleteSurvey(srvySn: number): Promise { + await client.delete(`${ENDPOINT.CMS_SERVICE.SURVEY}/${srvySn}`); + } + public async getQuestionList(params: QuestionParams): Promise { const response = await client.get( `${ENDPOINT.CMS_SERVICE.SURVEY_QUESTION}`, diff --git a/apps/cs/src/pages/survey/ui/detail-page.tsx b/apps/cs/src/pages/survey/ui/detail-page.tsx index de1abc783..59bf28425 100644 --- a/apps/cs/src/pages/survey/ui/detail-page.tsx +++ b/apps/cs/src/pages/survey/ui/detail-page.tsx @@ -29,6 +29,13 @@ function DetailPage({ srvySn }: { srvySn: string }) { queryFn: () => SurveyApi.getSurveyInfo(parseInt(srvySn)), }); + const { mutateAsync: deleteSurvey } = useMutationWrapper({ + mutationFn: () => SurveyApi.deleteSurvey(parseInt(srvySn)), + onSuccess: () => { + alert("삭제되었습니다.", router.back); + }, + }); + const postHistoryQuery = useQuery({ queryKey: [ENDPOINT.CMS_SERVICE.POSTINGS, srvySn], queryFn: () => @@ -77,6 +84,12 @@ function DetailPage({ srvySn }: { srvySn: string }) { }, }); + const handleDeleteSurvey = async () => { + if (await confirm("삭제하시겠습니까?")) { + deleteSurvey(); + } + }; + const handleDeletePostingHistory = async () => { const data = postingTable.getFilteredSelectedRowModel().rows.map((row) => ({ ...row.original, @@ -101,7 +114,9 @@ function DetailPage({ srvySn }: { srvySn: string }) { - +
    diff --git a/apps/cs/src/widgets/post/ui/general-file-uploader.tsx b/apps/cs/src/widgets/post/ui/general-file-uploader.tsx index 2012201da..cbd77ca18 100644 --- a/apps/cs/src/widgets/post/ui/general-file-uploader.tsx +++ b/apps/cs/src/widgets/post/ui/general-file-uploader.tsx @@ -102,7 +102,7 @@ function GeneralFileUploader({ {attachment.orgnlFileNm}