diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index e27766d2..a5d88100 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -16,7 +16,7 @@ What steps did you take to verify your changes work? These should be clear enoug Describe any new unit tests you added. -Provide screenshots of any new components, styling changes, or pages. +Provide screenshots of any new components, styling changes, or pages. ### 🏕️ (Optional) Future Work / Notes diff --git a/.github/workflows/backend-tests.yml b/.github/workflows/backend-tests.yml index 2a419624..981caf00 100644 --- a/.github/workflows/backend-tests.yml +++ b/.github/workflows/backend-tests.yml @@ -1,6 +1,16 @@ on: [push, pull_request] jobs: + prettier-check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + - run: yarn install + - run: yarn prettier:check + backend-tests: runs-on: ubuntu-latest services: @@ -30,7 +40,6 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 20 - - run: yarn install --frozen-lockfile - run: yarn list strip-ansi string-width string-length - - run: yarn test \ No newline at end of file + - run: npx jest \ No newline at end of file diff --git a/README.md b/README.md index cc7d8a8f..ec47314a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,8 @@ yarn install To set up your backend, follow the backend-specific instructions [here](apps/backend/README.md). -*Note: you may need to prefix your `nx` commands with `npx`. For example, to serve the frontend, if: +\*Note: you may need to prefix your `nx` commands with `npx`. For example, to serve the frontend, if: + ``` nx serve frontend ``` @@ -24,6 +25,7 @@ npx nx serve frontend ## Start the app To start the development server, run one of the following commands: + - To run the frontend at http://localhost:4200/: `nx serve frontend` - To run the backend at http://localhost:3000/: `nx serve backend` - The homepage includes the Swagger API documentation. diff --git a/apps/backend/README.md b/apps/backend/README.md index d2b154bc..ebe04a3c 100644 --- a/apps/backend/README.md +++ b/apps/backend/README.md @@ -10,11 +10,11 @@ You'll need to download: Then, set up a database called `securing-safe-food`. If you're not familiar with how to do so, it's easy to do through PgAdmin 1. Open PgAdmin and configure your credentials (if necessary). Then, right click on the `Databases` dropdown (under `Servers` > `PostgreSQL [version]`) - + ![alt text](resources/pg-setup-1.png) 2. Enter "securing-safe-food" as the database name - + ![alt text](resources/pg-setup-2.png) Next, create a file called `.env` in the **root directory** (under `ssf/`) and copy over the contents from `.env.example`. Replace `DATABASE_PASSWORD` with the password you entered for the `postgres` user (NOT necessarily your PgAdmin master password!) @@ -25,13 +25,14 @@ You can check that your database connection details are correct by running `nx s "LOG 🚀 Application is running on: http://localhost:3000/api" ``` -Finally, run `yarn run typeorm:migrate` to load all the tables into your database. If everything is set up correctly, you should see "Migration ... has been executed successfully." in the terminal. +Finally, run `yarn run typeorm:migrate` to load all the tables into your database. If everything is set up correctly, you should see "Migration ... has been executed successfully." in the terminal. # AWS Setup We have a few environment variables that we utilize to access several AWS services throughout the application. Below is a list of each of them and how to access each after logging in to AWS 1. `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`: + - Click on your username in the top right corner, and navigate to Security Credentials - Scroll down to access keys, and create a new key - Select "Local code" as the purpose for the key, and add an optional description @@ -39,15 +40,16 @@ We have a few environment variables that we utilize to access several AWS servic - Click done 2. `AWS_REGION`: -This can be found next to your profile name when you login to the main page. Some accounts may be different, but we generally use us-east-1 or us-east-2. -This is the region that you find on the right side after clicking on the location dropdown, usually saying "United States (*some region*)". -For example, if we want to use Ohio as the region, we would put `AWS_REGION="us-east2"` + This can be found next to your profile name when you login to the main page. Some accounts may be different, but we generally use us-east-1 or us-east-2. + This is the region that you find on the right side after clicking on the location dropdown, usually saying "United States (_some region_)". + For example, if we want to use Ohio as the region, we would put `AWS_REGION="us-east2"` 3. `AWS_BUCKET_NAME`: -This one is already given to you. As of right now, we only use one bucket, confirm-delivery-photos to store photos in a public S3 Bucket. This may be subject to change as we use S3 more in the project. + This one is already given to you. As of right now, we only use one bucket, confirm-delivery-photos to store photos in a public S3 Bucket. This may be subject to change as we use S3 more in the project. 4. `COGNITO_CLIENT_SECRET`: -This is used to help authenticate you with AWS Cognito and allow you to properly sign in using proper credential. To find this: + This is used to help authenticate you with AWS Cognito and allow you to properly sign in using proper credential. To find this: + - Navigate to AWS Cognito - Make sure you are on "United States (N. Virginia) as your region - Go into User pools and click on the one that says "ssf" (NOTE: You can also validate the User pool id in the `auth/aws_exports.ts` file) @@ -64,7 +66,7 @@ This is used to help authenticate you with AWS Cognito and allow you to properly - Click 'Create User' - Load up the app, and go to the landing page - Verify you are able to login with these new credentials you created - + ### Running backend tests 1. Create a **separate** Postgres database (for example `securing-safe-food-test`). diff --git a/apps/frontend/tsconfig.json b/apps/frontend/tsconfig.json index a664b36c..8ce3a2df 100644 --- a/apps/frontend/tsconfig.json +++ b/apps/frontend/tsconfig.json @@ -14,8 +14,8 @@ "@public/*": ["../public/*"], "@shared/*": ["../../../shared/*"], "@utils/*": ["utils/*"], - "@loaders/*": ["loaders/*"], - }, + "@loaders/*": ["loaders/*"] + } }, "files": [], "include": [], diff --git a/apps/frontend/vite.config.ts b/apps/frontend/vite.config.ts index 0f5bdfff..e9a13d9c 100644 --- a/apps/frontend/vite.config.ts +++ b/apps/frontend/vite.config.ts @@ -41,7 +41,7 @@ export default defineConfig({ '@public': path.resolve(__dirname, './public'), '@shared': path.resolve(__dirname, '../../shared'), '@utils': path.resolve(__dirname, './src/utils'), - '@loaders': path.resolve(__dirname, './src/loaders') + '@loaders': path.resolve(__dirname, './src/loaders'), }, }, }); diff --git a/package.json b/package.json index 8652eef2..d28c7dbc 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,9 @@ "prepare": "husky install", "typeorm:migrate": "ts-node --project apps/backend/tsconfig.app.json -r dotenv/config ./node_modules/typeorm/cli.js migration:run -d apps/backend/src/config/typeorm.ts", "typeorm:revert": "ts-node --project apps/backend/tsconfig.app.json -r dotenv/config ./node_modules/typeorm/cli.js migration:revert -d apps/backend/src/config/typeorm.ts", - "typeorm:create": "ts-node --project apps/backend/tsconfig.app.json -r dotenv/config ./node_modules/typeorm/cli.js migration:create" + "typeorm:create": "ts-node --project apps/backend/tsconfig.app.json -r dotenv/config ./node_modules/typeorm/cli.js migration:create", + "prettier:check": "prettier --check \"apps/**/*.{ts,tsx,js,jsx,json,md}\"", + "prettier:write": "prettier --write \"apps/**/*.{ts,tsx,js,jsx,json,md}\"" }, "private": true, "dependencies": { @@ -119,4 +121,4 @@ "strip-ansi": "6.0.1", "string-width": "4.2.3" } -} \ No newline at end of file +}