Loading backend/src/place/entities/place.entity.ts +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ export class Place { @OneToMany(() => AvailableDate, (available) => available.place) availableDates: AvailableDate[]; @ManyToMany(() => Category) @ManyToMany(() => Category, { eager: true }) @JoinTable() categories: Category[]; Loading backend/src/route/entities/route.entity.ts +1 −1 Original line number Diff line number Diff line Loading @@ -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 }) Loading backend/src/route/route.controller.ts +7 −2 Original line number Diff line number Diff line Loading @@ -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') Loading backend/src/route/route.service.ts +2 −1 Original line number Diff line number Diff line Loading @@ -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; } } Loading
backend/src/place/entities/place.entity.ts +1 −1 Original line number Diff line number Diff line Loading @@ -30,7 +30,7 @@ export class Place { @OneToMany(() => AvailableDate, (available) => available.place) availableDates: AvailableDate[]; @ManyToMany(() => Category) @ManyToMany(() => Category, { eager: true }) @JoinTable() categories: Category[]; Loading
backend/src/route/entities/route.entity.ts +1 −1 Original line number Diff line number Diff line Loading @@ -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 }) Loading
backend/src/route/route.controller.ts +7 −2 Original line number Diff line number Diff line Loading @@ -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') Loading
backend/src/route/route.service.ts +2 −1 Original line number Diff line number Diff line Loading @@ -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; } }