summaryrefslogtreecommitdiff
path: root/packages/backend/src/models/User.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/backend/src/models/User.ts')
-rw-r--r--packages/backend/src/models/User.ts29
1 files changed, 19 insertions, 10 deletions
diff --git a/packages/backend/src/models/User.ts b/packages/backend/src/models/User.ts
index 3bc2494577..760ef52d2b 100644
--- a/packages/backend/src/models/User.ts
+++ b/packages/backend/src/models/User.ts
@@ -132,11 +132,13 @@ export class MiUser {
@JoinColumn()
public background: MiDriveFile | null;
+ // avatarId が null になったとしてもこれが null でない可能性があるため、このフィールドを使うときは avatarId の non-null チェックをすること
@Column('varchar', {
length: 512, nullable: true,
})
public avatarUrl: string | null;
+ // bannerId が null になったとしてもこれが null でない可能性があるため、このフィールドを使うときは bannerId の non-null チェックをすること
@Column('varchar', {
length: 512, nullable: true,
})
@@ -147,11 +149,13 @@ export class MiUser {
})
public backgroundUrl: string | null;
+ // avatarId が null になったとしてもこれが null でない可能性があるため、このフィールドを使うときは avatarId の non-null チェックをすること
@Column('varchar', {
length: 128, nullable: true,
})
public avatarBlurhash: string | null;
+ // bannerId が null になったとしてもこれが null でない可能性があるため、このフィールドを使うときは bannerId の non-null チェックをすること
@Column('varchar', {
length: 128, nullable: true,
})
@@ -227,12 +231,6 @@ export class MiUser {
})
public speakAsCat: boolean;
- @Column('boolean', {
- default: false,
- comment: 'Whether the User is the root.',
- })
- public isRoot: boolean;
-
@Index()
@Column('boolean', {
default: true,
@@ -274,6 +272,17 @@ export class MiUser {
})
public emojis: string[];
+ // チャットを許可する相手
+ // everyone: 誰からでも
+ // followers: フォロワーのみ
+ // following: フォローしているユーザーのみ
+ // mutual: 相互フォローのみ
+ // none: 誰からも受け付けない
+ @Column('varchar', {
+ length: 128, default: 'mutual',
+ })
+ public chatScope: 'everyone' | 'followers' | 'following' | 'mutual' | 'none';
+
@Index()
@Column('varchar', {
length: 128, nullable: true,
@@ -379,24 +388,24 @@ export class MiUser {
export type MiLocalUser = MiUser & {
host: null;
uri: null;
-}
+};
export type MiPartialLocalUser = Partial<MiUser> & {
id: MiUser['id'];
host: null;
uri: null;
-}
+};
export type MiRemoteUser = MiUser & {
host: string;
uri: string;
-}
+};
export type MiPartialRemoteUser = Partial<MiUser> & {
id: MiUser['id'];
host: string;
uri: string;
-}
+};
export const localUsernameSchema = { type: 'string', pattern: /^\w{1,20}$/.toString().slice(1, -1) } as const;
export const passwordSchema = { type: 'string', minLength: 1 } as const;