Files
goumrah-api/src/database/entities/city.entity.ts
2025-11-15 22:28:58 +07:00

34 lines
567 B
TypeScript

import { Country } from "@/database/entities/country.entity";
import {
Entity,
ManyToOne,
PrimaryKey,
Property,
type Rel,
} from "@mikro-orm/core";
@Entity()
export class City {
@PrimaryKey({ type: "varchar", length: 30 })
id!: string;
@Property({ type: "varchar", length: 100 })
name!: string;
@ManyToOne(() => Country)
country!: Rel<Country>;
@Property({
type: "timestamp",
onCreate: () => new Date(),
})
createdAt!: Date;
@Property({
type: "timestamp",
onCreate: () => new Date(),
onUpdate: () => new Date(),
})
updatedAt!: Date;
}