chore: annoucement module with user-group
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import { Column, Entity, Index, ManyToMany } from "typeorm";
|
||||
|
||||
import { BaseEntity } from "../../../common/entities/base.entity";
|
||||
import { UserGroup } from "../../users/entities/user-group.entity";
|
||||
|
||||
@Entity()
|
||||
@Index(["isPublic", "createdAt"])
|
||||
export class Announcement extends BaseEntity {
|
||||
@Column({ type: "varchar", length: 100 })
|
||||
title: string;
|
||||
|
||||
@Column({ type: "text" })
|
||||
content: string;
|
||||
|
||||
@Column({ type: "timestamp", default: null, nullable: true })
|
||||
publishAt: Date;
|
||||
|
||||
//TODO: Add service here
|
||||
//TODO: Add customer here
|
||||
|
||||
@Column({ type: "boolean", default: false })
|
||||
isImportant: boolean;
|
||||
|
||||
@ManyToMany(() => UserGroup, (group) => group.announcements)
|
||||
targetGroups: UserGroup[];
|
||||
|
||||
@Column({ default: false })
|
||||
isPublic: boolean;
|
||||
|
||||
isPublicAnnouncement(): boolean {
|
||||
return this.isPublic;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user