2023-01-13 05:40:33 +01:00
|
|
|
import {
|
2023-11-26 21:33:46 +01:00
|
|
|
Column,
|
2023-01-13 05:40:33 +01:00
|
|
|
Entity,
|
|
|
|
Index,
|
|
|
|
JoinColumn,
|
|
|
|
ManyToOne,
|
2023-11-26 21:33:46 +01:00
|
|
|
PrimaryColumn,
|
2023-01-13 05:40:33 +01:00
|
|
|
} from "typeorm";
|
|
|
|
import { id } from "../id.js";
|
2023-11-26 21:33:46 +01:00
|
|
|
import { User } from "./user.js";
|
2019-04-07 14:50:36 +02:00
|
|
|
|
|
|
|
@Entity()
|
|
|
|
export class AbuseUserReport {
|
|
|
|
@PrimaryColumn(id())
|
|
|
|
public id: string;
|
|
|
|
|
|
|
|
@Index()
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("timestamp with time zone", {
|
|
|
|
comment: "The created date of the AbuseUserReport.",
|
2019-04-07 14:50:36 +02:00
|
|
|
})
|
|
|
|
public createdAt: Date;
|
|
|
|
|
|
|
|
@Index()
|
|
|
|
@Column(id())
|
2023-01-13 05:40:33 +01:00
|
|
|
public targetUserId: User["id"];
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@ManyToOne((type) => User, {
|
|
|
|
onDelete: "CASCADE",
|
2019-04-07 14:50:36 +02:00
|
|
|
})
|
|
|
|
@JoinColumn()
|
2020-10-19 12:29:04 +02:00
|
|
|
public targetUser: User | null;
|
2019-04-07 14:50:36 +02:00
|
|
|
|
|
|
|
@Index()
|
|
|
|
@Column(id())
|
2023-01-13 05:40:33 +01:00
|
|
|
public reporterId: User["id"];
|
2019-04-07 14:50:36 +02:00
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@ManyToOne((type) => User, {
|
|
|
|
onDelete: "CASCADE",
|
2019-04-07 14:50:36 +02:00
|
|
|
})
|
|
|
|
@JoinColumn()
|
|
|
|
public reporter: User | null;
|
|
|
|
|
2020-10-19 12:29:04 +02:00
|
|
|
@Column({
|
|
|
|
...id(),
|
2021-12-09 15:58:30 +01:00
|
|
|
nullable: true,
|
2020-10-19 12:29:04 +02:00
|
|
|
})
|
2023-01-13 05:40:33 +01:00
|
|
|
public assigneeId: User["id"] | null;
|
2020-10-19 12:29:04 +02:00
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@ManyToOne((type) => User, {
|
|
|
|
onDelete: "SET NULL",
|
2020-10-19 12:29:04 +02:00
|
|
|
})
|
|
|
|
@JoinColumn()
|
|
|
|
public assignee: User | null;
|
|
|
|
|
|
|
|
@Index()
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("boolean", {
|
2021-12-09 15:58:30 +01:00
|
|
|
default: false,
|
2020-10-19 12:29:04 +02:00
|
|
|
})
|
|
|
|
public resolved: boolean;
|
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("boolean", {
|
|
|
|
default: false,
|
2022-01-20 19:06:38 +01:00
|
|
|
})
|
|
|
|
public forwarded: boolean;
|
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("varchar", {
|
2020-10-19 12:29:04 +02:00
|
|
|
length: 2048,
|
2019-04-07 14:50:36 +02:00
|
|
|
})
|
|
|
|
public comment: string;
|
2020-10-19 12:29:04 +02:00
|
|
|
|
|
|
|
//#region Denormalized fields
|
|
|
|
@Index()
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("varchar", {
|
2023-08-19 04:05:42 +02:00
|
|
|
length: 512,
|
2023-05-29 18:31:02 +02:00
|
|
|
nullable: true,
|
|
|
|
comment: "[Denormalized]",
|
2020-10-19 12:29:04 +02:00
|
|
|
})
|
|
|
|
public targetUserHost: string | null;
|
|
|
|
|
|
|
|
@Index()
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("varchar", {
|
2023-08-19 04:05:42 +02:00
|
|
|
length: 512,
|
2023-05-29 18:31:02 +02:00
|
|
|
nullable: true,
|
|
|
|
comment: "[Denormalized]",
|
2020-10-19 12:29:04 +02:00
|
|
|
})
|
|
|
|
public reporterHost: string | null;
|
|
|
|
//#endregion
|
2019-04-07 14:50:36 +02:00
|
|
|
}
|