30 lines
850 B
TypeScript
30 lines
850 B
TypeScript
import { TABLE_NAME } from 'src/core/strings/constants/table.constants';
|
|
import { TimeGroupEntity } from '../../domain/entities/time-group.entity';
|
|
import { Column, Entity, OneToMany } from 'typeorm';
|
|
import { BaseStatusModel } from 'src/core/modules/data/model/base-status.model';
|
|
import { ItemModel } from 'src/modules/item-related/item/data/models/item.model';
|
|
|
|
@Entity(TABLE_NAME.TIME_GROUPS)
|
|
export class TimeGroupModel
|
|
extends BaseStatusModel<TimeGroupEntity>
|
|
implements TimeGroupEntity
|
|
{
|
|
@Column('varchar', { name: 'name' })
|
|
name: string;
|
|
|
|
@Column({ type: 'time' })
|
|
start_time: string;
|
|
|
|
@Column({ type: 'time' })
|
|
end_time: string;
|
|
|
|
@Column({ type: 'time' })
|
|
max_usage_time: string;
|
|
|
|
@OneToMany(() => ItemModel, (model) => model.time_group, {
|
|
onDelete: 'CASCADE',
|
|
onUpdate: 'CASCADE',
|
|
})
|
|
items: ItemModel[];
|
|
}
|