Loading backend/src/town/entities/town.entity.ts +5 −2 Original line number Diff line number Diff line import { Place } from 'src/place/entities/place.entity'; import { State } from 'src/state/entities/state.entity'; import { Entity, Column, ManyToOne, JoinColumn, PrimaryGeneratedColumn } from 'typeorm'; import { Entity, Column, ManyToOne, PrimaryGeneratedColumn, OneToMany } from 'typeorm'; @Entity() export class Town { @PrimaryGeneratedColumn() townId: number; @ManyToOne(() => State, (state) => state.stateId, { nullable: false }) @JoinColumn() state: number; @OneToMany(() => Place, (place) => place.towns) places: Place[]; @Column() name: string; Loading Loading
backend/src/town/entities/town.entity.ts +5 −2 Original line number Diff line number Diff line import { Place } from 'src/place/entities/place.entity'; import { State } from 'src/state/entities/state.entity'; import { Entity, Column, ManyToOne, JoinColumn, PrimaryGeneratedColumn } from 'typeorm'; import { Entity, Column, ManyToOne, PrimaryGeneratedColumn, OneToMany } from 'typeorm'; @Entity() export class Town { @PrimaryGeneratedColumn() townId: number; @ManyToOne(() => State, (state) => state.stateId, { nullable: false }) @JoinColumn() state: number; @OneToMany(() => Place, (place) => place.towns) places: Place[]; @Column() name: string; Loading