From e979743dbb41c6bc928f0d1e0449f348ade65d59 Mon Sep 17 00:00:00 2001 From: osamu <46447427+sam-osamu@users.noreply.github.com> Date: Wed, 8 Nov 2023 21:58:27 +0900 Subject: [PATCH 01/10] =?UTF-8?q?user.ts=E3=80=81page.ts=E3=80=81drive-fol?= =?UTF-8?q?der.ts=E3=82=92=E5=90=84EntityService=E3=81=AE=E6=88=BB?= =?UTF-8?q?=E3=82=8A=E5=80=A4=E3=82=92=E3=82=82=E3=81=A8=E3=81=AB=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/models/json-schema/drive-folder.ts | 12 +- .../backend/src/models/json-schema/page.ts | 58 +++- .../backend/src/models/json-schema/user.ts | 271 ++++++++++++++++-- 3 files changed, 306 insertions(+), 35 deletions(-) diff --git a/packages/backend/src/models/json-schema/drive-folder.ts b/packages/backend/src/models/json-schema/drive-folder.ts index 51107d423fec..aaad301303b1 100644 --- a/packages/backend/src/models/json-schema/drive-folder.ts +++ b/packages/backend/src/models/json-schema/drive-folder.ts @@ -21,6 +21,12 @@ export const packedDriveFolderSchema = { type: 'string', optional: false, nullable: false, }, + parentId: { + type: 'string', + optional: false, nullable: true, + format: 'id', + example: 'xxxxxxxxxx', + }, foldersCount: { type: 'number', optional: true, nullable: false, @@ -29,12 +35,6 @@ export const packedDriveFolderSchema = { type: 'number', optional: true, nullable: false, }, - parentId: { - type: 'string', - optional: false, nullable: true, - format: 'id', - example: 'xxxxxxxxxx', - }, parent: { type: 'object', optional: true, nullable: true, diff --git a/packages/backend/src/models/json-schema/page.ts b/packages/backend/src/models/json-schema/page.ts index 3f20a4b802f5..3ae07f3c1c78 100644 --- a/packages/backend/src/models/json-schema/page.ts +++ b/packages/backend/src/models/json-schema/page.ts @@ -22,6 +22,24 @@ export const packedPageSchema = { optional: false, nullable: false, format: 'date-time', }, + userId: { + type: 'string', + optional: false, nullable: false, + format: 'id', + }, + user: { + type: 'object', + ref: 'UserLite', + optional: false, nullable: false, + }, + content: { + type: 'array', + optional: false, nullable: false, + }, + variables: { + type: 'array', + optional: false, nullable: false, + }, title: { type: 'string', optional: false, nullable: false, @@ -34,23 +52,47 @@ export const packedPageSchema = { type: 'string', optional: false, nullable: true, }, - content: { - type: 'array', + hideTitleWhenPinned: { + type: 'boolean', optional: false, nullable: false, }, - variables: { - type: 'array', + alignCenter: { + type: 'boolean', optional: false, nullable: false, }, - userId: { + font: { type: 'string', optional: false, nullable: false, - format: 'id', }, - user: { + script: { + type: 'string', + optional: false, nullable: false, + }, + eyeCatchingImageId: { + type: 'string', + optional: false, nullable: true, + }, + eyeCatchingImage: { type: 'object', - ref: 'UserLite', + optional: false, nullable: true, + ref: 'DriveFile', + }, + attachedFiles: { + type: 'array', + optional: false, nullable: false, + items: { + type: 'object', + optional: false, nullable: false, + ref: 'DriveFile', + }, + }, + likedCount: { + type: 'number', optional: false, nullable: false, }, + isLiked: { + type: 'boolean', + optional: true, nullable: false, + }, }, } as const; diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts index 37bdcbe281f2..30489b0b6364 100644 --- a/packages/backend/src/models/json-schema/user.ts +++ b/packages/backend/src/models/json-schema/user.ts @@ -49,11 +49,6 @@ export const packedUserLiteSchema = { nullable: false, optional: false, format: 'id', }, - url: { - type: 'string', - format: 'url', - nullable: false, optional: false, - }, angle: { type: 'number', nullable: false, optional: true, @@ -62,33 +57,83 @@ export const packedUserLiteSchema = { type: 'boolean', nullable: false, optional: true, }, + url: { + type: 'string', + format: 'url', + nullable: false, optional: false, + }, }, }, }, - isAdmin: { + isBot: { type: 'boolean', nullable: false, optional: true, - default: false, }, - isModerator: { + isCat: { type: 'boolean', nullable: false, optional: true, - default: false, }, - isBot: { - type: 'boolean', + instance: { + type: 'object', nullable: false, optional: true, + properties: { + name: { + type: 'string', + nullable: true, optional: false, + }, + softwareName: { + type: 'string', + nullable: true, optional: false, + }, + softwareVersion: { + type: 'string', + nullable: true, optional: false, + }, + iconUrl: { + type: 'string', + nullable: true, optional: false, + }, + faviconUrl: { + type: 'string', + nullable: true, optional: false, + }, + themeColor: { + type: 'string', + nullable: true, optional: false, + }, + }, }, - isCat: { - type: 'boolean', - nullable: false, optional: true, + emojis: { + type: 'object', + nullable: false, optional: false, }, onlineStatus: { type: 'string', - format: 'url', - nullable: true, optional: false, + nullable: false, optional: false, enum: ['unknown', 'online', 'active', 'offline'], }, + badgeRoles: { + type: 'array', + nullable: false, optional: true, + items: { + type: 'object', + nullable: false, optional: false, + properties: { + name: { + type: 'string', + nullable: false, optional: false, + }, + iconUrl: { + type: 'number', + nullable: true, optional: false, + }, + displayOrder: { + type: 'number', + nullable: false, optional: false, + }, + }, + }, + }, }, } as const; @@ -105,7 +150,7 @@ export const packedUserDetailedNotMeOnlySchema = { format: 'uri', nullable: true, optional: false, }, - movedToUri: { + movedTo: { type: 'string', format: 'uri', nullable: true, @@ -249,6 +294,11 @@ export const packedUserDetailedNotMeOnlySchema = { type: 'boolean', nullable: false, optional: false, }, + ffVisibility: { + type: 'string', + nullable: false, optional: false, + enum: ['public', 'followers', 'private'], + }, twoFactorEnabled: { type: 'boolean', nullable: false, optional: false, @@ -264,6 +314,57 @@ export const packedUserDetailedNotMeOnlySchema = { nullable: false, optional: false, default: false, }, + roles: { + type: 'array', + nullable: false, optional: false, + items: { + type: 'object', + nullable: false, optional: false, + items: { + id: { + type: 'string', + nullable: false, optional: false, + format: 'id', + }, + name: { + type: 'string', + nullable: false, optional: false, + }, + color: { + type: 'string', + nullable: true, optional: false, + }, + iconUrl: { + type: 'string', + nullable: true, optional: false, + }, + description: { + type: 'string', + nullable: false, optional: false, + }, + isModerator: { + type: 'boolean', + nullable: false, optional: false, + }, + isAdministrator: { + type: 'boolean', + nullable: false, optional: false, + }, + displayOrder: { + type: 'number', + nullable: false, optional: false, + }, + }, + }, + }, + memo: { + type: 'string', + nullable: false, optional: true, + }, + moderationNote: { + type: 'string', + nullable: true, optional: true, + }, //#region relations isFollowing: { type: 'boolean', @@ -297,10 +398,6 @@ export const packedUserDetailedNotMeOnlySchema = { type: 'boolean', nullable: false, optional: true, }, - memo: { - type: 'string', - nullable: false, optional: true, - }, notify: { type: 'string', nullable: false, optional: true, @@ -326,6 +423,14 @@ export const packedMeDetailedOnlySchema = { nullable: true, optional: false, format: 'id', }, + isModerator: { + type: 'boolean', + nullable: true, optional: false, + }, + isAdmin: { + type: 'boolean', + nullable: true, optional: false, + }, injectFeaturedNote: { type: 'boolean', nullable: true, optional: false, @@ -391,6 +496,10 @@ export const packedMeDetailedOnlySchema = { type: 'boolean', nullable: false, optional: false, }, + hasUnreadChannel: { + type: 'boolean', + nullable: false, optional: false, + }, hasUnreadNotification: { type: 'boolean', nullable: false, optional: false, @@ -435,6 +544,126 @@ export const packedMeDetailedOnlySchema = { nullable: false, optional: false, }, }, + achievements: { + type: 'array', + nullable: false, optional: false, + items: { + type: 'object', + nullable: false, optional: false, + items: { + name: { + type: 'object', + nullable: false, optional: false, + }, + unlockedAt: { + type: 'number', + nullable: false, optional: false, + }, + }, + }, + }, + loggedInDays: { + type: 'number', + nullable: false, optional: false, + }, + policies: { + type: 'object', + nullable: false, optional: false, + items: { + gtlAvailable: { + type: 'boolean', + nullable: false, optional: false, + }, + ltlAvailable: { + type: 'boolean', + nullable: false, optional: false, + }, + canPublicNote: { + type: 'boolean', + nullable: false, optional: false, + }, + canInvite: { + type: 'boolean', + nullable: false, optional: false, + }, + inviteLimit: { + type: 'number', + nullable: false, optional: false, + }, + inviteLimitCycle: { + type: 'number', + nullable: false, optional: false, + }, + inviteExpirationTime: { + type: 'number', + nullable: false, optional: false, + }, + canManageCustomEmojis: { + type: 'boolean', + nullable: false, optional: false, + }, + canManageAvatarDecorations: { + type: 'boolean', + nullable: false, optional: false, + }, + canSearchNotes: { + type: 'boolean', + nullable: false, optional: false, + }, + canUseTranslator: { + type: 'boolean', + nullable: false, optional: false, + }, + canHideAds: { + type: 'boolean', + nullable: false, optional: false, + }, + driveCapacityMb: { + type: 'number', + nullable: false, optional: false, + }, + alwaysMarkNsfw: { + type: 'boolean', + nullable: false, optional: false, + }, + pinLimit: { + type: 'number', + nullable: false, optional: false, + }, + antennaLimit: { + type: 'number', + nullable: false, optional: false, + }, + wordMuteLimit: { + type: 'number', + nullable: false, optional: false, + }, + webhookLimit: { + type: 'number', + nullable: false, optional: false, + }, + clipLimit: { + type: 'number', + nullable: false, optional: false, + }, + noteEachClipsLimit: { + type: 'number', + nullable: false, optional: false, + }, + userListLimit: { + type: 'number', + nullable: false, optional: false, + }, + userEachUserListsLimit: { + type: 'number', + nullable: false, optional: false, + }, + rateLimitFactor: { + type: 'number', + nullable: false, optional: false, + }, + }, + }, //#region secrets email: { type: 'string', From fac1d27676ed2b98bb090e310129d0099f7fe6fd Mon Sep 17 00:00:00 2001 From: osamu <46447427+sam-osamu@users.noreply.github.com> Date: Fri, 10 Nov 2023 11:09:07 +0900 Subject: [PATCH 02/10] =?UTF-8?q?=E5=86=8D=E7=A2=BA=E8=AA=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/models/json-schema/drive-file.ts | 6 ++-- .../src/models/json-schema/drive-folder.ts | 2 +- .../backend/src/models/json-schema/page.ts | 8 +++++ .../backend/src/models/json-schema/user.ts | 29 +++++++++---------- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/packages/backend/src/models/json-schema/drive-file.ts b/packages/backend/src/models/json-schema/drive-file.ts index 87f13408129b..7b65c2142c29 100644 --- a/packages/backend/src/models/json-schema/drive-file.ts +++ b/packages/backend/src/models/json-schema/drive-file.ts @@ -74,7 +74,7 @@ export const packedDriveFileSchema = { }, url: { type: 'string', - optional: false, nullable: true, + optional: false, nullable: false, format: 'url', }, thumbnailUrl: { @@ -94,7 +94,7 @@ export const packedDriveFileSchema = { }, folder: { type: 'object', - optional: true, nullable: true, + optional: false, nullable: true, ref: 'DriveFolder', }, userId: { @@ -105,7 +105,7 @@ export const packedDriveFileSchema = { }, user: { type: 'object', - optional: true, nullable: true, + optional: false, nullable: true, ref: 'UserLite', }, }, diff --git a/packages/backend/src/models/json-schema/drive-folder.ts b/packages/backend/src/models/json-schema/drive-folder.ts index aaad301303b1..36f8a791ae77 100644 --- a/packages/backend/src/models/json-schema/drive-folder.ts +++ b/packages/backend/src/models/json-schema/drive-folder.ts @@ -37,7 +37,7 @@ export const packedDriveFolderSchema = { }, parent: { type: 'object', - optional: true, nullable: true, + optional: true, nullable: false, ref: 'DriveFolder', }, }, diff --git a/packages/backend/src/models/json-schema/page.ts b/packages/backend/src/models/json-schema/page.ts index 3ae07f3c1c78..9baacd6884d4 100644 --- a/packages/backend/src/models/json-schema/page.ts +++ b/packages/backend/src/models/json-schema/page.ts @@ -35,10 +35,18 @@ export const packedPageSchema = { content: { type: 'array', optional: false, nullable: false, + items: { + type: 'object', + optional: false, nullable: false, + }, }, variables: { type: 'array', optional: false, nullable: false, + items: { + type: 'object', + optional: false, nullable: false, + }, }, title: { type: 'string', diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts index 30489b0b6364..4767f51e2792 100644 --- a/packages/backend/src/models/json-schema/user.ts +++ b/packages/backend/src/models/json-schema/user.ts @@ -124,7 +124,7 @@ export const packedUserLiteSchema = { nullable: false, optional: false, }, iconUrl: { - type: 'number', + type: 'string', nullable: true, optional: false, }, displayOrder: { @@ -153,18 +153,15 @@ export const packedUserDetailedNotMeOnlySchema = { movedTo: { type: 'string', format: 'uri', - nullable: true, - optional: false, + nullable: true, optional: false, }, alsoKnownAs: { type: 'array', - nullable: true, - optional: false, + nullable: true, optional: false, items: { type: 'string', format: 'id', - nullable: false, - optional: false, + nullable: false, optional: false, }, }, createdAt: { @@ -359,11 +356,11 @@ export const packedUserDetailedNotMeOnlySchema = { }, memo: { type: 'string', - nullable: false, optional: true, + nullable: true, optional: false, }, moderationNote: { type: 'string', - nullable: true, optional: true, + nullable: false, optional: true, }, //#region relations isFollowing: { @@ -433,27 +430,27 @@ export const packedMeDetailedOnlySchema = { }, injectFeaturedNote: { type: 'boolean', - nullable: true, optional: false, + nullable: false, optional: false, }, receiveAnnouncementEmail: { type: 'boolean', - nullable: true, optional: false, + nullable: false, optional: false, }, alwaysMarkNsfw: { type: 'boolean', - nullable: true, optional: false, + nullable: false, optional: false, }, autoSensitive: { type: 'boolean', - nullable: true, optional: false, + nullable: false, optional: false, }, carefulBot: { type: 'boolean', - nullable: true, optional: false, + nullable: false, optional: false, }, autoAcceptFollowed: { type: 'boolean', - nullable: true, optional: false, + nullable: false, optional: false, }, noCrawle: { type: 'boolean', @@ -538,7 +535,7 @@ export const packedMeDetailedOnlySchema = { }, emailNotificationTypes: { type: 'array', - nullable: true, optional: false, + nullable: false, optional: false, items: { type: 'string', nullable: false, optional: false, From 273dbea6620d044aad6dbee813fd36cbda9ef37a Mon Sep 17 00:00:00 2001 From: osamu <46447427+sam-osamu@users.noreply.github.com> Date: Sat, 11 Nov 2023 06:44:04 +0900 Subject: [PATCH 03/10] fix error --- packages/backend/src/models/json-schema/user.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts index 4767f51e2792..658fbc10eb13 100644 --- a/packages/backend/src/models/json-schema/user.ts +++ b/packages/backend/src/models/json-schema/user.ts @@ -317,7 +317,7 @@ export const packedUserDetailedNotMeOnlySchema = { items: { type: 'object', nullable: false, optional: false, - items: { + properties: { id: { type: 'string', nullable: false, optional: false, @@ -547,9 +547,9 @@ export const packedMeDetailedOnlySchema = { items: { type: 'object', nullable: false, optional: false, - items: { + properties: { name: { - type: 'object', + type: 'string', nullable: false, optional: false, }, unlockedAt: { @@ -566,7 +566,7 @@ export const packedMeDetailedOnlySchema = { policies: { type: 'object', nullable: false, optional: false, - items: { + properties: { gtlAvailable: { type: 'boolean', nullable: false, optional: false, From 0b533c982300d46375e191ebdcf7dac393058504 Mon Sep 17 00:00:00 2001 From: osamu <46447427+sam-osamu@users.noreply.github.com> Date: Sat, 11 Nov 2023 18:38:11 +0900 Subject: [PATCH 04/10] =?UTF-8?q?note=E4=BB=A5=E5=A4=96=E3=81=AE=E6=AE=8B?= =?UTF-8?q?=E3=82=8A=E3=81=AE=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entities/NotificationEntityService.ts | 14 +++-- .../src/models/json-schema/announcement.ts | 8 ++- .../backend/src/models/json-schema/channel.ts | 57 +++++++++++-------- .../backend/src/models/json-schema/clip.ts | 8 +-- .../models/json-schema/federation-instance.ts | 9 ++- .../backend/src/models/json-schema/flash.ts | 18 +++--- .../src/models/json-schema/following.ts | 10 ++-- .../src/models/json-schema/gallery-post.ts | 24 +++++--- .../src/models/json-schema/notification.ts | 26 ++++----- .../backend/src/models/json-schema/user.ts | 8 +++ 10 files changed, 104 insertions(+), 78 deletions(-) diff --git a/packages/backend/src/core/entities/NotificationEntityService.ts b/packages/backend/src/core/entities/NotificationEntityService.ts index f74594ff0c97..e723ea5a558d 100644 --- a/packages/backend/src/core/entities/NotificationEntityService.ts +++ b/packages/backend/src/core/entities/NotificationEntityService.ts @@ -198,12 +198,14 @@ export class NotificationEntityService implements OnModuleInit { }); } else if (notification.type === 'renote:grouped') { const users = await Promise.all(notification.userIds.map(userId => { - const user = hint?.packedUsers != null - ? hint.packedUsers.get(userId) - : this.userEntityService.pack(userId!, { id: meId }, { - detail: false, - }); - return user; + const packedUser = hint?.packedUsers != null ? hint.packedUsers.get(userId) : null; + if (packedUser) { + return packedUser; + } + + return this.userEntityService.pack(userId, { id: meId }, { + detail: false, + }); })); return await awaitAll({ id: notification.id, diff --git a/packages/backend/src/models/json-schema/announcement.ts b/packages/backend/src/models/json-schema/announcement.ts index c7e24c7f2928..78a98872b251 100644 --- a/packages/backend/src/models/json-schema/announcement.ts +++ b/packages/backend/src/models/json-schema/announcement.ts @@ -42,11 +42,15 @@ export const packedAnnouncementSchema = { type: 'string', optional: false, nullable: false, }, - forYou: { + needConfirmationToRead: { type: 'boolean', optional: false, nullable: false, }, - needConfirmationToRead: { + silence: { + type: 'boolean', + optional: false, nullable: false, + }, + forYou: { type: 'boolean', optional: false, nullable: false, }, diff --git a/packages/backend/src/models/json-schema/channel.ts b/packages/backend/src/models/json-schema/channel.ts index 8f9770cdc5fe..5b0fa0f15dd7 100644 --- a/packages/backend/src/models/json-schema/channel.ts +++ b/packages/backend/src/models/json-schema/channel.ts @@ -19,7 +19,7 @@ export const packedChannelSchema = { }, lastNotedAt: { type: 'string', - optional: false, nullable: true, + nullable: true, optional: false, format: 'date-time', }, name: { @@ -27,26 +27,51 @@ export const packedChannelSchema = { optional: false, nullable: false, }, description: { + type: 'string', + optional: false, nullable: true, + }, + userId: { type: 'string', nullable: true, optional: false, + format: 'id', }, bannerUrl: { type: 'string', format: 'url', nullable: true, optional: false, }, + pinnedNoteIds: { + type: 'array', + nullable: false, optional: false, + items: { + type: 'string', + format: 'id', + }, + }, + color: { + type: 'string', + optional: false, nullable: false, + }, isArchived: { type: 'boolean', optional: false, nullable: false, }, - notesCount: { + usersCount: { type: 'number', nullable: false, optional: false, }, - usersCount: { + notesCount: { type: 'number', nullable: false, optional: false, }, + isSensitive: { + type: 'boolean', + optional: false, nullable: false, + }, + allowRenoteToExternal: { + type: 'boolean', + optional: false, nullable: false, + }, isFollowing: { type: 'boolean', optional: true, nullable: false, @@ -55,30 +80,14 @@ export const packedChannelSchema = { type: 'boolean', optional: true, nullable: false, }, - userId: { - type: 'string', - nullable: true, optional: false, - format: 'id', - }, - pinnedNoteIds: { + pinnedNotes: { type: 'array', - nullable: false, optional: false, + optional: true, nullable: false, items: { - type: 'string', - format: 'id', + type: 'object', + optional: false, nullable: false, + ref: 'Note', }, }, - color: { - type: 'string', - optional: false, nullable: false, - }, - isSensitive: { - type: 'boolean', - optional: false, nullable: false, - }, - allowRenoteToExternal: { - type: 'boolean', - optional: false, nullable: false, - }, }, } as const; diff --git a/packages/backend/src/models/json-schema/clip.ts b/packages/backend/src/models/json-schema/clip.ts index 64f7a2ad9ca8..1ab96c2b3bfb 100644 --- a/packages/backend/src/models/json-schema/clip.ts +++ b/packages/backend/src/models/json-schema/clip.ts @@ -44,13 +44,13 @@ export const packedClipSchema = { type: 'boolean', optional: false, nullable: false, }, - isFavorited: { - type: 'boolean', - optional: true, nullable: false, - }, favoritedCount: { type: 'number', optional: false, nullable: false, }, + isFavorited: { + type: 'boolean', + optional: true, nullable: false, + }, }, } as const; diff --git a/packages/backend/src/models/json-schema/federation-instance.ts b/packages/backend/src/models/json-schema/federation-instance.ts index 4ad84d02ff79..4da5055c9a08 100644 --- a/packages/backend/src/models/json-schema/federation-instance.ts +++ b/packages/backend/src/models/json-schema/federation-instance.ts @@ -79,6 +79,10 @@ export const packedFederationInstanceSchema = { type: 'string', optional: false, nullable: true, }, + isSilenced: { + type: 'boolean', + optional: false, nullable: false, + }, iconUrl: { type: 'string', optional: false, nullable: true, @@ -93,11 +97,6 @@ export const packedFederationInstanceSchema = { type: 'string', optional: false, nullable: true, }, - isSilenced: { - type: "boolean", - optional: false, - nullable: false, - }, infoUpdatedAt: { type: 'string', optional: false, nullable: true, diff --git a/packages/backend/src/models/json-schema/flash.ts b/packages/backend/src/models/json-schema/flash.ts index 9453ba1dcef1..f08fa7a2795e 100644 --- a/packages/backend/src/models/json-schema/flash.ts +++ b/packages/backend/src/models/json-schema/flash.ts @@ -22,26 +22,26 @@ export const packedFlashSchema = { optional: false, nullable: false, format: 'date-time', }, - title: { + userId: { type: 'string', optional: false, nullable: false, + format: 'id', }, - summary: { - type: 'string', + user: { + type: 'object', + ref: 'UserLite', optional: false, nullable: false, }, - script: { + title: { type: 'string', optional: false, nullable: false, }, - userId: { + summary: { type: 'string', optional: false, nullable: false, - format: 'id', }, - user: { - type: 'object', - ref: 'UserLite', + script: { + type: 'string', optional: false, nullable: false, }, likedCount: { diff --git a/packages/backend/src/models/json-schema/following.ts b/packages/backend/src/models/json-schema/following.ts index 3a24ebb619a8..e92cff20a10c 100644 --- a/packages/backend/src/models/json-schema/following.ts +++ b/packages/backend/src/models/json-schema/following.ts @@ -22,16 +22,16 @@ export const packedFollowingSchema = { optional: false, nullable: false, format: 'id', }, - followee: { - type: 'object', - optional: true, nullable: false, - ref: 'UserDetailed', - }, followerId: { type: 'string', optional: false, nullable: false, format: 'id', }, + followee: { + type: 'object', + optional: true, nullable: false, + ref: 'UserDetailed', + }, follower: { type: 'object', optional: true, nullable: false, diff --git a/packages/backend/src/models/json-schema/gallery-post.ts b/packages/backend/src/models/json-schema/gallery-post.ts index cf260c0bf503..df7038950c24 100644 --- a/packages/backend/src/models/json-schema/gallery-post.ts +++ b/packages/backend/src/models/json-schema/gallery-post.ts @@ -22,14 +22,6 @@ export const packedGalleryPostSchema = { optional: false, nullable: false, format: 'date-time', }, - title: { - type: 'string', - optional: false, nullable: false, - }, - description: { - type: 'string', - optional: false, nullable: true, - }, userId: { type: 'string', optional: false, nullable: false, @@ -40,6 +32,14 @@ export const packedGalleryPostSchema = { ref: 'UserLite', optional: false, nullable: false, }, + title: { + type: 'string', + optional: false, nullable: false, + }, + description: { + type: 'string', + optional: false, nullable: true, + }, fileIds: { type: 'array', optional: true, nullable: false, @@ -70,5 +70,13 @@ export const packedGalleryPostSchema = { type: 'boolean', optional: false, nullable: false, }, + likedCount: { + type: 'number', + optional: false, nullable: false, + }, + isLiked: { + type: 'boolean', + optional: true, nullable: false, + }, }, } as const; diff --git a/packages/backend/src/models/json-schema/notification.ts b/packages/backend/src/models/json-schema/notification.ts index 27db3bb62c09..c6d6e8431731 100644 --- a/packages/backend/src/models/json-schema/notification.ts +++ b/packages/backend/src/models/json-schema/notification.ts @@ -42,13 +42,9 @@ export const packedNotificationSchema = { type: 'string', optional: true, nullable: true, }, - choice: { - type: 'number', - optional: true, nullable: true, - }, - invitation: { - type: 'object', - optional: true, nullable: true, + achievement: { + type: 'string', + optional: true, nullable: false, }, body: { type: 'string', @@ -81,14 +77,14 @@ export const packedNotificationSchema = { required: ['user', 'reaction'], }, }, - }, - users: { - type: 'array', - optional: true, nullable: true, - items: { - type: 'object', - ref: 'UserLite', - optional: false, nullable: false, + users: { + type: 'array', + optional: true, nullable: true, + items: { + type: 'object', + ref: 'UserLite', + optional: false, nullable: false, + }, }, }, } as const; diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts index 658fbc10eb13..765d149d6351 100644 --- a/packages/backend/src/models/json-schema/user.ts +++ b/packages/backend/src/models/json-schema/user.ts @@ -737,5 +737,13 @@ export const packedUserSchema = { type: 'object', ref: 'UserDetailed', }, + { + type: 'object', + ref: 'UserDetailedNotMe', + }, + { + type: 'object', + ref: 'MeDetailed', + }, ], } as const; From 09c564b32d24fbe655f676bcd53363944f91c554 Mon Sep 17 00:00:00 2001 From: osamu <46447427+sam-osamu@users.noreply.github.com> Date: Sat, 11 Nov 2023 20:01:09 +0900 Subject: [PATCH 05/10] fix CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57415554e7df..455bcaaf81f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,11 +15,11 @@ ## 2023.x.x (unreleased) ### General -- +- Enhance: json-schemaを出来る限り最新化 #12311 ### Client - Fix: アイコンデコレーションが複数の場所で見切れている問題を修正 -― Fix: 「フォロー中の人全員の返信を含める/含めないようにする」のボタンを押下した際の確認が機能していない問題を修正 +- Fix: 「フォロー中の人全員の返信を含める/含めないようにする」のボタンを押下した際の確認が機能していない問題を修正 ### Server - Fix: トークンのないプラグインをアンインストールするときにエラーが出ないように From ff1676c6a038d6d14ba2f3a904adbdaea1fd6cf2 Mon Sep 17 00:00:00 2001 From: osamu <46447427+sam-osamu@users.noreply.github.com> Date: Sat, 11 Nov 2023 20:02:03 +0900 Subject: [PATCH 06/10] fix CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 455bcaaf81f0..bd6697f6bc96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ ## 2023.x.x (unreleased) ### General -- Enhance: json-schemaを出来る限り最新化 #12311 +- Enhance: json-schema(OpenAPIの戻り値として使用されるスキーマ定義)を出来る限り最新化 #12311 ### Client - Fix: アイコンデコレーションが複数の場所で見切れている問題を修正 From 1e505a2f58cd6455827a4a8f8559a2af20384690 Mon Sep 17 00:00:00 2001 From: osamu <46447427+sam-osamu@users.noreply.github.com> Date: Sat, 11 Nov 2023 20:40:51 +0900 Subject: [PATCH 07/10] fix user.ts --- packages/backend/src/models/json-schema/user.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts index 765d149d6351..2bfbd87b93a2 100644 --- a/packages/backend/src/models/json-schema/user.ts +++ b/packages/backend/src/models/json-schema/user.ts @@ -489,6 +489,14 @@ export const packedMeDetailedOnlySchema = { type: 'boolean', nullable: false, optional: false, }, + unreadAnnouncements: { + type: 'array', + nullable: false, optional: false, + items: { + type: 'object', + ref: 'Announcement', + }, + }, hasUnreadAntenna: { type: 'boolean', nullable: false, optional: false, From 219354f7827f9052e2d98a91bd19da82a9866d46 Mon Sep 17 00:00:00 2001 From: osamu <46447427+sam-osamu@users.noreply.github.com> Date: Sat, 11 Nov 2023 20:52:59 +0900 Subject: [PATCH 08/10] fix user.ts --- packages/backend/src/models/json-schema/user.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts index 2bfbd87b93a2..b0e18db01ac1 100644 --- a/packages/backend/src/models/json-schema/user.ts +++ b/packages/backend/src/models/json-schema/user.ts @@ -494,6 +494,7 @@ export const packedMeDetailedOnlySchema = { nullable: false, optional: false, items: { type: 'object', + nullable: false, optional: false, ref: 'Announcement', }, }, From 7630cbe59fec6eb637a5b4a8236552537007dd84 Mon Sep 17 00:00:00 2001 From: osamu <46447427+sam-osamu@users.noreply.github.com> Date: Sun, 12 Nov 2023 14:35:09 +0900 Subject: [PATCH 09/10] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/models/json-schema/drive-file.ts | 4 ++-- packages/backend/src/models/json-schema/drive-folder.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/backend/src/models/json-schema/drive-file.ts b/packages/backend/src/models/json-schema/drive-file.ts index 7b65c2142c29..79f242a7111e 100644 --- a/packages/backend/src/models/json-schema/drive-file.ts +++ b/packages/backend/src/models/json-schema/drive-file.ts @@ -94,7 +94,7 @@ export const packedDriveFileSchema = { }, folder: { type: 'object', - optional: false, nullable: true, + optional: true, nullable: true, ref: 'DriveFolder', }, userId: { @@ -105,7 +105,7 @@ export const packedDriveFileSchema = { }, user: { type: 'object', - optional: false, nullable: true, + optional: true, nullable: true, ref: 'UserLite', }, }, diff --git a/packages/backend/src/models/json-schema/drive-folder.ts b/packages/backend/src/models/json-schema/drive-folder.ts index 36f8a791ae77..aaad301303b1 100644 --- a/packages/backend/src/models/json-schema/drive-folder.ts +++ b/packages/backend/src/models/json-schema/drive-folder.ts @@ -37,7 +37,7 @@ export const packedDriveFolderSchema = { }, parent: { type: 'object', - optional: true, nullable: false, + optional: true, nullable: true, ref: 'DriveFolder', }, }, From f1dfd319911838ee3442662cd23fc48d10ad1ca5 Mon Sep 17 00:00:00 2001 From: osamu <46447427+sam-osamu@users.noreply.github.com> Date: Tue, 21 Nov 2023 11:10:35 +0900 Subject: [PATCH 10/10] fix note.ts --- .../backend/src/models/json-schema/note.ts | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/packages/backend/src/models/json-schema/note.ts b/packages/backend/src/models/json-schema/note.ts index 38c0054b5515..9d5d558f5102 100644 --- a/packages/backend/src/models/json-schema/note.ts +++ b/packages/backend/src/models/json-schema/note.ts @@ -127,22 +127,18 @@ export const packedNoteSchema = { channel: { type: 'object', optional: true, nullable: true, - items: { - type: 'object', - optional: false, nullable: false, - properties: { - id: { - type: 'string', - optional: false, nullable: false, - }, - name: { - type: 'string', - optional: false, nullable: true, - }, - isSensitive: { - type: 'boolean', - optional: true, nullable: false, - }, + properties: { + id: { + type: 'string', + optional: false, nullable: false, + }, + name: { + type: 'string', + optional: false, nullable: true, + }, + isSensitive: { + type: 'boolean', + optional: true, nullable: false, }, }, },