Skip to content
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

1416: Create endpoint for user data #1528

Merged
merged 15 commits into from
Jul 25, 2024
Merged

Conversation

seluianova
Copy link
Contributor

@seluianova seluianova commented Jul 3, 2024

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:

Resolved issues

Fixes: #1416

Testing

CSV data example:

userHash, startDate, endDate, revoked, regionId
dashj21sasd32, 12.05.2024, 12.10.2028, false, 1

@seluianova seluianova linked an issue Jul 3, 2024 that may be closed by this pull request
@seluianova seluianova force-pushed the 1416-create-endpoint-for-user-data branch from 05729e7 to db58bde Compare July 3, 2024 14:08
…ate-endpoint-for-user-data

# Conflicts:
#	backend/src/main/kotlin/app/ehrenamtskarte/backend/migration/migrations/MigrationsRegistry.kt
@seluianova seluianova force-pushed the 1416-create-endpoint-for-user-data branch from 43acd1f to 0a2c6b2 Compare July 9, 2024 13:34
…ate-endpoint-for-user-data

# Conflicts:
#	backend/src/main/kotlin/app/ehrenamtskarte/backend/migration/TablesRegistry.kt
@seluianova
Copy link
Contributor Author

All the comments have been addressed

@seluianova seluianova force-pushed the 1416-create-endpoint-for-user-data branch from 7507cc8 to 1e25ade Compare July 23, 2024 10:28
Copy link
Contributor

@f1sh1918 f1sh1918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good implementation. Tested with postman. 👍
There is just one error to catch i think for revoked.
I'm not happy with the naming of the table tbh.
Added a proposal

@seluianova seluianova force-pushed the 1416-create-endpoint-for-user-data branch from a2a484c to 94f6d43 Compare July 23, 2024 14:51
@f1sh1918
Copy link
Contributor

Tested the import again. everything fine from my side @seluianova

@seluianova seluianova merged commit 231d182 into main Jul 25, 2024
1 check passed
@seluianova seluianova deleted the 1416-create-endpoint-for-user-data branch July 25, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create endpoint for user data
4 participants