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.
52 lines
1002 B
52 lines
1002 B
const { pool } = require('../database')
|
|
|
|
/**
|
|
* function to get all Systeme note
|
|
* @returns promise
|
|
*/
|
|
async function getSysteme() {
|
|
const sql = 'SELECT * FROM notesystems'
|
|
|
|
try {
|
|
let [rows] = await pool.query(sql)
|
|
|
|
return rows[0]
|
|
} 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 sql = 'UPDATE notesystems SET admis = ?, redouble = ?, renvoyer = ? WHERE id = ?'
|
|
|
|
try {
|
|
let [result] = await pool.query(sql, [admis, redouble, renvoyer, id])
|
|
|
|
if (result.affectedRows === 0) {
|
|
return {
|
|
success: false,
|
|
message: 'Année Scolaire non trouvé.'
|
|
}
|
|
}
|
|
|
|
return {
|
|
success: true,
|
|
message: 'Année Scolaire supprimé avec succès.'
|
|
}
|
|
} catch (error) {
|
|
return error
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
getSysteme,
|
|
updateSysteme
|
|
}
|
|
|