Commit fb787390 authored by Diego Iván's avatar Diego Iván
Browse files

agregando relacion many to many de place y categories

parent 005d8adf
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
import { PointOfInterest } from 'src/pointOfInterest/entities/PointOfInterest.entity';
import { Available } from 'src/pointOfInterest/enum/available.enum';
import { Town } from 'src/town/entities/town.entity';
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryGeneratedColumn } from 'typeorm';
import {
  Column,
  Entity,
  JoinColumn,
  JoinTable,
  ManyToMany,
  ManyToOne,
  OneToMany,
  PrimaryGeneratedColumn,
} from 'typeorm';
import { AvailableDate } from './available-date.entity';
import { Category } from 'src/category/entities/category.entity';
import { PlaceTraduction } from './place-traduction.entity';

@Entity()
export class Place {
@@ -11,7 +22,7 @@ export class Place {

  @JoinColumn({ name: 'idTown' })
  @ManyToOne(() => Town, (town) => town.townId, { nullable: false })
  idTown: Town;
  town: Town;

  @OneToMany(() => PointOfInterest, (point) => point.idPoint)
  points: PointOfInterest[];
@@ -19,6 +30,13 @@ export class Place {
  @OneToMany(() => AvailableDate, (available) => available.idPlace)
  availableDates: AvailableDate[];

  @ManyToMany(() => Category)
  @JoinTable()
  categories: Category[];

  @OneToMany(() => PlaceTraduction, (placeTraduction) => placeTraduction.idPlace)
  placeTraduction: PlaceTraduction[];

  @Column()
  available: Available;