Commit 33c0703a authored by Lorenzo Trujillo Rojas's avatar Lorenzo Trujillo Rojas
Browse files

Merge branch 'main' into 'main'

agregando town y tags en la respuesta de route

See merge request !77
parents e8151e0b 8f9e7c48
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ export class Place {
  @OneToMany(() => AvailableDate, (available) => available.place)
  availableDates: AvailableDate[];

  @ManyToMany(() => Category)
  @ManyToMany(() => Category, { eager: true })
  @JoinTable()
  categories: Category[];

+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ export class Route {
  user: User;

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

  @OneToMany(() => TravelPlace, (travelPlace) => travelPlace.route, { eager: true })
+7 −2
Original line number Diff line number Diff line
@@ -39,8 +39,13 @@ export class RouteController {
  @ApiBearerAuth('jwt')
  @UseGuards(AuthUserGuard)
  async getRecommendRoute(@Req() req: CustomUserRequest, @Query('routeStatus') routeStatus: RouteStatus) {
    try {
      const { email } = req.user;
      return await this.routeService.getRouteAndPlacesByUser(email, routeStatus);
    } catch (error) {
      console.log(error);
      return error;
    }
  }

  @Get('/:idRoute')
+2 −1
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ export class RouteService {

  async getRouteById(idRoute: number, email: string) {
    const user: User = await this.userService.findOne(email);
    return await this.routeRepository.findOneBy({ idRoute, user });
    const res = await this.routeRepository.findOneBy({ idRoute, user });
    return res;
  }
}