add types and schemas

This commit is contained in:
ItsMalma
2025-11-08 13:51:18 +07:00
parent b347ab0250
commit e6386648be
28 changed files with 1082 additions and 101 deletions

View File

@@ -0,0 +1,44 @@
import { Hotel } from "@/database/entities/hotel.entity";
import { PackageDetail } from "@/database/entities/package-detail.entity";
import {
Collection,
Entity,
ManyToMany,
ManyToOne,
PrimaryKey,
Property,
type Rel,
} from "@mikro-orm/core";
@Entity()
export class HotelSchedule {
@PrimaryKey({ type: "varchar", length: 30 })
id!: string;
@ManyToOne(() => Hotel)
hotel!: Rel<Hotel>;
@Property({ type: "time" })
checkIn!: string;
@Property({ type: "time" })
checkOut!: string;
@Property({
type: "timestamp",
onCreate: () => new Date(),
})
createdAt!: Date;
@Property({
type: "timestamp",
onCreate: () => new Date(),
onUpdate: () => new Date(),
})
updatedAt!: Date;
// Inverse side
@ManyToMany(() => PackageDetail, (packageDetail) => packageDetail.tourHotels)
tourPackageDetails = new Collection<PackageDetail>(this);
}