feat(services): add update function in mysql service
This commit adds an `update` function to the `mysql.service.ts`. This new function will update a rent record in the database. It takes a database handler object and a rent object containing the updated data, and returns a Promise that resolves to the status result of the update operation. The function will throw an error if an issue occurs during the update operation. Issue: #23 Signed-off-by: Mathis <yidhra@tuta.io>
This commit is contained in:
parent
fef2bda082
commit
82afff9878
@ -1135,6 +1135,7 @@ const MySqlService = {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//ToTest
|
||||||
/**
|
/**
|
||||||
* Retrieves all assigned vehicles from the database.
|
* Retrieves all assigned vehicles from the database.
|
||||||
*
|
*
|
||||||
@ -1156,6 +1157,16 @@ const MySqlService = {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//ToTest
|
||||||
|
/**
|
||||||
|
* Updates a rent record in the database.
|
||||||
|
*
|
||||||
|
* @param {MysqlHandler} handler - The database handler object.
|
||||||
|
* @param {IDbRent} data - The rent object containing the updated data.
|
||||||
|
* @returns {Promise<IDbStatusResult>} - A promise that resolves to the status result of the update operation.
|
||||||
|
* @throws {Error} - If an error occurs during the update operation.
|
||||||
|
*/
|
||||||
update(handler: MysqlHandler, data: IDbRent): Promise<IDbStatusResult> {
|
update(handler: MysqlHandler, data: IDbRent): Promise<IDbStatusResult> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (!data.id) return reject("Id is undefined");
|
if (!data.id) return reject("Id is undefined");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user