-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/backend/implement task endpoints #154
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
base: dev
Are you sure you want to change the base?
Changes from all commits
baaac77
598a73e
3fd0bef
93ab5d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| meta { | ||
| name: Task-Create | ||
| type: http | ||
| seq: 6 | ||
| } | ||
|
|
||
| post { | ||
| url: http://localhost:5000/tasks | ||
| body: json | ||
| auth: none | ||
| } | ||
|
|
||
| headers { | ||
| Content-Type: application/json | ||
| x-user-id: {{userId}} | ||
| } | ||
|
|
||
| body:json { | ||
| { | ||
| "clubMembershipId": {{clubMembershipId}}, | ||
| "title": "{{taskTitle}}", | ||
| "description": "{{taskDescription}}", | ||
| "volunteeredSeconds": {{volunteeredSeconds}}, | ||
| "category": "{{taskCategory}}", | ||
| "attachment": "{{attachmentUrl}}" | ||
| } | ||
| } | ||
|
|
||
| vars:pre-request { | ||
| userId: 1 | ||
| clubMembershipId: 1 | ||
| taskTitle: Website Development | ||
| taskDescription: Develop a modern website for our programming club with member registration and event management features | ||
| volunteeredSeconds: 7200 | ||
| taskCategory: club_programs_projects | ||
| attachmentUrl: https://example.com/project-proposal.pdf | ||
| } | ||
|
|
||
| docs { | ||
| # Create Task API | ||
|
|
||
| This endpoint creates a new task for a club member. | ||
|
|
||
| ## Authentication | ||
| - Requires a valid user ID in the x-user-id header | ||
| - User must have the club membership specified in clubMembershipId | ||
|
|
||
| ## Request Body | ||
| - `clubMembershipId`: ID of the user's club membership (required, integer) | ||
| - `title`: Task title (required, string, max 100 characters) | ||
| - `description`: Task description (required, string, max 500 characters) | ||
| - `volunteeredSeconds`: Time spent in seconds (required, integer, min 0) | ||
| - `category`: Task category (required, string, enum) | ||
| - Available categories: club_programs_projects, uni_collab, external_collab, club_initiatives, internal_activities, community_contributions | ||
| - `attachment`: URL to attachment (optional, max 4096 characters) | ||
|
|
||
| ## Example | ||
| ``` | ||
| POST /tasks | ||
| x-user-id: 1 | ||
| Content-Type: application/json | ||
|
|
||
| { | ||
| "clubMembershipId": 1, | ||
| "title": "Website Development", | ||
| "description": "Develop club website", | ||
| "volunteeredSeconds": 7200, | ||
| "category": "club_programs_projects", | ||
| "attachment": "https://example.com/attachment.pdf" | ||
| } | ||
| ``` | ||
|
|
||
| ## Response | ||
| - `201 Created` on success with created task: | ||
| ```json | ||
| { | ||
| "data": { | ||
| "id": 1, | ||
| "uuid": "new-task-uuid", | ||
| "title": "Website Development", | ||
| "description": "Develop club website", | ||
| "volunteeredSeconds": 7200, | ||
| "category": "club_programs_projects", | ||
| "status": "pending", | ||
| "attachment": "https://example.com/attachment.pdf", | ||
| "reviewComment": null, | ||
| "createdAt": "2024-01-01T00:00:00Z", | ||
| "updatedAt": "2024-01-01T00:00:00Z" | ||
| } | ||
| } | ||
| ``` | ||
| - `400 Bad Request` if validation fails | ||
| - `401 Unauthorized` if user is not authenticated | ||
| - `403 Forbidden` if user doesn't have the specified club membership | ||
| - `500 Internal Server Error` for server issues | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| meta { | ||
| name: Task-Delete | ||
| type: http | ||
| seq: 8 | ||
| } | ||
|
|
||
| delete { | ||
| url: http://localhost:5000/tasks/{{taskUuid}} | ||
| body: none | ||
| auth: none | ||
| } | ||
|
|
||
| headers { | ||
| x-user-id: {{userId}} | ||
| } | ||
|
|
||
| vars:pre-request { | ||
| userId: 1 | ||
| taskUuid: "task-uuid-here" | ||
| } | ||
|
|
||
| docs { | ||
| # Delete Task API | ||
|
|
||
| This endpoint soft deletes a task by setting isArchived to true. The task is not permanently deleted but marked as archived. | ||
|
|
||
| ## Authentication | ||
| - Requires a valid user ID in the x-user-id header | ||
| - User must be the task owner or have club admin/HR role | ||
|
|
||
| ## Path Parameters | ||
| - `taskUuid`: Task UUID | ||
|
|
||
| ## Example | ||
| ``` | ||
| DELETE /tasks/550e8400-e29b-41d4-a716-446655440000 | ||
| x-user-id: 1 | ||
| ``` | ||
|
|
||
| ## Response | ||
| - `204 No Content` on successful deletion (no response body) | ||
| - `400 Bad Request` if task UUID format is invalid | ||
| - `401 Unauthorized` if user is not authenticated | ||
| - `403 Forbidden` if user doesn't have permission to delete this task | ||
| - `404 Not Found` if task doesn't exist | ||
| - `500 Internal Server Error` for server issues | ||
|
|
||
| ## Important Notes | ||
| - This is a soft delete operation | ||
| - The task is marked as archived with isArchived=true and archivedAt timestamp | ||
| - Archived tasks are automatically filtered out from GET requests | ||
| - System cleanup job will permanently delete tasks archived for more than 1 year | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| meta { | ||
| name: Task-Get-All-For-Club | ||
| type: http | ||
| seq: 4 | ||
| } | ||
|
|
||
| get { | ||
| url: http://localhost:5000/tasks/clubs/{{clubUuid}}/tasks?page={{page}}&limit={{limit}}&status[eq]={{taskStatus}}&category[eq]={{taskCategory}} | ||
| body: none | ||
| auth: none | ||
| } | ||
|
|
||
| headers { | ||
| x-user-id: {{userId}} | ||
| } | ||
|
|
||
| vars:pre-request { | ||
| userId: 1 | ||
| clubUuid: "club-uuid-here" | ||
| page: 1 | ||
| limit: 10 | ||
| taskStatus: pending | ||
| taskCategory: club_programs_projects | ||
| } | ||
|
|
||
| docs { | ||
| # Get All Tasks for Club API | ||
|
|
||
| This endpoint retrieves all tasks for a specific club, including tasks from all club members. | ||
|
|
||
| ## Authentication | ||
| - Requires a valid user ID in the x-user-id header | ||
|
|
||
| ## Path Parameters | ||
| - `clubUuid`: Club UUID | ||
|
|
||
| ## Query Parameters | ||
| - `page`: Page number (default: 1) | ||
| - `limit`: Items per page (default: 10, max: 50) | ||
| - `sort`: Sort fields (e.g., `-createdAt,title`) | ||
| - `fields`: Fields to include (e.g., `title,description,status`) | ||
| - `search`: Search term (searches in title and description) | ||
| - `status[eq]`: Filter by status (accepted, pending, changes_requested, denied) | ||
| - `category[eq]`: Filter by category | ||
|
|
||
| ## Example | ||
| ``` | ||
| GET /tasks/clubs/550e8400-e29b-41d4-a716-446655440000/tasks?page=1&limit=10&status[eq]=pending | ||
| x-user-id: 1 | ||
| ``` | ||
|
|
||
| ## Response | ||
| - `200 OK` on success with array of tasks and pagination metadata: | ||
| ```json | ||
| { | ||
| "success": true, | ||
| "data": { | ||
| "tasks": [ | ||
| { | ||
| "id": 1, | ||
| "uuid": "task-uuid", | ||
| "title": "Website Development", | ||
| "description": "Develop club website", | ||
| "volunteeredSeconds": 7200, | ||
| "category": "club_programs_projects", | ||
| "status": "pending", | ||
| "attachment": "https://example.com/attachment.pdf", | ||
| "reviewComment": null, | ||
| "createdAt": "2024-01-01T00:00:00Z", | ||
| "updatedAt": "2024-01-01T00:00:00Z", | ||
| "clubMembership": { | ||
| "id": 1, | ||
| "uuid": "membership-uuid", | ||
| "role": "member", | ||
| "status": "active", | ||
| "user": { | ||
| "id": 1, | ||
| "firstName": "John", | ||
| "lastName": "Doe" | ||
| }, | ||
| "club": { | ||
| "id": 1, | ||
| "name": "Programming Club" | ||
| } | ||
| }, | ||
| "createdByUser": { | ||
| "id": 1, | ||
| "firstName": "John", | ||
| "lastName": "Doe" | ||
| } | ||
| } | ||
| ], | ||
| "clubUuid": "550e8400-e29b-41d4-a716-446655440000", | ||
| "pagination": { | ||
| "page": 1, | ||
| "limit": 10, | ||
| "total": 1, | ||
| "pages": 1 | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
| - `400 Bad Request` if club UUID format is invalid | ||
| - `401 Unauthorized` if user is not authenticated | ||
| - `404 Not Found` if club doesn't exist or is archived | ||
| - `500 Internal Server Error` for server issues | ||
|
|
||
| ## Notes | ||
| - This endpoint returns tasks from all active members of the club | ||
| - Archived tasks and tasks from archived memberships are automatically filtered out | ||
| - If the club has no members, an empty array is returned | ||
| - Related data (clubMembership, user info) is always included in the response | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,109 @@ | ||||||
| meta { | ||||||
| name: Task-Get-All-For-Membership | ||||||
| type: http | ||||||
| seq: 5 | ||||||
| } | ||||||
|
|
||||||
| get { | ||||||
| url: http://localhost:5000/tasks/memberships/{{membershipUuid}}/tasks?page={{page}}&limit={{limit}}&status[eq]={{taskStatus}}&category[eq]={{taskCategory}} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix redundant URL structure. The URL contains Apply this fix to use a cleaner URL structure: - url: http://localhost:5000/tasks/memberships/{{membershipUuid}}/tasks?page={{page}}&limit={{limit}}&status[eq]={{taskStatus}}&category[eq]={{taskCategory}}
+ url: http://localhost:5000/memberships/{{membershipUuid}}/tasks?page={{page}}&limit={{limit}}&status[eq]={{taskStatus}}&category[eq]={{taskCategory}}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| body: none | ||||||
| auth: none | ||||||
| } | ||||||
|
|
||||||
| headers { | ||||||
| x-user-id: {{userId}} | ||||||
| } | ||||||
|
|
||||||
| vars:pre-request { | ||||||
| userId: 1 | ||||||
| membershipUuid: "membership-uuid-here" | ||||||
| page: 1 | ||||||
| limit: 10 | ||||||
| taskStatus: pending | ||||||
| taskCategory: club_programs_projects | ||||||
| } | ||||||
|
|
||||||
| docs { | ||||||
| # Get All Tasks for Membership API | ||||||
|
|
||||||
| This endpoint retrieves all tasks for a specific club membership. | ||||||
|
|
||||||
| ## Authentication | ||||||
| - Requires a valid user ID in the x-user-id header | ||||||
|
|
||||||
| ## Path Parameters | ||||||
| - `membershipUuid`: Club Membership UUID | ||||||
|
|
||||||
| ## Query Parameters | ||||||
| - `page`: Page number (default: 1) | ||||||
| - `limit`: Items per page (default: 10, max: 50) | ||||||
| - `sort`: Sort fields (e.g., `-createdAt,title`) | ||||||
| - `fields`: Fields to include (e.g., `title,description,status`) | ||||||
| - `include`: Relations to include (e.g., `clubMembership,createdByUser`) | ||||||
| - `search`: Search term (searches in title and description) | ||||||
| - `status[eq]`: Filter by status (accepted, pending, changes_requested, denied) | ||||||
| - `category[eq]`: Filter by category | ||||||
|
|
||||||
| ## Example | ||||||
| ``` | ||||||
| GET /tasks/memberships/550e8400-e29b-41d4-a716-446655440000/tasks?page=1&limit=10&status[eq]=pending | ||||||
| x-user-id: 1 | ||||||
| ``` | ||||||
|
|
||||||
| ## Response | ||||||
| - `200 OK` on success with array of tasks and pagination metadata: | ||||||
| ```json | ||||||
| { | ||||||
| "success": true, | ||||||
| "data": { | ||||||
| "tasks": [ | ||||||
| { | ||||||
| "id": 1, | ||||||
| "uuid": "task-uuid", | ||||||
| "title": "Website Development", | ||||||
| "description": "Develop club website", | ||||||
| "volunteeredSeconds": 7200, | ||||||
| "category": "club_programs_projects", | ||||||
| "status": "pending", | ||||||
| "attachment": "https://example.com/attachment.pdf", | ||||||
| "reviewComment": null, | ||||||
| "createdAt": "2024-01-01T00:00:00Z", | ||||||
| "updatedAt": "2024-01-01T00:00:00Z", | ||||||
| "clubMembership": { | ||||||
| "id": 1, | ||||||
| "uuid": "membership-uuid", | ||||||
| "role": "member", | ||||||
| "status": "active", | ||||||
| "club": { | ||||||
| "id": 1, | ||||||
| "uuid": "club-uuid", | ||||||
| "name": "Programming Club" | ||||||
| }, | ||||||
| "user": { | ||||||
| "id": 1, | ||||||
| "firstName": "John", | ||||||
| "lastName": "Doe" | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| ], | ||||||
| "membershipUuid": "550e8400-e29b-41d4-a716-446655440000", | ||||||
| "pagination": { | ||||||
| "page": 1, | ||||||
| "limit": 10, | ||||||
| "total": 1, | ||||||
| "pages": 1 | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| ``` | ||||||
| - `400 Bad Request` if membership UUID format is invalid | ||||||
| - `401 Unauthorized` if user is not authenticated | ||||||
| - `404 Not Found` if membership doesn't exist or is archived | ||||||
| - `500 Internal Server Error` for server issues | ||||||
|
|
||||||
| ## Notes | ||||||
| - This endpoint returns tasks only for the specified membership | ||||||
| - Archived tasks are automatically filtered out | ||||||
| - Useful for viewing all tasks submitted by a specific member in a specific club | ||||||
| } | ||||||
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.
Fix redundant URL structure.
The URL contains
/taskstwice, which is redundant and violates REST conventions, similar to the membership endpoint.Apply this fix to use a cleaner URL structure:
📝 Committable suggestion
🤖 Prompt for AI Agents