feat(services): add availability check in rent service
A new condition was added in `rent.service.ts` to check if a vehicle is available before executing the rent operation. It also logs an error if the vehicle is not available. Signed-off-by: Mathis <yidhra@tuta.io>
This commit is contained in:
parent
e8acfd7b30
commit
83d07a2812
@ -32,6 +32,10 @@ async function createRentService(data: IDbRent): Promise<boolean> {
|
||||
return false;
|
||||
}
|
||||
const vehicleId = vehicleIfExist[0].id
|
||||
if (!vehicleIfExist[0].isAvailable) {
|
||||
logger.error(`Vehicle is not available`);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
const result = await MySqlService.Rent.insert(DbHandler, {
|
||||
id: v4(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user