-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: misc scripting, crashes and unexpected behaviour (#45)
* fix: text content, update img * feat: import script * fix: config changes * fix: config change again * fix: incorrect mapping of asset urls * fix: readability * chore: untrack data files * fix: incorrect formatting for service session date * fix: crash on 0 permissions * fix: failed request on 0 announcements navigation * fix: infinite loading on dne announcement * fix: ghost keys and handle non-existent session in AttendanceMenuEntry * fix: undefined build error * fix: add alt props to img * fix: many ics allowed for service * fix: sort services * fix: imported names too short * fix: nextattendance is wrong * fix: fix tests * fix: admin searching gives undefined pages * fix: allow search in service sessions * fix: timezone differences * chore: raise rate limit * fix: make service session search clearable * chore: optimise + allow longer time to have qr available * feat: import hours script * fix: minor change of plans for import hours * chore: update readme * fix: modify update script path * fix: lower permissions mark absence failure * feat: manual password reset script * feat: allow redirects on login * fix: dont report issues to sentry on dev server * fix: prerender error on useSearchParams * chore: create sessions manually script * fix: incorrect default value on searchable select * fix: incorrect usage of pw reset * chore: bump next to 14.2 * refactor: Makefile build commands for different scenarios * fix: CORS origin issue in API routes * chore: Update docker-compose files to remove version field * chore: rename data-source to snake case * chore: simplify imports * chore: Update imports in unit tests to use @models/. * chore: bump bun to 1.1.3 * chore: Update docker-compose files to include VERSION environment variable * chore: add footer version * chore: add release for sentry observability * fix: naming conflict in version * fix: reorganise files * fix: naming conflict * refactor: reuse code for describe() * chore: add node-xlsx package for Excel file handling * feat: implement logic for GM exports * chore: remove newlines * feat: refactor validation middleware * refactor: redo exports * fix: show full output on build failure * fix: prevent memory leak by cleaning dumpfiles >7 days old * chore: prettier * refactor: use early return clause * feat: allow for exports date filtering * fix: restrict endpoint * feat: add frontend * refactor: efficiently compare edit action changes * fix: incorrect pathing for renamed data_source * chore: revert #c116271 * feat: add diffing algorithm * feat: add bulk service hour changes * fix: dockerfile failure due to incorrect shell syntax * feat: add endpoint linkage and clean up * fix: consise regex number syntax * fix: build error * fix: update service hours in bulk overwriting value * chore: bump version
- Loading branch information
1 parent
12aca7e
commit aa857c6
Showing
106 changed files
with
1,819 additions
and
636 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -176,4 +176,7 @@ dist | |
|
||
pgdata/ | ||
minio_data/ | ||
dump/ | ||
dump/ | ||
|
||
*.csv | ||
*.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,10 @@ | ||
# Contributing guidelines | ||
|
||
Thanks for coming onboard to contribute to this project. This document outlines a few common code guidelines when contributing to the project. Lead maintainers can choose to modify these guidelines if they feel it is too strict/lax. Last updated: 12 Dec 2023. | ||
|
||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL | ||
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and | ||
"OPTIONAL" in this document are to be interpreted as described in | ||
RFC 2119. | ||
|
||
## Table of Contents | ||
- [Coding Guidelines](#coding-guidelines) | ||
1. [General Guidelines](#general-guidelines) | ||
2. [Backend Guidelines](#backend-guidelines) | ||
3. [Frontend Guidelines](#frontend-guidelines) | ||
- [Product Demo Guidelines](#product-demo-guidelines) | ||
|
||
## Coding Guidelines | ||
### General guidelines | ||
|
||
- All features SHOULD NOT be commited directly to the ``main`` branch, unless you have a very specific reason to do so (eg. CI/CD testing). Otherwise, checkout a new branch and open a PR. | ||
|
||
- You SHOULD follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) when making commits to the ``main``/``dev`` branches, and it is RECOMMENDED to do the same on all other branches. | ||
|
||
- You MAY use the test suite in Github Actions to ensure that your current build of the project is stable to push to production. | ||
|
||
|
||
### Backend Guidelines | ||
|
||
- Before merging a PR with backend changes, you SHOULD check that tests pass and that you have tested your own changes. | ||
|
||
- ``snake_case`` SHALL be used for all response/request body parameters. | ||
|
||
```js | ||
// this is fine | ||
POST HTTP/1.1 /test 200 | ||
{ | ||
a_variable: "jewdfjskd", | ||
a_very_long_name: "dsfkjsda" | ||
} | ||
|
||
GET HTTP/1.1 /test?variable_name=lol 200 | ||
|
||
// this is not ok | ||
POST HTTP/1.1 /test 200 | ||
{ | ||
camelCase: "no" | ||
} | ||
``` | ||
- You SHOULD throw informative errors when an error occurs in response/query. | ||
```js | ||
// this is good | ||
GET HTTP/1.1 /test 400 | ||
{ | ||
"error": "missing fields 'asdf', 'err'" | ||
} | ||
|
||
// this is not good | ||
GET HTTP/1.1 /test 400 | ||
{ | ||
"error": "an error occurred. try again later" | ||
} | ||
``` | ||
### Frontend guidelines | ||
- Pages (``page.tsx``) SHOULD be written with ``export default function``. | ||
```ts | ||
// good | ||
export default function HomePage {...} | ||
|
||
// bad | ||
export const HomePage = () => {} | ||
Homepage.displayName = 'HomePage'; // needed for NextJS | ||
export default HomePage; | ||
``` | ||
- Non-interactive components SHOULD be made a server component. This SHOULD include all pages (``pages.tsx``). | ||
- Pages SHOULD be broken down into simple, reusable components if possible. | ||
## Product Demo Guidelines | ||
Thanks for coming in to test this project. This section details what to do when testing out demos/test builds. | ||
- Look out for potential complex functionality that is not properly explained. Such behaviour may make it difficult for future users to understand how to use the website. | ||
- Test forms/input fields with a variety of values, and attempt to cause errors if possible. This is really helpful in case an exploit is present in the inputs. Examples of invalid input values that one can test out: | ||
- Username: ``a; DROP TABLE users;--`` (SQL injection, for technical users) | ||
- UserID: ``2147483648`` (32 bit signed int overflow) | ||
- Username: ``jjjj...jjjjjj`` (a very long string that may exceed memory limits) | ||
- Email: ``a.dsfsajf`` (an input that is clearly not an email) | ||
- Birthday: ``30/2/2023`` (a date that does not exist) | ||
- Age: ``-1`` (an age that cannot exist) | ||
- Start time: ``09:00``, End time: ``08:00`` (End time < Start time) | ||
- Day of the week: ``Yesterday`` (Not a day of the week) | ||
- Month: ``Decembuary`` (Not a month) | ||
- Check for discrepancies in responsive display sizes. Ie. Does the size of screen affect readability of certain text/functionality? To test this on a PC, use the in-browser viewport resizing tool (CTRL + Shift + I on Chrome). Refer to your browser's support page for more information. | ||
- Look out for behaviour that may be too complex for a normal user, or is not supported on touchscreen devices. | ||
# Contributing guidelines | ||
|
||
Thanks for coming onboard to contribute to this project. This document outlines a few common code guidelines when contributing to the project. Lead maintainers can choose to modify these guidelines if they feel it is too strict/lax. Last updated: 12 Dec 2023. | ||
|
||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL | ||
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and | ||
"OPTIONAL" in this document are to be interpreted as described in | ||
RFC 2119. | ||
|
||
WIP DO NOT CHANGE THIS FILE UNTIL POST 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,56 @@ | ||
|
||
.PHONY: | ||
.ONESHELL: | ||
|
||
SHELL := bash | ||
|
||
# version := dev | ||
ifeq ($(version), ) | ||
DC_CMD := docker compose -f docker-compose.dev.yml | ||
else | ||
DC_CMD := docker compose -f docker-compose.$(version).yml | ||
tag := --$(version) | ||
endif | ||
|
||
|
||
build: | ||
$(DC_CMD) -v down | ||
$(DC_CMD) build | ||
watch: | ||
$(DC_CMD) watch | ||
run: | ||
$(DC_CMD) up -d | ||
down: | ||
$(DC_CMD) -v down | ||
|
||
|
||
|
||
.PHONY: | ||
.ONESHELL: | ||
|
||
SHELL := bash | ||
|
||
# version := dev | ||
ifeq ($(version), ) | ||
DC_CMD := docker compose -f docker-compose.dev.yml | ||
else | ||
DC_CMD := docker compose -f docker-compose.$(version).yml | ||
tag := --$(version) | ||
endif | ||
|
||
APP_VERSION := $(shell git describe --tag --abbrev=0 2>/dev/null)-$(shell git rev-parse --short HEAD 2>/dev/null) | ||
# if the git describe command fails, we will set the APP_VERSION to an empty string | ||
ifeq ($(APP_VERSION),-) | ||
APP_VERSION := | ||
endif | ||
export APP_VERSION | ||
|
||
# scenario 1: version=prod, real=true | ||
# we need to down the container, prune the system, and rebuild the container | ||
|
||
# scenario 2: version=prod, real=false | ||
# we need to down the container, change the .env file, rebuild the container, and revert the .env file | ||
# replace the IP address with localhost so that the container can connect to the local database | ||
|
||
# scenario 3: version=* (dev, staging), real=* | ||
# we need to down the container and rebuild the container | ||
ifeq ($(version), prod) | ||
ifeq ($(real), true) | ||
BUILD_COMMANDS = $(DC_CMD) -v down ;\ | ||
docker system prune -f ;\ | ||
$(DC_CMD) build --no-cache | ||
else | ||
BUILD_COMMANDS = trap "find . -iname .env.*.bak -exec sh -c 'mv $$0 $${0%.bak}' {} \;" SIGINT ;\ | ||
$(DC_CMD) -v down ;\ | ||
find . -iname .env.* -exec cp {} {}.bak \; ;\ | ||
find . -iname .env.* ! -iname "*.bak" -exec sed -i -e 's/13.229.79.214/localhost/g' {} \; ;\ | ||
$(DC_CMD) build --no-cache ;\ | ||
find . -iname .env.*.bak -exec sh -c 'mv $$0 $${0%.bak}' {} \; | ||
endif | ||
else | ||
BUILD_COMMANDS = $(DC_CMD) -v down ;\ | ||
$(DC_CMD) build | ||
endif | ||
|
||
build: | ||
$(BUILD_COMMANDS) | ||
watch: | ||
$(DC_CMD) watch | ||
run: | ||
$(DC_CMD) up -d | ||
down: | ||
$(DC_CMD) -v down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.