From 6757b3b383d9a47f5dfd1e28e81b1f32dcf3c528 Mon Sep 17 00:00:00 2001 From: Andrew Lee <87255788+leeaj8-uci@users.noreply.github.com> Date: Wed, 2 Aug 2023 05:41:45 -0700 Subject: [PATCH] Some bug fixes and updates to the README.md (#49) * Update yarn files + gitignore * Added error message that came up during maintenance * Fix issue where columns were displayed alphabetically instead of in their intended order * Some basic formatting for the User schema * Show error in backend when connecting even if there isn't a nice message * Make stylistic edits including minor edits to DB schema * Update schema slightly * Delete unneeded CD.yml file * (Tried to) upgrade packages * Update README.md --- .github/workflows/CD.yml | 30 - .gitignore | 3 +- .yarnrc.yml | 5 + README.md | 114 +- package.json | 24 +- public/logo512.png | Bin 0 -> 98422 bytes public/readme-images/add-data.png | Bin 0 -> 37949 bytes public/readme-images/dashboard-popup.png | Bin 0 -> 90446 bytes public/readme-images/dashboard.png | Bin 0 -> 48993 bytes public/readme-images/manage-data.png | Bin 0 -> 75886 bytes public/readme-images/query-data.png | Bin 0 -> 77264 bytes routes/rakers.router.js | 4 +- routes/tables.router.js | 9 +- server/db.js | 3 +- server/schema/clams.sql | 36 +- server/schema/computation.sql | 22 +- server/schema/raker.sql | 50 +- server/schema/survey.sql | 20 +- server/schema/user.sql | 10 +- yarn.lock | 9183 +++++++++++++--------- 20 files changed, 5854 insertions(+), 3659 deletions(-) delete mode 100644 .github/workflows/CD.yml create mode 100644 .yarnrc.yml create mode 100644 public/logo512.png create mode 100644 public/readme-images/add-data.png create mode 100644 public/readme-images/dashboard-popup.png create mode 100644 public/readme-images/dashboard.png create mode 100644 public/readme-images/manage-data.png create mode 100644 public/readme-images/query-data.png diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml deleted file mode 100644 index 9699159..0000000 --- a/.github/workflows/CD.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: EC2 Deploy - -on: - push: - branches: dev - -jobs: - Deploy: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Deploy in EC2 - env: - PRIVATE_KEY: ${{ secrets.AWS_EC2_PRIVATE_KEY }} - HOSTNAME : ${{ secrets.AWS_EC2_HOSTNAME }} - USER: ${{ secrets.AWS_EC2_USER }} - - run: | - echo "$PRIVATE_KEY" > private_key.pem && chmod 600 private_key.pem - ssh -o StrictHostKeyChecking=no -i private_key.pem ${USER}@${HOSTNAME} ' - - #Now we have got the access of EC2 and we will start the deploy . - cd ~/get-inspired-backend && - git checkout dev && - git stash && - git pull origin dev && - yarn && - pm2 restart app.js - ' diff --git a/.gitignore b/.gitignore index 5dc7d0a..fbcdf37 100644 --- a/.gitignore +++ b/.gitignore @@ -47,8 +47,9 @@ typings/ # TypeScript cache *.tsbuildinfo -# Optional npm cache directory +# Optional npm/yarn cache directories .npm +.yarn/ # Optional eslint cache .eslintcache diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 0000000..e55ce3b --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1,5 @@ +nodeLinker: node-modules + +plugins: + - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs + spec: "@yarnpkg/plugin-interactive-tools" diff --git a/README.md b/README.md index 4636607..6c1c356 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,101 @@ # Get Inspired +
+ +
-This is the backend for the Get Inspired project! ++ 🌐Website | + Facebook | + Instagram | + Youtube +
-## Setting up development environment +Get Inspired promotes ocean restoration awareness and education among youths through engaging the community in environmental stewardship. They host programs that educate students on marine life and provide volunteer opportunities to restore and preserve marine ecosystems. -To start working on with this project, follow these steps: -1. Install the [EditorConfig plugin](https://editorconfig.org/#download) for your IDE. -1. Add the `.env` file stored in your projects Google Drive folder to the root of the project. -1. Navigate to the project folder in your terminal and run `npm install` to install required packages. ++ +
-## Project branching structure +## 🔎 About the Project -Due to complications with some of the GitHub Actions this project uses, the git branch structure is non-standard. +*Nancy, the director of Get Inspired, has been maintaining Pismo clam data using spreadsheets. However, as the volume of data grows, efficiently collecting and displaying the information has become increasingly challenging.* -1. `dev`: This is the main branch of the project. All PRs should be merged into this branch, as if it was "main". -1. `main`: This is the "production-ready" branch of the project; `dev` should only be merged into `main` when it is at a presentable state. +🆙 We built a web application and database to store and display a variety of information about Pismo clams, including their color, location, date and time of survey, and other key characteristics. Our interface allows Nancy to easily input, view, and query the data as necessary. The dashboard shows each survey's automatically calculated statistics, which will be used to identify ways to restore the clam population. -## Available Scripts ++ + + + +
+ +### Tech Stack + +**🔼 [Frontend](https://github.com/ctc-uci/get-inspired-frontend/):** React (UI Kit: [AntDesign](https://ant.design/)) + Firebase (Authentication) + +**🔽 [Backend](https://github.com/ctc-uci/get-inspired-backend):** NodeJS + MySQL + +--- + +## 💻 Development + +This subsection contains further details on the more technical aspects of the project, including information for developers. + + +### Project branching structure -In the project directory, you can run: +Due to complications with some of the GitHub Actions this project uses, the git branch structure is non-standard: `dev` is the main branch of the project. All PRs should be merged into this branch, as if it were the "main" branch. -### `npm start` -Runs the app in the development mode, with hot-reload support from [nodemon](https://github.com/remy/nodemon).\ -The server will be accessible from http://localhost:3001, and will reload if you make edits.\ -You will also see any lint errors in the console. +## 🔨 Setting up the Development Environment + +To start working on with this project, follow these steps: +1. Install [Node.js](https://nodejs.org/en) and [Yarn](https://yarnpkg.com/getting-started/install), if you haven't already. +2. Clone the repository and navigate to the project folder: + ``` + git clone https://github.com/ctc-uci/get-inspired-backend.git + cd get-inspired-backend + ``` +3. Place the `.env` file in the project's root directory. + - If you are currently maintaining this project, ask your organziation or contact CTC for the most up-to-date `.env` file. + - If you are making the `.env` file youself, it should follow this structure: + ```bash + NODE_ENV=development + + # react info + REACT_APP_HOST= + REACT_APP_PROD_HOST= + REACT_APP_PROD_PORT= + + # aws info + AWS_REGION= + AWS_HOST= + AWS_DB_NAME= + AWS_USER= + AWS_PORT= + AWS_PASSWORD= + + # react app info + REACT_APP_EMAIL_FIRST_NAME= + REACT_APP_EMAIL_LAST_NAME= + REACT_APP_EMAIL_USERNAME= + REACT_APP_EMAIL_PASSWORD= + ``` +4. Install the [EditorConfig plugin](https://editorconfig.org/#download) for your IDE. +5. Run `yarn` to install the required packages. +6. (Optionally) Run `yarn start` to run the project locally! + +## Available Scripts + +### Run (Development): `yarn start` +To run the project locally in development mode, use `yarn start`, then open [http://localhost:3000](http://localhost:3000) to view it in the browser. The console will show any lint errors, and the apge will reload after you make local edits to the code. -### `npm run format` -Formats `.js` files with Prettier.\ -See the [Prettier docs](https://prettier.io/docs/en/index.html) for more information. +### Format: `yarn format` +Run `yarn format` to format all `.js`, `.jsx`, `.css` files with [Prettier](https://prettier.io/docs/en/index.html) (see [ESLint and Prettier](#eslint-and-prettier) below). + +### Build: `yarn build` +Builds the app for production to the `build` folder. ## ESLint and Prettier @@ -38,7 +104,8 @@ This project uses ESLint and Prettier to enforce the [Airbnb JavaScript Style Gu ### ESLint Plugins Currently, the following ESLint plugins are installed: -1. [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) +- [eslint-plugin-react](https://github.com/yannickcr/eslint-plugin-react) +- [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) Visit the links to learn more about each plugin. @@ -61,10 +128,3 @@ Use the `--no-verify` option to skip pre-commit checks, but please note that thi The configuration for lint-staged is inside the `lint-staged` object inside of `package.json`. Learn more about lint-staged [here](https://github.com/okonet/lint-staged). The configuration for husky is in the `.husky` directory, located in the root of the project. Learn more about husky [here](https://typicode.github.io/husky/). - - -## Learn more about Node and ExpressJS - -You can learn about Node [here](https://nodejs.org/en/). - -To learn about express, check out the this express tutorial [here](https://www.tutorialspoint.com/nodejs/nodejs_express_framework.htm). \ No newline at end of file diff --git a/package.json b/package.json index 0742934..e2b8179 100644 --- a/package.json +++ b/package.json @@ -16,25 +16,25 @@ "*.js": "yarn run eslint" }, "dependencies": { - "@babel/runtime": "^7.21.0", - "@react-awesome-query-builder/core": "^6.1.1", + "@babel/runtime": "^7.22.6", + "@react-awesome-query-builder/core": "^6.4.1", "cookie-parser": "^1.4.6", "cors": "^2.8.5", - "csv-parse": "^5.3.6", + "csv-parse": "^5.4.0", "dotenv": "^10.0.0", - "eslint": "^8.1.0", - "eslint-config-airbnb-base": "^14.2.1", - "eslint-plugin-import": "^2.25.2", - "eslint-plugin-prettier": "^4.0.0", - "express": "^4.17.1", - "firebase-admin": "^11.3.0", + "eslint": "^8.46.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-plugin-import": "^2.28.0", + "eslint-plugin-prettier": "^4.2.1", + "express": "^4.18.2", + "firebase-admin": "^11.10.1", "mysql": "^2.18.1", "named-placeholders": "^1.1.3", - "nodemon": "^2.0.20", - "prettier": "^2.4.1" + "nodemon": "^2.0.22", + "prettier": "^2.8.8" }, "devDependencies": { - "eslint-config-prettier": "^8.3.0", + "eslint-config-prettier": "^8.9.0", "husky": "^7.0.4", "lint-staged": "^11.2.6" } diff --git a/public/logo512.png b/public/logo512.png new file mode 100644 index 0000000000000000000000000000000000000000..992b67ea88758c2801a2a427dd94c4e061f53d64 GIT binary patch literal 98422 zcmaG{byyo;uniC(SkdCeol+?74#nNwp}1Rt;1n-z#S64J#WgrBPAO6>&|t+~LwNbU z_y7CyCA-OPzP&ql=FXgRX5+Oq-r-?WVgmpGJY^+$9RL6oxr+(_VIVhGfxjP+8=#|% zx(oo&l!^nlMn`_9vsKbj2LOUu0D$ml0N}q@9+JU@47iz5$U z*r>jf2R#4xD(S7tK>mX1tE{eoxrg}*_y$LfvbquZXMnQ2j9%c%(UW0-opLr52hpDQ z>fec{6CDAsoTH-R!DMy)8~+@q@5+Lv0o)gFyv^&kcB+GNtMX=e@tY6qX&g>=da0}X zNYvM-vh}m{vyAhMvv^x%rH6J19oqJ`I>e|!Uq5>OXoRY0Vv28$rP5lPp5h5pzla;! z^89}`!s)Xzr{P0hdiNW*eeDI0aYcWx*ZbNEz^j^f?9azR79S!{!OxG~4`OjcO+`cB z!-c8i^36ey>mZMnEytCe5A7e0>6VoPrDkTj{~(BkEBd#V^ZxI&SVw}J?w3bV!5hv} zFB0m2H_hUgf~$W{_NKxt<8-m9Q?9AA(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