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:
Mathis H (Avnyr) 2024-05-03 11:23:00 +02:00
parent fef2bda082
commit 82afff9878
Signed by: Mathis
GPG Key ID: DD9E0666A747D126

View File

@ -1135,6 +1135,7 @@ const MySqlService = {
});
},
//ToTest
/**
* 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> {
return new Promise((resolve, reject) => {
if (!data.id) return reject("Id is undefined");