Refactor Visitor Password Controller and Service for Enhanced Security and Functionality

This commit is contained in:
faris Aljohari
2024-08-13 01:41:23 +03:00
parent 3aff8d59d2
commit 764cfbe7e2
3 changed files with 39 additions and 20 deletions

View File

@ -49,8 +49,8 @@ export class VisitorPasswordController {
);
}
}
// @ApiBearerAuth()
// @UseGuards(JwtAuthGuard)
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Post('temporary-password/online/one-time')
async addOnlineTemporaryPassword(
@Body() addDoorLockOnlineOneTimeDto: AddDoorLockOnlineOneTimeDto,
@ -86,8 +86,6 @@ export class VisitorPasswordController {
return {
statusCode: HttpStatus.CREATED,
success: true,
message: 'offline temporary password added successfully',
data: temporaryPassword,
};
} catch (error) {
@ -112,8 +110,6 @@ export class VisitorPasswordController {
return {
statusCode: HttpStatus.CREATED,
success: true,
message: 'offline temporary password added successfully',
data: temporaryPassword,
};
} catch (error) {
@ -123,7 +119,9 @@ export class VisitorPasswordController {
);
}
}
@Get('')
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get()
async GetVisitorPassword() {
try {
return await this.visitorPasswordService.getPasswords();
@ -134,6 +132,8 @@ export class VisitorPasswordController {
);
}
}
@ApiBearerAuth()
@UseGuards(JwtAuthGuard)
@Get('/devices')
async GetVisitorDevices() {
try {