diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2020-10-19 19:29:04 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2020-10-19 19:29:04 +0900 |
| commit | 87f61e714ad3b17856a6a5ac66051707badb3bd0 (patch) | |
| tree | 353b384f026bb326d16b7194d5fa5dfee7f12069 /src/models | |
| parent | 12.48.3 (diff) | |
| download | misskey-87f61e714ad3b17856a6a5ac66051707badb3bd0.tar.gz misskey-87f61e714ad3b17856a6a5ac66051707badb3bd0.tar.bz2 misskey-87f61e714ad3b17856a6a5ac66051707badb3bd0.zip | |
Resolve #6087
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/entities/abuse-user-report.ts | 41 | ||||
| -rw-r--r-- | src/models/repositories/abuse-user-report.ts | 9 |
2 files changed, 44 insertions, 6 deletions
diff --git a/src/models/entities/abuse-user-report.ts b/src/models/entities/abuse-user-report.ts index 43ab56023a..c0cff139f6 100644 --- a/src/models/entities/abuse-user-report.ts +++ b/src/models/entities/abuse-user-report.ts @@ -3,7 +3,6 @@ import { User } from './user'; import { id } from '../id'; @Entity() -@Index(['userId', 'reporterId'], { unique: true }) export class AbuseUserReport { @PrimaryColumn(id()) public id: string; @@ -16,13 +15,13 @@ export class AbuseUserReport { @Index() @Column(id()) - public userId: User['id']; + public targetUserId: User['id']; @ManyToOne(type => User, { onDelete: 'CASCADE' }) @JoinColumn() - public user: User | null; + public targetUser: User | null; @Index() @Column(id()) @@ -34,8 +33,42 @@ export class AbuseUserReport { @JoinColumn() public reporter: User | null; + @Column({ + ...id(), + nullable: true + }) + public assigneeId: User['id'] | null; + + @ManyToOne(type => User, { + onDelete: 'SET NULL' + }) + @JoinColumn() + public assignee: User | null; + + @Index() + @Column('boolean', { + default: false + }) + public resolved: boolean; + @Column('varchar', { - length: 512, + length: 2048, }) public comment: string; + + //#region Denormalized fields + @Index() + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]' + }) + public targetUserHost: string | null; + + @Index() + @Column('varchar', { + length: 128, nullable: true, + comment: '[Denormalized]' + }) + public reporterHost: string | null; + //#endregion } diff --git a/src/models/repositories/abuse-user-report.ts b/src/models/repositories/abuse-user-report.ts index bff64c770c..dbdaa5ee15 100644 --- a/src/models/repositories/abuse-user-report.ts +++ b/src/models/repositories/abuse-user-report.ts @@ -15,14 +15,19 @@ export class AbuseUserReportRepository extends Repository<AbuseUserReport> { id: report.id, createdAt: report.createdAt, comment: report.comment, + resolved: report.resolved, reporterId: report.reporterId, - userId: report.userId, + targetUserId: report.targetUserId, + assigneeId: report.assigneeId, reporter: Users.pack(report.reporter || report.reporterId, null, { detail: true }), - user: Users.pack(report.user || report.userId, null, { + targetUser: Users.pack(report.targetUser || report.targetUserId, null, { detail: true }), + assignee: report.assigneeId ? Users.pack(report.assignee || report.assigneeId, null, { + detail: true + }) : null, }); } |