Commit 73b45a0f authored by Omar Luna Hernández's avatar Omar Luna Hernández
Browse files

Se modifica para que no se vuelvan a insertar puntos cuando se haya llegado al final

parent f43c1ad5
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -40,6 +40,20 @@ export class PointOfInterestService {
    if (!place) {
      throw new BadRequestException('Place not found');
    }

    const idPlace = place.idPlace;
    const points: getPointDto[] = await this.dataSource
      .getRepository(PointOfInterestTraduction)
      .createQueryBuilder('pointTrad')
      .leftJoin('pointTrad.idPoint', 'point')
      .select(['point.idPoint as idPoint', 'pointTrad.directions as directions', 'point.idPlace as idPlace'])
      .where('point.idPlace = :idPlace', { idPlace })
      .andWhere('pointTrad.directions IS NULL')
      .getRawMany();
    if (points.length > 0) {
      throw new BadRequestException('El ultimo punto ha sido registrad');
    }

    const createPointDto: CreatePointDto = {
      name: createPointAndTradDto.name,
      imageName: createPointAndTradDto.image,