Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions API-REST/Task/Task-Create-Setup.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

96 changes: 96 additions & 0 deletions API-REST/Task/Task-Create.bru
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
}
53 changes: 53 additions & 0 deletions API-REST/Task/Task-Delete.bru
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
}
113 changes: 113 additions & 0 deletions API-REST/Task/Task-Get-All-For-Club.bru
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}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix redundant URL structure.

The URL contains /tasks twice, which is redundant and violates REST conventions, similar to the membership endpoint.

Apply this fix to use a cleaner URL structure:

-  url: http://localhost:5000/tasks/clubs/{{clubUuid}}/tasks?page={{page}}&limit={{limit}}&status[eq]={{taskStatus}}&category[eq]={{taskCategory}}
+  url: http://localhost:5000/clubs/{{clubUuid}}/tasks?page={{page}}&limit={{limit}}&status[eq]={{taskStatus}}&category[eq]={{taskCategory}}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
url: http://localhost:5000/tasks/clubs/{{clubUuid}}/tasks?page={{page}}&limit={{limit}}&status[eq]={{taskStatus}}&category[eq]={{taskCategory}}
url: http://localhost:5000/clubs/{{clubUuid}}/tasks?page={{page}}&limit={{limit}}&status[eq]={{taskStatus}}&category[eq]={{taskCategory}}
🤖 Prompt for AI Agents
In API-REST/Task/Task-Get-All-For-Club.bru at line 8, the URL path redundantly
includes "/tasks" twice. Remove the extra "/tasks" segment so the URL path
correctly reflects the resource hierarchy without duplication, following REST
conventions. Adjust the URL to have only one "/tasks" segment after
"/clubs/{{clubUuid}}".

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
}
109 changes: 109 additions & 0 deletions API-REST/Task/Task-Get-All-For-Membership.bru
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}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix redundant URL structure.

The URL contains /tasks twice, which is redundant and violates REST conventions.

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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}}
🤖 Prompt for AI Agents
In API-REST/Task/Task-Get-All-For-Membership.bru at line 8, the URL path
redundantly includes "/tasks" twice. Remove the extra "/tasks" segment so the
URL follows REST conventions and is cleaner, resulting in a single "/tasks" path
after the membership UUID.

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
}
Loading