summaryrefslogtreecommitdiff
path: root/packages/backend/src/models
diff options
context:
space:
mode:
authoryukineko <27853966+hideki0403@users.noreply.github.com>2024-01-30 19:53:53 +0900
committerGitHub <noreply@github.com>2024-01-30 19:53:53 +0900
commita6a91fec3af5314472b0a70402c1ef7e73a478ef (patch)
tree7a7977d47a038038136082ee444840781c7164da /packages/backend/src/models
parentiOSで大きな画像を変換してアップロードできない問題を... (diff)
downloadsharkey-a6a91fec3af5314472b0a70402c1ef7e73a478ef.tar.gz
sharkey-a6a91fec3af5314472b0a70402c1ef7e73a478ef.tar.bz2
sharkey-a6a91fec3af5314472b0a70402c1ef7e73a478ef.zip
refactor: frontendのcomponentsの型エラーを改善 (#12926)
* add: safeFloatParserを追加 * fix: 欠けていた型を追加 * refactor: pageBlockTypesをjson-schemaに移植 * refactor: components/global内の型エラーが出ている箇所を修正 * lint: fix null check style * refactor: fix type error * refactor: fix some type errors * fix: 翻訳が抜けていた箇所を修正 * refactor: getJsonSchemaで正しいスキーマが返されるように修正 * fix: MkChartの型エラーとbytesオプションが機能していない問題を修正 * fix(misskey-js): `drive`->`folderUpdated`のpayloadの型が間違っていたのを修正 * refactor: fix some type errors * change: Captcha読み込み中の文言をLoadingに変更 * refactor(backend/misskey-js): MainEventの型を改善 * refactor: chartjs-plugin-gradientが二重でpluginに登録されていたのを修正 * update: misskey-js.api.md * refactor: fix some type errors * fix: backendのtypecheckが落ちていたのを修正 * update: misskey-js.api.md * add: json-schemaのnoteにpollの型定義を追加 * refactor: noteのjson-schemaの型を改善 * refactor: MkPoll * refactor: fix some type errors * change: UserLiteにisLockedを持たせるように * fix: notificationスキーマにroleが含まれていないのを修正 * Revert "change: UserLiteにisLockedを持たせるように" This reverts commit 1bb0c8e7a9b19a4e9f21bf7381712b98f27672a5. * fix: フォロー通知から鍵垢へのフォローを行うと処理中のまま止まってしまう問題を修正 * refactor: noteスキーマのvisibilityにenumを追加 * change: deepCloneのCloneableTypeにundefinedを追加 * refactor: fix some type errors * refactor: `allowEmpty: false`を使用していた箇所を`minLength: 1`に置き換え * enhance: API 'retension' のresponseの型を追加 * fix: Chart関連のtooltipが正しい位置に表示されない問題を修正 * refactor: fix some type errors * fix: 型情報が不足していたのを修正 * enhance: announcementスキーマにenumを追加 * enhance: ロールポリシーの型定義をRoleServiceからjson-schemaに移植 * refactor: policiesを`ref: RolePolicies`に統一 * fix: API `meta` のレスポンスの型にpoliciesが含まれていないのを修正 * refactor: fix some type errors * fix: backendのlintが落ちているのを修正 * fix: MkFoldableSectionの開閉時のanimationが適用されていない問題を修正 * fix: backendのtypecheckが落ちているのを修正 * update: run build-misskey-js-with-types * fix: MkDialogのmount時に文字数制限の判定が行われない問題を修正 * update: CHANGELOG.md * refactor: MkUserSelectDialogの型を改善 * fix: deepCloneでundefinedはcloneしないように (#9207) * change: frontendのcloneをbackend側にも反映 * update: CHANGELOG.md * fix: RoleServiceからPackを通して型RolePoliciesに依存させないように * Update packages/frontend/src/scripts/get-note-summary.ts * revert RoleService.ts changes * change: optional chaining -> non-null assertion * remove: unused import * fix: propsで渡されたuserがUserLiteの場合に意図しない動作になってしまうのを修正 * change: fix null check style * refactor: fix type error * change: fix null check style * Update packages/frontend/src/components/MkDrive.vue Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> * refactor: css moduleでglobalを使わないように * refactor: roleのiconUrlは必ず存在するものとして扱うように * enhance: MenuButtonのactiveにcomputedを受け付けられるように * Update packages/frontend/src/components/MkNotePreview.vue * Update MkWindow.vue * refactor: notification.noteは必ず存在するものとして扱うように * Update packages/frontend/src/components/MkNotification.vue Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> * fix: MkSignupDialogでdoneのemit時にresを含んでいなかったのを修正 * Update packages/frontend/src/scripts/clone.ts Co-authored-by: syuilo <Syuilotan@yahoo.co.jp> * refactor: 不要な返り値の型を削除 * refactor: 不要なnullチェックを削除 * update: misskey-js-autogen * update: clone.ts * refactor * Update MkNotification.vue * Update MkNotification.vue * :v: * Update MkNotification.vue * Update MkNotification.vue * Update MkNotification.vue * Update MkNotifications.vue * Update MkUserSetupDialog.Profile.vue * Update MkUserCardMini.vue * :v: * Update MkMenu.vue --------- Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/backend/src/models')
-rw-r--r--packages/backend/src/models/Announcement.ts4
-rw-r--r--packages/backend/src/models/json-schema/announcement.ts2
-rw-r--r--packages/backend/src/models/json-schema/note.ts59
-rw-r--r--packages/backend/src/models/json-schema/notification.ts396
-rw-r--r--packages/backend/src/models/json-schema/page.ts102
-rw-r--r--packages/backend/src/models/json-schema/role.ts152
-rw-r--r--packages/backend/src/models/json-schema/user.ts99
7 files changed, 626 insertions, 188 deletions
diff --git a/packages/backend/src/models/Announcement.ts b/packages/backend/src/models/Announcement.ts
index 8f8be88fed..c2d9e9878c 100644
--- a/packages/backend/src/models/Announcement.ts
+++ b/packages/backend/src/models/Announcement.ts
@@ -38,7 +38,7 @@ export class MiAnnouncement {
length: 256, nullable: false,
default: 'info',
})
- public icon: string;
+ public icon: 'info' | 'warning' | 'error' | 'success';
// normal ... お知らせページ掲載
// banner ... お知らせページ掲載 + バナー表示
@@ -47,7 +47,7 @@ export class MiAnnouncement {
length: 256, nullable: false,
default: 'normal',
})
- public display: string;
+ public display: 'normal' | 'banner' | 'dialog';
@Column('boolean', {
default: false,
diff --git a/packages/backend/src/models/json-schema/announcement.ts b/packages/backend/src/models/json-schema/announcement.ts
index 78a98872b2..57fd7d605d 100644
--- a/packages/backend/src/models/json-schema/announcement.ts
+++ b/packages/backend/src/models/json-schema/announcement.ts
@@ -37,10 +37,12 @@ export const packedAnnouncementSchema = {
icon: {
type: 'string',
optional: false, nullable: false,
+ enum: ['info', 'warning', 'error', 'success'],
},
display: {
type: 'string',
optional: false, nullable: false,
+ enum: ['dialog', 'normal', 'banner'],
},
needConfirmationToRead: {
type: 'boolean',
diff --git a/packages/backend/src/models/json-schema/note.ts b/packages/backend/src/models/json-schema/note.ts
index 2b7722129b..929f697e8a 100644
--- a/packages/backend/src/models/json-schema/note.ts
+++ b/packages/backend/src/models/json-schema/note.ts
@@ -69,6 +69,7 @@ export const packedNoteSchema = {
visibility: {
type: 'string',
optional: false, nullable: false,
+ enum: ['public', 'home', 'followers', 'specified'],
},
mentions: {
type: 'array',
@@ -117,6 +118,48 @@ export const packedNoteSchema = {
poll: {
type: 'object',
optional: true, nullable: true,
+ properties: {
+ expiresAt: {
+ type: 'string',
+ optional: true, nullable: true,
+ format: 'date-time',
+ },
+ multiple: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ choices: {
+ type: 'array',
+ optional: false, nullable: false,
+ items: {
+ type: 'object',
+ optional: false, nullable: false,
+ properties: {
+ isVoted: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ text: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ votes: {
+ type: 'number',
+ optional: false, nullable: false,
+ },
+ },
+ },
+ },
+ },
+ },
+ emojis: {
+ type: 'object',
+ optional: true, nullable: false,
+ additionalProperties: {
+ anyOf: [{
+ type: 'string',
+ }],
+ },
},
channelId: {
type: 'string',
@@ -162,9 +205,23 @@ export const packedNoteSchema = {
type: 'string',
optional: false, nullable: true,
},
+ reactionEmojis: {
+ type: 'object',
+ optional: false, nullable: false,
+ additionalProperties: {
+ anyOf: [{
+ type: 'string',
+ }],
+ },
+ },
reactions: {
type: 'object',
optional: false, nullable: false,
+ additionalProperties: {
+ anyOf: [{
+ type: 'number',
+ }],
+ },
},
renoteCount: {
type: 'number',
@@ -196,7 +253,7 @@ export const packedNoteSchema = {
},
myReaction: {
- type: 'object',
+ type: 'string',
optional: true, nullable: true,
},
},
diff --git a/packages/backend/src/models/json-schema/notification.ts b/packages/backend/src/models/json-schema/notification.ts
index c6d6e84317..6286950de5 100644
--- a/packages/backend/src/models/json-schema/notification.ts
+++ b/packages/backend/src/models/json-schema/notification.ts
@@ -5,7 +5,7 @@
import { notificationTypes } from '@/types.js';
-export const packedNotificationSchema = {
+const baseSchema = {
type: 'object',
properties: {
id: {
@@ -23,68 +23,368 @@ export const packedNotificationSchema = {
optional: false, nullable: false,
enum: [...notificationTypes, 'reaction:grouped', 'renote:grouped'],
},
- user: {
- type: 'object',
- ref: 'UserLite',
- optional: true, nullable: true,
+ },
+} as const;
+
+export const packedNotificationSchema = {
+ type: 'object',
+ oneOf: [{
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['note'],
+ },
+ user: {
+ type: 'object',
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ userId: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
+ note: {
+ type: 'object',
+ ref: 'Note',
+ optional: false, nullable: false,
+ },
},
- userId: {
- type: 'string',
- optional: true, nullable: true,
- format: 'id',
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['mention'],
+ },
+ user: {
+ type: 'object',
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ userId: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
+ note: {
+ type: 'object',
+ ref: 'Note',
+ optional: false, nullable: false,
+ },
},
- note: {
- type: 'object',
- ref: 'Note',
- optional: true, nullable: true,
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['reply'],
+ },
+ user: {
+ type: 'object',
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ userId: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
+ note: {
+ type: 'object',
+ ref: 'Note',
+ optional: false, nullable: false,
+ },
},
- reaction: {
- type: 'string',
- optional: true, nullable: true,
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['renote'],
+ },
+ user: {
+ type: 'object',
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ userId: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
+ note: {
+ type: 'object',
+ ref: 'Note',
+ optional: false, nullable: false,
+ },
},
- achievement: {
- type: 'string',
- optional: true, nullable: false,
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['quote'],
+ },
+ user: {
+ type: 'object',
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ userId: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
+ note: {
+ type: 'object',
+ ref: 'Note',
+ optional: false, nullable: false,
+ },
},
- body: {
- type: 'string',
- optional: true, nullable: true,
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['reaction'],
+ },
+ user: {
+ type: 'object',
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ userId: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
+ note: {
+ type: 'object',
+ ref: 'Note',
+ optional: false, nullable: false,
+ },
+ reaction: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
},
- header: {
- type: 'string',
- optional: true, nullable: true,
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['pollEnded'],
+ },
+ user: {
+ type: 'object',
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ userId: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
+ note: {
+ type: 'object',
+ ref: 'Note',
+ optional: false, nullable: false,
+ },
},
- icon: {
- type: 'string',
- optional: true, nullable: true,
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['follow'],
+ },
+ user: {
+ type: 'object',
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ userId: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
},
- reactions: {
- type: 'array',
- optional: true, nullable: true,
- items: {
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['receiveFollowRequest'],
+ },
+ user: {
type: 'object',
- properties: {
- user: {
- type: 'object',
- ref: 'UserLite',
- optional: false, nullable: false,
- },
- reaction: {
- type: 'string',
- optional: false, nullable: false,
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ userId: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
+ },
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['followRequestAccepted'],
+ },
+ user: {
+ type: 'object',
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ userId: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ },
+ },
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['roleAssigned'],
+ },
+ role: {
+ type: 'object',
+ ref: 'Role',
+ optional: false, nullable: false,
+ },
+ },
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['achievementEarned'],
+ },
+ achievement: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ },
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['app'],
+ },
+ body: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ header: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ icon: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ },
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['reaction:grouped'],
+ },
+ note: {
+ type: 'object',
+ ref: 'Note',
+ optional: false, nullable: false,
+ },
+ reactions: {
+ type: 'array',
+ optional: false, nullable: false,
+ items: {
+ type: 'object',
+ properties: {
+ user: {
+ type: 'object',
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ reaction: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
},
+ required: ['user', 'reaction'],
},
- required: ['user', 'reaction'],
},
},
- users: {
- type: 'array',
- optional: true, nullable: true,
- items: {
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['renote:grouped'],
+ },
+ note: {
type: 'object',
- ref: 'UserLite',
+ ref: 'Note',
optional: false, nullable: false,
},
+ users: {
+ type: 'array',
+ optional: false, nullable: false,
+ items: {
+ type: 'object',
+ ref: 'UserLite',
+ optional: false, nullable: false,
+ },
+ },
},
- },
+ }, {
+ type: 'object',
+ properties: {
+ ...baseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['test'],
+ },
+ },
+ }],
} as const;
diff --git a/packages/backend/src/models/json-schema/page.ts b/packages/backend/src/models/json-schema/page.ts
index 9baacd6884..402db76e52 100644
--- a/packages/backend/src/models/json-schema/page.ts
+++ b/packages/backend/src/models/json-schema/page.ts
@@ -3,6 +3,107 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+const blockBaseSchema = {
+ type: 'object',
+ properties: {
+ id: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ },
+} as const;
+
+const textBlockSchema = {
+ type: 'object',
+ properties: {
+ ...blockBaseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['text'],
+ },
+ text: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ },
+} as const;
+
+const sectionBlockSchema = {
+ type: 'object',
+ properties: {
+ ...blockBaseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['section'],
+ },
+ title: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ children: {
+ type: 'array',
+ optional: false, nullable: false,
+ items: {
+ type: 'object',
+ optional: false, nullable: false,
+ ref: 'PageBlock',
+ },
+ },
+ },
+} as const;
+
+const imageBlockSchema = {
+ type: 'object',
+ properties: {
+ ...blockBaseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['image'],
+ },
+ fileId: {
+ type: 'string',
+ optional: false, nullable: true,
+ },
+ },
+} as const;
+
+const noteBlockSchema = {
+ type: 'object',
+ properties: {
+ ...blockBaseSchema.properties,
+ type: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['note'],
+ },
+ detailed: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ note: {
+ type: 'string',
+ optional: false, nullable: true,
+ },
+ },
+} as const;
+
+export const packedPageBlockSchema = {
+ type: 'object',
+ oneOf: [
+ textBlockSchema,
+ sectionBlockSchema,
+ imageBlockSchema,
+ noteBlockSchema,
+ ],
+} as const;
+
export const packedPageSchema = {
type: 'object',
properties: {
@@ -38,6 +139,7 @@ export const packedPageSchema = {
items: {
type: 'object',
optional: false, nullable: false,
+ ref: 'PageBlock',
},
},
variables: {
diff --git a/packages/backend/src/models/json-schema/role.ts b/packages/backend/src/models/json-schema/role.ts
index b0c6804bb8..55348d4f3d 100644
--- a/packages/backend/src/models/json-schema/role.ts
+++ b/packages/backend/src/models/json-schema/role.ts
@@ -1,26 +1,103 @@
-const rolePolicyValue = {
+export const packedRolePoliciesSchema = {
type: 'object',
+ optional: false, nullable: false,
properties: {
- value: {
- oneOf: [
- {
- type: 'integer',
- optional: false, nullable: false,
- },
- {
- type: 'boolean',
- optional: false, nullable: false,
- },
- ],
+ gtlAvailable: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ ltlAvailable: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ canPublicNote: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ canInvite: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ inviteLimit: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ inviteLimitCycle: {
+ type: 'integer',
+ optional: false, nullable: false,
},
- priority: {
+ inviteExpirationTime: {
type: 'integer',
optional: false, nullable: false,
},
- useDefault: {
+ canManageCustomEmojis: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ canManageAvatarDecorations: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ canSearchNotes: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ canUseTranslator: {
type: 'boolean',
optional: false, nullable: false,
},
+ canHideAds: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ driveCapacityMb: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ alwaysMarkNsfw: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ pinLimit: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ antennaLimit: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ wordMuteLimit: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ webhookLimit: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ clipLimit: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ noteEachClipsLimit: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ userListLimit: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ userEachUserListsLimit: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ rateLimitFactor: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ avatarDecorationLimit: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
},
} as const;
@@ -121,31 +198,28 @@ export const packedRoleSchema = {
policies: {
type: 'object',
optional: false, nullable: false,
- properties: {
- pinLimit: rolePolicyValue,
- canInvite: rolePolicyValue,
- clipLimit: rolePolicyValue,
- canHideAds: rolePolicyValue,
- inviteLimit: rolePolicyValue,
- antennaLimit: rolePolicyValue,
- gtlAvailable: rolePolicyValue,
- ltlAvailable: rolePolicyValue,
- webhookLimit: rolePolicyValue,
- canPublicNote: rolePolicyValue,
- userListLimit: rolePolicyValue,
- wordMuteLimit: rolePolicyValue,
- alwaysMarkNsfw: rolePolicyValue,
- canSearchNotes: rolePolicyValue,
- driveCapacityMb: rolePolicyValue,
- rateLimitFactor: rolePolicyValue,
- inviteLimitCycle: rolePolicyValue,
- noteEachClipsLimit: rolePolicyValue,
- inviteExpirationTime: rolePolicyValue,
- canManageCustomEmojis: rolePolicyValue,
- userEachUserListsLimit: rolePolicyValue,
- canManageAvatarDecorations: rolePolicyValue,
- canUseTranslator: rolePolicyValue,
- avatarDecorationLimit: rolePolicyValue,
+ additionalProperties: {
+ anyOf: [{
+ type: 'object',
+ properties: {
+ value: {
+ oneOf: [
+ {
+ type: 'integer',
+ },
+ {
+ type: 'boolean',
+ },
+ ],
+ },
+ priority: {
+ type: 'integer',
+ },
+ useDefault: {
+ type: 'boolean',
+ },
+ },
+ }],
},
},
usersCount: {
diff --git a/packages/backend/src/models/json-schema/user.ts b/packages/backend/src/models/json-schema/user.ts
index 6a0d43b1ac..7447513a93 100644
--- a/packages/backend/src/models/json-schema/user.ts
+++ b/packages/backend/src/models/json-schema/user.ts
@@ -590,104 +590,7 @@ export const packedMeDetailedOnlySchema = {
policies: {
type: 'object',
nullable: false, optional: false,
- properties: {
- 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,
- },
- avatarDecorationLimit: {
- type: 'number',
- nullable: false, optional: false,
- },
- },
+ ref: 'RolePolicies',
},
//#region secrets
email: {