Skip to content

Conversation

@MoshiMoshiMochi
Copy link
Collaborator

IN THIS EPISODE OF PR (WHAT THE DOG DOIN?)

NEW FEATURES 🥇

Fully customizable Admin Dashboard!

Overall Section (Whatever you need comes first!)

ezgif-6b57b34b0c7e33
ezgif-6de2e65c619238

  1. This section, located at the top of the screen will allow admin users to display various different statistics of the database!
  2. Users can fully customize this view by clicking on the edit display button to insert/delete/edit/reorder the display cards however they like!
  3. Also, the edit display view is draggable!!!! (kinda like deez ....)
  4. Upon logging in for the first time/users have no cards, user's card deck will be populated with a default deck of cards!

Tabs Section (JESSE, we need to ORGANIZE)

ezgif-630c0de4a0d264

  1. This section, located in the middle of the screen, is aimed at helping admins users better sort their various cards for greater organization.
  2. This section, is contains a different deck of cards, not related to the Overall Section deck of cards.
  3. Likewise, users can customize each tabs' view
  4. Likewise, upon logging in for the first time/users with no cards, each tab will be auto populated with a default deck of cards

Analytics Section (Boys, are we cooking with these analytics?)

ezgif-630cb98ce92518

  1. Analytics Section will allow for the admin user to view the current website traffic and monitor various statistics like total users/ new users and total page views.
  2. Admin users can adjust the from/to date accordingly to view specifics.
  3. Each redirect and the UnderStance application counts as 1 page view.

Design in dark mode 🌚

image

MoshiMoshiMochi and others added 25 commits July 3, 2025 17:31
into the secrets.js file. updated compose file for this.
…l, tried updating designs for UpdateItemPanel.
@github-actions
Copy link

github-actions bot commented Jul 9, 2025

There is one or more linting errors (Backend)

Lint Issues npm warn exec The following package was not found and will be installed: @biomejs/biome@2.1.1 Backend/app.js:7:20 lint/style/useNodejsImportProtocol FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i A Node.js builtin module should be imported with the node: protocol.

5 │ const analyticsRoutes = require("./routes/analytics.route");
6 │ 

7 │ const fs = require("fs");
│ ^^^^
8 │
9 │ const morgan = require("morgan");

i Using the node: protocol is more explicit and signals that the imported module belongs to Node.js.

i Unsafe fix: Add the node: protocol.

 5  5 │   const analyticsRoutes = require("./routes/analytics.route");
 6  6 │   
 7    │ - const·fs·=·require("fs");
    7 │ + const·fs·=·require("node:fs");
 8  8 │   
 9  9 │   const morgan = require("morgan");

Backend/tests/integration/stances.integration.test.js:135:28 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━

i The computed expression can be simplified without the use of a string literal.

133 │     extendedFakeStances[0]["Issue Summary"] = "On the anthem";
134 │     extendedFakeStances[1]["Issue Summary"] = "On the anthem";

135 │ extendedFakeStances[0]["Party"] = "Coalition for Shakira";
│ ^^^^^^^
136 │ extendedFakeStances[1]["Party"] = "Traditionalists' Party";
137 │ extendedFakeStances.push({

i Unsafe fix: Use a literal key instead.

133 133 │       extendedFakeStances[0]["Issue Summary"] = "On the anthem";
134 134 │       extendedFakeStances[1]["Issue Summary"] = "On the anthem";
135     │ - ····extendedFakeStances[0]["Party"]·=·"Coalition·for·Shakira";
    135 │ + ····extendedFakeStances[0].Party·=·"Coalition·for·Shakira";
136 136 │       extendedFakeStances[1]["Party"] = "Traditionalists' Party";
137 137 │       extendedFakeStances.push({

Backend/tests/integration/stances.integration.test.js:136:28 lint/complexity/useLiteralKeys FIXABLE ━━━━━━━━━━

i The computed expression can be simplified without the use of a string literal.

134 │     extendedFakeStances[1]["Issue Summary"] = "On the anthem";
135 │     extendedFakeStances[0]["Party"] = "Coalition for Shakira";

136 │ extendedFakeStances[1]["Party"] = "Traditionalists' Party";
│ ^^^^^^^
137 │ extendedFakeStances.push({
138 │ StanceID: 3,

i Unsafe fix: Use a literal key instead.

134 134 │       extendedFakeStances[1]["Issue Summary"] = "On the anthem";
135 135 │       extendedFakeStances[0]["Party"] = "Coalition for Shakira";
136     │ - ····extendedFakeStances[1]["Party"]·=·"Traditionalists'·Party";
    136 │ + ····extendedFakeStances[1].Party·=·"Traditionalists'·Party";
137 137 │       extendedFakeStances.push({
138 138 │           StanceID: 3,

Backend/app.js:5:7 lint/correctness/noUnusedVariables FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

! This variable analyticsRoutes is unused.

3 │ const routes = require("./routes/router");
4 │ const securedRoutes = require("./routes/secured.router");

5 │ const analyticsRoutes = require("./routes/analytics.route");
│ ^^^^^^^^^^^^^^^
6 │
7 │ const fs = require("fs");

i Unused variables are often the result of an incomplete refactoring, typos, or other sources of bugs.

i Unsafe fix: If this is intentional, prepend analyticsRoutes with an underscore.

 3  3 │   const routes = require("./routes/router");
 4  4 │   const securedRoutes = require("./routes/secured.router");
 5    │ - const·analyticsRoutes·=·require("./routes/analytics.route");
    5 │ + const·_analyticsRoutes·=·require("./routes/analytics.route");
 6  6 │   
 7  7 │   const fs = require("fs");

Backend/app.js:7:7 lint/correctness/noUnusedVariables FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

! This variable fs is unused.

5 │ const analyticsRoutes = require("./routes/analytics.route");
6 │ 

7 │ const fs = require("fs");
│ ^^
8 │
9 │ const morgan = require("morgan");

i Unused variables are often the result of an incomplete refactoring, typos, or other sources of bugs.

i Unsafe fix: If this is intentional, prepend fs with an underscore.

 5  5 │   const analyticsRoutes = require("./routes/analytics.route");
 6  6 │   
 7    │ - const·fs·=·require("fs");
    7 │ + const·_fs·=·require("fs");
 8  8 │   
 9  9 │   const morgan = require("morgan");

Backend/routes/dashboard.route.js:5:9 lint/correctness/noUnusedVariables ━━━━━━━━━━━━━━━━━━━━━━━━━━━

! This variable management is unused.

3 │ const validator = require("../utils/input-validation");
4 │ const logger = require("../utils/logger");

5 │ const { management } = require("../utils/management-client");
│ ^^^^^^^^^^
6 │ const db = require("../utils/DAL");
7 │

i Unused variables are often the result of an incomplete refactoring, typos, or other sources of bugs.

Backend/routes/users.route.js:14:12 lint/correctness/noUnusedFunctionParameters FIXABLE ━━━━━━━━━━

! This parameter is unused.

12 │     "/users",
13 │     checkRequiredPermissions([permissions.readUsers]),

14 │ async (req, res) => {
│ ^^^
15 │ try {
16 │ const allUsers = await management.users

i Unused parameters might be the result of an incomplete refactoring.

i Unsafe fix: If this is intentional, prepend req with an underscore.

 12  12 │       "/users",
 13  13 │       checkRequiredPermissions([permissions.readUsers]),
 14     │ - ····async·(req,·res)·=>·{
     14 │ + ····async·(_req,·res)·=>·{
 15  15 │           try {
 16  16 │               const allUsers = await management.users

Backend/routes/users.route.js:36:12 lint/correctness/noUnusedFunctionParameters FIXABLE ━━━━━━━━━━

! This parameter is unused.

34 │     "/roles",
35 │     checkRequiredPermissions([permissions.readUsers]),

36 │ async (req, res) => {
│ ^^^
37 │ try {
38 │ const roles = await management.roles.getAll();

i Unused parameters might be the result of an incomplete refactoring.

i Unsafe fix: If this is intentional, prepend req with an underscore.

 34  34 │       "/roles",
 35  35 │       checkRequiredPermissions([permissions.readUsers]),
 36     │ - ····async·(req,·res)·=>·{
     36 │ + ····async·(_req,·res)·=>·{
 37  37 │           try {
 38  38 │               const roles = await management.roles.getAll();

Backend/routes/users.route.js:63:15 lint/correctness/noUnusedVariables FIXABLE ━━━━━━━━━━━━━━━━━━━

! This variable validators is unused.

61 │         // temporary validate with party name validator
62 │         // reasonable for most strings

63 │ const validators = {
│ ^^^^^^^^^^
64 │ Name: validator.validatePartyName,
65 │ Email: validator.validatePartyName,

i Unused variables are often the result of an incomplete refactoring, typos, or other sources of bugs.

i Unsafe fix: If this is intentional, prepend validators with an underscore.

 61  61 │           // temporary validate with party name validator
 62  62 │           // reasonable for most strings
 63     │ - ········const·validators·=·{
     63 │ + ········const·_validators·=·{
 64  64 │               Name: validator.validatePartyName,
 65  65 │               Email: validator.validatePartyName,

Backend/tests/unit/auth.unit.test.js:69:30 lint/correctness/noUnusedFunctionParameters FIXABLE ━━━━━━━━━━

! This parameter is unused.

67 │             }),
68 │             claimCheck: jest.fn((fn) => {

69 │ return (req, res, next) => {
│ ^^^
70 │ fn(req.auth);
71 │ };

i Unused parameters might be the result of an incomplete refactoring.

i Unsafe fix: If this is intentional, prepend res with an underscore.

67 67 │               }),
68 68 │               claimCheck: jest.fn((fn) => {
69    │ - ················return·(req,·res,·next)·=>·{
   69 │ + ················return·(req,·_res,·next)·=>·{
70 70 │                       fn(req.auth);
71 71 │                   };

Backend/tests/unit/auth.unit.test.js:69:35 lint/correctness/noUnusedFunctionParameters FIXABLE ━━━━━━━━━━

! This parameter is unused.

67 │             }),
68 │             claimCheck: jest.fn((fn) => {

69 │ return (req, res, next) => {
│ ^^^^
70 │ fn(req.auth);
71 │ };

i Unused parameters might be the result of an incomplete refactoring.

i Unsafe fix: If this is intentional, prepend next with an underscore.

67 67 │               }),
68 68 │               claimCheck: jest.fn((fn) => {
69    │ - ················return·(req,·res,·next)·=>·{
   69 │ + ················return·(req,·res,·_next)·=>·{
70 70 │                       fn(req.auth);
71 71 │                   };

Backend/tests/unit/dashboard.unit.test.js:12:7 lint/correctness/noUnusedVariables FIXABLE ━━━━━━━━━━

! This variable middleware is unused.

10 │     }),
11 │ }));

12 │ const middleware = require("../../utils/auth0.middleware");
│ ^^^^^^^^^^
13 │ jest.mock("../../utils/DAL");
14 │ const db = require("../../utils/DAL");

i Unused variables are often the result of an incomplete refactoring, typos, or other sources of bugs.

i Unsafe fix: If this is intentional, prepend middleware with an underscore.

 10  10 │       }),
 11  11 │   }));
 12     │ - const·middleware·=·require("../../utils/auth0.middleware");
     12 │ + const·_middleware·=·require("../../utils/auth0.middleware");
 13  13 │   jest.mock("../../utils/DAL");
 14  14 │   const db = require("../../utils/DAL");

Backend/tests/unit/users.unit.test.js:290:15 lint/correctness/noUnusedVariables FIXABLE ━━━━━━━━━━

! This variable expected is unused.

288 │ describe("mock GET roles", () => {
289 │     test("should return 200 OK", () => {

290 │ const expected = fakeRoles;
│ ^^^^^^^^
291 │ return request(app)
292 │ .get("/roles")

i Unused variables are often the result of an incomplete refactoring, typos, or other sources of bugs.

i Unsafe fix: If this is intentional, prepend expected with an underscore.

288 288 │   describe("mock GET roles", () => {
289 289 │       test("should return 200 OK", () => {
290     │ - ········const·expected·=·fakeRoles;
    290 │ + ········const·_expected·=·fakeRoles;
291 291 │           return request(app)
292 292 │               .get("/roles")

Backend/utils/auth0.middleware.js:6:5 lint/correctness/noUnusedVariables ━━━━━━━━━━━━━━━━━━━━━━━━━━━

! This variable InsufficientScopeError is unused.

4 │     auth,
5 │     claimCheck,

6 │ InsufficientScopeError,
│ ^^^^^^^^^^^^^^^^^^^^^^
7 │ } = require("express-oauth2-jwt-bearer");
8 │

i Unused variables are often the result of an incomplete refactoring, typos, or other sources of bugs.

Backend/tests/unit/DAL.unit.test.js:755:58 lint/suspicious/noDuplicateObjectKeys FIXABLE ━━━━━━━━━━

× This property is later overwritten by an object member with the same name.

753 │         error.code = "22030"; //as per psql guideline
754 │         mockQuery.mockRejectedValueOnce(error);

755 │ await expect(dal.updateDashboard("auth0|user", { Bingus:1, Bingus: 2 }, {})).rejects.toThrow(
│ ^^^^^^^^
756 │ "Invalid JSON text",
757 │ );

i Overwritten with this property.

753 │         error.code = "22030"; //as per psql guideline
754 │         mockQuery.mockRejectedValueOnce(error);

755 │ await expect(dal.updateDashboard("auth0|user", { Bingus:1, Bingus: 2 }, {})).rejects.toThrow(
│ ^^^^^^^^^
756 │ "Invalid JSON text",
757 │ );

i If an object property with the same name is defined multiple times (except when combining a getter with a setter), only the last definition makes it into the object and previous definitions are ignored.

i Unsafe fix: Remove this property.

755 │ ········await·expect(dal.updateDashboard("auth0|user",·{·Bingus:1,·Bingus:·2·},·{})).rejects.toThrow(
    │                                                          ----------                                  

Checked 42 files in 96ms. Fixed 1 file.
Found 1 error.
Found 11 warnings.
lint ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

× Some errors were emitted while running checks.

🌏

@github-actions
Copy link

github-actions bot commented Jul 9, 2025

🧪 Admin Dashboard Test Results

33 tests   33 ✅  1s ⏱️
 9 suites   0 💤
 1 files     0 ❌

Results for commit 441b9eb.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jul 9, 2025

🧪 Frontend Unit Test Results

13 tests  ±0   13 ✅ ±0   0s ⏱️ ±0s
 3 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit 441b9eb. ± Comparison against base commit 674828f.

♻️ This comment has been updated with latest results.

@github-actions
Copy link

github-actions bot commented Jul 9, 2025

🧪 Backend Unit Test Results

  1 files  ± 0   18 suites  +1   2m 39s ⏱️ + 1m 38s
273 tests  - 41  273 ✅ +21  0 💤 ±0  0 ❌  - 62 
295 runs   - 41  295 ✅ +21  0 💤 ±0  0 ❌  - 62 

Results for commit 441b9eb. ± Comparison against base commit 674828f.

This pull request removes 67 and adds 26 tests. Note that renamed tests count towards both.
DELETE category 200 OK basic DELETE ‑ DELETE category 200 OK basic DELETE
DELETE category 400 DELETE for categories that still have associated questions ‑ DELETE category 400 DELETE for categories that still have associated questions
DELETE category 400 DELETE for invalid resource identifier ‑ DELETE category 400 DELETE for invalid resource identifier
DELETE category 403 for token with invalid scope ‑ DELETE category 403 for token with invalid scope
DELETE category 404 invalid DELETE for resource that does not exist ‑ DELETE category 404 invalid DELETE for resource that does not exist
DELETE party 200 OK basic DELETE ‑ DELETE party 200 OK basic DELETE
DELETE party 400 DELETE for invalid resource identifier ‑ DELETE party 400 DELETE for invalid resource identifier
DELETE party 403 for token with invalid scope ‑ DELETE party 403 for token with invalid scope
DELETE party 404 invalid DELETE for resource that does not exist ‑ DELETE party 404 invalid DELETE for resource that does not exist
DELETE quiz question 200 OK basic DELETE ‑ DELETE quiz question 200 OK basic DELETE
…
JSON validator should fail for invalid JSON ‑ JSON validator should fail for invalid JSON
JSON validator should pass for valid JSON ‑ JSON validator should pass for valid JSON
authenticated mock GET dashboard data should return 200 OK ‑ authenticated mock GET dashboard data should return 200 OK
authenticated mock GET dashboard data should return 500 if DB error ‑ authenticated mock GET dashboard data should return 500 if DB error
authenticated mock PUT dashboard data should return 200 OK if no previous resource ‑ authenticated mock PUT dashboard data should return 200 OK if no previous resource
authenticated mock PUT dashboard data should return 200 OK if updating resource ‑ authenticated mock PUT dashboard data should return 200 OK if updating resource
authenticated mock PUT dashboard data should return 400 if invalid JSON ‑ authenticated mock PUT dashboard data should return 400 if invalid JSON
authenticated mock PUT dashboard data should return 400 if missing fields ‑ authenticated mock PUT dashboard data should return 400 if missing fields
authenticated mock PUT dashboard data should return 500 if DB error ‑ authenticated mock PUT dashboard data should return 500 if DB error
mock DELETE dashboard should delete dashboard ‑ mock DELETE dashboard should delete dashboard
…

♻️ This comment has been updated with latest results.

@MoshiMoshiMochi MoshiMoshiMochi requested a review from Harjun751 July 9, 2025 08:52
@codecov
Copy link

codecov bot commented Jul 10, 2025

Codecov Report

Attention: Patch coverage is 67.13287% with 47 lines in your changes missing coverage. Please review.

Project coverage is 92.03%. Comparing base (0869a15) to head (441b9eb).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
Backend/utils/analytics.utils.js 9.67% 28 Missing ⚠️
Backend/utils/secrets.js 0.00% 8 Missing ⚠️
Backend/routes/analytics.route.js 50.00% 5 Missing ⚠️
Backend/utils/DAL.js 93.75% 3 Missing ⚠️
Backend/routes/dashboard.route.js 93.93% 2 Missing ⚠️
Backend/routes/users.route.js 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #34      +/-   ##
==========================================
- Coverage   97.23%   92.03%   -5.20%     
==========================================
  Files          17       20       +3     
  Lines         688      829     +141     
==========================================
+ Hits          669      763      +94     
- Misses         19       66      +47     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Owner

@Harjun751 Harjun751 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Top 10 PR of all time, lgtm, we fix codecov later :)

@Harjun751 Harjun751 merged commit a8f4040 into main Jul 10, 2025
7 of 9 checks passed
@Harjun751 Harjun751 deleted the thad/JIRA-58-create-dashboard-page branch July 12, 2025 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants