100 Commits
Author SHA1 Message Date
Stephan b9278b56df Fix 404 error messages for HEAD and GET media
+ Add unnecessary console.error when successfully uploading media
2022-12-01 09:24:11 +01:00
Stephan 474b3f8185 Rewrite parts of the requestTokenEmailController 2022-06-09 16:23:54 +02:00
Stephan 68cf5bf573 Address some comments and fix issues 2022-06-09 16:23:54 +02:00
Stephan 3a995c6b03 Add route to get participant for role 2022-06-09 16:23:54 +02:00
Stephan 718c040517 Fix routes, add getRole controller 2022-06-09 16:23:54 +02:00
Stephan 87f5fa2e91 Add various participant and role controllers
+ Fix issues
2022-06-09 16:23:54 +02:00
Stephan 94b2030c8f Return false on controlled 2022-06-06 21:17:44 +02:00
Stephan d1f41c8927 Only throw when the auth is not controlled 2022-06-06 21:15:15 +02:00
Stephan 731ab3c87a FIX: fullDescription not being set when creating discipline 2022-06-06 14:23:46 +02:00
Stephan 339ecff938 FIX: RequireAuthentication now throws on wrong auth type 2022-06-05 21:42:47 +02:00
Stephan 0c0b2c3ced Merge pull request #60 from detleph/create-pull-request/patch
Reformat files using prettier
2022-05-30 21:59:20 +02:00
stephan418 5efb3597fd [create-pull-request] push formatted files 2022-05-30 19:59:00 +00:00
Stephan eb20ff4965 Refractor auth logic
+ Add possibility (_requireAdminAuthentication, _requireTeamleaderAuthentication) to make auth optional
+ Add possibility to combine multiple auth types into one function
2022-05-30 18:18:44 +02:00
Stephan cd0cb00106 Add requireResponsibleForGroup
+ Update controllers
2022-05-29 14:47:32 +02:00
Stephan 197fd9c654 Improve validation and error handling
+ Check code and routes
+ Comment code
2022-05-29 13:25:11 +02:00
Stephan c41bbe9ab4 Add error handling and comment code 2022-05-29 12:58:28 +02:00
Stephan 7ae0c81bb8 Fix errors and improve error handling
+ Review code
+ Fix error with braces
2022-05-29 12:37:02 +02:00
Stephan 2a33b703bc Add methods for requiring more specific levels of teamleader auth
+ Add AuthError
2022-05-27 23:08:23 +02:00
Stephan a9c182cf64 Add teamleader authentication 2022-05-27 22:48:16 +02:00
Stephan 197d1a52a3 Add basic controllers and helper for roles
+ Directly link participants to teams for sake of query efficiency
2022-05-27 22:12:16 +02:00
Stephan bdfc15eab4 Add functionality to get media meta
+ Remove unused code
+ Fix misspelling
+ Fix error handling to handle errors with no status code
2022-05-18 08:27:11 +02:00
Stephan c393508a06 Add functionality to add metadata to media 2022-05-18 08:27:11 +02:00
Stephan a16126a1db Fix media
+ Create media directory on dev start
+ Create media file on POST
2022-05-18 08:27:11 +02:00
Stephan f4288d7319 Fix dev.sh script (Now respects port) 2022-05-18 08:27:11 +02:00
Stephan b1c1e53a2d Add fulldescription 2022-05-18 08:27:11 +02:00
Stephan 734acbab38 Fix and comment code for linking media 2022-05-18 08:27:11 +02:00
Stephan 196604599b FIX: **quickly** fix all errors in the media system 2022-05-18 08:27:11 +02:00
Stephan 13d6f881ea Extract shared error code
+ Create new functions for generating errors
2022-05-18 08:27:11 +02:00
Stephan bb4f4babce Add controller and routes to upload images
+ Checks for valid image formats
+ Limits file size
+ Requires authentication
+ Disabled for now
2022-05-18 08:27:11 +02:00
Stephan 323fc396f7 Add express.static() to serve semi-static files
+ Should be user-updateable in the future
2022-05-18 08:27:11 +02:00
Stephan 3ec5f92429 Add controllers for 404 and the root endpoint 2022-05-17 16:16:26 +02:00
Stephan 645baf1f8a Add cors 2022-05-17 15:42:50 +02:00
Stephan 2eb9edee69 Only create default admin when in development mode 2022-05-16 15:38:22 +02:00
Stephan 6c5fd27a73 Merge pull request #45 from detleph/feature-endpoints
Add more endpoints
2022-05-03 14:58:01 +02:00
Stephan 8384a3eebb Add controller for roleSchemas (unfinished)
+ Refine error messages for role schemas
+ Add role schema routes
+ Add RESULT_SCHEMA DataType
+ Add SchemaError.isSchemaError() type guard
2022-05-01 18:18:48 +02:00
Stephan 72ee918f00 Add schema valiation
+ Using zod for validation
+ Add SchemaError
2022-05-01 17:18:55 +02:00
Stephan 2034faa448 Add endpoint to delete disciplines 2022-05-01 16:09:10 +02:00
Stephan 9bafdebd31 Add function to create disciplines
+ Fix async errors
+ Extract name error
2022-04-29 10:35:39 +02:00
Stephan 3c8cea8c71 Add routes for getting disciplines
+ Throwing an error still crashes the server
2022-04-29 10:35:38 +02:00
Stephan df9b47dbfd Add router to delete groups
+ Add route to delete organisations
2022-04-29 10:35:31 +02:00
Stephan 6fb09b9f31 HOTFIX: next() only called when in development mode
+ Push fix, now the server should be working again
2022-04-29 10:25:13 +02:00
Stephan 51c744de26 Add debugging code
+ Small fix in the event controller
+ Add development flag to the dev container
2022-04-28 14:39:16 +02:00
Stephan 09931c78da Add logger and remove unused code 2022-04-28 14:39:16 +02:00
Stephan 8bf18267d1 Fix: Add winston; And: Add custom error handlers
+ addCustomHandler()
+ removeCustomHandler()
2022-04-28 14:39:16 +02:00
Stephan 9ac4fb8efd Add logger to main
+ Remove whitespace
2022-04-28 14:39:16 +02:00
Stephan 9516b60d93 Add logger using winston
+ Add formats
+ Add debug and error log files
2022-04-28 14:39:16 +02:00
Stephan 382a42d439 Add basic error handling
+ Add express-async-errors package to handle async errors
+ Add ForwaradableError class (Base class for all project-specific errors)
+ Add defaultErrorHandler middleware which handles errors and sends info to the client
2022-04-28 14:39:16 +02:00
Stephan d688a7db9c HOTFIX: Name of uuid function
The prisma schema didn't compile with the previous schema
2022-04-28 13:00:27 +02:00
Stephan f6d194f0c9 Fix: The server should always return 403 on failed login 2022-04-28 13:00:14 +02:00
Stephan 5418d7b790 Refactor the endpoints to share common code 2022-04-28 12:49:07 +02:00
Stephan 0fb8a9ca73 Update the admin revision on password change
+ Update type of revision to DateTime
2022-04-28 12:49:07 +02:00
Stephan f3c165bbd7 Restructure the process of changing a password
+ Requests are now dispatched to the according user ressource, not the collection
+ The current user can be referenced by setting the pid to 'current'
+ Refactored the error logic
2022-04-28 12:49:07 +02:00
Stephan ff9d5b7912 Change the controller for changing passwords to use PIDs and not usernames 2022-04-28 12:49:07 +02:00
Stephan 94ce50aaf1 Add a controller and router to update a user's password
+ Add a function to update the password internally
+ The current interface could be improved (made more RESTful)
2022-04-28 12:49:07 +02:00
Stephan a2e314f036 Add the permission_level 'ELEVATED' to the default user 2022-04-28 12:49:07 +02:00
Stephan ed90f1e6ae Allow for groups to be specified when POSTing /api/admins
+ Add the admin router to the global app
2022-04-28 12:49:07 +02:00
Stephan c0878d5614 Add code that ensures that an (admin) user is always present 2022-04-28 12:49:07 +02:00
Stephan dd3133c3f3 Add router for the /admin endpoint 2022-04-28 12:49:07 +02:00
Stephan 84db24fdb4 Add controller for adding a user
+ Add function to narrow type of string to AdminLevel
2022-04-28 12:49:07 +02:00
Stephan 79c5c3752c Extract code for error messages for better reusability
+ Create function for generating permission errors
2022-04-28 12:49:07 +02:00
Stephan 579dc68d82 Remove event <-> admin association and introduce a default value for revision 2022-04-28 12:49:07 +02:00
Stephan fdfbd22daf Add a controller for getting all admin user details
+ Requires Authentication
2022-04-28 12:49:07 +02:00
Stephan 5e5b6bb60c Add routes for admin authentication endpoints
+ Add router to the app
2022-04-28 12:49:07 +02:00
Stephan 22a959bcea FIX: The dev script can now run in any directory
Initially, the directory was required to be called 'server'; This is not the case anymore
2022-04-28 12:49:07 +02:00
Stephan 4a65dd4665 Add authorization 2022-04-28 12:49:05 +02:00
Stephan 6d471eced2 Add function for deleting events 2022-04-28 12:49:05 +02:00
Stephan 2936aa77f1 FIX: Event endpoints are now using the correct format 2022-04-28 12:49:05 +02:00
Stephan 9965acee40 Update name to organisation 2022-04-27 08:34:25 +02:00
Stephan 01077dab22 Change name from oragnisation to organisation 2022-04-27 08:34:25 +02:00
Stephan bff9dcc5f8 Extract function to create an object by name
+ Add route to create groups
2022-04-26 16:04:26 +02:00
Stephan fe6879ea56 Only show details when authenticated 2022-04-26 16:04:26 +02:00
Stephan 0c65aec96c Add controller and routes for groups 2022-04-26 16:04:26 +02:00
Stephan 8aa4e5ef16 Improve error handling and simplify code 2022-04-26 16:04:26 +02:00
Stephan ca11eba3d4 Add better error handling 2022-04-26 16:04:26 +02:00
Stephan 12034fa32a Add function to update an organisation
+ Extract basicOrganisation and detailedOrganiation select types
2022-04-26 16:04:26 +02:00
Stephan 831017e7c2 Add routes for organisations
+ FIX: Change eventId type
2022-04-26 16:04:26 +02:00
Stephan 08e18db3c3 Extract common function to handle selecting organisations 2022-04-26 16:04:26 +02:00
Stephan ab62e39d8e Add function to create new organisations
+ Extract common functions from the admin controller
2022-04-26 16:04:26 +02:00
Stephan 37437152da Add the organisation controller
+ Add function to get all organisation
+ Add function to get a specific organisation
2022-04-26 16:04:26 +02:00
Stephan dce75d1a97 Port yens dev script to detleph
+ Provides more config options
+ Allows deleting and resetting the database
2022-04-26 15:15:22 +02:00
Stephan d2de4e9208 HOTFIX: Name of uuid function
The prisma schema didn't compile with the previous schema
2022-04-23 14:52:23 +02:00
Stephan d7e7694249 Fix: The server should always return 403 on failed login 2022-04-23 14:01:45 +02:00
Stephan 1be42be4e5 Merge pull request #25 from detleph/feature-user-auth
Implement user authentication and admin operations
2022-01-03 14:52:41 +01:00
Stephan 064497a4ca Refactor the endpoints to share common code 2022-01-02 17:36:21 +01:00
Stephan 08419d581b Update the admin revision on password change
+ Update type of revision to DateTime
2022-01-02 17:26:20 +01:00
Stephan 4d23eccba6 Restructure the process of changing a password
+ Requests are now dispatched to the according user ressource, not the collection
+ The current user can be referenced by setting the pid to 'current'
+ Refactored the error logic
2022-01-02 16:49:01 +01:00
Stephan cc1c394dce Change the controller for changing passwords to use PIDs and not usernames 2022-01-02 15:46:47 +01:00
Stephan 5b02905d71 Add a controller and router to update a user's password
+ Add a function to update the password internally
+ The current interface could be improved (made more RESTful)
2021-12-31 00:11:04 +01:00
Stephan bfca7e8672 Add the permission_level 'ELEVATED' to the default user 2021-12-29 15:19:23 +01:00
Stephan 97fee47c6e Allow for groups to be specified when POSTing /api/admins
+ Add the admin router to the global app
2021-12-29 15:19:22 +01:00
Stephan 3363039f79 Add code that ensures that an (admin) user is always present 2021-12-29 15:19:21 +01:00
Stephan 9b2c8b17c6 Add router for the /admin endpoint 2021-12-29 15:19:20 +01:00
Stephan b57315d916 Add controller for adding a user
+ Add function to narrow type of string to AdminLevel
2021-12-29 15:19:19 +01:00
Stephan b82a84322b Extract code for error messages for better reusability
+ Create function for generating permission errors
2021-12-29 15:19:18 +01:00
Stephan 913e0ee0e0 Remove event <-> admin association and introduce a default value for revision 2021-12-29 15:19:17 +01:00
Stephan 59f4d53af5 Add a controller for getting all admin user details
+ Requires Authentication
2021-12-29 15:19:16 +01:00
Stephan eb70a14c61 Add routes for admin authentication endpoints
+ Add router to the app
2021-12-29 15:19:10 +01:00
Stephan 584903e55d FIX: The dev script can now run in any directory
Initially, the directory was required to be called 'server'; This is not the case anymore
2021-12-29 15:08:40 +01:00
Stephan 2a5e631d1f Fix bug where nodemon restarts multiple times
- Nodemon was watching the whole file system and not only the /app directory
2021-12-03 10:21:43 +01:00
Stephan a138bca256 Fix quotes 2021-12-03 10:21:43 +01:00