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.ts23
1 files changed, 22 insertions, 1 deletions
diff --git a/packages/backend/src/models/User.ts b/packages/backend/src/models/User.ts
index 46f8e84a94..f40bb41a22 100644
--- a/packages/backend/src/models/User.ts
+++ b/packages/backend/src/models/User.ts
@@ -3,10 +3,12 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
-import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn } from 'typeorm';
+import { Entity, Column, Index, OneToOne, JoinColumn, PrimaryColumn, ManyToOne } from 'typeorm';
import { type UserUnsignedFetchOption, userUnsignedFetchOptions } from '@/const.js';
+import { MiInstance } from '@/models/Instance.js';
import { id } from './util/id.js';
import { MiDriveFile } from './DriveFile.js';
+import type { MiUserProfile } from './UserProfile.js';
@Entity('user')
@Index(['usernameLower', 'host'], { unique: true })
@@ -292,6 +294,16 @@ export class MiUser {
})
public host: string | null;
+ @ManyToOne(() => MiInstance, {
+ onDelete: 'CASCADE',
+ })
+ @JoinColumn({
+ name: 'host',
+ foreignKeyConstraintName: 'FK_user_host',
+ referencedColumnName: 'host',
+ })
+ public instance: MiInstance | null;
+
@Column('varchar', {
length: 512, nullable: true,
comment: 'The inbox URL of the User. It will be null if the origin of the user is local.',
@@ -378,6 +390,15 @@ export class MiUser {
})
public allowUnsignedFetch: UserUnsignedFetchOption;
+ @Column('text', {
+ name: 'attributionDomains',
+ array: true, default: '{}',
+ })
+ public attributionDomains: string[];
+
+ @OneToOne('user_profile', (profile: MiUserProfile) => profile.user)
+ public userProfile: MiUserProfile | null;
+
constructor(data: Partial<MiUser>) {
if (data == null) return;