diff --git a/scripts/data/structures.js b/scripts/data/structures.js index 9de10021f046f404cc0eb4673f5b53e6022b8456..6298725cb59ae1676c6891177ca975fcaa4cf716 100644 --- a/scripts/data/structures.js +++ b/scripts/data/structures.js @@ -5,7 +5,7 @@ module.exports = { data: [ { _id: mongoose.Types.ObjectId('6001a35f16b08100062e415f'), - freeWorkShop: false, + freeWorkShop: 'Non', createdAt: '2020-11-16T15:37:00.000Z', updatedAt: '2021-03-02T12:36:53.000Z', structureName: "Maison de l'Emploi (Feyzin)", @@ -164,7 +164,7 @@ module.exports = { handicaps: ['physicalDisability'], publicOthers: ['uniquementFemmes'], }, - freeWorkShop: false, + freeWorkShop: 'Non', createdAt: '2020-11-16T10:19:00.000Z', updatedAt: '2020-12-16T10:19:00.000Z', structureName: 'Pôle emploi (Vénissieux)', @@ -270,7 +270,7 @@ module.exports = { }, { _id: mongoose.Types.ObjectId('6001a38516b08100062e4161'), - freeWorkShop: false, + freeWorkShop: 'Non', createdAt: '2020-11-16T14:15:00.000Z', updatedAt: '2021-04-27T14:19:17.000Z', structureName: 'Centre social Quartier Vitalité', @@ -371,7 +371,7 @@ module.exports = { handicaps: ['physicalDisability'], publicOthers: ['uniquementFemmes'], }, - freeWorkShop: false, + freeWorkShop: 'Non', createdAt: '2020-11-16T09:30:00.000Z', updatedAt: '2021-04-12T08:48:00.000Z', structureName: "L'Atelier Numérique", @@ -514,7 +514,7 @@ module.exports = { handicaps: ['physicalDisability'], publicOthers: ['uniquementFemmes'], }, - freeWorkShop: false, + freeWorkShop: 'Non', createdAt: '2020-11-16T08:53:00.000Z', updatedAt: '2021-04-27T17:06:46.000Z', structureName: 'Cyber-base / MJC Louis Aragon', @@ -618,7 +618,7 @@ module.exports = { handicaps: ['physicalDisability'], publicOthers: ['uniquementFemmes'], }, - freeWorkShop: false, + freeWorkShop: 'Non', createdAt: '2020-11-04T09:27:00.000Z', updatedAt: '2021-03-02T10:07:48.000Z', structureName: 'Oasis Informatique', @@ -730,7 +730,7 @@ module.exports = { handicaps: ['physicalDisability'], publicOthers: ['uniquementFemmes'], }, - freeWorkShop: false, + freeWorkShop: 'Non', createdAt: '2020-11-13T14:13:00.000Z', updatedAt: '2021-03-02T10:09:30.000Z', structureName: 'Le Son du Clic', @@ -848,7 +848,7 @@ module.exports = { pmrAccess: false, remoteAccompaniment: false, accountVerified: true, - freeWorkShop: false, + freeWorkShop: 'Non', nbComputers: 0, nbPrinters: 0, nbScanners: 0, @@ -917,7 +917,7 @@ module.exports = { pmrAccess: false, remoteAccompaniment: false, accountVerified: true, - freeWorkShop: false, + freeWorkShop: 'Non', nbComputers: 0, nbPrinters: 0, nbScanners: 0, diff --git a/src/structures/services/structures.service.ts b/src/structures/services/structures.service.ts index 0c72935190131776e715ec0d2f23bbdcc54dac1f..2b8e21dd8eb63007a4f5fa5b8d830e3cd0389c78 100644 --- a/src/structures/services/structures.service.ts +++ b/src/structures/services/structures.service.ts @@ -7,7 +7,7 @@ import * as ejs from 'ejs'; import * as _ from 'lodash'; import { DateTime } from 'luxon'; import { DocumentDefinition, FilterQuery, Model, Types } from 'mongoose'; -import { lastValueFrom, map, Observable, tap } from 'rxjs'; +import { lastValueFrom, map, tap } from 'rxjs'; import { PendingStructureDto } from '../../admin/dto/pending-structure.dto'; import { UnclaimedStructureDto } from '../../admin/dto/unclaimed-structure-dto'; import { Categories } from '../../categories/schemas/categories.schema'; @@ -1162,7 +1162,9 @@ export class StructuresService { const structures: StructureDocument[] = await this.findAll(); for (const structure of structures) { this.setCtmTerritory(structure).then(async (updatedStructure) => { - await this.structureModel.findByIdAndUpdate(new Types.ObjectId(structure._id), updatedStructure).exec(); + await this.structureModel + .findByIdAndUpdate(new Types.ObjectId(structure._id), updatedStructure, { timestamps: false }) + .exec(); }); } return null; diff --git a/src/structures/structures.controller.ts b/src/structures/structures.controller.ts index b354a6821dedd1a68835b1760eda58db8bd5b3e1..c076dc3231ffc97f9599f872cb38c1f97f1fa5d9 100644 --- a/src/structures/structures.controller.ts +++ b/src/structures/structures.controller.ts @@ -181,10 +181,10 @@ export class StructuresController { description: `Mettre à jour les territoires CTM des structures à partir de Data Grand Lyon`, }) @ApiResponse({ - status: 204, + status: 201, description: 'The CTM territories have been updated successfully.', }) - @Get('/ctm/update') + @Post('/ctm/update') @UseGuards(JwtAuthGuard, RolesGuard) @Roles('admin') public async updateCTM(): Promise<void> { diff --git a/src/tcl/tclStopPoint.controller.ts b/src/tcl/tclStopPoint.controller.ts index b649e3df4e85b297495aea1569454fed45851ef1..e49137f1e18d16a53674ea3610115ed7b1002ccf 100644 --- a/src/tcl/tclStopPoint.controller.ts +++ b/src/tcl/tclStopPoint.controller.ts @@ -1,4 +1,4 @@ -import { Body, Controller, Get, Logger, Post, UseGuards } from '@nestjs/common'; +import { Body, Controller, Logger, Post, UseGuards } from '@nestjs/common'; import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger'; import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard'; import { Roles } from '../users/decorators/roles.decorator'; @@ -17,10 +17,10 @@ export class TclStopPointController { description: `Mettre à jour les points d'arrêt TCL à partir de Data Grand Lyon`, }) @ApiResponse({ - status: 204, + status: 201, description: 'The stop points have been updated successfully.', }) - @Get('/update') + @Post('/update') @UseGuards(JwtAuthGuard, RolesGuard) @Roles('admin') public updateStopPoints(): Promise<void> {