Skip to content

Commit

Permalink
feat: API 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
SaaaHoP committed Oct 13, 2022
1 parent ffd1bcb commit 6c1a04d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/api/projects.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Blob } from 'buffer';
import request from './request';
import {
Id,
Expand All @@ -16,6 +17,8 @@ import {
PostProjectsKanbanTaskLikeRequestProps,
DeleteProjectsKanbanRequestProps,
DeleteProjectsKanbanTaskRequestProps,
PutProjectsVieoRequestProps,
GetProjectsVideoResponse,
} from './types';

const projectsBaseUrl = '/api/projects';
Expand Down Expand Up @@ -58,6 +61,8 @@ const projectsUrl = {

projectsKanbanTaskLike: ({ projectId, taskId }: PostProjectsKanbanTaskLikeRequestProps) =>
`${projectsBaseUrl}/${projectId}/tasks/${taskId}/like`,

projectsVideoUpload: (projectId: number) => `${projectsBaseUrl}/${projectId}/video`,
};

export const createProject = ({ name, description, deadline }: PostProjectRequestProps) =>
Expand Down Expand Up @@ -154,3 +159,11 @@ export const postProjectsKanbanTaskLike = ({ projectId, taskId }: PostProjectsKa

export const deleteProjectsKanbanTaskLike = ({ projectId, taskId }: PostProjectsKanbanTaskLikeRequestProps) =>
request('DELETE', projectsUrl.projectsKanbanTaskLike({ projectId, taskId }));

// 프로젝트 비디오

export const putProjectsVideo = ({ videoFormData, projectId }: PutProjectsVieoRequestProps) =>
request('PUT', projectsUrl.projectsVideoUpload(projectId), videoFormData);

export const getProjectsVideo = (projectId: number) =>
request<Blob>('GET', projectsUrl.projectsVideoUpload(projectId)).then((res) => res.data);
11 changes: 11 additions & 0 deletions lib/api/types/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,14 @@ export interface PostProjectsKanbanTaskLikeRequestProps {
projectId: number;
taskId: number;
}

// 프로젝트 비디오

export interface PutProjectsVieoRequestProps {
videoFormData: FormData;
projectId: number;
}

export interface GetProjectsVideoResponse {
data: File | undefined;
}
1 change: 1 addition & 0 deletions lib/constants/queryKeys/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const PROJECTS_MY_CREW = '/projects/my/crew';
export const PROJECTS_MY_CREW_TERMINATED = '/projects/my/crew/terminated';
export const PROJECTS_INVITES = '/account/invitations';
export const PROJECTS_KANBAN = '/projects/kanban';
export const PROJECTS_VIDEO = '/projects/video';

export const PROJECTS_BY_ID = (id: number) => `/projects/${id}`;
export const PROJECTS_BY_ID_CREWS = (id: number) => `/projects/${id}/crews`;

0 comments on commit 6c1a04d

Please sign in to comment.