Groups
Groups are used to organize and categorize jobs within an organization. They allow you to group related jobs together for easier management and reporting.
Schema​
Group​
Fields​
| Name | Type | Description | Example |
|---|---|---|---|
| id | ID | The unique group ID | "ckmnpybisiy5x08abky4g2d1f" |
| code | string | The unique code to represent this group | "GRP-001" |
| name | string | The name of the group | "Commercial Projects" |
| createdAt | DateTime | When this object was created | "2021-03-24 17:26:46.983Z" |
| updatedAt | DateTime | When this object was last updated | "2021-03-24 17:26:46.983Z" |
| deletedAt | DateTime | When this object was deleted (soft delete) | "2021-03-24 17:26:46.983Z" |
| createdById | ID | The ID of the user who created this group | "ckmnpybisiy5x08abky4g2d1f" |
| createdBy | User | The user who created this group | See Users |
Queries​
group​
Read a single group. You must specify either the ID or the code.
Parameters​
| Name | Description | Example |
|---|---|---|
| id | The ID of the group to fetch | "ckmnpybisiy5x08abky4g2d1f" |
| code | The code of the group to fetch | "GRP-001" |
Response​
A single Group object.
Example Query​
query {
group(code: "GRP-001") {
code
name
id
}
}
Example Response​
{
"code": "GRP-001",
"name": "Commercial Projects",
"id": "ckmnpybisiy5x08abky4g2d1f"
}
groups​
Read all groups, with pagination.
Parameters​
Accepts all standard pagination parameters.
Allowed orderBy fields: code, createdAt, id (default), name, updatedAt.
Allowed filter fields: code, createdAt, id, name, updatedAt.
Response​
A list of Group objects.
Example Query​
query {
groups(limit: 10, orderBy: name) {
code
name
id
}
}
Example Response​
[
{
"code": "GRP-001",
"name": "Commercial Projects",
"id": "ckmnpybisiy5x08abky4g2d1f"
},
{
"code": "GRP-002",
"name": "Residential Projects",
"id": "ckmnpybi7ag5x08abky4g2f1ff"
}
]
Mutations​
createGroup​
Creates a new group.
Parameters​
| Name | Type | Description | Example |
|---|---|---|---|
| name | string | Required. The name of the group | "Commercial Projects" |
| code | string | The unique code to represent this group | "GRP-001" |
Response​
The created Group.
Example Mutation​
mutation {
createGroup(
name: "Commercial Projects"
code: "GRP-001"
) {
code
name
id
}
}
Example Response​
{
"code": "GRP-001",
"name": "Commercial Projects",
"id": "ckmnpybisiy5x08abky4g2d1f"
}
updateGroup​
Updates a group.
Parameters​
| Name | Type | Description | Example |
|---|---|---|---|
| id | ID | Required. The ID of the group to update. | "ckmnpybisiy5x08abky4g2d1f" |
| name | string | The name of the group | "Updated Project Name" |
| code | string | The code of the group to update | "GRP-001-A" |
Response​
The updated Group.
Example Mutation​
mutation {
updateGroup(
id: "ckmnpybisiy5x08abky4g2d1f"
name: "Updated Commercial Projects"
) {
code
id
name
}
}
Example Response​
{
"code": "GRP-001",
"id": "ckmnpybisiy5x08abky4g2d1f",
"name": "Updated Commercial Projects"
}