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

feat: books api 스펙 정리 #676

Merged
merged 6 commits into from
Aug 22, 2023
Merged

Conversation

JeongJiHwan
Copy link
Contributor

개요

books api 스펙 contracts 정리

작업 사항

get: books/info/search
get: books/info/tag
get: books/info -> /books/info/sorted
get: books/info/:id
get: books/search
get: books/create
get: books/:bookId
post: books/create
patch: books/update
patch: books/donator

@JeongJiHwan JeongJiHwan linked an issue Aug 17, 2023 that may be closed by this pull request
@JeongJiHwan JeongJiHwan temporarily deployed to development August 17, 2023 03:35 — with GitHub Actions Inactive
@scarf005 scarf005 self-assigned this Aug 17, 2023
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

작성하시느라 수고 많으셨어요! 다만 zod의 객체 메서드들을 사용하면 중복되는 코드를 많이 줄일 수 있을 것 같아요. 또, 상태값의 경우에는 숫자 대신 리터럴 유니언 타입을 사용하면 좀 더 명확하게 의도를 전달할 수 있을 것 같아요.

또 궁금한 점이 있다면 언제라도 답글을 달아주세요!

contracts/src/books/schema.ts Show resolved Hide resolved
Comment on lines +39 to +48
export const createBookBodySchema = z.object({
title: z.string(),
isbn: z.string(),
author: z.string(),
publisher: z.string(),
image: z.string(),
categoryId: z.string(),
pubdate: z.string(),
donator: z.string(),
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createBookBodySchemaupdateBookBodySchema는 모두 bookInfoSchema에서 조금씩만 변형된 형태입니다. 그렇다면 zod의 .pick()과 .omit()을 써보면 어떨까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zod의 기능을 전혀 활용하지 못하고 있었네요 ㅎ.. 확인해보겠습니다!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

book, bookinfo, book&bookinfo 등 아직 정리가 되지 않아서 이후 api 구현하면서 수정해보도록 하겠습니다.

contracts/src/books/schema.ts Outdated Show resolved Hide resolved
@JeongJiHwan JeongJiHwan temporarily deployed to development August 20, 2023 06:49 — with GitHub Actions Inactive
@scarf005 scarf005 changed the title 672 books api 스펙 정리 feat: books api 스펙 정리 Aug 21, 2023
@scarf005 scarf005 self-requested a review August 21, 2023 01:08
Copy link
Member

@jimin52 jimin52 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jimin52
Copy link
Member

jimin52 commented Aug 21, 2023

뒤늦게 지정도서가 뭔지 기억났습니다.
동물책같은 과제에 필수적이면서 자주 빌려가는 책들을 대출 불가하도록 (클러스터에서만 읽을 수 있게) 처리하려고 했었던 것이었습니다.
현재 딱히 쓰이고 있지는 않은 값입니다

@JeongJiHwan JeongJiHwan temporarily deployed to development August 22, 2023 02:56 — with GitHub Actions Inactive
Copy link
Member

@scarf005 scarf005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

수고 많으셨습니다!

@scarf005 scarf005 merged commit 32547b9 into develop Aug 22, 2023
@scarf005 scarf005 deleted the 672-books-api-스펙-정리 branch August 22, 2023 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 완료
Development

Successfully merging this pull request may close these issues.

books API 스펙 정리
3 participants