260713_01_ENH: 미진행인 모니터링 평가에 대해서도 upload가 가능하도록 수정 및 재단 계정에서도 업로드 가능하게 수정

This commit is contained in:
2026-07-13 11:35:47 +09:00
parent c6eeb3e62f
commit 6a1a1ba263
3 changed files with 27 additions and 7 deletions

View File

@@ -168,10 +168,12 @@ export const POST = async (
const backendForm = new FormData(); const backendForm = new FormData();
backendForm.append("file", file, file.name); backendForm.append("file", file, file.name);
const paramUserId = req.nextUrl.searchParams.get("paramUserId") ?? undefined;
const result = await backApi.postForm<PerformanceReview>( const result = await backApi.postForm<PerformanceReview>(
`/review/${encodeURIComponent(action)}/${encodeURIComponent(second)}`, `/review/${encodeURIComponent(action)}/${encodeURIComponent(second)}`,
backendForm backendForm,
{ query: paramUserId ? { paramUserId } : undefined }
); );
return NextResponse.json(result, { status: 200 }); return NextResponse.json(result, { status: 200 });
} }

View File

@@ -146,7 +146,9 @@ function ReviewFileActions({
const upload = async (file?: File) => { const upload = async (file?: File) => {
try { try {
if (!file) return; if (!file) return;
await withLoadingAsync(() => uploadMutation.mutateAsync({performanceId, reviewType, file})); await withLoadingAsync(() =>
uploadMutation.mutateAsync({performanceId, reviewType, file, paramUserId: userId})
);
alert("파일 업로드가 완료되었습니다."); alert("파일 업로드가 완료되었습니다.");
} finally { } finally {
if (fileInputRef.current) fileInputRef.current.value = ""; if (fileInputRef.current) fileInputRef.current.value = "";
@@ -179,7 +181,7 @@ function ReviewFileActions({
return ( return (
<div className="flex flex-wrap gap-1"> <div className="flex flex-wrap gap-1">
{canEdit && ( {canEdit && userId && (
<> <>
<input ref={fileInputRef} type="file" className="hidden" onChange={(event) => void upload(event.target.files?.[0])} /> <input ref={fileInputRef} type="file" className="hidden" onChange={(event) => void upload(event.target.files?.[0])} />
<FileActionButton icon="upload" disabled={uploadMutation.isPending || !canUpload} onClick={() => fileInputRef.current?.click()}>파일 업로드</FileActionButton> <FileActionButton icon="upload" disabled={uploadMutation.isPending || !canUpload} onClick={() => fileInputRef.current?.click()}>파일 업로드</FileActionButton>
@@ -335,8 +337,10 @@ function MonitoringStatusRow({
uploadFileName={row.review?.uploadFileName} uploadFileName={row.review?.uploadFileName}
pdfFileName={row.review?.pdfFileName} pdfFileName={row.review?.pdfFileName}
pdfConvert={row.review?.pdfConvert} pdfConvert={row.review?.pdfConvert}
canUpload={canEdit && isReviewComplete(row.review)} //canUpload={canEdit && isReviewComplete(row.review)}
canEdit={canEdit} //canEdit={canEdit}
canUpload={true}
canEdit={true}
/> />
</div> </div>
{row.slot.visit?.length ? ( {row.slot.visit?.length ? (

View File

@@ -19,10 +19,24 @@ export function useUploadReviewFileMutation() {
const qc = useQueryClient(); const qc = useQueryClient();
return useMutation({ return useMutation({
mutationFn: ({performanceId, reviewType, file}: {performanceId: number; reviewType: number; file: File}) => { mutationFn: ({
performanceId,
reviewType,
file,
paramUserId,
}: {
performanceId: number;
reviewType: number;
file: File;
paramUserId?: string;
}) => {
const formData = new FormData(); const formData = new FormData();
formData.append("file", file, file.name); formData.append("file", file, file.name);
return nextApi.postForm<PerformanceReview>(`/review/${performanceId}/${reviewType}`, formData); return nextApi.postForm<PerformanceReview>(
`/review/${performanceId}/${reviewType}`,
formData,
{query: paramUserId ? {paramUserId} : undefined}
);
}, },
onSuccess: (_res, {performanceId, reviewType}) => { onSuccess: (_res, {performanceId, reviewType}) => {
qc.invalidateQueries({ queryKey: ["review", performanceId, reviewType] }); qc.invalidateQueries({ queryKey: ["review", performanceId, reviewType] });