UNPKG

echadospalante-core

Version:

This package contains the core of the echadospalante project, it contains the domain entities, helpers, and other utilities that are shared between the different services.

36 lines (28 loc) 699 B
import { Column, CreateDateColumn, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn, UpdateDateColumn, } from "typeorm"; import { DepartmentData } from "./department.data"; import { UserData } from "./user.data"; @Entity({ name: "municipality" }) export class MunicipalityData { @PrimaryGeneratedColumn() id: number; @Column() name: string; @CreateDateColumn() createdAt: Date; @UpdateDateColumn() updatedAt: Date; @ManyToOne(() => DepartmentData, (department) => department.municipalities) @JoinColumn({ name: "departmentId" }) department: DepartmentData; @OneToMany(() => UserData, (user) => user.municipality) users: UserData[]; }