REST API (4) ‐ Groups - najat-mansour/task-go GitHub Wiki

Create Group

Endpoint

POST /task-go/v1/workspaces/{workspaceId}/groups

Request Headers

Header Value
Authorization Bearer <JWT>

Path Parameters

Parameter Type Description
workspaceId string UUID of the workspace

Request Body

{
  "name": "Development Team",
  "description": "Handles all development tasks"
}

Possible Responses

✅ 201 Created

{
  "message": "Group created successfully."
}

⚠️ 400 Bad Request

{
  "error": "Invalid input format."
}

🔐 401 Unauthorized

{
  "error": "Unauthorized. Token missing or invalid."
}

❌ 404 Not Found

{
  "error": "Workspace not found."
}

Update Group

Endpoint

PATCH /task-go/v1/workspaces/groups/{groupId}

Request Headers

Header Value
Authorization Bearer <JWT>

Path Parameters

Parameter Type Description
groupId string UUID of the group

Request Body

{
  "name": "Updated Group Name",
  "description": "Updated description."
}

All fields are optional.

Possible Responses

✅ 200 OK

{
  "message": "Group updated successfully."
}

⚠️ 400 Bad Request

{
  "error": "Invalid input format."
}

🔐 401 Unauthorized

{
  "error": "Unauthorized. Token missing or invalid."
}

❌ 404 Not Found

{
  "error": "Group not found."
}

Delete Group

Endpoint

DELETE /task-go/v1/workspaces/groups/{groupId}

Request Headers

Header Value
Authorization Bearer <JWT>

Path Parameters

Parameter Type Description
groupId string UUID of the group

Possible Responses

✅ 200 OK

{
  "message": "Group deleted successfully."
}

🔐 401 Unauthorized

{
  "error": "Unauthorized. Token missing or invalid."
}

❌ 404 Not Found

{
  "error": "Group not found in workspace."
}

Get Group by ID

Endpoint

GET /task-go/v1/workspaces/groups/{groupId}

Request Headers

Header Value
Authorization Bearer <JWT>

Path Parameters

Parameter Type Description
groupId string UUID of the group

Possible Responses

✅ 200 OK

{
  "id": "group-uuid",
  "name": "Development Team",
  "color": "#123456",
  "description": "Handles all development tasks",
  "tasks": [
    {
      "id": "task-uuid",
      "name": "Setup project",
      "description": "Initialize Git repo and base structure",
      "status": "NOT_STARTED",
      "priority": "HIGH",
      "isFavorite": false,
      "startingTimestamp": "2025-05-01T10:00:00",
      "endingTimestamp": "2025-05-02T18:00:00",
      "assignedTo": {
        "id": "user-uuid",
        "username": "najat-mansour",
        "firstName": "Najat",
        "lastName": "Mansour",
        "email": "[email protected]",
        "birthdate": "2003-01-28",
        "gender": "FEMALE",
        "address": {
          "country": "Palestine",
          "city": "Nablus",
          "town": "",
          "street": ""
        },
        "createdAt": "2025-05-02T18:00:00",
        "app_rate": 5
      },
      "subtasks": [
        {
          "id": "subtask-uuid",
          "name": "Create GitHub repo",
          "description": "Set up the GitHub repository",
          "status": "NOT_STARTED",
          "priority": "MEDIUM",
          "startingTimestamp": "2025-05-01T11:00:00",
          "endingTimestamp": "2025-05-01T12:00:00"
        }
      ]
    }
  ]
}

🔐 401 Unauthorized

{
  "error": "Unauthorized. Token missing or invalid."
}

❌ 404 Not Found

{
  "error": "Group not found in workspace."
}
⚠️ **GitHub.com Fallback** ⚠️