Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Release 2021-09-06 #215

Merged
merged 34 commits into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
12f2be1
build(deps): bump react-hook-form from 7.14.1 to 7.14.2 in /client (#…
dependabot[bot] Aug 31, 2021
1bce5ea
build(deps-dev): bump eslint-plugin-prettier in /server (#188)
dependabot[bot] Sep 1, 2021
d9224b9
build(deps-dev): bump eslint-plugin-prettier in /client (#190)
dependabot[bot] Sep 1, 2021
27b6ccf
docs(readme): leave DBeaver to last, not needed to start (#193)
LoneRifle Sep 1, 2021
594b324
refactor(answers): type controllers as ControllerHandler (#185)
nauynix Sep 1, 2021
f93eafc
fix(search): have agency-specific results from agency page (#192)
LoneRifle Sep 1, 2021
f00cf2f
chore(header/footer): rename help center to AskGov (#198)
nauynix Sep 1, 2021
cb24ec9
refactor(search): refine SearchBox hooks, add `showSearchIcon` flag
LoneRifle Sep 1, 2021
566139d
fix(search): retain search results even on abandon
LoneRifle Sep 1, 2021
2f8484d
build(deps-dev): bump @types/node from 16.7.7 to 16.7.10 in /server (…
dependabot[bot] Sep 1, 2021
3da6baa
reaf(tags): type controllers as ControllerHandler (#197)
nauynix Sep 2, 2021
65ecd5d
refactor(auth): type controllers as ControllerHandler (#194)
nauynix Sep 2, 2021
466efca
refactor(post): type controllers as ControllerHandler (#177)
nauynix Sep 2, 2021
38dea01
fix(pages): scroll to top on loading all pages, not just legalese (#195)
nauynix Sep 2, 2021
48c2d41
refactor(header): migrate to Chakra (#196)
nauynix Sep 2, 2021
3ae6861
fix(footer): stick footer to bottom of post page (#204)
nauynix Sep 2, 2021
66c9b6c
chore(banner): prevent banner width from shrinking (#203)
nauynix Sep 2, 2021
1d195b5
feat(header): update askgov logo (#202)
nauynix Sep 2, 2021
7d0d632
refactor(search): make SearchBox a component, not a form
LoneRifle Sep 1, 2021
4cf6889
feat(enquiries): use SearchBox to suggest questions
LoneRifle Sep 1, 2021
4a479a4
feat(search): add searchOnEnter flag to SearchBox, default true
LoneRifle Sep 2, 2021
30411b1
chore: add focus and error colour to searchbox
nauynix Sep 2, 2021
0df1e64
Merge pull request #199 from opengovsg/feat/enquiries/suggest
LoneRifle Sep 2, 2021
9177799
build(deps): bump sass from 1.38.2 to 1.39.0 in /client (#205)
dependabot[bot] Sep 2, 2021
72d38c6
build(deps): bump axios from 0.21.1 to 0.21.3 in /server (#209)
dependabot[bot] Sep 5, 2021
462533d
build(deps): bump axios from 0.21.1 to 0.21.3 in /client (#211)
dependabot[bot] Sep 5, 2021
22f1185
build(deps): bump react-router-dom from 5.2.1 to 5.3.0 in /client (#212)
dependabot[bot] Sep 5, 2021
5d80476
build(deps): bump react-hook-form from 7.14.2 to 7.15.0 in /client (#…
dependabot[bot] Sep 5, 2021
7916986
build(deps-dev): bump @types/styled-components in /client (#214)
dependabot[bot] Sep 5, 2021
dea5063
chore: update readme (#208)
nauynix Sep 6, 2021
3e18bf0
build(deps): bump @aws-sdk/client-s3 from 3.28.0 to 3.29.0 in /server…
dependabot[bot] Sep 6, 2021
239407d
fix(search): ensure input is preserved on touchEnd event (#217)
LoneRifle Sep 6, 2021
ac034d1
docs(readme): fix typo on MySQL port number (#221)
LoneRifle Sep 6, 2021
89902c3
Revert "build(deps): bump @aws-sdk/client-s3 from 3.28.0 to 3.29.0 in…
LoneRifle Sep 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DB_HOST=localhost
DB_NAME=askgov
DB_USER=root
DB_PASSWORD=*create your own pw here*
DB_PASSWORD=password
SERVER_PORT=5000
NODE_ENV=development
JWT_SECRET=mysecrettoken
Expand All @@ -16,8 +16,8 @@ AWS_SECRET_ACCESS_KEY=localstack
MAIL_PORT=1025
MAIL_FROM=admin@ask.gov.sg
MAIL_HOST=127.0.0.1
MAIL_AUTH_USER=
MAIL_AUTH_PASS=
MAIL_AUTH_USER=user
MAIL_AUTH_PASS=password

BANNER_MESSAGE=

Expand Down
89 changes: 46 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# AskGov
Answers from the Singapore Government

## Tech Stack

#### Front-end

- Front-end Framework: `React`, switching to `react-query`
- Styling: `SASS` and `BOOTSTRAP`, switching to [Chakra UI](https://chakra-ui.com/)
- Front-end Framework: `React`
- Styling: `SASS` switching to [Chakra UI](https://chakra-ui.com/)

#### Back-end

Expand All @@ -16,87 +18,82 @@

[Git](https://git-scm.com/download/mac)

[Docker](https://docs.docker.com/desktop/mac/install/)

[direnv](https://formulae.brew.sh/formula/direnv#default)

Optionally [VSCode](https://code.visualstudio.com/) with extension `ESLint`

## Setup
Optionally [DBeaver](https://dbeaver.io/download/) to view database with GUI

* Create a `.env` file with the same format as `.env.example` and fill it in:
## Setup

For development:
```
DB_HOST=localhost
DB_NAME=askgov
DB_USER=root
DB_PASSWORD=*create your own pw here*
SERVER_PORT=5000
NODE_ENV=development
JWT_SECRET=mysecrettoken
* Make a copy of `.env.example` and name it `.env`

REACT_APP_RECAPTCHA_SITE_KEY=6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
RECAPTCHA_SECRET_KEY=6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe

FILE_BUCKET_NAME=files.ask.gov.sg
AWS_ACCESS_KEY_ID=localstack
AWS_SECRET_ACCESS_KEY=localstack
* [Hook](https://github.com/direnv/direnv/blob/master/docs/hook.md) direnv onto your appropriate shell. Load the environment variables:

MAIL_PORT=1025
MAIL_FROM=admin@ask.gov.sg
MAIL_HOST=127.0.0.1
```
direnv allow .
```

* Install and audit node dependencies

```
$ npm install (To install all the dependencies)
npm install

$ npm run auditDep (Run this to audit fix all the vulnerabilities)
npm run auditDep
```

* Install `direnv` [here](https://github.com/direnv/direnv/blob/master/docs/installation.md) and [hook](https://github.com/direnv/direnv/blob/master/docs/hook.md) it onto your appropriate shell. Load the environment variables:

* Spin up docker containers (this will create the `askgov` database):
```
$ direnv allow .
docker-compose up
```

* Spin up MySQL by running `docker-compose up`
* Create tables in database:

* Download a database GUI like [DBeaver](https://dbeaver.io/download/) and connect to the local MySQL server
```
npm run seq-cli db:migrate
```

* Seed the database with a sample dataset:

Create database by executing the following in `DBeaver`:
```sql
CREATE DATABASE askgov;
```
npm run seq-cli db:seed:all
```

* Execute `npm run seq-cli db:migrate` to create the tables

* Execute `npm run seq-cli db:seed:all` to seed the database with a sample dataset
* Optional: Use Dbeaver to connect to the local MySQL server at `127.0.0.1:3006`, using the username and password in `.env`

* Check that your Database ER Diagram looks like this:

![image](https://user-images.githubusercontent.com/20250559/130938844-60255d06-d07d-4c84-ad3f-0c13be7dcb67.png)


* Spin down MySQL by running `docker-compose down`
* Stop docker compose (`npm run dev` will spin it up again):

```
docker-compose stop
```

## Running in Development

* Start running frontend, backend, maildev, localstack and mysql simultaneously

```
$ npm run dev
npm run dev
```

Alternatively, to run individually:

```
# for supporting services
$ docker-compose up
docker-compose up

# for backend server only
$ npm run server
npm run server

# for frontend server only
$ npm run client
npm run client
```

Frontend server accessible on `localhost:3000`
Expand Down Expand Up @@ -149,10 +146,13 @@ Optionally [VSCode](https://code.visualstudio.com/) with extension `ESLint`
- `GET /agencies?<longname, shortname>`
- `GET /agencies/:agencyId`

#### Auth
- `GET /auth`
- `GET /auth/verifyotp`
- `GET /auth/sendotp`

#### Users

- `GET /auth`
- `POST /auth`
- `POST /users/:id`
- `GET /users/:id`

Expand All @@ -169,9 +169,12 @@ Optionally [VSCode](https://code.visualstudio.com/) with extension `ESLint`

- `GET /posts/answers/:id`
- `POST /posts/answers/:id`
- `PUT /posts/answers/:id`
- `DELETE /posts/answers/:id`

#### Tags

- `GET /tags`
- `GET /tags/:tag_name`
- `GET /tags/user`
- `GET /tags/agency/:agencyId`
- `GET /tags/:tagname`
38 changes: 19 additions & 19 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.2.1",
"axios": "^0.21.1",
"axios": "^0.21.3",
"downshift": "^6.1.7",
"draft-js": "^0.11.7",
"draftjs-to-html": "^0.9.1",
Expand All @@ -26,14 +26,14 @@
"react-ga": "^3.3.0",
"react-google-recaptcha": "^2.1.0",
"react-helmet": "6.1.0",
"react-hook-form": "^7.14.1",
"react-hook-form": "^7.15.0",
"react-icons": "^4.2.0",
"react-query": "^3.21.1",
"react-router-dom": "^5.2.1",
"react-router-dom": "^5.3.0",
"react-scripts": "^4.0.3",
"react-select": "^4.3.1",
"react-tabs": "^3.1.2",
"sass": "^1.38.2",
"sass": "^1.39.0",
"styled-components": "^5.3.1",
"uuid": "^8.3.2"
},
Expand Down Expand Up @@ -66,13 +66,13 @@
"@types/react-google-recaptcha": "^2.1.2",
"@types/react-router-dom": "^5.1.7",
"@types/react-select": "^4.0.16",
"@types/styled-components": "^5.1.13",
"@types/styled-components": "^5.1.14",
"@typescript-eslint/eslint-plugin": "^4.30.0",
"@typescript-eslint/parser": "^4.30.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.25.1",
"lint-staged": "^11.1.2",
"prettier": "^2.2.1",
Expand Down
3 changes: 0 additions & 3 deletions client/src/assets/ArrowDownLg.svg

This file was deleted.

3 changes: 0 additions & 3 deletions client/src/assets/ArrowUpLg.svg

This file was deleted.

3 changes: 0 additions & 3 deletions client/src/assets/Globe.svg

This file was deleted.

9 changes: 0 additions & 9 deletions client/src/assets/LogoAlpha.svg

This file was deleted.

4 changes: 0 additions & 4 deletions client/src/assets/LogoGlyphMd.svg

This file was deleted.

3 changes: 0 additions & 3 deletions client/src/assets/LogoMd.svg

This file was deleted.

3 changes: 0 additions & 3 deletions client/src/assets/Search.svg

This file was deleted.

Loading