mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 21:34:54 +00:00
Add Default Door Lock Password and Open Door Lock Endpoint
This commit is contained in:
@ -211,4 +211,23 @@ export class DoorLockController {
|
||||
);
|
||||
}
|
||||
}
|
||||
@ApiBearerAuth()
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Post('open/:doorLockUuid')
|
||||
async openDoorLock(@Param('doorLockUuid') doorLockUuid: string) {
|
||||
try {
|
||||
await this.doorLockService.openDoorLock(doorLockUuid);
|
||||
|
||||
return {
|
||||
statusCode: HttpStatus.CREATED,
|
||||
success: true,
|
||||
message: 'door lock opened successfully',
|
||||
};
|
||||
} catch (error) {
|
||||
throw new HttpException(
|
||||
error.message || 'Internal server error',
|
||||
error.status || HttpStatus.INTERNAL_SERVER_ERROR,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user