From 9fa0df1f2fdb2846ad9f70c08a2da011ddd8559a Mon Sep 17 00:00:00 2001 From: fantasticit Date: Thu, 30 Jun 2022 22:06:02 +0800 Subject: [PATCH] server: check organization --- packages/server/src/services/organization.service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/server/src/services/organization.service.ts b/packages/server/src/services/organization.service.ts index d4e865fe..178f62ab 100644 --- a/packages/server/src/services/organization.service.ts +++ b/packages/server/src/services/organization.service.ts @@ -139,12 +139,15 @@ export class OrganizationService { * @returns */ public async getOrganizationDetail(user: IUser, id: IOrganization['id']) { + const organization = await this.organizationRepo.findOne({ id }); + if (!organization) { + throw new HttpException('组织不存在', HttpStatus.NOT_FOUND); + } await this.authService.canView(user.id, { organizationId: id, wikiId: null, documentId: null, }); - const organization = await this.organizationRepo.findOne({ id }); return organization; }