Add getFilesTypes method to machines service

Implemented a new method to retrieve file types associated with a specific machine by its ID. This method queries the database and returns a promise that resolves to an array of file types.
This commit is contained in:
Mathis H (Avnyr) 2024-10-08 16:08:50 +02:00
parent 86da1b7bce
commit 84d6743863
Signed by: Mathis
GPG Key ID: DD9E0666A747D126

View File

@ -160,8 +160,20 @@ export class MachinesService {
.execute();
}
/**
* Retrieves the file types associated with a specific machine based on the given machine ID.
*
* @param {string} machineId - The unique identifier of the machine whose file types are to be retrieved.
* @return {Promise<Array<object>>} A promise that resolves to an array of file types associated with the machine.
*/
async getFilesTypes(machineId: string) {
//TODO Find machineId and associated filesTypes
return this.database
.use()
.select()
.from(FilesTypeForMachine)
.where(eq(FilesTypeForMachine.machineId, machineId))
.prepare("getMachineFilesTypesById")
.execute();
}
/**