From f6ec954c6fd909ff41b3f34e923f899d978afae5 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Mon, 7 Apr 2025 20:49:39 +0800 Subject: [PATCH] chore: separate DBresponse classes --- scripts/response/activity.JS | 20 +++++++++ scripts/response/log.JS | 17 ++++++++ scripts/{DBParser.JS => response/parser.JS} | 47 --------------------- scripts/response/user.JS | 17 ++++++++ 4 files changed, 54 insertions(+), 47 deletions(-) create mode 100644 scripts/response/activity.JS create mode 100644 scripts/response/log.JS rename scripts/{DBParser.JS => response/parser.JS} (52%) create mode 100644 scripts/response/user.JS diff --git a/scripts/response/activity.JS b/scripts/response/activity.JS new file mode 100644 index 0000000..86dbb8f --- /dev/null +++ b/scripts/response/activity.JS @@ -0,0 +1,20 @@ +const DBParser = require(`./parser.JS`); + +class Activity extends DBParser { + /* + Modify user information. + + @param {Object} ENTRY the selected entry, or the entries + */ + constructor(ENTRY) { + super(DATA, { + "_id": "ID", + "username": "username", + "description": "description", + "duration": "duration", + "date": "date" + }); + } +} + +module.exports = Activity; \ No newline at end of file diff --git a/scripts/response/log.JS b/scripts/response/log.JS new file mode 100644 index 0000000..cb8b42d --- /dev/null +++ b/scripts/response/log.JS @@ -0,0 +1,17 @@ +const DBParser = require(`./parser.JS`) + +DBParser.Log = class Log extends DBParser { + /* + Clean the log information. + + @param {Object} ENTRY the selected entry, or the entries + */ + constructor(ENTRY) { + super(ENTRY, { + "_id": "ID", + "username": "name", + "count": "count", + "log": "activities" + }); + }; +} \ No newline at end of file diff --git a/scripts/DBParser.JS b/scripts/response/parser.JS similarity index 52% rename from scripts/DBParser.JS rename to scripts/response/parser.JS index 6f884c2..26d6962 100644 --- a/scripts/DBParser.JS +++ b/scripts/response/parser.JS @@ -50,51 +50,4 @@ class DBParser { } -DBParser.User = class User extends DBParser { - /* - Modify user information. - - @param {Object} ENTRY the selected entry, or the entries - */ - constructor(DATA) { - super(DATA, { - "_id": "ID", - "username": "name" - }); - } -} - -DBParser.Activity = class Activity extends DBParser { - /* - Modify user information. - - @param {Object} ENTRY the selected entry, or the entries - */ - constructor(ENTRY) { - super(DATA, { - "_id": "ID", - "username": "username", - "description": "description", - "duration": "duration", - "date": "date" - }); - } -} - -DBParser.Log = class Log extends DBParser { - /* - Clean the log information. - - @param {Object} ENTRY the selected entry, or the entries - */ - constructor(ENTRY) { - super(ENTRY, { - "_id": "ID", - "username": "name", - "count": "count", - "log": "activities" - }); - }; -} - module.exports = DBParser; \ No newline at end of file diff --git a/scripts/response/user.JS b/scripts/response/user.JS new file mode 100644 index 0000000..8585d25 --- /dev/null +++ b/scripts/response/user.JS @@ -0,0 +1,17 @@ +const DBParser = require(`./parser.JS`); + +class User extends DBParser { + /* + Modify user information. + + @param {Object} ENTRY the selected entry, or the entries + */ + constructor(DATA) { + super(DATA, { + "_id": "ID", + "username": "name" + }); + } +} + +module.exports = User; \ No newline at end of file