From e537f9120c0ad6a5fdcf44a45847b66876a2b13e Mon Sep 17 00:00:00 2001 From: zyoshoka Date: Thu, 11 Jan 2024 20:44:21 +0900 Subject: [PATCH] =?UTF-8?q?fix(backend):=20`text:=20null`=E3=81=A0?= =?UTF-8?q?=E3=81=91=E3=81=AE=E3=83=8E=E3=83=BC=E3=83=88=E3=81=AF=E6=8A=95?= =?UTF-8?q?=E7=A8=BF=E3=81=A7=E3=81=8D=E3=81=AA=E3=81=84=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/server/api/endpoints/notes/create.ts | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/packages/backend/src/server/api/endpoints/notes/create.ts b/packages/backend/src/server/api/endpoints/notes/create.ts index c5d42dabe4..168ce70c11 100644 --- a/packages/backend/src/server/api/endpoints/notes/create.ts +++ b/packages/backend/src/server/api/endpoints/notes/create.ts @@ -172,13 +172,32 @@ export const paramDef = { }, }, // (re)note with text, files and poll are optional - anyOf: [ - { required: ['text'] }, - { required: ['renoteId'] }, - { required: ['fileIds'] }, - { required: ['mediaIds'] }, - { required: ['poll'] }, - ], + if: { + properties: { + renoteId: { + type: 'null', + }, + fileIds: { + type: 'null', + }, + mediaIds: { + type: 'null', + }, + poll: { + type: 'null', + }, + }, + }, + then: { + properties: { + text: { + type: 'string', + minLength: 1, + maxLength: MAX_NOTE_TEXT_LENGTH, + nullable: false, + }, + }, + }, } as const; @Injectable()