2023-12-05 08:12:10 +01:00
|
|
|
import { Entity, Index, Column, PrimaryColumn } from "typeorm";
|
2023-01-13 05:40:33 +01:00
|
|
|
import { id } from "../id.js";
|
2020-01-29 20:37:25 +01:00
|
|
|
|
|
|
|
@Entity()
|
|
|
|
export class Announcement {
|
|
|
|
@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 Announcement.",
|
2020-01-29 20:37:25 +01:00
|
|
|
})
|
|
|
|
public createdAt: Date;
|
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("timestamp with time zone", {
|
|
|
|
comment: "The updated date of the Announcement.",
|
2021-12-09 15:58:30 +01:00
|
|
|
nullable: true,
|
2020-01-29 20:37:25 +01:00
|
|
|
})
|
|
|
|
public updatedAt: Date | null;
|
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("varchar", {
|
|
|
|
length: 8192,
|
|
|
|
nullable: false,
|
2020-01-29 20:37:25 +01:00
|
|
|
})
|
|
|
|
public text: string;
|
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("varchar", {
|
|
|
|
length: 256,
|
|
|
|
nullable: false,
|
2020-01-29 20:37:25 +01:00
|
|
|
})
|
|
|
|
public title: string;
|
|
|
|
|
2023-05-29 18:31:02 +02:00
|
|
|
@Column("varchar", {
|
|
|
|
length: 1024,
|
|
|
|
nullable: true,
|
2020-01-29 20:37:25 +01:00
|
|
|
})
|
|
|
|
public imageUrl: string | null;
|
|
|
|
|
2023-07-08 21:48:20 +02:00
|
|
|
@Column("boolean", {
|
|
|
|
default: false,
|
|
|
|
})
|
|
|
|
public showPopup: boolean;
|
|
|
|
|
|
|
|
@Column("boolean", {
|
|
|
|
default: false,
|
|
|
|
})
|
|
|
|
public isGoodNews: boolean;
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
constructor(data: Partial<Announcement>) {
|
|
|
|
if (data == null) return;
|
|
|
|
|
|
|
|
for (const [k, v] of Object.entries(data)) {
|
|
|
|
(this as any)[k] = v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|