Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/api/tags/{bookInfoId}에 반환 값 type 추가 #486

Merged
merged 6 commits into from
May 31, 2023
Merged
3 changes: 2 additions & 1 deletion backend/src/DTO/tags.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ export interface subDefaultTag {
login: string;
content: string;
superContent: string;
visibility: "public" | "private";
visibility: 'public' | 'private';
}

export interface superDefaultTag {
id: number;
content: string;
login: string;
count: number;
type: 'super' | 'default';
}
8 changes: 8 additions & 0 deletions backend/src/routes/tags.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -711,23 +711,31 @@ router
* type: integer
* login:
* description: 태그를 작성한 카뎃의 인트라 id. 슈퍼 태그는 기본값이 null이며, 디폴트 태그만 작성자 값이 있다.
* type: string
* type:
* description: 태그의 타입. 슈퍼 태그는 'super'이며, 디폴트 태그는 'default'이다.
* type: string
* example:
* - id: 0
* content: 1서클_추천_책
* count: 3
* login:
* type: super
* - id: 42
* content: 커리어
* count: 1
* login:
* type: super
* - id: 0
* content: yena가_추천하는
* count: 0
* login: yena
* type: default
* - id: 42
* content: 마법같은_파이썬
* count: 0
* login: yena
* type: default
* '400':
* description: 잘못된 요청. 잘못 입력된 json key, 유효하지 않은 value 등
* '401':
Expand Down
2 changes: 2 additions & 0 deletions backend/src/tags/tags.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class TagsService {
superDefaultTags = superTags.map((sp) => ({
...sp,
count: Number(sp.count),
type: 'super',
}));
const defaultTag = await this.superTagRepository.getDefaultTag(bookInfoId);
if (defaultTag) {
Expand All @@ -105,6 +106,7 @@ export class TagsService {
content: dt.content,
login: dt.login,
count: 0,
type: 'default',
});
});
}
Expand Down