From 13c5f826f8252cc51c7e9d34d9e77b56e5c371fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Tue, 27 Aug 2024 20:59:30 -0600 Subject: [PATCH 1/2] cambiando de entero a decimal las coordenadas --- backend/src/place/dto/create-place.dto.ts | 5 +++-- backend/src/place/entities/place.entity.ts | 9 ++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/backend/src/place/dto/create-place.dto.ts b/backend/src/place/dto/create-place.dto.ts index 63fd9330..ed87948a 100644 --- a/backend/src/place/dto/create-place.dto.ts +++ b/backend/src/place/dto/create-place.dto.ts @@ -7,8 +7,9 @@ export class CreatePlaceDto { name: string; imageName: string; town: Town; - latitude: number; - longitude: number; + latitude: 'decimal'; + longitude: 'decimal'; + address: string; openAt: number; closeAt: number; categories: Category[]; diff --git a/backend/src/place/entities/place.entity.ts b/backend/src/place/entities/place.entity.ts index 00412dcc..2176b5bf 100644 --- a/backend/src/place/entities/place.entity.ts +++ b/backend/src/place/entities/place.entity.ts @@ -46,11 +46,14 @@ export class Place { @Column() imageName: string; - @Column({ nullable: false }) - latitude: number; + @Column({ nullable: false, type: 'decimal', precision: 10, scale: 8 }) + latitude; + + @Column({ nullable: false, type: 'decimal', precision: 10, scale: 8 }) + longitude; @Column({ nullable: false }) - longitude: number; + address: string; @Column({ nullable: false }) openAt: number; -- GitLab From 367130356f484f10754a23cde8748256697cd389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Iv=C3=A1n?= <80365304+Diego-lvan@users.noreply.github.com> Date: Tue, 27 Aug 2024 20:59:50 -0600 Subject: [PATCH 2/2] agregando campo address en un place --- backend/src/place/dto/create-place-date.dto.ts | 9 ++++++--- backend/src/place/dto/get-place.dto.ts | 3 +++ backend/src/place/place.service.ts | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/backend/src/place/dto/create-place-date.dto.ts b/backend/src/place/dto/create-place-date.dto.ts index a8162052..d427c679 100644 --- a/backend/src/place/dto/create-place-date.dto.ts +++ b/backend/src/place/dto/create-place-date.dto.ts @@ -26,11 +26,14 @@ export class CreatePlaceDateTradDto { @ApiProperty({ type: 'string', format: 'binary' }) image; - @ApiProperty() - latitude: number; + @ApiProperty({ type: 'decimal' }) + latitude; + + @ApiProperty({ type: 'decimal' }) + longitude; @ApiProperty() - longitude: number; + address: string; // 24-hour format @ApiProperty({ maximum: 24, minimum: 0 }) diff --git a/backend/src/place/dto/get-place.dto.ts b/backend/src/place/dto/get-place.dto.ts index ae110d55..c42c6983 100644 --- a/backend/src/place/dto/get-place.dto.ts +++ b/backend/src/place/dto/get-place.dto.ts @@ -27,4 +27,7 @@ export class GetPlaceDto { endDate: Date; @ApiProperty() categories: any[]; + + @ApiProperty() + address: string; } diff --git a/backend/src/place/place.service.ts b/backend/src/place/place.service.ts index e0f8d592..904aaa4c 100644 --- a/backend/src/place/place.service.ts +++ b/backend/src/place/place.service.ts @@ -47,6 +47,7 @@ export class PlaceService { openAt: createPlaceDto.openAt, imageName: createPlaceDto.image.filename, categories: categories, + address: createPlaceDto.address, }; if (!town) { @@ -105,6 +106,7 @@ export class PlaceService { endDate: place.availableDates[0]?.endDate || null, categories: place.categories, description: place.placeTraduction[0].description, + address: place.address, }; }); return places; @@ -140,6 +142,7 @@ export class PlaceService { endDate: place.availableDates[0]?.endDate, categories: place.categories, description: place.placeTraduction[0].description, + address: place.address, }; return res; } -- GitLab