Skip to content

Commit

Permalink
fix: not found subscribe throw null
Browse files Browse the repository at this point in the history
  • Loading branch information
caoxing9 committed Sep 19, 2024
1 parent 3648597 commit 50f2e1b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class CommentOpenApiService {

async getSubscribeDetail(tableId: string, recordId: string) {
return await this.prismaService.commentSubscription
.findUnique({
.findUniqueOrThrow({
where: {
// eslint-disable-next-line
tableId_recordId: {
Expand Down
1 change: 1 addition & 0 deletions apps/nestjs-backend/test/comment.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ describe('OpenAPI CommentController (e2e)', () => {

await deleteCommentSubscribe(tableId, recordId);
const subscribeInfo = await getCommentSubscribe(tableId, recordId);
// actually the subscribe info is null but, there is no idea to return ''.
expect(subscribeInfo.data).toEqual('');
});
});
Expand Down
5 changes: 5 additions & 0 deletions packages/openapi/src/comment/subscribe/get-subscribe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export const GetCommentSubscribeRoute: RouteConfig = registerRoute({
responses: {
200: {
description: 'Successfully get record comment subscribe detail.',
content: {
'application/json': {
schema: commentSubscribeVoSchema.nullable(),
},
},
},
},
tags: ['comment'],
Expand Down

0 comments on commit 50f2e1b

Please sign in to comment.