summaryrefslogtreecommitdiff
path: root/packages/backend/src/models/json-schema/role.ts
diff options
context:
space:
mode:
authorzyoshoka <107108195+zyoshoka@users.noreply.github.com>2024-02-16 14:27:33 +0900
committerGitHub <noreply@github.com>2024-02-16 14:27:33 +0900
commit40bbae3d6c200afb8ed9a70ca20ef03ebaed4e57 (patch)
tree784a5253038a4e014334291454564dd0cab0b089 /packages/backend/src/models/json-schema/role.ts
parentfeat(backend): likeOnlyなどでハートにフォールバックする際異... (diff)
downloadsharkey-40bbae3d6c200afb8ed9a70ca20ef03ebaed4e57.tar.gz
sharkey-40bbae3d6c200afb8ed9a70ca20ef03ebaed4e57.tar.bz2
sharkey-40bbae3d6c200afb8ed9a70ca20ef03ebaed4e57.zip
fix(backend): add missing schemas and fix incorrect schemas (#13295)
* fix(backend): add missing schemas and fix incorrect schemas * fix: ci * fix: ci (本命) * fix: run `pnpm build-misskey-js-with-types` * fix: typos * fix: role-condition-formula-value contains `id` * fix: incorrect schema
Diffstat (limited to 'packages/backend/src/models/json-schema/role.ts')
-rw-r--r--packages/backend/src/models/json-schema/role.ts127
1 files changed, 127 insertions, 0 deletions
diff --git a/packages/backend/src/models/json-schema/role.ts b/packages/backend/src/models/json-schema/role.ts
index 55348d4f3d..ef6b279bee 100644
--- a/packages/backend/src/models/json-schema/role.ts
+++ b/packages/backend/src/models/json-schema/role.ts
@@ -1,3 +1,129 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+export const packedRoleCondFormulaLogicsSchema = {
+ type: 'object',
+ properties: {
+ id: {
+ type: 'string', optional: false,
+ },
+ type: {
+ type: 'string',
+ nullable: false, optional: false,
+ enum: ['and', 'or'],
+ },
+ values: {
+ type: 'array',
+ nullable: false, optional: false,
+ items: {
+ ref: 'RoleCondFormulaValue',
+ },
+ },
+ },
+} as const;
+
+export const packedRoleCondFormulaValueNot = {
+ type: 'object',
+ properties: {
+ id: {
+ type: 'string', optional: false,
+ },
+ type: {
+ type: 'string',
+ nullable: false, optional: false,
+ enum: ['not'],
+ },
+ value: {
+ type: 'object',
+ optional: false,
+ ref: 'RoleCondFormulaValue',
+ },
+ },
+} as const;
+
+export const packedRoleCondFormulaValueIsLocalOrRemoteSchema = {
+ type: 'object',
+ properties: {
+ id: {
+ type: 'string', optional: false,
+ },
+ type: {
+ type: 'string',
+ nullable: false, optional: false,
+ enum: ['isLocal', 'isRemote'],
+ },
+ },
+} as const;
+
+export const packedRoleCondFormulaValueCreatedSchema = {
+ type: 'object',
+ properties: {
+ id: {
+ type: 'string', optional: false,
+ },
+ type: {
+ type: 'string',
+ nullable: false, optional: false,
+ enum: [
+ 'createdLessThan',
+ 'createdMoreThan',
+ ],
+ },
+ sec: {
+ type: 'number',
+ nullable: false, optional: false,
+ },
+ },
+} as const;
+
+export const packedRoleCondFormulaFollowersOrFollowingOrNotesSchema = {
+ type: 'object',
+ properties: {
+ id: {
+ type: 'string', optional: false,
+ },
+ type: {
+ type: 'string',
+ nullable: false, optional: false,
+ enum: [
+ 'followersLessThanOrEq',
+ 'followersMoreThanOrEq',
+ 'followingLessThanOrEq',
+ 'followingMoreThanOrEq',
+ 'notesLessThanOrEq',
+ 'notesMoreThanOrEq',
+ ],
+ },
+ value: {
+ type: 'number',
+ nullable: false, optional: false,
+ },
+ },
+} as const;
+
+export const packedRoleCondFormulaValueSchema = {
+ type: 'object',
+ oneOf: [
+ {
+ ref: 'RoleCondFormulaLogics',
+ },
+ {
+ ref: 'RoleCondFormulaValueNot',
+ },
+ {
+ ref: 'RoleCondFormulaValueIsLocalOrRemote',
+ },
+ {
+ ref: 'RoleCondFormulaValueCreated',
+ },
+ {
+ ref: 'RoleCondFormulaFollowersOrFollowingOrNotes',
+ },
+ ],
+} as const;
+
export const packedRolePoliciesSchema = {
type: 'object',
optional: false, nullable: false,
@@ -174,6 +300,7 @@ export const packedRoleSchema = {
condFormula: {
type: 'object',
optional: false, nullable: false,
+ ref: 'RoleCondFormulaValue',
},
isPublic: {
type: 'boolean',