Loading backend/src/route/route.controller.ts +10 −9 Original line number Diff line number Diff line Loading @@ -13,6 +13,14 @@ import { UpdateRouteStatusDto } from './dto/updateRouteStatus.dto'; export class RouteController { constructor(private readonly routeService: RouteService) {} @Get('/info/:idRoute') @ApiParam({ name: 'idRoute', type: Number }) @ApiBearerAuth('jwt') // @UseGuards(AuthUserGuard) async getRouteInfo(@Param('idRoute') idRoute: number) { return await this.routeService.getRouteInfoById(idRoute); } @Post('/:idTown') @ApiParam({ name: 'idTown', type: Number }) @ApiBody({ type: CreateRouteReq }) Loading Loading @@ -48,8 +56,9 @@ export class RouteController { } } @Get('/:idRoute') @Get('/:idRoute/:lang') @ApiParam({ name: 'idRoute', type: Number }) @ApiParam({ name: 'lang', type: String, enum: Object.values(LANGUAGES) }) @ApiBearerAuth('jwt') @UseGuards(AuthUserGuard) async getRoute(@Param('idRoute') idRoute: number, @Param('lang') lang: LANGUAGES, @Req() req: CustomUserRequest) { Loading @@ -66,12 +75,4 @@ export class RouteController { async updateRoute(@Body() updateRouteStatusDto: UpdateRouteStatusDto, @Param('idRoute') idRoute: number) { return await this.routeService.updateRoute(idRoute, updateRouteStatusDto.status); } @Get('/info/:idRoute') @ApiParam({ name: 'idRoute', type: Number }) @ApiBearerAuth('jwt') @UseGuards(AuthUserGuard) async getRouteInfo(@Param('idRoute') idRoute: number) { return await this.routeService.getRouteInfoById(idRoute); } } backend/src/route/route.service.ts +23 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,29 @@ export class RouteService { .where('route.idRoute = :idRoute', { idRoute }) .getOne(); if (res && res.travelPlace) { res.travelPlace = res.travelPlace.map((travelPlace: TravelPlace) => { return { travelPlaceId: travelPlace.travelPlaceId, idPlace: travelPlace.place.idPlace, available: travelPlace.place.available, latitude: travelPlace.place.latitude, longitude: travelPlace.place.longitude, imageName: `${ServerConstants.HOST}/places/${travelPlace.place.imageName}`, name: travelPlace.place.name, openAt: travelPlace.place.openAt, closeAt: travelPlace.place.closeAt, startDate: travelPlace.startDate, endDate: travelPlace.endDate, categories: travelPlace.place.categories, address: travelPlace.place.address, done: travelPlace.done, route: travelPlace.route, place: { ...travelPlace.place, imageName: `${ServerConstants.HOST}/places/${travelPlace.place.imageName}` }, }; }); } return res; } } backend/src/user/dto/update-user.dto.ts +12 −3 Original line number Diff line number Diff line import { PartialType } from '@nestjs/swagger'; import { CreateUserDto } from './create-user.dto'; import { ApiProperty } from '@nestjs/swagger'; export class UpdateUserDto extends PartialType(CreateUserDto) {} export class UpdateUserDto { @ApiProperty() name: string; @ApiProperty() lastName: string; } export class UpdateImageUserDto { @ApiProperty({ type: 'string', format: 'binary' }) image; } backend/src/user/dto/user-response.ts 0 → 100644 +16 −0 Original line number Diff line number Diff line import { ApiProperty } from '@nestjs/swagger'; export class UserResponse { @ApiProperty() name: string; @ApiProperty() lastName: string; @ApiProperty() imageUrl: string; @ApiProperty() email: string; @ApiProperty() emailConfirmed: boolean; } backend/src/user/entities/user.entity.ts +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ export class User { @Column() password: string; @Column({ nullable: true }) imageUrl: string; @Column({ default: false }) isEmailConfirmed: boolean; Loading Loading
backend/src/route/route.controller.ts +10 −9 Original line number Diff line number Diff line Loading @@ -13,6 +13,14 @@ import { UpdateRouteStatusDto } from './dto/updateRouteStatus.dto'; export class RouteController { constructor(private readonly routeService: RouteService) {} @Get('/info/:idRoute') @ApiParam({ name: 'idRoute', type: Number }) @ApiBearerAuth('jwt') // @UseGuards(AuthUserGuard) async getRouteInfo(@Param('idRoute') idRoute: number) { return await this.routeService.getRouteInfoById(idRoute); } @Post('/:idTown') @ApiParam({ name: 'idTown', type: Number }) @ApiBody({ type: CreateRouteReq }) Loading Loading @@ -48,8 +56,9 @@ export class RouteController { } } @Get('/:idRoute') @Get('/:idRoute/:lang') @ApiParam({ name: 'idRoute', type: Number }) @ApiParam({ name: 'lang', type: String, enum: Object.values(LANGUAGES) }) @ApiBearerAuth('jwt') @UseGuards(AuthUserGuard) async getRoute(@Param('idRoute') idRoute: number, @Param('lang') lang: LANGUAGES, @Req() req: CustomUserRequest) { Loading @@ -66,12 +75,4 @@ export class RouteController { async updateRoute(@Body() updateRouteStatusDto: UpdateRouteStatusDto, @Param('idRoute') idRoute: number) { return await this.routeService.updateRoute(idRoute, updateRouteStatusDto.status); } @Get('/info/:idRoute') @ApiParam({ name: 'idRoute', type: Number }) @ApiBearerAuth('jwt') @UseGuards(AuthUserGuard) async getRouteInfo(@Param('idRoute') idRoute: number) { return await this.routeService.getRouteInfoById(idRoute); } }
backend/src/route/route.service.ts +23 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,29 @@ export class RouteService { .where('route.idRoute = :idRoute', { idRoute }) .getOne(); if (res && res.travelPlace) { res.travelPlace = res.travelPlace.map((travelPlace: TravelPlace) => { return { travelPlaceId: travelPlace.travelPlaceId, idPlace: travelPlace.place.idPlace, available: travelPlace.place.available, latitude: travelPlace.place.latitude, longitude: travelPlace.place.longitude, imageName: `${ServerConstants.HOST}/places/${travelPlace.place.imageName}`, name: travelPlace.place.name, openAt: travelPlace.place.openAt, closeAt: travelPlace.place.closeAt, startDate: travelPlace.startDate, endDate: travelPlace.endDate, categories: travelPlace.place.categories, address: travelPlace.place.address, done: travelPlace.done, route: travelPlace.route, place: { ...travelPlace.place, imageName: `${ServerConstants.HOST}/places/${travelPlace.place.imageName}` }, }; }); } return res; } }
backend/src/user/dto/update-user.dto.ts +12 −3 Original line number Diff line number Diff line import { PartialType } from '@nestjs/swagger'; import { CreateUserDto } from './create-user.dto'; import { ApiProperty } from '@nestjs/swagger'; export class UpdateUserDto extends PartialType(CreateUserDto) {} export class UpdateUserDto { @ApiProperty() name: string; @ApiProperty() lastName: string; } export class UpdateImageUserDto { @ApiProperty({ type: 'string', format: 'binary' }) image; }
backend/src/user/dto/user-response.ts 0 → 100644 +16 −0 Original line number Diff line number Diff line import { ApiProperty } from '@nestjs/swagger'; export class UserResponse { @ApiProperty() name: string; @ApiProperty() lastName: string; @ApiProperty() imageUrl: string; @ApiProperty() email: string; @ApiProperty() emailConfirmed: boolean; }
backend/src/user/entities/user.entity.ts +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ export class User { @Column() password: string; @Column({ nullable: true }) imageUrl: string; @Column({ default: false }) isEmailConfirmed: boolean; Loading