[questions][feat] update userId check

pull/457/head
hpkoh 3 years ago
parent 9f4ab6ef58
commit 72f3e18f34

@ -39,7 +39,7 @@ export const questionsAnswerCommentUserRouter = createProtectedRouter()
}, },
}); });
if (answerCommentToUpdate?.id !== userId) { if (answerCommentToUpdate?.userId !== userId) {
throw new TRPCError({ throw new TRPCError({
code: 'UNAUTHORIZED', code: 'UNAUTHORIZED',
message: 'User have no authorization to record.', message: 'User have no authorization to record.',
@ -71,7 +71,7 @@ export const questionsAnswerCommentUserRouter = createProtectedRouter()
}, },
}); });
if (answerCommentToDelete?.id !== userId) { if (answerCommentToDelete?.userId !== userId) {
throw new TRPCError({ throw new TRPCError({
code: 'UNAUTHORIZED', code: 'UNAUTHORIZED',
message: 'User have no authorization to record.', message: 'User have no authorization to record.',

@ -41,7 +41,7 @@ export const questionsQuestionCommentUserRouter = createProtectedRouter()
}, },
}); });
if (questionCommentToUpdate?.id !== userId) { if (questionCommentToUpdate?.userId !== userId) {
throw new TRPCError({ throw new TRPCError({
code: 'UNAUTHORIZED', code: 'UNAUTHORIZED',
message: 'User have no authorization to record.', message: 'User have no authorization to record.',
@ -72,7 +72,7 @@ export const questionsQuestionCommentUserRouter = createProtectedRouter()
}, },
}); });
if (questionCommentToDelete?.id !== userId) { if (questionCommentToDelete?.userId !== userId) {
throw new TRPCError({ throw new TRPCError({
code: 'UNAUTHORIZED', code: 'UNAUTHORIZED',
message: 'User have no authorization to record.', message: 'User have no authorization to record.',

@ -94,7 +94,7 @@ export const questionsQuestionEncounterUserRouter = createProtectedRouter()
}, },
}); });
if (questionEncounterToUpdate?.id !== userId) { if (questionEncounterToUpdate?.userId !== userId) {
throw new TRPCError({ throw new TRPCError({
code: 'UNAUTHORIZED', code: 'UNAUTHORIZED',
message: 'User have no authorization to record.', message: 'User have no authorization to record.',
@ -157,7 +157,7 @@ export const questionsQuestionEncounterUserRouter = createProtectedRouter()
}, },
}); });
if (questionEncounterToDelete?.id !== userId) { if (questionEncounterToDelete?.userId !== userId) {
throw new TRPCError({ throw new TRPCError({
code: 'UNAUTHORIZED', code: 'UNAUTHORIZED',
message: 'User have no authorization to record.', message: 'User have no authorization to record.',

@ -59,7 +59,7 @@ export const questionsQuestionUserRouter = createProtectedRouter()
}, },
}); });
if (questionToUpdate?.id !== userId) { if (questionToUpdate?.userId !== userId) {
throw new TRPCError({ throw new TRPCError({
code: 'UNAUTHORIZED', code: 'UNAUTHORIZED',
message: 'User have no authorization to record.', message: 'User have no authorization to record.',
@ -93,7 +93,7 @@ export const questionsQuestionUserRouter = createProtectedRouter()
}, },
}); });
if (questionToDelete?.id !== userId) { if (questionToDelete?.userId !== userId) {
throw new TRPCError({ throw new TRPCError({
code: 'UNAUTHORIZED', code: 'UNAUTHORIZED',
message: 'User have no authorization to record.', message: 'User have no authorization to record.',

Loading…
Cancel
Save