-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
featureFeature or improvementFeature or improvementpriority:highHigh priority work itemHigh priority work item
Description
Overview
Implement /user endpoints for the course-management microservice defined in https://github.com/puffproject/docs/blob/master/API_ARCHITECTURE.md.
The task breaks down into the following steps:
PR#1 should be:
- Create an
AssignmentEnrollmententity based on theASSIGNMENT_ENROLLMENTtable. This is the table that keeps track of if a user is tracking an assignment, i.e. they are working on it. This includes a column where they can pin the assignment for easy access. Should join on the assignment id (SeeAssignment.javato see example of join column) - Annotate the
AssignmentEnrollmententity with swagger annotations (@model etc.) + ignore the id and user id fields. - Create an
AssignmentEnrollmentRepositoryfor the JPA database connection. - Create an
AssignmentEnrollmentPagemodel (extendBasePage) to define the data model we want to return to the user. Add necessary swagger annotations. - Add test data in the
bootstrap_data.sqlfile to automatically populate the database when the service is loaded.
PR#2 should be:
5. Create a user service. You'll need methods for
- Getting the user's assignment enrollments (Needs to have a pageable and non-pageable versions)
- Enrolling a user in an assignment with the option to pin the assignment for them. Calling this endpoint multiple times should not ever create multiple records. There should only ever be one enrollment for a user in an assignment.
- Unenrolling a user from an assignment
- Check if a user has already voted on something (Might have to create a new function in a the vote service)
- Create a Rest interface for user endpoints in
restApipackage with all the right annotations. Don't forget to include thePrincipalargument to get the user's token (it represents their identity) - Implement the rest interface in a user controller. The controller will call the user service endpoints to implement:
- GET
/user/assignments: pageable endpoint that returnsAssignmentEnrollmentPageobjects. (Double check here that we can sort to the have the pinned ones at the top, I'm not sure if it's possible) - POST
/user/assignment/{assignmentId}/enroll?pin={true|false} - DELETE
/user/assignment/{assignmentId}/unenroll - GET
/user/engagement/{sourceType}/{sourceItemId}/vote: Check if a user has voted on something (Might need to create a new model to return) - Manually test each of the endpoints + they should appear in the swagger under the User tag.
PR#3 should be:
8. Automated testing for the user service class.
9. Automated mock testing for the user endpoints.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureFeature or improvementFeature or improvementpriority:highHigh priority work itemHigh priority work item