From e867b410267fed2d135e20f1c66ab4443a5b59c8 Mon Sep 17 00:00:00 2001 From: Trillium Smith Date: Thu, 30 May 2024 14:08:58 -0700 Subject: [PATCH 1/3] feat: Add host to server in config for docker development --- client/vite.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/client/vite.config.js b/client/vite.config.js index 4b883b46b..3cf906985 100644 --- a/client/vite.config.js +++ b/client/vite.config.js @@ -12,6 +12,7 @@ export default defineConfig(({ mode }) => { ], server: { port: env.CLIENT_PORT, + host: true, proxy: { '/api': { target: env.REACT_APP_PROXY, From b5c431e018ccb48bc7e1309eb29ec4dd46f7db31 Mon Sep 17 00:00:00 2001 From: Trillium Smith Date: Thu, 30 May 2024 17:40:40 -0700 Subject: [PATCH 2/3] feat: Restore sort functionality in ProjectList --- client/src/pages/ProjectList.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/src/pages/ProjectList.js b/client/src/pages/ProjectList.js index ae100e0f8..fd47269ae 100644 --- a/client/src/pages/ProjectList.js +++ b/client/src/pages/ProjectList.js @@ -46,16 +46,21 @@ export default function ProjectList() { if(user?.accessLevel === 'admin') { projectData = await projectApiService.fetchProjects(); - setProjects(projectData); } // if user is not admin, but is a project manager, only show projects they manage if (user?.accessLevel !== 'admin' && user?.managedProjects.length > 0) { projectData = await projectApiService.fetchPMProjects(user.managedProjects); - setProjects(projectData); } - } + + //sort the projects alphabetically + projectData = projectData.sort((a, b) => + a.name?.localeCompare(b.name) + ); + setProjects(projectData); + } + fetchAllProjects(); }, [projectApiService, user.accessLevel, user.managedProjects] From 123481604388f3ba66b037d452ea5a2d3bb2a315 Mon Sep 17 00:00:00 2001 From: Trillium Smith Date: Mon, 3 Jun 2024 10:35:43 -0700 Subject: [PATCH 3/3] feat: Update tests to use beforeAll on setupDB step --- backend/globalConfig.json | 2 +- backend/models/project.test.js | 5 ++++- backend/models/user.test.js | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/globalConfig.json b/backend/globalConfig.json index 0c381857a..24feb73f9 100644 --- a/backend/globalConfig.json +++ b/backend/globalConfig.json @@ -1 +1 @@ -{"mongoUri":"mongodb://127.0.0.1:63857/jest?","mongoDBName":"jest"} \ No newline at end of file +{"mongoUri":"mongodb://127.0.0.1:53806/jest?","mongoDBName":"jest"} \ No newline at end of file diff --git a/backend/models/project.test.js b/backend/models/project.test.js index 8cefa3138..0f00cdc7c 100644 --- a/backend/models/project.test.js +++ b/backend/models/project.test.js @@ -1,7 +1,10 @@ const { Project } = require('./project.model'); const { setupDB } = require("../setup-test"); -setupDB("project-model"); + +beforeAll(async () => { + await setupDB("user-model"); +}); describe("Project Model saves the correct values", () => { test("Save a model instance and then read from the db", async (done) => { diff --git a/backend/models/user.test.js b/backend/models/user.test.js index 97ef50d35..e2325f0bd 100644 --- a/backend/models/user.test.js +++ b/backend/models/user.test.js @@ -1,7 +1,10 @@ const { User } = require('./user.model'); const { setupDB } = require("../setup-test"); -setupDB("user-model"); + +beforeAll(async () => { + await setupDB("user-model"); +}); // Please add and expand on this simple test. describe("Question Model saves the correct values", () => {