chore: ticket service but not tested

This commit is contained in:
mahyargdz
2025-01-28 20:08:43 +03:30
parent 239099bb15
commit 1d11509371
28 changed files with 368 additions and 73 deletions
@@ -1,16 +1,23 @@
import { Column, Entity, OneToMany } from "typeorm";
import { Column, Entity, ManyToOne, OneToMany } from "typeorm";
import { Ticket } from "./ticket.entity";
import { BaseEntity } from "../../../common/entities/base.entity";
import { UserGroup } from "../../users/entities/user-group.entity";
@Entity()
export class TicketCategory extends BaseEntity {
@Column({ type: "varchar", length: 150, nullable: false, unique: true })
name: string;
title: string;
@Column({ type: "text", nullable: true })
description: string;
@Column({ type: "boolean", default: true })
isActive: boolean;
@OneToMany(() => Ticket, (ticket) => ticket.category)
tickets: Ticket[];
@ManyToOne(() => UserGroup, (group) => group.ticketCategories, { onDelete: "RESTRICT" })
group: UserGroup;
}
@@ -1,6 +1,7 @@
import { Column, Entity, JoinColumn, ManyToOne } from "typeorm";
import { BaseEntity } from "../../../common/entities/base.entity";
import { Ticket } from "./ticket.entity";
import { BaseEntity } from "../../../common/entities/base.entity";
import { User } from "../../users/entities/user.entity";
@Entity()
@@ -3,6 +3,7 @@ import { Column, Entity, JoinColumn, ManyToOne, OneToMany } from "typeorm";
import { TicketCategory } from "./ticket-category.entity";
import { TicketMessage } from "./ticket-message.entity";
import { BaseEntity } from "../../../common/entities/base.entity";
import { DanakService } from "../../danak-services/entities/danak-service.entity";
import { User } from "../../users/entities/user.entity";
import { TicketPriority } from "../enums/ticket-priority.enum";
import { TicketStatus } from "../enums/ticket-status.enum";
@@ -24,7 +25,8 @@ export class Ticket extends BaseEntity {
@Column({ type: "enum", enum: TicketPriority, nullable: false })
priority: TicketPriority;
//TODO:ADD service reference here
@ManyToOne(() => DanakService, (danakService) => danakService.tickets, { onDelete: "RESTRICT", nullable: false })
danakService: DanakService;
@JoinColumn()
@ManyToOne(() => User, (user) => user.tickets, { nullable: true })