Loading backend/src/place/entities/available-date.entity.ts +4 −4 Original line number Diff line number Diff line import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm'; import { Place } from './place.entity'; @Entity() export class AvailableDate { @PrimaryGeneratedColumn() idAvailableDate: number; @PrimaryColumn() idPlace: number; @JoinColumn({ name: 'idPlace' }) @ManyToOne(() => Place, (place) => place.availableDates, { nullable: false }) idPlace: Place; place: Place; @Column() startDate: Date; Loading backend/src/place/entities/place.entity.ts +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ export class Place { @OneToMany(() => PointOfInterest, (point) => point.idPoint) points: PointOfInterest[]; @OneToMany(() => AvailableDate, (available) => available.idPlace) @OneToMany(() => AvailableDate, (available) => available.place) availableDates: AvailableDate[]; @ManyToMany(() => Category) Loading backend/src/place/place.service.ts +14 −4 Original line number Diff line number Diff line Loading @@ -76,7 +76,11 @@ export class PlaceService { await this.placeTraductionRepository.insert(createTradEs); await this.placeTraductionRepository.insert(createTradEn); if (createPlaceDto.available === Available.CUSTOM) { await this.availableDateRepository.insert({ ...createDate, idPlace: insertedPlace }); await this.availableDateRepository.insert({ ...createDate, place: insertedPlace, idPlace: insertedPlace.idPlace, }); } } Loading Loading @@ -166,6 +170,7 @@ export class PlaceService { place.name = updatePlaceReqDto.name; place.openAt = updatePlaceReqDto.openAt; place.imageName = updatePlaceReqDto.image.filename; place.address = updatePlaceReqDto.address; // Update categories const categories: Category[] = []; Loading Loading @@ -201,9 +206,14 @@ export class PlaceService { // Update available date if necessary if (updatePlaceReqDto.available === Available.CUSTOM) { await this.availableDateRepository.update( { idPlace: place }, { startDate: updatePlaceReqDto.startDate, endDate: updatePlaceReqDto.endDate }, await this.availableDateRepository.upsert( { idPlace: place.idPlace, place: place, startDate: updatePlaceReqDto.startDate, endDate: updatePlaceReqDto.endDate, }, ['idPlace'], ); } } Loading web/package-lock.json +62 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ "@types/react-dom": "^18.2.21", "@vis.gl/react-google-maps": "^1.1.0", "axios": "^1.6.8", "buffer": "^6.0.3", "react": "^18.2.0", "react-data-table-component": "^7.6.2", "react-dom": "^18.2.0", Loading Loading @@ -5844,6 +5845,25 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ] }, "node_modules/batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", Loading Loading @@ -6018,6 +6038,29 @@ "node-int64": "^0.4.0" } }, "node_modules/buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ], "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" } }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", Loading Loading @@ -9590,6 +9633,25 @@ "node": ">=4" } }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ] }, "node_modules/ignore": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", Loading web/package.json +1 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ "@types/react-dom": "^18.2.21", "@vis.gl/react-google-maps": "^1.1.0", "axios": "^1.6.8", "buffer": "^6.0.3", "react": "^18.2.0", "react-data-table-component": "^7.6.2", "react-dom": "^18.2.0", Loading Loading
backend/src/place/entities/available-date.entity.ts +4 −4 Original line number Diff line number Diff line import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm'; import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from 'typeorm'; import { Place } from './place.entity'; @Entity() export class AvailableDate { @PrimaryGeneratedColumn() idAvailableDate: number; @PrimaryColumn() idPlace: number; @JoinColumn({ name: 'idPlace' }) @ManyToOne(() => Place, (place) => place.availableDates, { nullable: false }) idPlace: Place; place: Place; @Column() startDate: Date; Loading
backend/src/place/entities/place.entity.ts +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ export class Place { @OneToMany(() => PointOfInterest, (point) => point.idPoint) points: PointOfInterest[]; @OneToMany(() => AvailableDate, (available) => available.idPlace) @OneToMany(() => AvailableDate, (available) => available.place) availableDates: AvailableDate[]; @ManyToMany(() => Category) Loading
backend/src/place/place.service.ts +14 −4 Original line number Diff line number Diff line Loading @@ -76,7 +76,11 @@ export class PlaceService { await this.placeTraductionRepository.insert(createTradEs); await this.placeTraductionRepository.insert(createTradEn); if (createPlaceDto.available === Available.CUSTOM) { await this.availableDateRepository.insert({ ...createDate, idPlace: insertedPlace }); await this.availableDateRepository.insert({ ...createDate, place: insertedPlace, idPlace: insertedPlace.idPlace, }); } } Loading Loading @@ -166,6 +170,7 @@ export class PlaceService { place.name = updatePlaceReqDto.name; place.openAt = updatePlaceReqDto.openAt; place.imageName = updatePlaceReqDto.image.filename; place.address = updatePlaceReqDto.address; // Update categories const categories: Category[] = []; Loading Loading @@ -201,9 +206,14 @@ export class PlaceService { // Update available date if necessary if (updatePlaceReqDto.available === Available.CUSTOM) { await this.availableDateRepository.update( { idPlace: place }, { startDate: updatePlaceReqDto.startDate, endDate: updatePlaceReqDto.endDate }, await this.availableDateRepository.upsert( { idPlace: place.idPlace, place: place, startDate: updatePlaceReqDto.startDate, endDate: updatePlaceReqDto.endDate, }, ['idPlace'], ); } } Loading
web/package-lock.json +62 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ "@types/react-dom": "^18.2.21", "@vis.gl/react-google-maps": "^1.1.0", "axios": "^1.6.8", "buffer": "^6.0.3", "react": "^18.2.0", "react-data-table-component": "^7.6.2", "react-dom": "^18.2.0", Loading Loading @@ -5844,6 +5845,25 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ] }, "node_modules/batch": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", Loading Loading @@ -6018,6 +6038,29 @@ "node-int64": "^0.4.0" } }, "node_modules/buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ], "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" } }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", Loading Loading @@ -9590,6 +9633,25 @@ "node": ">=4" } }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "funding": [ { "type": "github", "url": "https://github.com/sponsors/feross" }, { "type": "patreon", "url": "https://www.patreon.com/feross" }, { "type": "consulting", "url": "https://feross.org/support" } ] }, "node_modules/ignore": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.1.tgz", Loading
web/package.json +1 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ "@types/react-dom": "^18.2.21", "@vis.gl/react-google-maps": "^1.1.0", "axios": "^1.6.8", "buffer": "^6.0.3", "react": "^18.2.0", "react-data-table-component": "^7.6.2", "react-dom": "^18.2.0", Loading