-
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.
* chore: restructure tests * fix: fix hanging connections in recreate db * fix: tweak ci * fix: clean up smells * feat: update docs * feat: add change email endpoint * chore: rename actions file * feat: add get endpoints for permissions and users * feat: update docs * fix: duplicate error message on log in * feat: add navbar * chore: bump bun version * fix: tweak signup and signin forms * fix: make navbar actually sticky * feat: add footer * feat: add verification email * feat: add under construction signage * chore: hopefully fix promise types * fix: attempt to fix again with rewrite * fix: fix again * fix: smells and navbar title * feat: prettier verify email template * fix: tweak verify email page render * feat: reset pw pages * feat: prettier emails * fix: add titleing to emails * chore: update metadata * refactor: clean up verify email code * fix: invalid header * chore: bump bun version * fix: reset password email invalid link * fix: consistency while requesting api routes * feat: start on settings and admin pages * chore: prettier * feat: add admin ability to change email * feat: add admin functionality to update service hours * fix: admin change email using wrong jwt * feat: allow deletion of user account * feat: admin page * chore: add loading states for login and signup * feat: pagination and authprovider tweaks * fix: update navbar * feat: settings page * fix: misc fixes
- Loading branch information
1 parent
ca284f0
commit 5582c31
Showing
90 changed files
with
3,410 additions
and
708 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 |
---|---|---|
@@ -1,10 +1,107 @@ | ||
# Contributing guidelines | ||
|
||
Thanks for coming onboard to contribute to this project. | ||
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. | ||
All features should not be commited directly to the ``main`` or ``dev`` branches, unless you have a very specific reason to do so (eg. CI/CD testing). Otherwise, checkout a new branch and open a PR. | ||
Please follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) when making commits to the ``main``/``dev`` branches, and it is highly recommended to do the same on all other branches. | ||
Before merging a PR, please check that CI/CD tests pass and that you have tested your own changes. | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ POSTGRES_PORT=5432 | |
API_PORT=8000 | ||
|
||
REDIS_URL=redis://interapp-redis:6379 | ||
FRONTEND_URL=http://localhost:3000 | ||
|
||
SCHOOL_EMAIL_REGEX="^[A-Za-z0-9]+@student\.ri\.edu\.sg|[A-Za-z0-9][email protected]$" |
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 |
---|---|---|
|
@@ -7,5 +7,6 @@ POSTGRES_PORT=5432 | |
API_PORT=8000 | ||
|
||
REDIS_URL=redis://interapp-redis:6379 | ||
FRONTEND_URL=http://localhost:3000 # TODO: Change this to the actual frontend URL | ||
|
||
SCHOOL_EMAIL_REGEX="^[A-Za-z0-9]+@student\.ri\.edu\.sg|[A-Za-z0-9][email protected]$" |
54 changes: 49 additions & 5 deletions
54
interapp-backend/api/email_handler/templates/reset_password.html
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,5 +1,49 @@ | ||
<h1>RESET PASSWORD</h1> | ||
<p>Hi {{ username }},</p> | ||
<p>Click the link below to reset your password:</p> | ||
<p>{{ token }}</p> | ||
<p><a href="{{ url }}">Reset Now!</a></p> | ||
<head> | ||
<title>Reset password email</title> | ||
<style> | ||
body { | ||
font-family: Arial, Helvetica, sans-serif; | ||
} | ||
|
||
.title { | ||
font-size: 20px; | ||
font-weight: bold; | ||
} | ||
.content { | ||
font-size: 16px; | ||
} | ||
.button { | ||
background-color: #da2400; | ||
border: none; | ||
color: white; | ||
padding: 10px 20px; | ||
text-align: center; | ||
text-decoration: none; | ||
display: inline-block; | ||
} | ||
.button a { | ||
color: white; | ||
text-decoration: none; | ||
font-weight: bold; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div> | ||
<h1 class="title">Reset your password on Interapp!</h1> | ||
<p class="content">Hi {{ username }},</p> | ||
<p class="content">Click the link below to reset your password:</p> | ||
<button class="content button"><a href="{{ url }}">Reset</a></button> | ||
<p class="content"> | ||
If you did not request this, please ignore this email. Do not click on the reset password and | ||
contact the administrator immediately. | ||
</p> | ||
<p class="content">Thanks,</p> | ||
<p class="content">Interapp Team</p> | ||
<hr /> | ||
<p class="content"> | ||
If you're having trouble clicking the "Reset" button, copy and paste the URL below into your | ||
web browser: <a href="{{ url }}">{{ url }}</a> | ||
</p> | ||
</div> | ||
</body> |
51 changes: 46 additions & 5 deletions
51
interapp-backend/api/email_handler/templates/verify_email.html
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,5 +1,46 @@ | ||
<h1>VERIFY EMAIL</h1> | ||
<p>Hi {{ username }},</p> | ||
<p>Click the link below to verify email:</p> | ||
<p>{{ token }}</p> | ||
<p><a href="{{ url }}">Reset Now!</a></p> | ||
<head> | ||
<title>Verify email</title> | ||
<style> | ||
body { | ||
font-family: Arial, Helvetica, sans-serif; | ||
} | ||
|
||
.title { | ||
font-size: 20px; | ||
font-weight: bold; | ||
} | ||
.content { | ||
font-size: 16px; | ||
} | ||
.button { | ||
background-color: #da2400; | ||
border: none; | ||
color: white; | ||
padding: 10px 20px; | ||
text-align: center; | ||
text-decoration: none; | ||
display: inline-block; | ||
} | ||
.button a { | ||
color: white; | ||
text-decoration: none; | ||
font-weight: bold; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div> | ||
<h1 class="title">Verify your email with Interapp!</h1> | ||
<p class="content">Hi {{ username }},</p> | ||
<p class="content">Click the link below to verify your email:</p> | ||
<button class="content button"><a href="{{ url }}">Verify Now!</a></button> | ||
<p class="content">If you did not request this, please ignore this email.</p> | ||
<p class="content">Thanks,</p> | ||
<p class="content">Interapp Team</p> | ||
<hr /> | ||
<p class="content"> | ||
If you're having trouble clicking the "Verify Now" button, copy and paste the URL below into | ||
your web browser: <a href="{{ url }}">{{ url }}</a> | ||
</p> | ||
</div> | ||
</body> |
Oops, something went wrong.