-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix(api): 백엔드 서버 시그니처와 동기화 * feat(api): activity/study api 추가 * feat(api): activity/project, social api 추가
- Loading branch information
1 parent
8bec525
commit da8e599
Showing
14 changed files
with
404 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,44 @@ | ||
import { WinkApiRequest } from '@/api'; | ||
import { | ||
Project, | ||
ProjectAdmin, | ||
Social, | ||
SocialAdmin, | ||
Study, | ||
StudyAdmin, | ||
WinkApiRequest, | ||
} from '@/api'; | ||
|
||
export class Activity { | ||
constructor(private readonly request: WinkApiRequest) {} | ||
} | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
private readonly project: Project = new Project(this.request); | ||
private readonly projectAdmin: ProjectAdmin = new ProjectAdmin(this.request); | ||
private readonly study: Study = new Study(this.request); | ||
private readonly studyAdmin: StudyAdmin = new StudyAdmin(this.request); | ||
private readonly social: Social = new Social(this.request); | ||
private readonly socialAdmin: SocialAdmin = new SocialAdmin(this.request); | ||
|
||
public get Project() { | ||
return this.project; | ||
} | ||
|
||
public get ProjectAdmin() { | ||
return this.projectAdmin; | ||
} | ||
|
||
public get Study() { | ||
return this.study; | ||
} | ||
|
||
public get StudyAdmin() { | ||
return this.studyAdmin; | ||
} | ||
|
||
public get Social() { | ||
return this.social; | ||
} | ||
|
||
public get SocialAdmin() { | ||
return this.socialAdmin; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { MemberType, WinkApiRequest } from '@/api'; | ||
|
||
export class Project { | ||
constructor(private readonly request: WinkApiRequest) {} | ||
|
||
public async getProject(data: GetProjectRequestDto): Promise<GetProjectResponseDto> { | ||
return this.request.get('/activity/project/detail', data); | ||
} | ||
|
||
public async getProjectsPage(): Promise<GetProjectsPageResponseDto> { | ||
return this.request.get('/activity/project/max'); | ||
} | ||
|
||
public async getProjects(data: GetProjectsRequestDto): Promise<GetProjectsResponseDto> { | ||
return this.request.get('/activity/project', data); | ||
} | ||
} | ||
|
||
export class ProjectAdmin { | ||
constructor(private readonly request: WinkApiRequest) {} | ||
|
||
public async createProject(data: CreateProjectRequestDto): Promise<CreateProjectResponseDto> { | ||
return this.request.put('/admin/activity/project', data); | ||
} | ||
|
||
public async updateProject(data: UpdateProjectRequestDto): Promise<void> { | ||
return this.request.patch('/admin/activity/project', data); | ||
} | ||
|
||
public async deleteProject(data: DeleteProjectRequestDto): Promise<void> { | ||
return this.request.delete('/admin/activity/project', data); | ||
} | ||
} | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
|
||
export interface CreateProjectRequestDto { | ||
title: string; | ||
content: string; | ||
tags: string[]; | ||
image: string; | ||
} | ||
|
||
export interface DeleteProjectRequestDto { | ||
projectId: string; | ||
} | ||
|
||
export interface GetProjectRequestDto { | ||
projectId: string; | ||
} | ||
|
||
export interface GetProjectsRequestDto { | ||
page: number; | ||
} | ||
|
||
export interface UpdateProjectRequestDto { | ||
projectId: string; | ||
title: string; | ||
content: string; | ||
tags: string[]; | ||
image: string; | ||
} | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
|
||
export interface CreateProjectResponseDto { | ||
project: ProjectType; | ||
} | ||
|
||
export interface GetProjectResponseDto { | ||
project: ProjectType; | ||
} | ||
|
||
export interface GetProjectsResponseDto { | ||
projects: ProjectType[]; | ||
} | ||
|
||
export interface GetProjectsPageResponseDto { | ||
page: number; | ||
} | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
|
||
export interface ProjectType { | ||
_id: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
type: 'Project' | 'Study' | 'Social'; | ||
author: MemberType; | ||
title: string; | ||
content: string; | ||
tags: string[]; | ||
image: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { WinkApiRequest } from '@/api'; | ||
|
||
export class Social { | ||
constructor(private readonly request: WinkApiRequest) {} | ||
|
||
public async getSocial(data: GetSocialRequestDto): Promise<GetSocialResponseDto> { | ||
return this.request.get('/activity/social/detail', data); | ||
} | ||
|
||
public async getSocials(): Promise<GetSocialsResponseDto> { | ||
return this.request.get('/activity/social'); | ||
} | ||
} | ||
|
||
export class SocialAdmin { | ||
constructor(private readonly request: WinkApiRequest) {} | ||
|
||
public async createSocial(data: CreateSocialRequestDto): Promise<CreateSocialResponseDto> { | ||
return this.request.put('/admin/activity/social', data); | ||
} | ||
|
||
public async updateSocial(data: UpdateSocialRequestDto): Promise<void> { | ||
return this.request.patch('/admin/activity/social', data); | ||
} | ||
|
||
public async deleteSocial(data: DeleteSocialRequestDto): Promise<void> { | ||
return this.request.delete('/admin/activity/social', data); | ||
} | ||
} | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
|
||
export interface CreateSocialRequestDto { | ||
title: string; | ||
contents: Content[]; | ||
} | ||
|
||
export interface DeleteSocialRequestDto { | ||
socialId: string; | ||
} | ||
|
||
export interface GetSocialRequestDto { | ||
socialId: string; | ||
} | ||
|
||
export interface UpdateSocialRequestDto { | ||
socialId: string; | ||
title: string; | ||
contents: Content[]; | ||
} | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
|
||
export interface CreateSocialResponseDto { | ||
social: SocialType; | ||
} | ||
|
||
export interface GetSocialResponseDto { | ||
social: SocialType; | ||
} | ||
|
||
export interface GetSocialsResponseDto { | ||
socials: SocialType[]; | ||
} | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
|
||
export interface SocialType { | ||
_id: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
type: 'Project' | 'Study' | 'Social'; | ||
title: string; | ||
contents: Content[]; | ||
} | ||
|
||
export interface Content { | ||
content: string; | ||
image: string; | ||
} |
Oops, something went wrong.