Skip to content
Snippets Groups Projects
Commit f9e8f36c authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

Merge branch 'dev' into 'master'

Dev

See merge request web-et-numerique/pamn_plateforme-des-acteurs-de-la-mediation-numerique/pamn_server!39
parents d9595ab7 8fd705f5
Branches
Tags
2 merge requests!45Dev,!39Dev
...@@ -32,12 +32,19 @@ export class AdminController { ...@@ -32,12 +32,19 @@ export class AdminController {
@ApiOperation({ description: 'Validate structure ownership' }) @ApiOperation({ description: 'Validate structure ownership' })
public async validatePendingStructure(@Body() pendingStructureDto: PendingStructureDto) { public async validatePendingStructure(@Body() pendingStructureDto: PendingStructureDto) {
const structure = await this.structuresService.findOne(pendingStructureDto.structureId); const structure = await this.structuresService.findOne(pendingStructureDto.structureId);
return this.usersService.validatePendingStructure( await this.usersService.validatePendingStructure(
pendingStructureDto.userEmail, pendingStructureDto.userEmail,
pendingStructureDto.structureId, pendingStructureDto.structureId,
structure.structureName, structure.structureName,
true true
); );
const pendingStructure = await this.usersService.getPendingStructures();
return await Promise.all(
pendingStructure.map(async (structure) => {
structure.structureName = (await this.structuresService.findOne(structure.structureId)).structureName;
return structure;
})
);
} }
@UseGuards(JwtAuthGuard, RolesGuard) @UseGuards(JwtAuthGuard, RolesGuard)
...@@ -46,11 +53,18 @@ export class AdminController { ...@@ -46,11 +53,18 @@ export class AdminController {
@ApiOperation({ description: 'Refuse structure ownership' }) @ApiOperation({ description: 'Refuse structure ownership' })
public async refusePendingStructure(@Body() pendingStructureDto: PendingStructureDto) { public async refusePendingStructure(@Body() pendingStructureDto: PendingStructureDto) {
const structure = await this.structuresService.findOne(pendingStructureDto.structureId); const structure = await this.structuresService.findOne(pendingStructureDto.structureId);
return this.usersService.validatePendingStructure( await this.usersService.validatePendingStructure(
pendingStructureDto.userEmail, pendingStructureDto.userEmail,
pendingStructureDto.structureId, pendingStructureDto.structureId,
structure.structureName, structure.structureName,
false false
); );
const pendingStructure = await this.usersService.getPendingStructures();
return await Promise.all(
pendingStructure.map(async (structure) => {
structure.structureName = (await this.structuresService.findOne(structure.structureId)).structureName;
return structure;
})
);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment