entitlementcard
entitlementcard copied to clipboard
1416: Create endpoint for user data
Short description
Create an http entpoint for Koblenz project to import user data
Proposed changes
- create new table to store user data with the columns: userHash, startDate, endDate, revoked, projectId, lastUpdated
- create an endpoint that receives data in the csv file, validates it, and stores it in the database
- if userHash already exists in the database, the record is updated, otherwise it is created
Questionable items:
-
I decided to create a POST endpoint instead of PUT because: As I see it, PUT is typically used to update or create the target resource indicated in the URI. Like, PUT /user/{id}, for example. But in our case it's more like a procedure call and in such case IMO it's more common to use POST. But if it's already agreed upon, let me know, and I'll just change it to PUT.
-
I named the table UserEntitlements because I think it will be more accurate than just Users or UserData. But feel free to object.
-
I named the column 'revoked' instead of 'invalid', because 'valid' sounds like data validity to me. But feel free to object (2)
Not included:
- auto-tests (come next)
- userHash validation (to be added after #1433, with the potential to re-use some code from there maybe)
- authentication (to be done in #1417)
Resolved issues
Fixes: #1416
Testing
CSV data example:
userHash, startDate, endDate, revoked
dashj21sasd32, 12.05.2024, 12.10.2028, false