feat(#135): POST /parents/:id/co-parent — ajout co-parent foyer.
API staff pour foyer mono-parent : compte actif, liens + enfants, mail création MDP. Mini-specs front/back dans docs/tmp. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -30,6 +30,8 @@ import { UpdateParentsDto } from '../user/dto/update_parent.dto';
|
||||
import { UpdateParentFicheAdminDto } from './dto/update-parent-fiche-admin.dto';
|
||||
import { StaffCreateParentDossierDto } from './dto/staff-create-parent-dossier.dto';
|
||||
import { StaffCreateParentDossierResponseDto } from './dto/staff-create-parent-dossier-response.dto';
|
||||
import { StaffAddCoParentDto } from './dto/staff-add-co-parent.dto';
|
||||
import { StaffAddCoParentResponseDto } from './dto/staff-add-co-parent-response.dto';
|
||||
import { RegisterParentCompletDto } from '../auth/dto/register-parent-complet.dto';
|
||||
import { AuthGuard } from 'src/common/guards/auth.guard';
|
||||
import { RolesGuard } from 'src/common/guards/roles.guard';
|
||||
@@ -176,6 +178,28 @@ export class ParentsController {
|
||||
return mapParentForApi(parent);
|
||||
}
|
||||
|
||||
@Roles(RoleType.SUPER_ADMIN, RoleType.ADMINISTRATEUR, RoleType.GESTIONNAIRE)
|
||||
@Post(':id/co-parent')
|
||||
@HttpCode(HttpStatus.CREATED)
|
||||
@ApiOperation({
|
||||
summary: 'Ajouter un co-parent à un foyer existant (staff) — ticket #135',
|
||||
description:
|
||||
'Foyer mono-parent uniquement. Crée le co-parent actif, liens foyer + enfants, ' +
|
||||
'e-mail de création de mot de passe. Ne pas utiliser POST /auth/register/parent.',
|
||||
})
|
||||
@ApiParam({ name: 'id', description: 'UUID utilisateur du parent pivot' })
|
||||
@ApiBody({ type: StaffAddCoParentDto })
|
||||
@ApiResponse({ status: 201, type: StaffAddCoParentResponseDto })
|
||||
@ApiResponse({ status: 400, description: 'Foyer déjà à 2 parents / validation' })
|
||||
@ApiResponse({ status: 404, description: 'Parent introuvable' })
|
||||
@ApiResponse({ status: 409, description: 'Email déjà pris' })
|
||||
async addCoParent(
|
||||
@Param('id') id: string,
|
||||
@Body() dto: StaffAddCoParentDto,
|
||||
): Promise<StaffAddCoParentResponseDto> {
|
||||
return this.authService.addCoParentStaff(id, dto);
|
||||
}
|
||||
|
||||
@Roles(RoleType.SUPER_ADMIN, RoleType.GESTIONNAIRE, RoleType.ADMINISTRATEUR)
|
||||
@Post(':id/enfants/:enfantId')
|
||||
@ApiOperation({ summary: 'Rattacher un enfant à un parent — ticket #115' })
|
||||
|
||||
Reference in New Issue
Block a user