-
Notifications
You must be signed in to change notification settings - Fork 7
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
The head ref may contain hidden characters: "672-books-api-\uC2A4\uD399-\uC815\uB9AC"
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
작성하시느라 수고 많으셨어요! 다만 zod의 객체 메서드들을 사용하면 중복되는 코드를 많이 줄일 수 있을 것 같아요. 또, 상태값의 경우에는 숫자 대신 리터럴 유니언 타입을 사용하면 좀 더 명확하게 의도를 전달할 수 있을 것 같아요.
또 궁금한 점이 있다면 언제라도 답글을 달아주세요!
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(), | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createBookBodySchema
와 updateBookBodySchema
는 모두 bookInfoSchema
에서 조금씩만 변형된 형태입니다. 그렇다면 zod의 .pick()과 .omit()을 써보면 어떨까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zod의 기능을 전혀 활용하지 못하고 있었네요 ㅎ.. 확인해보겠습니다!
There was a problem hiding this comment.
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 구현하면서 수정해보도록 하겠습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
뒤늦게 지정도서가 뭔지 기억났습니다. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수고 많으셨습니다!
개요
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