Loading backend/src/app.module.ts +6 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,9 @@ import { PointOfInterestTraduction } from './pointOfInterest/entities/PointOfInt import { PlaceTraduction } from './place/entities/place-traduction.entity'; import { CategoryModule } from './category/category.module'; import { Category } from './category/entities/category.entity'; import { RouteModule } from './route/route.module'; import { Route } from './route/entities/route.entity'; import { TravelPlaceModule } from './travel-place/travel-place.module'; @Module({ imports: [ Loading @@ -48,6 +51,7 @@ import { Category } from './category/entities/category.entity'; PointOfInterestTraduction, PlaceTraduction, Category, Route, ], synchronize: DbConstants.DB_SYNC, logging: false, Loading @@ -65,6 +69,8 @@ import { Category } from './category/entities/category.entity'; }), PointOfInterestModule, CategoryModule, RouteModule, TravelPlaceModule, ], controllers: [AppController], providers: [AppService, DatabaseSeederModule], Loading backend/src/route/dto/create-route.dto.ts 0 → 100644 +1 −0 Original line number Diff line number Diff line export class CreateRouteDto {} backend/src/route/dto/update-route.dto.ts 0 → 100644 +4 −0 Original line number Diff line number Diff line import { PartialType } from '@nestjs/swagger'; import { CreateRouteDto } from './create-route.dto'; export class UpdateRouteDto extends PartialType(CreateRouteDto) {} backend/src/route/entities/route.entity.ts 0 → 100644 +22 −0 Original line number Diff line number Diff line import { Town } from 'src/town/entities/town.entity'; import { User } from 'src/user/entities/user.entity'; import { PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, Entity } from 'typeorm'; @Entity() export class Route { @PrimaryGeneratedColumn() idRoute: number; @JoinColumn({ name: 'user' }) @ManyToOne(() => User, (user) => user.email, { nullable: false }) user: User; @JoinColumn({ name: 'town' }) @ManyToOne(() => Town, (town) => town.townId, { nullable: false }) town: Town; @Column({ nullable: false }) startDate: Date; @Column({ nullable: false }) endDate: Date; } backend/src/route/route.controller.ts 0 → 100644 +34 −0 Original line number Diff line number Diff line import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; import { RouteService } from './route.service'; import { CreateRouteDto } from './dto/create-route.dto'; import { UpdateRouteDto } from './dto/update-route.dto'; @Controller('route') export class RouteController { constructor(private readonly routeService: RouteService) {} @Post() create(@Body() createRouteDto: CreateRouteDto) { return this.routeService.create(createRouteDto); } @Get() findAll() { return this.routeService.findAll(); } @Get(':id') findOne(@Param('id') id: string) { return this.routeService.findOne(+id); } @Patch(':id') update(@Param('id') id: string, @Body() updateRouteDto: UpdateRouteDto) { return this.routeService.update(+id, updateRouteDto); } @Delete(':id') remove(@Param('id') id: string) { return this.routeService.remove(+id); } } Loading
backend/src/app.module.ts +6 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,9 @@ import { PointOfInterestTraduction } from './pointOfInterest/entities/PointOfInt import { PlaceTraduction } from './place/entities/place-traduction.entity'; import { CategoryModule } from './category/category.module'; import { Category } from './category/entities/category.entity'; import { RouteModule } from './route/route.module'; import { Route } from './route/entities/route.entity'; import { TravelPlaceModule } from './travel-place/travel-place.module'; @Module({ imports: [ Loading @@ -48,6 +51,7 @@ import { Category } from './category/entities/category.entity'; PointOfInterestTraduction, PlaceTraduction, Category, Route, ], synchronize: DbConstants.DB_SYNC, logging: false, Loading @@ -65,6 +69,8 @@ import { Category } from './category/entities/category.entity'; }), PointOfInterestModule, CategoryModule, RouteModule, TravelPlaceModule, ], controllers: [AppController], providers: [AppService, DatabaseSeederModule], Loading
backend/src/route/dto/create-route.dto.ts 0 → 100644 +1 −0 Original line number Diff line number Diff line export class CreateRouteDto {}
backend/src/route/dto/update-route.dto.ts 0 → 100644 +4 −0 Original line number Diff line number Diff line import { PartialType } from '@nestjs/swagger'; import { CreateRouteDto } from './create-route.dto'; export class UpdateRouteDto extends PartialType(CreateRouteDto) {}
backend/src/route/entities/route.entity.ts 0 → 100644 +22 −0 Original line number Diff line number Diff line import { Town } from 'src/town/entities/town.entity'; import { User } from 'src/user/entities/user.entity'; import { PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn, Entity } from 'typeorm'; @Entity() export class Route { @PrimaryGeneratedColumn() idRoute: number; @JoinColumn({ name: 'user' }) @ManyToOne(() => User, (user) => user.email, { nullable: false }) user: User; @JoinColumn({ name: 'town' }) @ManyToOne(() => Town, (town) => town.townId, { nullable: false }) town: Town; @Column({ nullable: false }) startDate: Date; @Column({ nullable: false }) endDate: Date; }
backend/src/route/route.controller.ts 0 → 100644 +34 −0 Original line number Diff line number Diff line import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common'; import { RouteService } from './route.service'; import { CreateRouteDto } from './dto/create-route.dto'; import { UpdateRouteDto } from './dto/update-route.dto'; @Controller('route') export class RouteController { constructor(private readonly routeService: RouteService) {} @Post() create(@Body() createRouteDto: CreateRouteDto) { return this.routeService.create(createRouteDto); } @Get() findAll() { return this.routeService.findAll(); } @Get(':id') findOne(@Param('id') id: string) { return this.routeService.findOne(+id); } @Patch(':id') update(@Param('id') id: string, @Body() updateRouteDto: UpdateRouteDto) { return this.routeService.update(+id, updateRouteDto); } @Delete(':id') remove(@Param('id') id: string) { return this.routeService.remove(+id); } }