feat: Create activity log
This commit is contained in:
parent
9443810678
commit
8152c172a9
3 changed files with 78 additions and 11 deletions
|
@ -1,6 +1,7 @@
|
|||
const DBManagement = require(`./management.JS`);
|
||||
|
||||
const Activity = require(`../entry/activity.JS`);
|
||||
const Log = require(`../entry/log.JS`);
|
||||
|
||||
class ActivityManagement extends DBManagement {
|
||||
constructor() {
|
||||
|
@ -37,6 +38,24 @@ class ActivityManagement extends DBManagement {
|
|||
let CURRENT = await createActivity();
|
||||
return (CURRENT);
|
||||
};
|
||||
|
||||
/* Search for all activities for a given user.
|
||||
|
||||
@param {String} USERNAME the username
|
||||
@param {Object} CRITERIA the search criteria
|
||||
@param {Number} SIZE the size
|
||||
@return {Object} the log
|
||||
*/
|
||||
async search_User (USERNAME, CRITERIA, SIZE) {
|
||||
let RESULT = await this.search(Object.assign({}, CRITERIA, {"username": USERNAME}), SIZE);
|
||||
|
||||
const convertData = () => {
|
||||
let LOG = new Log({"name": USERNAME, "activities": (RESULT instanceof Array ? RESULT.length : false) ? RESULT : []});
|
||||
return (LOG);
|
||||
}
|
||||
|
||||
return(convertData());
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ActivityManagement;
|
Loading…
Add table
Add a link
Reference in a new issue