Skip to content

Commit 3d45427

Browse files
committed
fix: user.id 디코딩 누락 수정
1 parent 4a07931 commit 3d45427

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/services/changeWellItemOrder.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import { FetchError } from '@frolog/frolog-api';
1313
*/
1414
export default async function changeWellItemOrder(reqDto, user, transaction) {
1515
// (1) 해시 ID 디코딩
16+
let userId;
17+
if (!user.is_admin) {
18+
userId = decodeHashId(user.id);
19+
}
1620
const wellHashId = reqDto.well_id;
1721
const wellId = decodeHashId(wellHashId);
1822
const itemHashId = reqDto.id;
@@ -24,7 +28,7 @@ export default async function changeWellItemOrder(reqDto, user, transaction) {
2428
if (!item || item.well_id !== wellId) {
2529
return new FetchError('Well item is not found.', 404);
2630
}
27-
if (!user.is_admin && user.id !== well.owner_id) {
31+
if (!user.is_admin && userId !== well.owner_id) {
2832
return { result: false, message: 'Unauthorized access.' };
2933
}
3034
const lastOrder = item.order;

0 commit comments

Comments
 (0)