Load users presence

This commit is contained in:
2021-04-21 16:48:50 +02:00
parent 8705fc6581
commit 5f5f27e79d
7 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,32 @@
/**
* Forez Presence Helper
*
* @author Pierre Hubert
*/
class Presence {
constructor(userID, year, month, day) {
this.userID = userID;
this.year = year;
this.month = month;
this.day = day;
}
}
class ForezPresenceHelper {
/**
* Load the list of presence
*
* @param {number} groupID Target group ID
* @returns {Promise<Presence[]>}
*/
static async GetList(groupID) {
const list = await ws("forez_presence/list", {group: groupID});
return list.map(el => {
const infos = el.split(",").map(e => Number(e));
return new Presence(...infos)
});
}
}