Skip to content

Commit

Permalink
Merge branch 'development' into lcchrty/issue1646
Browse files Browse the repository at this point in the history
  • Loading branch information
lcchrty authored Sep 24, 2024
2 parents acb2fd6 + efb3345 commit d7f777d
Show file tree
Hide file tree
Showing 96 changed files with 4,205 additions and 12,093 deletions.
22 changes: 13 additions & 9 deletions .github/ISSUE_TEMPLATE/add-remove-pm-admin-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@ name: Add/Remove PM Admin Access
about: VRMS admin team members are currently adding or removing product managers manually.
This issue is how PMs can request changes to access on VRMS.
title: 'Add/Remove PM Admin Access: [name of project]'
labels: 'role: Product, time-sensitive'
labels: 'p-feature: Add/Remove PM access, role: Product, time-sensitive'
assignees: ''

---

Person who is staying on the team or leaving a team, person adds ticket.

feature: add/remove admin access
### Required information
- Name of PM requesting changes (your name):
- Slack handle:

Required information:
- Name of PM:
- Are they being added or remove Who is being added as a new PM on the team and needs admin access to the project on VRMS?
- Slack Handle:
- Email
- Add or Remove.
- Who has the access now, who to remove?
#### People you are removing
- Name:
- Slack Handle:
- Email:

#### People you are adding
- Name:
- Slack Handle:
- Email:
13 changes: 0 additions & 13 deletions .github/workflows/New-issue-create-card.yml

This file was deleted.

5 changes: 5 additions & 0 deletions .github/workflows/aws-frontend-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ jobs:
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.ref }}
- name: Checkout
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
18
1 change: 1 addition & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VRMS is governed by the [Hack for LA Code of Conduct](https://www.hackforla.org/code-of-conduct/) which applies to any interaction on our VRMS slack channel (inside the HackforLA Slack workspace), direct slack messages, github org or repository, or any other communication medium.
6 changes: 3 additions & 3 deletions backend/Dockerfile.api
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
FROM node:14.11.0 AS api-development
FROM node:18.12.0 AS api-development
RUN mkdir /srv/backend
WORKDIR /srv/backend
RUN mkdir -p node_modules
COPY package.json yarn.lock ./
RUN yarn install --pure-lockfile
COPY . .

FROM node:14.11.0 AS api-test
FROM node:18.12.0 AS api-test
RUN mkdir /srv/backend
WORKDIR /srv/backend
COPY package.json yarn.lock ./
RUN yarn install --silent
RUN mkdir -p node_modules

FROM node:14.11.0-slim AS api-production
FROM node:18.12.0-slim AS api-production
EXPOSE 4000
USER node
WORKDIR /srv/backend
Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.11.0 AS api-development
FROM node:18.12.0 AS api-development
RUN mkdir /srv/backend
WORKDIR /srv/backend
RUN mkdir -p node_modules
Expand Down
4 changes: 2 additions & 2 deletions backend/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:14.11.0 AS api-builder
FROM node:18.12.0 AS api-builder
RUN mkdir /srv/backend
WORKDIR /srv/backend
RUN mkdir -p node_modules
COPY package.json yarn.lock ./
RUN yarn install --pure-lockfile
COPY . .

FROM node:14.11.0-slim AS api-production
FROM node:18.12.0-slim AS api-production
EXPOSE 4000
USER node
WORKDIR /srv/backend
Expand Down
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
6 changes: 5 additions & 1 deletion backend/models/user.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ const userSchema = mongoose.Schema({
lastName: { type: String },
},
email: { type: String, unique: true },
accessLevel: { type: String, default: "user" },
accessLevel: {
type: String,
enum: ["user", "admin"], // restricts values to "user" and "admin"
default: "user"
},
createdDate: { type: Date, default: Date.now },
currentRole: { type: String }, // will remove but need to update check-in form
desiredRole: { type: String }, // will remove but need to update check-in form
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
4 changes: 2 additions & 2 deletions client/Dockerfile.client
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:14.11.0 AS client-development
FROM node:18-alpine AS client-development
RUN mkdir /srv/client && chown node:node /srv/client
WORKDIR /srv/client
USER node
RUN mkdir -p node_modules
COPY --chown=node:node package.json package.json ./
RUN npm install --silent

FROM node:14.11.0-slim AS client-builder
FROM node:18.12.0-slim AS client-builder
USER node
WORKDIR /srv/client
COPY --from=client-development /srv/client/node_modules node_modules
Expand Down
2 changes: 1 addition & 1 deletion client/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14.11.0 AS client-development
FROM node:18-alpine AS client-development
RUN mkdir /srv/client && chown node:node /srv/client
WORKDIR /srv/client
USER node
Expand Down
6 changes: 3 additions & 3 deletions client/Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:14.11.0 AS node-modules-install
FROM node:20-alpine AS node-modules-install
RUN mkdir /srv/client && chown node:node /srv/client
WORKDIR /srv/client
USER node
RUN mkdir -p node_modules
COPY --chown=node:node package.json package.json ./
RUN npm install --silent
RUN npm install --no-update-notifier

FROM node:14.11.0-slim AS client-builder
FROM node:18-slim AS client-builder
USER node
WORKDIR /srv/client
COPY --from=node-modules-install /srv/client/node_modules node_modules
Expand Down
9 changes: 5 additions & 4 deletions client/public/index.html → client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
Expand All @@ -18,13 +18,13 @@
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="manifest" href="/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
Notice the use of in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
Unlike "/favicon.ico" or "favicon.ico", "/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
Expand All @@ -33,6 +33,7 @@
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="/src/index.jsx"></script>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
Expand Down
34 changes: 22 additions & 12 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
"@emotion/styled": "^11.10.6",
"@mui/icons-material": "^5.14.19",
"@mui/material": "^5.11.12",
"@vitejs/plugin-react": "^4.0.3",
"@vitejs/plugin-react-swc": "^3.3.2",
"classnames": "^2.2.6",
"cross-env": "^7.0.2",
"cross-var": "^1.1.0",
Expand All @@ -21,20 +23,22 @@
"minimist": "^1.2.6",
"moment": "^2.29.2",
"moment-recur": "^1.0.7",
"react": "^16.13.1",
"react-datepicker": "^3.1.3",
"react-dom": "^16.13.1",
"react": "^18.2.0",
"react-datepicker": "^4.16.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.44.3",
"react-router-dom": "^5.1.2",
"react-scripts": "^3.4.1",
"validator": "^13.7.0"
"validator": "^13.7.0",
"vite": "^4.4.4",
"vite-plugin-svgr": "^3.2.0"
},
"scripts": {
"start": "dotenv -e .env -e ../backend/.env -- cross-var cross-env PORT=%CLIENT_PORT% react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --watchAll=false",
"test:watch": "react-scripts test",
"eject": "react-scripts eject",
"vite": "vite",
"dev": "vite",
"start": "dotenv -e .env -e ../backend/.env -- cross-var cross-env PORT=%CLIENT_PORT% vite",
"build": "vite build",
"test": "vitest run",
"preview": "vite preview",
"heroku-postbuild": "npm run build"
},
"eslintConfig": {
Expand All @@ -55,6 +59,8 @@
"author": "sarL3y",
"license": "ISC",
"devDependencies": {
"@testing-library/dom": "^10.3.2",
"@testing-library/react": "^16.0.0",
"eslint-config-airbnb": "^18.2.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "^6.11.0",
Expand All @@ -63,8 +69,12 @@
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-react": "^7.20.6",
"eslint-plugin-react-hooks": "^4.1.2",
"jsdom": "^24.1.0",
"prettier": "^2.1.1",
"react-test-renderer": "^16.13.1",
"sass": "^1.49.7"
"sass": "^1.49.7",
"vitest": "^1.6.0"
},
"engines": {
"node": "<=18.0.0"
}
}
17 changes: 17 additions & 0 deletions client/src/api/UserApiService.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,23 @@ class UserApiService {
alert('server not responding. Please try again.');
}
}

// Update user's access level (admin/user)
async updateUserAccessLevel(userToEdit, accessLevel) {
const url = `${this.baseUserUrl}${userToEdit._id}`;
const requestOptions = {
method: 'PATCH',
headers: this.headers,
body: JSON.stringify({ accessLevel }),
};

try {
return await fetch(url, requestOptions);
} catch (err) {
console.error('update access level error', err);
alert('server not responding. Please try again.');
}
}
}

export default UserApiService;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Leaderboard = (props) => {

setUsers(resJson);
} catch(error) {
alert(error);
console.log(error);
}
};

Expand Down
8 changes: 0 additions & 8 deletions client/src/components/Leaderboard.test.js

This file was deleted.

9 changes: 9 additions & 0 deletions client/src/components/Leaderboard.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from "react";
import LeaderBoard from "./Leaderboard";
import { render } from "@testing-library/react";
import { test, expect } from 'vitest';

test("renders without crashing", () => {
const { container } = render(<LeaderBoard />);
expect(container).toMatchSnapshot();
});
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions client/src/components/__snapshots__/Leaderboard.test.jsx.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`renders without crashing 1`] = `
<div>
<div
class="flexcenter-container"
>
<div
class="dashboard-header"
>
<p
class="dashboard-header-text-large"
>
Volunteer Leaderboard
</p>
</div>
<div
class="events-list"
>
<ul />
</div>
</div>
</div>
`;
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d7f777d

Please sign in to comment.