Refactoring et ajout de routes Hero Wars
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user