diff --git a/scripts/database/entry/activity.JS b/scripts/database/entry/activity.JS index 477a6dd..dd48a02 100644 --- a/scripts/database/entry/activity.JS +++ b/scripts/database/entry/activity.JS @@ -9,6 +9,28 @@ class Activity extends Entry { constructor(PROPERTIES) { super(PROPERTIES); }; + + /* + Generate a schema for MongoDB. + + @return {OBJECT} the schema + */ + static generateTemplate() { + let SCHEMA = { + "username": {"type": String, "required": true}, + "description": {"type": String}, + "date": {"type": Number}, + "duration": {"type": Number} + } + let TEST = new Activity(); + + // Verify that the schema is valid. + Object.keys(SCHEMA).forEach((KEY) => { + if (!Object.keys(TEST).includes(KEY)) {delete SCHEMA[KEY];}; + }); + + return (SCHEMA) + } } module.exports = Activity; \ No newline at end of file