From e696709a69d0e4d9c9ae44ac19bb2e6daaa5ac93 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Tue, 19 Sep 2023 17:28:07 +0800 Subject: [PATCH] resolve conflicts --- packages/api/src/resolvers/labels/index.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/api/src/resolvers/labels/index.ts b/packages/api/src/resolvers/labels/index.ts index 47bc1d693..5ca48a3ee 100644 --- a/packages/api/src/resolvers/labels/index.ts +++ b/packages/api/src/resolvers/labels/index.ts @@ -28,6 +28,7 @@ import { UpdateLabelSuccess, } from '../../generated/graphql' import { labelRepository } from '../../repository/label' +import { userRepository } from '../../repository/user' import { findOrCreateLabels, saveLabelsInHighlight, @@ -40,6 +41,13 @@ import { authorized } from '../../utils/helpers' export const labelsResolver = authorized( async (_obj, _params, { authTrx, log, uid }) => { try { + const user = await userRepository.findById(uid) + if (!user) { + return { + errorCodes: [LabelsErrorCode.Unauthorized], + } + } + const labels = await authTrx(async (tx) => { return tx.withRepository(labelRepository).find({ order: {