Skip to content

Commit e302e5d

Browse files
authored
fix: bugfix feedback (#16)
* chore: prettier * feat: sql dump script * fix: optimise select users by service * fix: prevent change email from submitting invalid inputs * fix: round email button corners * feat: add endpoint for getusersbyservice * fix: memory leak with bun in watchpack * feat: add bulk user service change to endpoints * feat: add service page * fix: fix code smells * feat: update navbar headers * feat: add create services gui * fix: clean up * fix: hopefully fix build process * feat: add delete service action * fix: move to node to prevent segfaults * feat: finalise services page * chore: clean up code smells * chore: revert breaking changes, optimise further * chore: bump version * feat: add minio * feat: add fullstack support for minio * fix: auto test failure * fix: fix incorrect placeholder image pathing * fix: simplify initialisation * fix: revert accidental removal of build test * chore: update readme * chore: standardise import aliases * fix: incorrect aliases * fix: update auth style breakpoints * fix: show error on invalid user permission combination * chore: bump bun version
1 parent 5582c31 commit e302e5d

79 files changed

Lines changed: 1840 additions & 138 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/pipeline.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ jobs:
1414
- name: Checkout code
1515
uses: actions/checkout@v3
1616

17-
- name: Setup test environment
18-
run: docker compose -f docker-compose.test.yml up -d --build
17+
- name: Build test environment
18+
run: docker compose -f docker-compose.test.yml build --no-cache
19+
20+
- name: Run test environment
21+
run: docker compose -f docker-compose.test.yml up -d
1922

2023
- name: Setup bun
2124
uses: oven-sh/setup-bun@v1

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,5 @@ dist
174174
# Finder (MacOS) folder config
175175
.DS_Store
176176

177-
pgdata/
177+
pgdata/
178+
minio_data/

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,22 @@ Ensure that you have the docker daemon running, along with ``bun``, ``make`` and
1515

1616
Clone with ``git clone https://github.com/raffles-interact/interapp.git``
1717

18-
### Running
18+
### First time setup
19+
20+
1. Run ``touch ./interapp-backend/.env.local`` and paste the contents of the file that the maintainers gave you.
21+
22+
2. Navigate to ``./interapp-backend/`` and ``./interapp-frontend/`` and run ``bun i`` in both directories.
1923

20-
Ensure you are in the root of the project, and that ``.env.local`` exists. Run ``make build`` and ``make watch`` (for HMR).
24+
3. Run ``make build`` and ``make run``.
25+
26+
4. (Optional) To give yourself all the permissions on the website, ssh into the ``interapp-postgres`` container and run an SQL query that gives your account permissions from 0 - 6. This should look like:
27+
```sql
28+
INSERT INTO user_permission (username, permission_id, "userUsername") VALUES (‘<username>’, 1, ‘<username>’), (‘<username>’, 2, ‘<username>’), (‘<username>’, 3, ‘<username>’), (‘<username>’, 4, ‘<username>’), (‘<username>’, 5, ‘<username>’), (‘<username>’, 6, ‘<username>’);
29+
```
30+
31+
### Running
2132

22-
If your IDE is giving you import errors, run ``bun i`` in the terminal.
33+
Run ``make build`` and ``make run`` for the development server. If needed, add ``version=(test|prod)`` for test and production servers respectively.
2334

2435
Go to ``localhost:3000`` for frontend and ``localhost:3000/api`` for api routes
2536

docker-compose.dev.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,33 @@ services:
6363
redis:
6464
condition: service_healthy
6565

66+
minio:
67+
container_name: interapp-minio
68+
image: minio/minio
69+
restart: on-failure
70+
command: minio server /data
71+
env_file:
72+
- ./interapp-backend/.env.development
73+
- ./interapp-backend/.env.local
74+
ports:
75+
- 9000:9000
76+
- 9001:9001
77+
volumes:
78+
- ./interapp-backend/minio_data:/data
79+
networks:
80+
- interapp-network
81+
healthcheck:
82+
test: ["CMD", "mc", "ready", "local"]
83+
interval: 2s
84+
timeout: 2s
85+
retries: 5
86+
start_period: 60s
87+
depends_on:
88+
postgres:
89+
condition: service_healthy
90+
91+
92+
6693
backend:
6794
container_name: interapp-backend
6895
restart: on-failure
@@ -88,6 +115,8 @@ services:
88115
condition: service_healthy
89116
redis:
90117
condition: service_healthy
118+
minio:
119+
condition: service_healthy
91120

92121
frontend:
93122
container_name: interapp-frontend
@@ -104,7 +133,6 @@ services:
104133
- interapp-network
105134
depends_on:
106135
- backend
107-
- postgres
108136
deploy:
109137
resources:
110138
reservations:

docker-compose.prod.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,30 @@ services:
5353
redis:
5454
condition: service_healthy
5555

56+
minio:
57+
container_name: interapp-minio
58+
image: minio/minio
59+
restart: on-failure
60+
command: minio server /data
61+
env_file:
62+
- ./interapp-backend/.env.production
63+
ports:
64+
- 9000:9000
65+
- 9001:9001
66+
volumes:
67+
- ./interapp-backend/minio_data:/data
68+
networks:
69+
- interapp-network
70+
healthcheck:
71+
test: ["CMD", "mc", "ready", "local"]
72+
interval: 2s
73+
timeout: 2s
74+
retries: 5
75+
start_period: 60s
76+
depends_on:
77+
postgres:
78+
condition: service_healthy
79+
5680

5781
backend:
5882
container_name: interapp-backend

docker-compose.test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,28 @@ services:
5454
retries: 7
5555
start_period: 60s
5656

57+
minio:
58+
container_name: interapp-minio
59+
image: minio/minio
60+
restart: on-failure
61+
command: minio server /data
62+
env_file:
63+
- ./interapp-backend/tests/config/.env.docker
64+
ports:
65+
- 9000:9000
66+
- 9001:9001
67+
networks:
68+
- interapp-network
69+
healthcheck:
70+
test: ["CMD", "mc", "ready", "local"]
71+
interval: 2s
72+
timeout: 2s
73+
retries: 5
74+
start_period: 60s
75+
depends_on:
76+
postgres:
77+
condition: service_healthy
78+
5779
backend:
5880
container_name: interapp-backend-test
5981
restart: on-failure
@@ -71,6 +93,8 @@ services:
7193
condition: service_healthy
7294
redis:
7395
condition: service_healthy
96+
minio:
97+
condition: service_healthy
7498

7599

76100
networks:

interapp-backend/.env.development

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,14 @@ API_PORT=8000
99
REDIS_URL=redis://interapp-redis:6379
1010
FRONTEND_URL=http://localhost:3000
1111

12-
SCHOOL_EMAIL_REGEX="^[A-Za-z0-9]+@student\.ri\.edu\.sg|[A-Za-z0-9]+@rafflesgirlssch.edu.sg$"
12+
SCHOOL_EMAIL_REGEX="^[A-Za-z0-9]+@student\.ri\.edu\.sg|[A-Za-z0-9]+@rafflesgirlssch.edu.sg$"
13+
14+
MINIO_ROOT_USER=minio-root
15+
MINIO_ROOT_PASSWORD=minio-password
16+
MINIO_ADDRESS=':9000'
17+
MINIO_CONSOLE_ADDRESS=':9001'
18+
MINIO_ACCESSKEY=minio-root
19+
MINIO_SECRETKEY=minio-password
20+
21+
MINIO_BUCKETNAME=interapp-minio
22+
MINIO_ENDPOINT=interapp-minio

interapp-backend/.env.production

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,14 @@ API_PORT=8000
99
REDIS_URL=redis://interapp-redis:6379
1010
FRONTEND_URL=http://localhost:3000 # TODO: Change this to the actual frontend URL
1111

12-
SCHOOL_EMAIL_REGEX="^[A-Za-z0-9]+@student\.ri\.edu\.sg|[A-Za-z0-9]+@rafflesgirlssch.edu.sg$"
12+
SCHOOL_EMAIL_REGEX="^[A-Za-z0-9]+@student\.ri\.edu\.sg|[A-Za-z0-9]+@rafflesgirlssch.edu.sg$"
13+
14+
MINIO_ROOT_USER=minio-root
15+
MINIO_ROOT_PASSWORD=minio-password
16+
MINIO_ADDRESS=':9000'
17+
MINIO_CONSOLE_ADDRESS=':9001'
18+
MINIO_ACCESSKEY=minio-root
19+
MINIO_SECRETKEY=minio-password
20+
21+
MINIO_BUCKETNAME=interapp-minio
22+
MINIO_ENDPOINT=interapp-minio

interapp-backend/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/**/*
2+
pgdata/**/*
3+
minio_data/**/*

interapp-backend/api/email_handler/templates/reset_password.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
text-align: center;
2121
text-decoration: none;
2222
display: inline-block;
23+
border-radius: 7px;
2324
}
2425
.button a {
2526
color: white;

0 commit comments

Comments
 (0)