임동욱 임동욱 08-21
Merge branch 'claude/admin-member-list-design-b1fec7' into hub
@1bc1fab972d6b41d50730ce51c72fc33aa0a22e4
app/(protected)/(basic)/contents/_components/content-video-field.tsx
--- app/(protected)/(basic)/contents/_components/content-video-field.tsx
+++ app/(protected)/(basic)/contents/_components/content-video-field.tsx
@@ -20,6 +20,8 @@
 
 interface ContentVideoFieldProps {
   defaultFileId?: string | null;
+  /** 이미 올라가 있는 영상의 원본 파일명. 없으면 대체 문구로 그린다. */
+  defaultFileName?: string | null;
 }
 
 /**
@@ -29,7 +31,10 @@
  * 업로드가 끝나기 전에 저장하면 영상 없이 저장되므로 그동안은 `videoUploading`을 실어 보내
  * Server Action이 막게 한다.
  */
-export function ContentVideoField({ defaultFileId }: ContentVideoFieldProps) {
+export function ContentVideoField({
+  defaultFileId,
+  defaultFileName,
+}: ContentVideoFieldProps) {
   const [fileId, setFileId] = useState(defaultFileId ?? '');
   const [isUploading, setIsUploading] = useState(false);
   const [error, setError] = useState('');
@@ -86,6 +91,11 @@
       <FoxFileUpload
         mode="default"
         accept={fileModuleAccept(FILE_MODULE.vodContent)}
+        defaultFiles={
+          defaultFileId
+            ? [{ id: defaultFileId, name: defaultFileName ?? '등록된 영상' }]
+            : undefined
+        }
         selectLabel="파일선택"
         placeholder="파일을 선택해 주세요."
         description={UPLOAD_HELP_TEXT}
app/(protected)/(basic)/contents/shorts/_components/shorts-form.tsx
--- app/(protected)/(basic)/contents/shorts/_components/shorts-form.tsx
+++ app/(protected)/(basic)/contents/shorts/_components/shorts-form.tsx
@@ -113,7 +113,10 @@
         </ContentFormRow>
 
         <ContentFormRow label="영상 콘텐츠 ID">
-          <ContentVideoField defaultFileId={item?.attachmentId} />
+          <ContentVideoField
+            defaultFileId={item?.attachmentId}
+            defaultFileName={item?.attachmentFileName}
+          />
         </ContentFormRow>
 
         <ContentFormRow label="썸네일">
lib/data/repositories/content-repository.ts
--- lib/data/repositories/content-repository.ts
+++ lib/data/repositories/content-repository.ts
@@ -86,6 +86,22 @@
   return { schoolCode, grades };
 }
 
+/** 첨부의 원본 파일명 — 조회로 연 화면이 어떤 파일이 붙어 있는지 보여 줄 때 쓴다. */
+function toFirstFileName(raw: unknown): string | null {
+  if (!Array.isArray(raw)) {
+    return null;
+  }
+  for (const entry of raw) {
+    if (isRecord(entry)) {
+      const name = readString(entry, 'orgnlFileNm');
+      if (name) {
+        return name;
+      }
+    }
+  }
+  return null;
+}
+
 /** 한 `atchFileId` 아래 여러 컷이 `fileSn`으로 들어온다. */
 function toFileNumbers(raw: unknown): number[] {
   if (!Array.isArray(raw)) {
@@ -120,6 +136,7 @@
     grades: schulGrd.grades,
     keywords: toKeywords(raw.keywordList),
     attachmentId: readString(raw, 'atchFileId'),
+    attachmentFileName: toFirstFileName(raw.fileList),
     thumbnailFileId: readString(raw, 'thumbAtchFileId'),
     isVisible: readString(raw, 'useYn') !== 'N',
     modifiedAt:
lib/domain/content.ts
--- lib/domain/content.ts
+++ lib/domain/content.ts
@@ -101,6 +101,8 @@
   keywords: ContentKeyword[];
   /** 만화의 컷 이미지·쇼츠의 영상이 묶인 첨부 ID. */
   attachmentId: string | null;
+  /** 첨부의 원본 파일명. 조회로 연 화면이 붙어 있는 파일을 보여 줄 때 쓴다. */
+  attachmentFileName: string | null;
   /** 만화 컷처럼 한 첨부 아래 여러 파일이 있을 때의 파일 번호들. */
   cutFileNumbers: number[];
   thumbnailFileId: string | null;
Add a comment
List