-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create applications #8
Conversation
Add meta tag for setting width to device width on load Fix padding for form progress
Start adding db entities
Also, bump target of ts compiler to es2018
Add application routes, pages, controllers and services Add initial dashboard and route (only basic page for now) Add basic error handler
I can't see any tests. Will they be coming later? |
There are a couple of things I need to add, like CV support |
Alright, do you want me to wait for the changes or should review the PR now? |
Wait for the changes, hopefully it will be done by this weekend |
Use nyc for code coverage
Add HTML coverage report
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! The application form looks really cool and I love how smart the questions system is!
I left a few suggestions below.
Makefile
Outdated
@@ -25,12 +25,12 @@ setup-network: | |||
|
|||
# starts the app and MySQL in docker containers | |||
up: build-docker setup-network | |||
@echo "=============starting hs_hub=============" | |||
@echo "=============starting hs_application=============" | |||
docker-compose up -d | |||
|
|||
# starts the app and MySQL in docker containers for dev environment | |||
up-dev: build-docker-dev setup-network |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a big deal but I'd say that it's better to just start the app on the host for a dev environment. Based on my experience working on hs_auth, it's not fun working on an app that is running in a container since you need to restart the container (and rebuild the image in this case) whenever you add any new dependencies or change any env variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have found the same 😂I will include a separate docker-compose for dev environments that will launch only the DB
docker-compose.yml
Outdated
@@ -19,7 +19,6 @@ services: | |||
command: --default-authentication-plugin=mysql_native_password --log_error_verbosity=1 | |||
environment: | |||
MYSQL_ROOT_PASSWORD: root |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say this should be set in a .env file because people might forget to change the root password if it's hidden inside the docker-compose
file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, true. I should write a script that creates a new user since having the root user is bad practice anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you create an issue for this if you're not going to do it in this diff?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be in this PR, I think I have a fix for the problem I was having
src/app.ts
Outdated
*/ | ||
private devMiddlewareSetup = (app: Express): void => { | ||
// Development environment set up | ||
if (app.get("env") === "dev") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be cleaner if this check was done prior to calling devMiddlewareSetup
because it's not evident from the method's name or the comment that env
has to be set to dev
for this method to do anything
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I agree. Good catch
|
||
/** | ||
* Loads the applications settings into Cache | ||
* Questions are stored under the name `Questions` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the questions not stored under Sections
? That's the name of the class right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to change this! Initially it was called Questions but then I changed to storing the questions in sections
this.statusCode = _statusCode; | ||
this.message = _message; | ||
|
||
switch (this.statusCode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could replace this switch by defining a map where the key is the response code and the value is the error message and then just call the map.
Though you would need to also add an if for when the response code is not in the map but it should still be cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it would be cleaner. I just stole this from hs_hub for now. I will rework this when I get round to it. I've created another issue for improving the error handling (see #10)
} | ||
|
||
console.error(err.stack); | ||
res.status(HttpResponseCode.INTERNAL_ERROR).send(new ApiError(HttpResponseCode.INTERNAL_ERROR, err.stack)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might not be a great idea to send the entire error stack trace to the user in prod as it might contain some sensitive information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I'll change this
@@ -2,6 +2,7 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file still contains instructions for hs_hub
but fixing this isn't urgent tbh
docker-compose.yml
Outdated
@@ -19,7 +19,6 @@ services: | |||
command: --default-authentication-plugin=mysql_native_password --log_error_verbosity=1 | |||
environment: | |||
MYSQL_ROOT_PASSWORD: root | |||
MYSQL_DATABASE: hub | |||
ports: | |||
- "${DB_PORT}:${DB_PORT}" | |||
# The healthcheck is used to ensure the database is running before the hub starts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It says: before the hub starts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 😊
@@ -3,6 +3,8 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to somehow indicate which fields are required but I'm guessing that is not a trivial change since the form is generated dynamically
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am working on this, just thinking about how to design it. The questions all have a setting called required
so it shouldn’t be too difficult.
Right now the required inputs turn red when you click and purple otherwise but it should be made clearer
Update applicant age req Run dev hs_applications on host Remove dev dockerfile
042d8a9
to
184574b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome
For issues #1
This pull request implements applications along with a basic error handler and dashboard
Features:
It it quite simple to add new hackathon questions, only a few files need to be modified but with some more work it could be better (this can be for future work)
Routes:
You can test out the routes using Postman and import the Postman Collection