From 5859e45ab4625d826344de4cf6a073b257f0c2b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=ED=98=84=EC=A1=B0?= Date: Sun, 29 Sep 2024 22:56:06 +0900 Subject: [PATCH] =?UTF-8?q?Refactor:=20=ED=83=80=EC=9E=85=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EB=B6=84=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/types/alarmTypes.ts | 6 + frontend/src/types/categoryTypes.ts | 9 + frontend/src/types/commentTypes.ts | 24 ++ frontend/src/types/fileTypes.ts | 27 ++ frontend/src/types/folderTypes.ts | 23 ++ frontend/src/types/imageTypes.ts | 33 +++ frontend/src/types/index.ts | 370 +-------------------------- frontend/src/types/labelTypes.ts | 53 ++++ frontend/src/types/memberTypes.ts | 11 + frontend/src/types/modelTypes.ts | 32 +++ frontend/src/types/projectTypes.ts | 27 ++ frontend/src/types/reportTypes.ts | 27 ++ frontend/src/types/reviewTypes.ts | 44 ++++ frontend/src/types/workspaceTypes.ts | 23 ++ 14 files changed, 352 insertions(+), 357 deletions(-) create mode 100644 frontend/src/types/alarmTypes.ts create mode 100644 frontend/src/types/categoryTypes.ts create mode 100644 frontend/src/types/commentTypes.ts create mode 100644 frontend/src/types/fileTypes.ts create mode 100644 frontend/src/types/folderTypes.ts create mode 100644 frontend/src/types/imageTypes.ts create mode 100644 frontend/src/types/labelTypes.ts create mode 100644 frontend/src/types/memberTypes.ts create mode 100644 frontend/src/types/modelTypes.ts create mode 100644 frontend/src/types/projectTypes.ts create mode 100644 frontend/src/types/reportTypes.ts create mode 100644 frontend/src/types/reviewTypes.ts create mode 100644 frontend/src/types/workspaceTypes.ts diff --git a/frontend/src/types/alarmTypes.ts b/frontend/src/types/alarmTypes.ts new file mode 100644 index 0000000..af82f5e --- /dev/null +++ b/frontend/src/types/alarmTypes.ts @@ -0,0 +1,6 @@ +export interface AlarmResponse { + id: number; + isRead: boolean; + createdAt: string; + type: string; +} diff --git a/frontend/src/types/categoryTypes.ts b/frontend/src/types/categoryTypes.ts new file mode 100644 index 0000000..e08f955 --- /dev/null +++ b/frontend/src/types/categoryTypes.ts @@ -0,0 +1,9 @@ +// 카테고리 관련 DTO +export interface CategoryRequest { + categoryName: string; +} + +export interface CategoryResponse { + id: number; + name: string; +} diff --git a/frontend/src/types/commentTypes.ts b/frontend/src/types/commentTypes.ts new file mode 100644 index 0000000..cf2a1c5 --- /dev/null +++ b/frontend/src/types/commentTypes.ts @@ -0,0 +1,24 @@ +import { MemberResponse } from './memberTypes'; + +// 댓글 관련 DTO +export interface CommentRequest { + content: string; + positionX: number; + positionY: number; +} + +export interface CommentResponse { + id: number; + memberId: number; + memberNickname: string; + memberProfileImage: string; + positionX: number; + positionY: number; + content: string; + createTime: string; // 작성 일자 (ISO 8601 형식) + author: MemberResponse; // 추가됨 +} + +export interface CommentListResponse { + commentResponses: CommentResponse[]; +} diff --git a/frontend/src/types/fileTypes.ts b/frontend/src/types/fileTypes.ts new file mode 100644 index 0000000..7d96a02 --- /dev/null +++ b/frontend/src/types/fileTypes.ts @@ -0,0 +1,27 @@ +// 파일 및 디렉터리 관련 타입 +export type FileItem = { + id: number; + name: string; + url: string; + type: 'image' | 'json'; + status: 'idle' | 'done'; +}; + +export type DirectoryItem = { + id: number; + name: string; + type: 'directory'; + children: Array; +}; + +export type Project = { + id: number; + name: string; + type: 'classification' | 'detection' | 'segmentation'; + children: Array; +}; +export type Workspace = { + id: number; + name: string; + projects: Array; +}; diff --git a/frontend/src/types/folderTypes.ts b/frontend/src/types/folderTypes.ts new file mode 100644 index 0000000..eb91acc --- /dev/null +++ b/frontend/src/types/folderTypes.ts @@ -0,0 +1,23 @@ +import { ImageResponse } from './imageTypes'; + +export interface FolderRequest { + title: string; + parentId: number; +} + +export interface ChildFolder { + id: number; + title: string; +} + +export interface FolderResponse { + id: number; + title: string; + images: ImageResponse[]; + children: ChildFolder[]; +} + +export interface FolderIdResponse { + id: number; + title: string; +} diff --git a/frontend/src/types/imageTypes.ts b/frontend/src/types/imageTypes.ts new file mode 100644 index 0000000..4fe094f --- /dev/null +++ b/frontend/src/types/imageTypes.ts @@ -0,0 +1,33 @@ +export type ImageStatus = 'PENDING' | 'IN_PROGRESS' | 'SAVE' | 'REVIEW_REQUEST' | 'REVIEW_REJECTED' | 'COMPLETED'; + +export interface ImageResponse { + id: number; + imageTitle: string; + imagePath: string; + dataPath: string; + status: ImageStatus; +} + +// 이미지 이동 및 상태변경 요청 DTO +export interface ImageMoveRequest { + moveFolderId: number; +} + +export interface ImageStatusChangeRequest { + labelStatus: ImageStatus; +} + +// 이미지 상세 조회 응답 DTO +export interface ImageDetailResponse { + id: number; + imageTitle: string; + imageUrl: string; + data: string | null; + status: ImageStatus; +} +export interface ImageFolderRequest { + memberId: number; + projectId: number; + parentId: number; + files: File[]; +} diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index e4c5c32..2cbfc3e 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -1,357 +1,13 @@ -// 파일 및 디렉터리 관련 타입 -export type FileItem = { - id: number; - name: string; - url: string; - type: 'image' | 'json'; - status: 'idle' | 'done'; -}; - -export type DirectoryItem = { - id: number; - name: string; - type: 'directory'; - children: Array; -}; - -// 프로젝트 관련 타입 -export type Project = { - id: number; - name: string; - type: 'classification' | 'detection' | 'segmentation'; - children: Array; -}; - -// 워크스페이스 관련 타입 -export type Workspace = { - id: number; - name: string; - projects: Array; -}; - -// 레이블 관련 타입 -export type Label = { - id: number; - categoryId: number; - color: string; - type: 'polygon' | 'rectangle' | 'point'; - coordinates: Array<[number, number]>; -}; - -export interface LabelingRequest { - memberId: number; - projectId: number; - imageId: number; -} - -export interface AutoLabelingResponse { - imageId: number; - imageUrl: string; - data: string; -} - -// 폴더 및 이미지 관련 DTO -export interface FolderRequest { - title: string; - parentId: number; -} - -export interface ChildFolder { - id: number; - title: string; -} - -export interface FolderResponse { - id: number; - title: string; - images: ImageResponse[]; - children: ChildFolder[]; -} - -export type ImageStatus = 'PENDING' | 'IN_PROGRESS' | 'SAVE' | 'REVIEW_REQUEST' | 'REVIEW_REJECTED' | 'COMPLETED'; - -export interface ImageResponse { - id: number; - imageTitle: string; - imagePath: string; - dataPath: string; - status: ImageStatus; -} - -// 이미지 이동 및 상태변경 요청 DTO -export interface ImageMoveRequest { - moveFolderId: number; -} - -export interface ImageStatusChangeRequest { - labelStatus: ImageStatus; -} - -// 멤버 관련 DTO -export interface MemberResponse { - id: number; - nickname: string; - profileImage: string; - email: string; -} - -// 워크스페이스 관련 DTO -export interface WorkspaceMemberResponse { - id: number; - nickname: string; - profileImage: string; -} -export interface WorkspaceRequest { - title: string; - content: string; -} - -export interface WorkspaceResponse { - id: number; - memberId: string; - title: string; - content: string; - createdAt: string; - updatedAt: string; -} - -export interface WorkspaceListResponse { - workspaceResponses: WorkspaceResponse[]; -} - -export interface ProjectRequest { - title: string; - projectType: 'classification' | 'detection' | 'segmentation'; - categories: string[]; -} - -export type ProjectResponse = { - id: number; - title: string; - workspaceId: number; - projectType: 'classification' | 'detection' | 'segmentation'; - createdAt: string; - updatedAt: string; - thumbnail?: string; // Optional -}; - -// 댓글 관련 DTO -export interface CommentRequest { - content: string; - positionX: number; - positionY: number; -} - -export interface CommentResponse { - id: number; - memberId: number; - memberNickname: string; - memberProfileImage: string; - positionX: number; - positionY: number; - content: string; - createTime: string; // 작성 일자 (ISO 8601 형식) - author: MemberResponse; // 추가됨 -} - -export interface CommentListResponse { - commentResponses: CommentResponse[]; -} - -// 프로젝트 멤버 관련 DTO -export interface ProjectMemberRequest { - memberId: number; - privilegeType: 'ADMIN' | 'MANAGER' | 'EDITOR' | 'VIEWER'; -} - -export interface ProjectMemberResponse { - memberId: number; - nickname: string; - profileImage: string; - privilegeType: 'ADMIN' | 'MANAGER' | 'EDITOR' | 'VIEWER'; -} - -// 리뷰 관련 DTO -export interface ReviewRequest { - title: string; - content: string; - imageIds: number[]; -} - -export interface ReviewResponse { - reviewId: number; - projectId: number; - title: string; - content: string; - status: 'REQUESTED' | 'APPROVED' | 'REJECTED'; - author: MemberResponse; - createAt: string; - updateAt: string; -} - -export interface ReviewStatusRequest { - reviewStatus: 'REQUESTED' | 'APPROVED' | 'REJECTED'; -} - -export interface ReviewImageResponse { - id: number; - imageTitle: string; - status: ImageStatus; - imagePath: string; - dataPath: string; -} - -export interface ReviewDetailResponse { - reviewId: number; - title: string; - content: string; - reviewStatus: 'REQUESTED' | 'APPROVED' | 'REJECTED'; - images: ReviewImageResponse[]; - createAt: string; - updateAt: string; - author: MemberResponse; - reviewer: MemberResponse; -} - -// 카테고리 관련 DTO -export interface CategoryRequest { - categoryName: string; -} - -export interface CategoryResponse { - id: number; - name: string; -} - -// 레이블 저장 요청 DTO -export interface LabelSaveRequest { - data: string; -} - -// 폴더 ID 응답 DTO -export interface FolderIdResponse { - id: number; - title: string; -} - -// 이미지 상세 조회 응답 DTO -export interface ImageDetailResponse { - id: number; - imageTitle: string; - imageUrl: string; - data: string | null; - status: ImageStatus; -} - -// 리프레시 토큰 응답 DTO -export interface RefreshTokenResponse { - accessToken: string; -} - -export interface Shape { - categoryId: number; - color: string; - points: [number, number][]; - group_id: number; - shape_type: 'polygon' | 'rectangle' | 'point'; - flags: Record; -} - -export interface LabelJson { - version: string; - task_type: 'cls' | 'det' | 'seg'; - shapes: Shape[]; - split: string; - imageHeight: number; - imageWidth: number; - imageDepth: number; -} - -export interface ErrorResponse { - status: number; - code: number; - message: string; - isSuccess: boolean; -} - -export interface ImageFolderRequest { - memberId: number; - projectId: number; - parentId: number; - files: File[]; -} -export interface LabelCategoryResponse { - id: number; - labelName: string; -} -// 카테고리 요청 DTO -export interface LabelCategoryRequest { - labelCategoryList: number[]; -} - -// 모델 카테고리 응답 DTO -export interface ModelCategoryResponse { - id: number; - name: string; -} - -// 모델 요청 DTO (API로 전달할 데이터 타입) -export interface ModelRequest { - name: string; -} - -// 모델 응답 DTO (API로부터 받는 데이터 타입) -export interface ModelResponse { - id: number; - name: string; - isDefault: boolean; - isTrain: boolean; - projectType: 'classification' | 'detection' | 'segmentation'; -} - -// 프로젝트 모델 리스트 응답 DTO -export interface ProjectModelsResponse extends Array {} -// 모델 훈련 요청 DTO -export interface ModelTrainRequest { - modelId: number; - ratio: number; - epochs: number; - batch: number; - lr0: number; - lrf: number; - optimizer: 'AUTO' | 'SGD' | 'ADAM' | 'ADAMW' | 'NADAM' | 'RADAM' | 'RMSPROP'; -} -export interface ResultResponse { - id: number; - precision: number; - recall: number; - fitness: number; - ratio: number; - epochs: number; - batch: number; - lr0: number; - lrf: number; - optimizer: 'AUTO' | 'SGD' | 'ADAM' | 'ADAMW' | 'NADAM' | 'RADAM' | 'RMSPROP'; - map50: number; - map5095: number; -} - -export interface ReportResponse { - modelId: number; - totalEpochs: number; - epoch: number; - boxLoss: number; - clsLoss: number; - dflLoss: number; - fitness: number; - epochTime: number; - leftSecond: number; - segLoss: number; -} - -export interface AlarmResponse { - id: number; - isRead: boolean; - createdAt: string; - type: string; -} +export * from './modelTypes'; +export * from './imageTypes'; +export * from './reviewTypes'; +export * from './alarmTypes'; +export * from './memberTypes'; +export * from './categoryTypes'; +export * from './workspaceTypes'; +export * from './commentTypes'; +export * from './folderTypes'; +export * from './projectTypes'; +export * from './labelTypes'; +export * from './fileTypes'; +export * from './reportTypes'; diff --git a/frontend/src/types/labelTypes.ts b/frontend/src/types/labelTypes.ts new file mode 100644 index 0000000..9ff1eea --- /dev/null +++ b/frontend/src/types/labelTypes.ts @@ -0,0 +1,53 @@ +// 레이블 관련 타입 +export type Label = { + id: number; + categoryId: number; + color: string; + type: 'polygon' | 'rectangle' | 'point'; + coordinates: Array<[number, number]>; +}; + +export interface LabelingRequest { + memberId: number; + projectId: number; + imageId: number; +} + +export interface AutoLabelingResponse { + imageId: number; + imageUrl: string; + data: string; +} + +// 레이블 저장 요청 DTO +export interface LabelSaveRequest { + data: string; +} + +export interface Shape { + categoryId: number; + color: string; + points: [number, number][]; + group_id: number; + shape_type: 'polygon' | 'rectangle' | 'point'; + flags: Record; +} + +export interface LabelJson { + version: string; + task_type: 'cls' | 'det' | 'seg'; + shapes: Shape[]; + split: string; + imageHeight: number; + imageWidth: number; + imageDepth: number; +} + +export interface LabelCategoryResponse { + id: number; + labelName: string; +} +// 카테고리 요청 DTO +export interface LabelCategoryRequest { + labelCategoryList: number[]; +} diff --git a/frontend/src/types/memberTypes.ts b/frontend/src/types/memberTypes.ts new file mode 100644 index 0000000..53688b8 --- /dev/null +++ b/frontend/src/types/memberTypes.ts @@ -0,0 +1,11 @@ +// 멤버 관련 DTO +export interface MemberResponse { + id: number; + nickname: string; + profileImage: string; + email: string; +} +// 리프레시 토큰 응답 DTO +export interface RefreshTokenResponse { + accessToken: string; +} diff --git a/frontend/src/types/modelTypes.ts b/frontend/src/types/modelTypes.ts new file mode 100644 index 0000000..16ac74f --- /dev/null +++ b/frontend/src/types/modelTypes.ts @@ -0,0 +1,32 @@ +// 모델 카테고리 응답 DTO +export interface ModelCategoryResponse { + id: number; + name: string; +} + +// 모델 요청 DTO (API로 전달할 데이터 타입) +export interface ModelRequest { + name: string; +} + +// 모델 응답 DTO (API로부터 받는 데이터 타입) +export interface ModelResponse { + id: number; + name: string; + isDefault: boolean; + isTrain: boolean; + projectType: 'classification' | 'detection' | 'segmentation'; +} + +// 프로젝트 모델 리스트 응답 DTO +export interface ProjectModelsResponse extends Array {} +// 모델 훈련 요청 DTO +export interface ModelTrainRequest { + modelId: number; + ratio: number; + epochs: number; + batch: number; + lr0: number; + lrf: number; + optimizer: 'AUTO' | 'SGD' | 'ADAM' | 'ADAMW' | 'NADAM' | 'RADAM' | 'RMSPROP'; +} diff --git a/frontend/src/types/projectTypes.ts b/frontend/src/types/projectTypes.ts new file mode 100644 index 0000000..25af50b --- /dev/null +++ b/frontend/src/types/projectTypes.ts @@ -0,0 +1,27 @@ +export interface ProjectRequest { + title: string; + projectType: 'classification' | 'detection' | 'segmentation'; + categories: string[]; +} + +export type ProjectResponse = { + id: number; + title: string; + workspaceId: number; + projectType: 'classification' | 'detection' | 'segmentation'; + createdAt: string; + updatedAt: string; + thumbnail?: string; // Optional +}; +// 프로젝트 멤버 관련 DTO +export interface ProjectMemberRequest { + memberId: number; + privilegeType: 'ADMIN' | 'MANAGER' | 'EDITOR' | 'VIEWER'; +} + +export interface ProjectMemberResponse { + memberId: number; + nickname: string; + profileImage: string; + privilegeType: 'ADMIN' | 'MANAGER' | 'EDITOR' | 'VIEWER'; +} diff --git a/frontend/src/types/reportTypes.ts b/frontend/src/types/reportTypes.ts new file mode 100644 index 0000000..246bb1b --- /dev/null +++ b/frontend/src/types/reportTypes.ts @@ -0,0 +1,27 @@ +export interface ResultResponse { + id: number; + precision: number; + recall: number; + fitness: number; + ratio: number; + epochs: number; + batch: number; + lr0: number; + lrf: number; + optimizer: 'AUTO' | 'SGD' | 'ADAM' | 'ADAMW' | 'NADAM' | 'RADAM' | 'RMSPROP'; + map50: number; + map5095: number; +} + +export interface ReportResponse { + modelId: number; + totalEpochs: number; + epoch: number; + boxLoss: number; + clsLoss: number; + dflLoss: number; + fitness: number; + epochTime: number; + leftSecond: number; + segLoss: number; +} diff --git a/frontend/src/types/reviewTypes.ts b/frontend/src/types/reviewTypes.ts new file mode 100644 index 0000000..ec7d65a --- /dev/null +++ b/frontend/src/types/reviewTypes.ts @@ -0,0 +1,44 @@ +import { ImageStatus } from './imageTypes'; +import { MemberResponse } from './memberTypes'; + +// 리뷰 관련 DTO +export interface ReviewRequest { + title: string; + content: string; + imageIds: number[]; +} + +export interface ReviewResponse { + reviewId: number; + projectId: number; + title: string; + content: string; + status: 'REQUESTED' | 'APPROVED' | 'REJECTED'; + author: MemberResponse; + createAt: string; + updateAt: string; +} + +export interface ReviewStatusRequest { + reviewStatus: 'REQUESTED' | 'APPROVED' | 'REJECTED'; +} + +export interface ReviewImageResponse { + id: number; + imageTitle: string; + status: ImageStatus; + imagePath: string; + dataPath: string; +} + +export interface ReviewDetailResponse { + reviewId: number; + title: string; + content: string; + reviewStatus: 'REQUESTED' | 'APPROVED' | 'REJECTED'; + images: ReviewImageResponse[]; + createAt: string; + updateAt: string; + author: MemberResponse; + reviewer: MemberResponse; +} diff --git a/frontend/src/types/workspaceTypes.ts b/frontend/src/types/workspaceTypes.ts new file mode 100644 index 0000000..09f89fa --- /dev/null +++ b/frontend/src/types/workspaceTypes.ts @@ -0,0 +1,23 @@ +// 워크스페이스 관련 DTO +export interface WorkspaceMemberResponse { + id: number; + nickname: string; + profileImage: string; +} +export interface WorkspaceRequest { + title: string; + content: string; +} + +export interface WorkspaceResponse { + id: number; + memberId: string; + title: string; + content: string; + createdAt: string; + updatedAt: string; +} + +export interface WorkspaceListResponse { + workspaceResponses: WorkspaceResponse[]; +}