Skip to content

Commit becfe4d

Browse files
Ajouter une méthode pour compter les identités
1 parent fe5fb2d commit becfe4d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/management/identities/identities.controller.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,19 @@ export class IdentitiesController extends AbstractController {
169169
}
170170
}
171171

172+
@Get('count')
173+
public async count(
174+
@Res() res: Response,
175+
@SearchFilterSchema() searchFilterSchema: FilterSchema,
176+
@SearchFilterOptions() searchFilterOptions: FilterOptions,
177+
): Promise<Response<number>> {
178+
const total = await this._service.count(searchFilterSchema, searchFilterOptions);
179+
return res.status(HttpStatus.OK).json({
180+
statusCode: HttpStatus.OK,
181+
data: total,
182+
});
183+
}
184+
172185
@Patch(':_id([0-9a-fA-F]{24})')
173186
@ApiParam({ name: '_id', type: String })
174187
@ApiUpdateDecorator(IdentitiesUpdateDto, IdentitiesDto)
@@ -192,7 +205,7 @@ export class IdentitiesController extends AbstractController {
192205
@Body() body: IdentitiesUpdateDto,
193206
@Res() res: Response,
194207
): Promise<Response> {
195-
const identity = await this._service.findById(_id);
208+
const identity = await this._service.findById<Identities>(_id);
196209
if (!identity) {
197210
throw new BadRequestException('Identity not found');
198211
}

0 commit comments

Comments
 (0)