From 82afff987840deaabe868085f2c3dd36f878ec46 Mon Sep 17 00:00:00 2001 From: Mathis Date: Fri, 3 May 2024 11:23:00 +0200 Subject: [PATCH] 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 --- src/services/mysql.service.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/services/mysql.service.ts b/src/services/mysql.service.ts index 6b34529..afae857 100644 --- a/src/services/mysql.service.ts +++ b/src/services/mysql.service.ts @@ -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} - 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 { return new Promise((resolve, reject) => { if (!data.id) return reject("Id is undefined");