Skip to content

Commit

Permalink
Merge pull request #1655 from Spiteless/vite
Browse files Browse the repository at this point in the history
Vite
  • Loading branch information
trillium authored Jun 3, 2024
2 parents bb1cb5f + 1234816 commit 6e2879a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backend/globalConfig.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"mongoUri":"mongodb://127.0.0.1:63857/jest?","mongoDBName":"jest"}
{"mongoUri":"mongodb://127.0.0.1:53806/jest?","mongoDBName":"jest"}
5 changes: 4 additions & 1 deletion backend/models/project.test.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down
5 changes: 4 additions & 1 deletion backend/models/user.test.js
Original file line number Diff line number Diff line change
@@ -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", () => {
Expand Down
11 changes: 8 additions & 3 deletions client/src/pages/ProjectList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
1 change: 1 addition & 0 deletions client/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default defineConfig(({ mode }) => {
],
server: {
port: env.CLIENT_PORT,
host: true,
proxy: {
'/api': {
target: env.REACT_APP_PROXY,
Expand Down

0 comments on commit 6e2879a

Please sign in to comment.