add core api

This commit is contained in:
ItsMalma
2025-11-15 22:28:58 +07:00
parent e6386648be
commit 8f91994f29
78 changed files with 6701 additions and 904 deletions

View File

@@ -1,22 +1,10 @@
import { City } from "@/database/entities/city.entity";
import {
Collection,
Entity,
OneToMany,
PrimaryKey,
Property,
Unique,
} from "@mikro-orm/core";
import { Entity, PrimaryKey, Property } from "@mikro-orm/core";
@Entity()
export class Country {
@PrimaryKey({ type: "varchar", length: 30 })
id!: string;
@Property({ type: "varchar", length: 200 })
@Unique()
slug!: string;
@Property({ type: "varchar", length: 100 })
name!: string;
@@ -32,9 +20,4 @@ export class Country {
onUpdate: () => new Date(),
})
updatedAt!: Date;
// Collections
@OneToMany(() => City, (city) => city.country)
cities = new Collection<City>(this);
}