summaryrefslogtreecommitdiff
path: root/packages/backend/src/models
diff options
context:
space:
mode:
authorMarie <Marie@kaifa.ch>2023-12-23 02:09:23 +0100
committerMarie <Marie@kaifa.ch>2023-12-23 02:09:23 +0100
commit5db583a3eb61d50de14d875ebf7ecef20490e313 (patch)
tree783dd43d2ac660c32e745a4485d499e9ddc43324 /packages/backend/src/models
parentadd: Custom MOTDs (diff)
parentUpdate CHANGELOG.md (diff)
downloadsharkey-5db583a3eb61d50de14d875ebf7ecef20490e313.tar.gz
sharkey-5db583a3eb61d50de14d875ebf7ecef20490e313.tar.bz2
sharkey-5db583a3eb61d50de14d875ebf7ecef20490e313.zip
merge: upstream
Diffstat (limited to 'packages/backend/src/models')
-rw-r--r--packages/backend/src/models/Meta.ts11
-rw-r--r--packages/backend/src/models/Notification.ts8
-rw-r--r--packages/backend/src/models/User.ts6
-rw-r--r--packages/backend/src/models/UserProfile.ts20
-rw-r--r--packages/backend/src/models/json-schema/ad.ts64
-rw-r--r--packages/backend/src/models/json-schema/announcement.ts8
-rw-r--r--packages/backend/src/models/json-schema/channel.ts57
-rw-r--r--packages/backend/src/models/json-schema/clip.ts8
-rw-r--r--packages/backend/src/models/json-schema/drive-file.ts2
-rw-r--r--packages/backend/src/models/json-schema/drive-folder.ts12
-rw-r--r--packages/backend/src/models/json-schema/federation-instance.ts9
-rw-r--r--packages/backend/src/models/json-schema/flash.ts18
-rw-r--r--packages/backend/src/models/json-schema/following.ts10
-rw-r--r--packages/backend/src/models/json-schema/gallery-post.ts24
-rw-r--r--packages/backend/src/models/json-schema/note.ts40
-rw-r--r--packages/backend/src/models/json-schema/notification.ts26
-rw-r--r--packages/backend/src/models/json-schema/page.ts66
-rw-r--r--packages/backend/src/models/json-schema/role.ts158
-rw-r--r--packages/backend/src/models/json-schema/signin.ts26
-rw-r--r--packages/backend/src/models/json-schema/user.ts339
20 files changed, 776 insertions, 136 deletions
diff --git a/packages/backend/src/models/Meta.ts b/packages/backend/src/models/Meta.ts
index b70828f3dd..6aa35b0b40 100644
--- a/packages/backend/src/models/Meta.ts
+++ b/packages/backend/src/models/Meta.ts
@@ -457,6 +457,17 @@ export class MiMeta {
public enableActiveEmailValidation: boolean;
@Column('boolean', {
+ default: false,
+ })
+ public enableVerifymailApi: boolean;
+
+ @Column('varchar', {
+ length: 1024,
+ nullable: true,
+ })
+ public verifymailAuthKey: string | null;
+
+ @Column('boolean', {
default: true,
})
public enableChartsForRemoteUser: boolean;
diff --git a/packages/backend/src/models/Notification.ts b/packages/backend/src/models/Notification.ts
index 1d5fc124e2..3bc2edaa0d 100644
--- a/packages/backend/src/models/Notification.ts
+++ b/packages/backend/src/models/Notification.ts
@@ -3,11 +3,10 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { notificationTypes } from '@/types.js';
import { MiUser } from './User.js';
import { MiNote } from './Note.js';
-import { MiFollowRequest } from './FollowRequest.js';
import { MiAccessToken } from './AccessToken.js';
+import { MiRole } from './Role.js';
export type MiNotification = {
type: 'note';
@@ -69,6 +68,11 @@ export type MiNotification = {
createdAt: string;
notifierId: MiUser['id'];
} | {
+ type: 'roleAssigned';
+ id: string;
+ createdAt: string;
+ roleId: MiRole['id'];
+} | {
type: 'achievementEarned';
id: string;
createdAt: string;
diff --git a/packages/backend/src/models/User.ts b/packages/backend/src/models/User.ts
index 1e1c07bfc4..3db8b398fd 100644
--- a/packages/backend/src/models/User.ts
+++ b/packages/backend/src/models/User.ts
@@ -166,8 +166,10 @@ export class MiUser {
})
public avatarDecorations: {
id: string;
- angle: number;
- flipH: boolean;
+ angle?: number;
+ flipH?: boolean;
+ offsetX?: number;
+ offsetY?: number;
}[];
@Index()
diff --git a/packages/backend/src/models/UserProfile.ts b/packages/backend/src/models/UserProfile.ts
index 8520a09f0b..ae46fbc83c 100644
--- a/packages/backend/src/models/UserProfile.ts
+++ b/packages/backend/src/models/UserProfile.ts
@@ -4,7 +4,7 @@
*/
import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm';
-import { obsoleteNotificationTypes, ffVisibility, notificationTypes } from '@/types.js';
+import { obsoleteNotificationTypes, followingVisibilities, followersVisibilities, notificationTypes } from '@/types.js';
import { id } from './util/id.js';
import { MiUser } from './User.js';
import { MiPage } from './Page.js';
@@ -29,6 +29,7 @@ export class MiUserProfile {
})
public location: string | null;
+ @Index()
@Column('char', {
length: 10, nullable: true,
comment: 'The birthday (YYYY-MM-DD) of the User.',
@@ -100,10 +101,16 @@ export class MiUserProfile {
public publicReactions: boolean;
@Column('enum', {
- enum: ffVisibility,
+ enum: followingVisibilities,
+ default: 'public',
+ })
+ public followingVisibility: typeof followingVisibilities[number];
+
+ @Column('enum', {
+ enum: followersVisibilities,
default: 'public',
})
- public ffVisibility: typeof ffVisibility[number];
+ public followersVisibility: typeof followersVisibilities[number];
@Column('varchar', {
length: 128, nullable: true,
@@ -222,7 +229,12 @@ export class MiUserProfile {
@Column('jsonb', {
default: [],
})
- public mutedWords: string[][];
+ public mutedWords: (string[] | string)[];
+
+ @Column('jsonb', {
+ default: [],
+ })
+ public hardMutedWords: (string[] | string)[];
@Column('jsonb', {
default: [],
diff --git a/packages/backend/src/models/json-schema/ad.ts b/packages/backend/src/models/json-schema/ad.ts
new file mode 100644
index 0000000000..649ffcd4dc
--- /dev/null
+++ b/packages/backend/src/models/json-schema/ad.ts
@@ -0,0 +1,64 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and other misskey contributors
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+export const packedAdSchema = {
+ type: 'object',
+ properties: {
+ id: {
+ type: 'string',
+ optional: false,
+ nullable: false,
+ format: 'id',
+ example: 'xxxxxxxxxx',
+ },
+ expiresAt: {
+ type: 'string',
+ optional: false,
+ nullable: false,
+ format: 'date-time',
+ },
+ startsAt: {
+ type: 'string',
+ optional: false,
+ nullable: false,
+ format: 'date-time',
+ },
+ place: {
+ type: 'string',
+ optional: false,
+ nullable: false,
+ },
+ priority: {
+ type: 'string',
+ optional: false,
+ nullable: false,
+ },
+ ratio: {
+ type: 'number',
+ optional: false,
+ nullable: false,
+ },
+ url: {
+ type: 'string',
+ optional: false,
+ nullable: false,
+ },
+ imageUrl: {
+ type: 'string',
+ optional: false,
+ nullable: false,
+ },
+ memo: {
+ type: 'string',
+ optional: false,
+ nullable: false,
+ },
+ dayOfWeek: {
+ type: 'integer',
+ optional: false,
+ nullable: false,
+ },
+ },
+} as const;
diff --git a/packages/backend/src/models/json-schema/announcement.ts b/packages/backend/src/models/json-schema/announcement.ts
index c7e24c7f29..78a98872b2 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 8f9770cdc5..5b0fa0f15d 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: {
@@ -28,25 +28,50 @@ export const packedChannelSchema = {
},
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 64f7a2ad9c..1ab96c2b3b 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/drive-file.ts b/packages/backend/src/models/json-schema/drive-file.ts
index 87f1340812..79f242a711 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: {
diff --git a/packages/backend/src/models/json-schema/drive-folder.ts b/packages/backend/src/models/json-schema/drive-folder.ts
index 51107d423f..aaad301303 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/federation-instance.ts b/packages/backend/src/models/json-schema/federation-instance.ts
index ac4b37fb57..94873716bf 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 9453ba1dce..f08fa7a279 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 3a24ebb619..e92cff20a1 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 cf260c0bf5..df7038950c 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/note.ts b/packages/backend/src/models/json-schema/note.ts
index 38c0054b55..aa749943f0 100644
--- a/packages/backend/src/models/json-schema/note.ts
+++ b/packages/backend/src/models/json-schema/note.ts
@@ -127,22 +127,26 @@ 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: false,
+ },
+ color: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ isSensitive: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ allowRenoteToExternal: {
+ type: 'boolean',
+ optional: false, nullable: false,
},
},
},
@@ -182,6 +186,10 @@ export const packedNoteSchema = {
optional: false, nullable: false,
},
},
+ clippedCount: {
+ type: 'number',
+ optional: true, nullable: false,
+ },
myReaction: {
type: 'object',
diff --git a/packages/backend/src/models/json-schema/notification.ts b/packages/backend/src/models/json-schema/notification.ts
index 27db3bb62c..c6d6e84317 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/page.ts b/packages/backend/src/models/json-schema/page.ts
index 3f20a4b802..9baacd6884 100644
--- a/packages/backend/src/models/json-schema/page.ts
+++ b/packages/backend/src/models/json-schema/page.ts
@@ -22,6 +22,32 @@ 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,
+ items: {
+ type: 'object',
+ optional: false, nullable: false,
+ },
+ },
+ variables: {
+ type: 'array',
+ optional: false, nullable: false,
+ items: {
+ type: 'object',
+ optional: false, nullable: false,
+ },
+ },
title: {
type: 'string',
optional: false, nullable: false,
@@ -34,23 +60,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/role.ts b/packages/backend/src/models/json-schema/role.ts
new file mode 100644
index 0000000000..b0c6804bb8
--- /dev/null
+++ b/packages/backend/src/models/json-schema/role.ts
@@ -0,0 +1,158 @@
+const rolePolicyValue = {
+ type: 'object',
+ properties: {
+ value: {
+ oneOf: [
+ {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ ],
+ },
+ priority: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ useDefault: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ },
+ },
+} as const;
+
+export const packedRoleLiteSchema = {
+ type: 'object',
+ properties: {
+ id: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'id',
+ example: 'xxxxxxxxxx',
+ },
+ name: {
+ type: 'string',
+ optional: false, nullable: false,
+ example: 'New Role',
+ },
+ color: {
+ type: 'string',
+ optional: false, nullable: true,
+ example: '#000000',
+ },
+ iconUrl: {
+ type: 'string',
+ optional: false, nullable: true,
+ },
+ description: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ isModerator: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ example: false,
+ },
+ isAdministrator: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ example: false,
+ },
+ displayOrder: {
+ type: 'integer',
+ optional: false, nullable: false,
+ example: 0,
+ },
+ },
+} as const;
+
+export const packedRoleSchema = {
+ type: 'object',
+ allOf: [
+ {
+ type: 'object',
+ ref: 'RoleLite',
+ },
+ {
+ type: 'object',
+ properties: {
+ createdAt: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'date-time',
+ },
+ updatedAt: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'date-time',
+ },
+ target: {
+ type: 'string',
+ optional: false, nullable: false,
+ enum: ['manual', 'conditional'],
+ },
+ condFormula: {
+ type: 'object',
+ optional: false, nullable: false,
+ },
+ isPublic: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ example: false,
+ },
+ isExplorable: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ example: false,
+ },
+ asBadge: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ example: false,
+ },
+ canEditMembersByModerator: {
+ type: 'boolean',
+ optional: false, nullable: false,
+ example: false,
+ },
+ 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,
+ },
+ },
+ usersCount: {
+ type: 'integer',
+ optional: false, nullable: false,
+ },
+ },
+ },
+ ],
+} as const;
diff --git a/packages/backend/src/models/json-schema/signin.ts b/packages/backend/src/models/json-schema/signin.ts
new file mode 100644
index 0000000000..d27d2490c5
--- /dev/null
+++ b/packages/backend/src/models/json-schema/signin.ts
@@ -0,0 +1,26 @@
+export const packedSigninSchema = {
+ type: 'object',
+ properties: {
+ id: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ createdAt: {
+ type: 'string',
+ optional: false, nullable: false,
+ format: 'date-time',
+ },
+ ip: {
+ type: 'string',
+ optional: false, nullable: false,
+ },
+ headers: {
+ type: 'object',
+ optional: false, nullable: false,
+ },
+ success: {
+ type: 'boolean',
+ 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 5b12050541..af67e62afa 100644
--- a/packages/backend/src/models/json-schema/user.ts
+++ b/packages/backend/src/models/json-schema/user.ts
@@ -3,6 +3,18 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+const notificationRecieveConfig = {
+ type: 'object',
+ nullable: false, optional: true,
+ properties: {
+ type: {
+ type: 'string',
+ nullable: false, optional: false,
+ enum: ['all', 'following', 'follower', 'mutualFollow', 'list', 'never'],
+ },
+ },
+} as const;
+
export const packedUserLiteSchema = {
type: 'object',
properties: {
@@ -49,17 +61,25 @@ export const packedUserLiteSchema = {
nullable: false, optional: false,
format: 'id',
},
+ angle: {
+ type: 'number',
+ nullable: false, optional: true,
+ },
+ flipH: {
+ type: 'boolean',
+ nullable: false, optional: true,
+ },
url: {
type: 'string',
format: 'url',
nullable: false, optional: false,
},
- angle: {
+ offsetX: {
type: 'number',
nullable: false, optional: true,
},
- flipH: {
- type: 'boolean',
+ offsetY: {
+ type: 'number',
nullable: false, optional: true,
},
},
@@ -95,12 +115,67 @@ export const packedUserLiteSchema = {
type: 'boolean',
nullable: false, optional: true,
},
+ 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,
+ },
+ },
+ },
+ 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: 'string',
+ nullable: true, optional: false,
+ },
+ displayOrder: {
+ type: 'number',
+ nullable: false, optional: false,
+ },
+ },
+ },
+ },
},
} as const;
@@ -117,21 +192,18 @@ export const packedUserDetailedNotMeOnlySchema = {
format: 'uri',
nullable: true, optional: false,
},
- movedToUri: {
+ 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: {
@@ -191,10 +263,10 @@ export const packedUserDetailedNotMeOnlySchema = {
example: '2018-03-12',
},
ListenBrainz: {
- type: "string",
+ type: 'string',
nullable: true,
optional: false,
- example: "Steve",
+ example: 'Steve',
},
lang: {
type: 'string',
@@ -272,6 +344,16 @@ export const packedUserDetailedNotMeOnlySchema = {
type: 'boolean',
nullable: false, optional: false,
},
+ followingVisibility: {
+ type: 'string',
+ nullable: false, optional: false,
+ enum: ['public', 'followers', 'private'],
+ },
+ followersVisibility: {
+ type: 'string',
+ nullable: false, optional: false,
+ enum: ['public', 'followers', 'private'],
+ },
twoFactorEnabled: {
type: 'boolean',
nullable: false, optional: false,
@@ -287,6 +369,23 @@ export const packedUserDetailedNotMeOnlySchema = {
nullable: false, optional: false,
default: false,
},
+ roles: {
+ type: 'array',
+ nullable: false, optional: false,
+ items: {
+ type: 'object',
+ nullable: false, optional: false,
+ ref: 'RoleLite',
+ },
+ },
+ memo: {
+ type: 'string',
+ nullable: true, optional: false,
+ },
+ moderationNote: {
+ type: 'string',
+ nullable: false, optional: true,
+ },
//#region relations
isFollowing: {
type: 'boolean',
@@ -320,13 +419,10 @@ export const packedUserDetailedNotMeOnlySchema = {
type: 'boolean',
nullable: false, optional: true,
},
- memo: {
- type: 'string',
- nullable: false, optional: true,
- },
notify: {
type: 'string',
nullable: false, optional: true,
+ enum: ['normal', 'none'],
},
withReplies: {
type: 'boolean',
@@ -354,29 +450,37 @@ export const packedMeDetailedOnlySchema = {
nullable: true, optional: false,
format: 'id',
},
- injectFeaturedNote: {
+ isModerator: {
type: 'boolean',
nullable: true, optional: false,
},
- receiveAnnouncementEmail: {
+ isAdmin: {
type: 'boolean',
nullable: true, optional: false,
},
+ injectFeaturedNote: {
+ type: 'boolean',
+ nullable: false, optional: false,
+ },
+ receiveAnnouncementEmail: {
+ type: 'boolean',
+ 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',
@@ -415,10 +519,23 @@ export const packedMeDetailedOnlySchema = {
type: 'boolean',
nullable: false, optional: false,
},
+ unreadAnnouncements: {
+ type: 'array',
+ nullable: false, optional: false,
+ items: {
+ type: 'object',
+ nullable: false, optional: false,
+ ref: 'Announcement',
+ },
+ },
hasUnreadAntenna: {
type: 'boolean',
nullable: false, optional: false,
},
+ hasUnreadChannel: {
+ type: 'boolean',
+ nullable: false, optional: false,
+ },
hasUnreadNotification: {
type: 'boolean',
nullable: false, optional: false,
@@ -443,6 +560,18 @@ export const packedMeDetailedOnlySchema = {
},
},
},
+ hardMutedWords: {
+ type: 'array',
+ nullable: false, optional: false,
+ items: {
+ type: 'array',
+ nullable: false, optional: false,
+ items: {
+ type: 'string',
+ nullable: false, optional: false,
+ },
+ },
+ },
mutedInstances: {
type: 'array',
nullable: true, optional: false,
@@ -454,15 +583,150 @@ export const packedMeDetailedOnlySchema = {
notificationRecieveConfig: {
type: 'object',
nullable: false, optional: false,
+ properties: {
+ app: notificationRecieveConfig,
+ quote: notificationRecieveConfig,
+ reply: notificationRecieveConfig,
+ follow: notificationRecieveConfig,
+ renote: notificationRecieveConfig,
+ mention: notificationRecieveConfig,
+ reaction: notificationRecieveConfig,
+ pollEnded: notificationRecieveConfig,
+ receiveFollowRequest: notificationRecieveConfig,
+ },
},
emailNotificationTypes: {
type: 'array',
- nullable: true, optional: false,
+ nullable: false, optional: false,
items: {
type: 'string',
nullable: false, optional: false,
},
},
+ achievements: {
+ type: 'array',
+ nullable: false, optional: false,
+ items: {
+ type: 'object',
+ nullable: false, optional: false,
+ properties: {
+ name: {
+ type: 'string',
+ 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,
+ 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,
+ },
+ },
+ },
//#region secrets
email: {
type: 'string',
@@ -478,6 +742,23 @@ export const packedMeDetailedOnlySchema = {
items: {
type: 'object',
nullable: false, optional: false,
+ properties: {
+ id: {
+ type: 'string',
+ nullable: false, optional: false,
+ format: 'id',
+ example: 'xxxxxxxxxx',
+ },
+ name: {
+ type: 'string',
+ nullable: false, optional: false,
+ },
+ lastUsed: {
+ type: 'string',
+ nullable: false, optional: false,
+ format: 'date-time',
+ },
+ },
},
},
//#endregion
@@ -539,5 +820,13 @@ export const packedUserSchema = {
type: 'object',
ref: 'UserDetailed',
},
+ {
+ type: 'object',
+ ref: 'UserDetailedNotMe',
+ },
+ {
+ type: 'object',
+ ref: 'MeDetailed',
+ },
],
} as const;