-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
194 changed files
with
4,717 additions
and
2,659 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 |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { APIRequest, HTTP_METHOD } from 'interfaces/APIRequest'; | ||
import { | ||
ArticlesResponse, | ||
ArticleResponse, | ||
HotArticlesResponse, | ||
SingleLostItemArticleResponseDTO, | ||
LostItemArticlesResponseDTO, | ||
LostItemResponse, | ||
LostItemArticlesRequestDTO, | ||
} from './entity'; | ||
|
||
export class GetArticles<R extends ArticlesResponse> implements APIRequest<R> { | ||
method = HTTP_METHOD.GET; | ||
|
||
path: string; | ||
|
||
response!: R; | ||
|
||
constructor(page: string | undefined) { | ||
this.path = `/articles?page=${page}&limit=10`; | ||
} | ||
} | ||
|
||
export class GetArticle<R extends ArticleResponse> implements APIRequest<R> { | ||
method = HTTP_METHOD.GET; | ||
|
||
path: string; | ||
|
||
response!: R; | ||
|
||
constructor(id: string | undefined) { | ||
this.path = `/articles/${id}`; | ||
} | ||
} | ||
|
||
export class GetHotArticles<R extends HotArticlesResponse> implements APIRequest<R> { | ||
method = HTTP_METHOD.GET; | ||
|
||
path = '/articles/hot'; | ||
|
||
response!: R; | ||
} | ||
|
||
export class GetLostItemArticles<R extends LostItemArticlesResponseDTO> implements APIRequest<R> { | ||
method = HTTP_METHOD.GET; | ||
|
||
path = '/articles/lost-item'; | ||
|
||
response!: R; | ||
} | ||
|
||
export class GetSingleLostItemArticle<R | ||
extends SingleLostItemArticleResponseDTO> implements APIRequest<R> { | ||
method = HTTP_METHOD.GET; | ||
|
||
path: string; | ||
|
||
response!: R; | ||
|
||
constructor(id: number) { | ||
this.path = `/articles/lost-item/${id}`; | ||
} | ||
} | ||
|
||
export class PostLostItemArticles<R extends LostItemResponse> implements APIRequest<R> { | ||
method = HTTP_METHOD.POST; | ||
|
||
path = '/articles/lost-item'; | ||
|
||
response!: R; | ||
|
||
auth = true; | ||
|
||
constructor(public authorization: string, public data: LostItemArticlesRequestDTO) { } | ||
} | ||
|
||
export class DeleteLostItemArticle<R extends LostItemResponse> implements APIRequest<R> { | ||
method = HTTP_METHOD.DELETE; | ||
|
||
path: string; | ||
|
||
response!: R; | ||
|
||
auth = true; | ||
|
||
constructor(public authorization: string, id: number) { | ||
this.path = `/articles/lost-item/${id}`; | ||
} | ||
} |
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,118 @@ | ||
import { APIResponse } from 'interfaces/APIResponse'; | ||
|
||
export interface GetArticlesRequest { | ||
boardId: string | ||
page: string | ||
} | ||
|
||
export interface Article { | ||
id: number | ||
board_id: number | ||
title: string | ||
author: string | ||
hit: number | ||
registered_at: string // yyyy-MM-dd 아우누리에 게시판에 등록된 날짜 | ||
updated_at: string // yyyy-MM-dd HH:mm:ss 이하 형식 동일 | ||
} | ||
|
||
export interface Attachment { | ||
id: 1, | ||
name: string, | ||
url: string, | ||
created_at: string, | ||
updated_at: string, | ||
} | ||
|
||
export interface PaginationInfo { | ||
total_count: number | ||
current_count: number | ||
total_page: number | ||
current_page: number | ||
} | ||
|
||
export interface PaginatedResponse<T> extends PaginationInfo, APIResponse { | ||
articles: T[]; | ||
} | ||
|
||
export type ArticlesResponse = PaginatedResponse<Article>; | ||
export type ArticlesSearchResponse = PaginatedResponse<Article>; | ||
|
||
export interface ArticleResponse extends Article, APIResponse { | ||
content: string; | ||
attachments: Attachment[]; | ||
prev_id: number; | ||
next_id: number; | ||
} | ||
|
||
export interface HotArticle extends Article { } | ||
|
||
export type HotArticlesResponse = HotArticle[]; | ||
|
||
// GET /articles/lost-item | ||
interface LostItemArticleForGetDTO { | ||
id: number; | ||
board_id: number; | ||
category: string; | ||
found_place: string; | ||
found_date: string; | ||
content: string; | ||
author: string; | ||
registered_at: string; | ||
updated_at: string; | ||
} | ||
|
||
export interface LostItemArticlesResponseDTO extends APIResponse { | ||
articles: LostItemArticleForGetDTO[]; | ||
total_count: number; | ||
current_count: number; | ||
total_page: number; | ||
current_page: number; | ||
} | ||
|
||
interface ImageDTO { | ||
id: number; | ||
image_url: string; | ||
} | ||
|
||
export interface SingleLostItemArticleResponseDTO extends APIResponse { | ||
id: number; | ||
board_id: number; | ||
category: string; | ||
found_place: string; | ||
found_date: string; | ||
content: string; | ||
author: string; | ||
images: ImageDTO[]; | ||
prev_id: number | null; | ||
next_id: number | null; | ||
registered_at: string; // yyyy-MM-dd | ||
updated_at: string; // yyyy-MM-dd HH:mm:ss | ||
} | ||
|
||
export interface LostItemResponse extends APIResponse { | ||
id: number; | ||
board_id: number; | ||
category: string; | ||
found_place: string; | ||
found_date: string; | ||
content: string; | ||
author: string; | ||
images: ImageDTO[]; | ||
prev_id: number | null; | ||
next_id: number | null; | ||
registered_at: string; | ||
updated_at: string; | ||
} | ||
|
||
// POST /articles/lost-item | ||
interface LostItemArticleForPostDTO { | ||
category: string; | ||
found_place: string; | ||
found_date: string; // yyyy-MM-dd | ||
content: string; | ||
images: string[]; | ||
} | ||
|
||
export interface LostItemArticlesRequestDTO { | ||
articles: Array<LostItemArticleForPostDTO>; | ||
} |
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,24 @@ | ||
import APIClient from 'utils/ts/apiClient'; | ||
import { | ||
GetArticles, | ||
GetHotArticles, | ||
GetArticle, | ||
GetLostItemArticles, | ||
GetSingleLostItemArticle, | ||
DeleteLostItemArticle, | ||
PostLostItemArticles, | ||
} from './APIDetail'; | ||
|
||
export const getArticles = APIClient.of(GetArticles); | ||
|
||
export const getArticle = APIClient.of(GetArticle); | ||
|
||
export const getHotArticles = APIClient.of(GetHotArticles); | ||
|
||
export const getLostItemArticles = APIClient.of(GetLostItemArticles); | ||
|
||
export const getSingleLostItemArticle = APIClient.of(GetSingleLostItemArticle); | ||
|
||
export const postLostItemArticle = APIClient.of(PostLostItemArticles); | ||
|
||
export const deleteLostItemArticle = APIClient.of(DeleteLostItemArticle); |
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,11 +1,12 @@ | ||
export * as abTest from './abTest'; | ||
export * as auth from './auth'; | ||
export * as store from './store'; | ||
export * as dept from './dept'; | ||
export * as timetable from './timetable'; | ||
export * as bus from './bus'; | ||
export * as notice from './notice'; | ||
export * as room from './room'; | ||
export * as cafeteria from './cafeteria'; | ||
export * as coopshop from './coopshop'; | ||
export * as dept from './dept'; | ||
export * as articles from './articles'; | ||
export * as review from './review'; | ||
export * as abTest from './abTest'; | ||
export * as room from './room'; | ||
export * as store from './store'; | ||
export * as timetable from './timetable'; | ||
export * as uploadFile from './uploadFile'; |
Oops, something went wrong.