Skip to content

Commit

Permalink
feat: VideoDescription API 추가
Browse files Browse the repository at this point in the history
- #48
  • Loading branch information
SaaaHoP committed Oct 13, 2022
1 parent 4f6c304 commit 1c6d500
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
14 changes: 12 additions & 2 deletions lib/api/projects.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import client from '@/lib/api/client';
import { Blob } from 'buffer';

import request from './request';
import {
Id,
Expand All @@ -19,7 +19,8 @@ import {
DeleteProjectsKanbanRequestProps,
DeleteProjectsKanbanTaskRequestProps,
PutProjectsVieoRequestProps,
GetProjectsVideoResponse,
PutProjectsVideoDescriptionRequestProps,
GetProjectsVideoDescriptionResponse,
} from './types';

const projectsBaseUrl = '/api/projects';
Expand Down Expand Up @@ -64,6 +65,7 @@ const projectsUrl = {
`${projectsBaseUrl}/${projectId}/tasks/${taskId}/like`,

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

export const createProject = ({ name, description, deadline }: PostProjectRequestProps) =>
Expand Down Expand Up @@ -166,6 +168,14 @@ export const deleteProjectsKanbanTaskLike = ({ projectId, taskId }: PostProjects
export const putProjectsVideo = ({ videoFormData, projectId }: PutProjectsVieoRequestProps) =>
request('PUT', projectsUrl.projectsVideoUpload(projectId), videoFormData);

export const putProjectsVideoDescription = ({ projectId, description }: PutProjectsVideoDescriptionRequestProps) =>
request('PUT', projectsUrl.projectsVideoDescriptionUpload(projectId), { description });

export const getProjectsVideoDescription = (projectId: number) =>
request<GetProjectsVideoDescriptionResponse>('GET', projectsUrl.projectsVideoDescriptionUpload(projectId)).then(
(res) => res.data,
);

// response Header에 접근하기 위해 request 대신 client 사용
export const getProjectsVideo = (projectId: number) =>
client.get(projectsUrl.projectsVideoUpload(projectId)).then((res) => res);
Expand Down
9 changes: 7 additions & 2 deletions lib/api/types/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ export interface PutProjectsVieoRequestProps {
projectId: number;
}

export interface GetProjectsVideoResponse {
data: File | undefined;
export interface PutProjectsVideoDescriptionRequestProps {
projectId: number;
description: string;
}

export interface GetProjectsVideoDescriptionResponse {
description: string;
}
1 change: 1 addition & 0 deletions lib/constants/queryKeys/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ 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_VIDEO_DESCRIPTION = '/projects/video/description';

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

0 comments on commit 1c6d500

Please sign in to comment.