Refactoring et ajout de routes Hero Wars

This commit is contained in:
2025-11-27 10:50:17 +01:00
parent c9ce3f343e
commit 60feffd929
47 changed files with 1224 additions and 236 deletions
+34
View File
@@ -0,0 +1,34 @@
const DB = require('../database/mysql');
const { HeroWar } = DB;
class HeroWarService {
static async createMember(data) {
return HeroWar.create(data);
}
static async getAllMembers() {
return HeroWar.findAll({
order: [['createdAt', 'DESC']],
});
}
static async getMemberById(id) {
return HeroWar.findByPk(id);
}
static async getMemberByName(email) {
return HeroWar.findOne({ where: { email: email } });
}
static async updateMember(data) {
return HeroWar.update(data);
}
static async deleteMember(data) {
return HeroWar.delete(data);
}
}
module.exports = HeroWarService;