You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
829 B
44 lines
829 B
const { database } = require('../database')
|
|
|
|
/**
|
|
* function to get all Systeme note
|
|
* @returns promise
|
|
*/
|
|
async function getSysteme() {
|
|
const query = database.prepare('SELECT * FROM notesystems')
|
|
|
|
try {
|
|
let response = await query.get()
|
|
|
|
return response
|
|
} catch (error) {
|
|
return error
|
|
}
|
|
}
|
|
|
|
/**
|
|
* function to update systeme note
|
|
* @param {*} id
|
|
* @param {*} admis
|
|
* @param {*} redouble
|
|
* @param {*} renvoyer
|
|
* @returns promise
|
|
*/
|
|
async function updateSysteme(id, admis, redouble, renvoyer) {
|
|
const query = database.prepare(
|
|
'UPDATE notesystems SET admis = ?, redouble = ?, renvoyer = ? WHERE id = ?'
|
|
)
|
|
|
|
try {
|
|
let response = await query.run(admis, redouble, renvoyer, id)
|
|
|
|
return response
|
|
} catch (error) {
|
|
return error
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
getSysteme,
|
|
updateSysteme
|
|
}
|
|
|