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

agregando status a una ruta

parent d280989e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -2,6 +2,11 @@ import { Town } from 'src/town/entities/town.entity';
import { TravelPlace } from 'src/travel-place/entities/travel-place.entity';
import { User } from 'src/user/entities/user.entity';
import { PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, Entity, OneToMany } from 'typeorm';
enum RouteStatus {
  PENDING = 'pending',
  ACCEPTED = 'accepted',
  REJECTED = 'rejected',
}

@Entity()
export class Route {
@@ -16,11 +21,14 @@ export class Route {
  @ManyToOne(() => Town, (town) => town.townId, { nullable: false })
  town: Town;

  @OneToMany(() => TravelPlace, (travelPlace) => travelPlace.route)
  @OneToMany(() => TravelPlace, (travelPlace) => travelPlace.route, { eager: true })
  travelPlace: TravelPlace[];

  @Column({ nullable: false })
  startDate: Date;
  @Column({ nullable: false })
  endDate: Date;

  @Column({ nullable: false, default: RouteStatus.PENDING })
  status: RouteStatus;
}