suggestion module
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Entity,
|
||||
Index,
|
||||
JoinColumn,
|
||||
ManyToOne,
|
||||
PrimaryGeneratedColumn,
|
||||
Unique,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
import { Service } from '../../services/entities/service.entity';
|
||||
import { SuggestionType } from '../enums/suggestion-type.enum';
|
||||
|
||||
@Entity('service_suggestions')
|
||||
@Unique(['serviceId', 'suggestedServiceId'])
|
||||
@Index(['serviceId', 'isActive', 'displayPriority'])
|
||||
export class ServiceSuggestion {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string;
|
||||
|
||||
@Column()
|
||||
serviceId: string;
|
||||
|
||||
@ManyToOne(() => Service, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'serviceId' })
|
||||
service: Service;
|
||||
|
||||
@Column()
|
||||
suggestedServiceId: string;
|
||||
|
||||
@ManyToOne(() => Service, { onDelete: 'CASCADE' })
|
||||
@JoinColumn({ name: 'suggestedServiceId' })
|
||||
suggestedService: Service;
|
||||
|
||||
@Column({ default: true })
|
||||
isActive: boolean;
|
||||
|
||||
@Column({ length: 100 })
|
||||
badgeTitle: string;
|
||||
|
||||
@Column({ type: 'int', default: 0 })
|
||||
displayPriority: number;
|
||||
|
||||
@Column({ type: 'varchar', length: 500, nullable: true })
|
||||
shortDescription: string | null;
|
||||
|
||||
@Column({
|
||||
type: 'enum',
|
||||
enum: SuggestionType,
|
||||
enumName: 'service_suggestions_type_enum',
|
||||
})
|
||||
type: SuggestionType;
|
||||
|
||||
@CreateDateColumn()
|
||||
createdAt: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
updatedAt: Date;
|
||||
}
|
||||
Reference in New Issue
Block a user