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

/tags/sub PATCH 서브 태그 공개 여부 수정은 사서만 가능하게 함 #487

Merged
merged 1 commit into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/src/routes/tags.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ router
* type: number
* example: 500
*/
.patch('/sub', authValidate(roleSet.all), updateSubTags);
.patch('/sub', authValidate(roleSet.librarian), updateSubTags);

router
/**
Expand Down
7 changes: 2 additions & 5 deletions backend/src/tags/tags.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const createDefaultTags = async (
if (await tagsService.isValidBookInfoId(parseInt(bookInfoId, 10)) === false) {
return next(new ErrorResponse(errorCode.INVALID_BOOKINFO_ID, 400));
}
if (content === '' || content.length > 42 || regex.test(content) === true)
if (content === '' || content.length > 42 || regex.test(content) === true)
return next(new ErrorResponse(errorCode.INVALID_INPUT_TAGS, 400));
await tagsService.createDefaultTags(tokenId, bookInfoId, content);
return res.status(status.CREATED).send();
Expand All @@ -39,7 +39,7 @@ export const createSuperTags = async (
if (await tagsService.isValidBookInfoId(parseInt(bookInfoId, 10)) === false) {
return next(new ErrorResponse(errorCode.INVALID_BOOKINFO_ID, 400));
}
if (content === '' || content === 'default' || content.length > 42 || regex.test(content) === true) {
if (content === '' || content === 'default' || content.length > 42 || regex.test(content) === true) {
return next(new ErrorResponse(errorCode.INVALID_INPUT_TAGS, 400));
}
await tagsService.createSuperTags(tokenId, bookInfoId, content);
Expand Down Expand Up @@ -166,9 +166,6 @@ export const updateSubTags = async (
if (await tagsService.isExistingSubTag(subTagId) === false) {
return next(new ErrorResponse(errorCode.INVALID_TAG_ID, 400));
}
if (await tagsService.isAuthorizedUser(tokenId, subTagId) === false) {
return next(new ErrorResponse(errorCode.UNAUTHORIZED_TAGS, 403));
}
try {
await tagsService.updateSubTags(tokenId, subTagId, visibility);
} catch (e) {
Expand Down