chore: annoucement module with user-group

This commit is contained in:
Matin
2025-01-26 10:57:20 +03:30
parent 6da4b5114c
commit c8c98be6ee
13 changed files with 239 additions and 5 deletions
@@ -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;
}
}