-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: `/stock` 제거 #767 (comment) * refactor: contracts에서 500번대 오류 제거 백엔드에서 복구 불가능한 오류일 시 반환하기 때문에, 프론트엔드에서 따로 처리하는 것이 좋을 것 같습니다. * refactor: `/history` -> `/lendings` #767 (comment) Co-authored-by: jwoo <74581396+Jiwon-Woo@users.noreply.github.com> * refactor: `/users ` 정리 #767 (comment) Co-authored-by: honeyl3ee <ddanhopark@gmail.com> * refactor: `/tag` 서비스 임시 제거 고도화를 하기 위해서는 내부 구현을 바꾸어야 하는 문제가 있어 우선순위를 낮추었습니다. 주석처리를 할까 고민했으나 제거 이전 커밋(1565441)으로 체크아웃시 전체 코드를 확인 가능하기 때문에 복잡도 감소를 위해 코드를 제거하였습니다. * refactor: `/books` 경로 정리 #767 (comment) #767 (comment) Co-authored-by: Jeong Jihwan <47599349+JeongJiHwan@users.noreply.github.com> Co-authored-by: jwoo <74581396+Jiwon-Woo@users.noreply.github.com> * feat: swagger에서 1줄 요약 표시 --------- Co-authored-by: jwoo <74581396+Jiwon-Woo@users.noreply.github.com> Co-authored-by: honeyl3ee <ddanhopark@gmail.com> Co-authored-by: Jeong Jihwan <47599349+JeongJiHwan@users.noreply.github.com>
- Loading branch information
1 parent
1565441
commit 6cbb823
Showing
22 changed files
with
217 additions
and
868 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,112 +1,106 @@ | ||
import { contract } from '@jiphyeonjeon-42/contracts'; | ||
import { initServer } from '@ts-rest/express'; | ||
import { | ||
searchAllBooks, | ||
searchBookById, | ||
searchBookInfoById, | ||
searchBookInfoForCreate, | ||
searchBookInfosByTag, | ||
searchBookInfosSorted, | ||
updateBookDonator, | ||
updateBookOrBookInfo, | ||
} from './service'; | ||
import { | ||
BookInfoNotFoundError, | ||
BookNotFoundError, | ||
bookInfoNotFound, | ||
bookNotFound, | ||
isbnNotFound, | ||
naverBookNotFound, | ||
pubdateFormatError, | ||
} from '../shared'; | ||
import { IsbnNotFoundError, NaverBookNotFound, PubdateFormatError } from './errors'; | ||
import authValidate from '~/v1/auth/auth.validate'; | ||
import { roleSet } from '~/v1/auth/auth.type'; | ||
// import { contract } from '@jiphyeonjeon-42/contracts'; | ||
// import { initServer } from '@ts-rest/express'; | ||
// import { | ||
// searchAllBooks, | ||
// searchBookById, | ||
// searchBookInfoById, | ||
// searchBookInfoForCreate, | ||
// searchBookInfosByTag, | ||
// searchBookInfosSorted, | ||
// updateBookDonator, | ||
// updateBookOrBookInfo, | ||
// } from './service'; | ||
// import { | ||
// BookInfoNotFoundError, | ||
// BookNotFoundError, | ||
// bookInfoNotFound, | ||
// bookNotFound, | ||
// isbnNotFound, | ||
// naverBookNotFound, | ||
// pubdateFormatError, | ||
// } from '../shared'; | ||
// import { IsbnNotFoundError, NaverBookNotFound, PubdateFormatError } from './errors'; | ||
// import authValidate from '~/v1/auth/auth.validate'; | ||
// import { roleSet } from '~/v1/auth/auth.type'; | ||
|
||
const s = initServer(); | ||
export const books = s.router(contract.books, { | ||
// searchAllBookInfos: async ({ query }) => { | ||
// const result = await searchAllBookInfos(query); | ||
// const s = initServer(); | ||
// export const books = s.router(contract.books, { | ||
// // searchAllBookInfos: async ({ query }) => { | ||
// // const result = await searchAllBookInfos(query); | ||
|
||
// return { status: 200, body: result } as const; | ||
// }, | ||
// @ts-expect-error | ||
searchBookInfosByTag: async ({ query }) => { | ||
const result = await searchBookInfosByTag(query); | ||
// // return { status: 200, body: result } as const; | ||
// // }, | ||
// searchBookInfosByTag: async ({ query }) => { | ||
// const result = await searchBookInfosByTag(query); | ||
|
||
return { status: 200, body: result } as const; | ||
}, | ||
// @ts-expect-error | ||
searchBookInfosSorted: async ({ query }) => { | ||
const result = await searchBookInfosSorted(query); | ||
// return { status: 200, body: result } as const; | ||
// }, | ||
// searchBookInfosSorted: async ({ query }) => { | ||
// const result = await searchBookInfosSorted(query); | ||
|
||
return { status: 200, body: result } as const; | ||
}, | ||
// @ts-expect-error | ||
searchBookInfoById: async ({ params: { id } }) => { | ||
const result = await searchBookInfoById(id); | ||
// return { status: 200, body: result } as const; | ||
// }, | ||
// searchBookInfoById: async ({ params: { id } }) => { | ||
// const result = await searchBookInfoById(id); | ||
|
||
if (result instanceof BookInfoNotFoundError) return bookInfoNotFound; | ||
// if (result instanceof BookInfoNotFoundError) return bookInfoNotFound; | ||
|
||
return { status: 200, body: result } as const; | ||
}, | ||
// @ts-expect-error | ||
searchAllBooks: async ({ query }) => { | ||
const result = await searchAllBooks(query); | ||
// return { status: 200, body: result } as const; | ||
// }, | ||
// searchAllBooks: async ({ query }) => { | ||
// const result = await searchAllBooks(query); | ||
|
||
return { status: 200, body: result } as const; | ||
}, | ||
searchBookInfoForCreate: { | ||
// middleware: [authValidate(roleSet.librarian)], | ||
// @ts-expect-error | ||
handler: async ({ query: { isbnQuery } }) => { | ||
const result = await searchBookInfoForCreate(isbnQuery); | ||
// return { status: 200, body: result } as const; | ||
// }, | ||
// searchBookInfoForCreate: { | ||
// // middleware: [authValidate(roleSet.librarian)], | ||
// handler: async ({ query: { isbnQuery } }) => { | ||
// const result = await searchBookInfoForCreate(isbnQuery); | ||
|
||
if (result instanceof IsbnNotFoundError) return isbnNotFound; | ||
// if (result instanceof IsbnNotFoundError) return isbnNotFound; | ||
|
||
if (result instanceof NaverBookNotFound) return naverBookNotFound; | ||
// if (result instanceof NaverBookNotFound) return naverBookNotFound; | ||
|
||
return { status: 200, body: result } as const; | ||
}, | ||
}, | ||
// @ts-expect-error | ||
searchBookById: async ({ params: { id } }) => { | ||
const result = await searchBookById({ id }); | ||
// return { status: 200, body: result } as const; | ||
// }, | ||
// }, | ||
// searchBookById: async ({ params: { id } }) => { | ||
// const result = await searchBookById({ id }); | ||
|
||
if (result instanceof BookNotFoundError) { | ||
return bookNotFound; | ||
} | ||
// if (result instanceof BookNotFoundError) { | ||
// return bookNotFound; | ||
// } | ||
|
||
return { | ||
status: 200, | ||
body: result, | ||
} as const; | ||
}, | ||
// createBook: { | ||
// middleware: [authValidate(roleSet.librarian)], | ||
// handler: async ({ body }) => { | ||
// return { | ||
// status: 200, | ||
// body: result, | ||
// } as const; | ||
// }, | ||
// // createBook: { | ||
// // middleware: [authValidate(roleSet.librarian)], | ||
// // handler: async ({ body }) => { | ||
|
||
// } | ||
// }, | ||
updateBook: { | ||
// middleware: [authValidate(roleSet.librarian)], | ||
// @ts-expect-error | ||
handler: async ({ body }) => { | ||
const result = await updateBookOrBookInfo(body); | ||
// // } | ||
// // }, | ||
// updateBook: { | ||
// // middleware: [authValidate(roleSet.librarian)], | ||
// // @ts-expect-error | ||
// handler: async ({ body }) => { | ||
// const result = await updateBookOrBookInfo(body); | ||
|
||
if (result instanceof PubdateFormatError) { | ||
return pubdateFormatError; | ||
} | ||
return { status: 200, body: '책 정보가 수정되었습니다.' } as const; | ||
}, | ||
}, | ||
updateDonator: { | ||
// middleware: [authValidate(roleSet.librarian)], | ||
// @ts-expect-error | ||
handler: async ({ body }) => { | ||
const result = await updateBookDonator(body); | ||
// if (result instanceof PubdateFormatError) { | ||
// return pubdateFormatError; | ||
// } | ||
// return { status: 200, body: '책 정보가 수정되었습니다.' } as const; | ||
// }, | ||
// }, | ||
// updateDonator: { | ||
// // middleware: [authValidate(roleSet.librarian)], | ||
// // @ts-expect-error | ||
// handler: async ({ body }) => { | ||
// const result = await updateBookDonator(body); | ||
|
||
return { status: 200, body: '기부자 정보가 수정되었습니다.' } as const; | ||
}, | ||
}, | ||
}); | ||
// return { status: 200, body: '기부자 정보가 수정되었습니다.' } as const; | ||
// }, | ||
// }, | ||
// }); |
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
File renamed without changes.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.