Skip to main content

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​

NameTypeDescriptionExample
idIDThe unique group ID"ckmnpybisiy5x08abky4g2d1f"
codestringThe unique code to represent this group"GRP-001"
namestringThe name of the group"Commercial Projects"
createdAtDateTimeWhen this object was created"2021-03-24 17:26:46.983Z"
updatedAtDateTimeWhen this object was last updated"2021-03-24 17:26:46.983Z"
deletedAtDateTimeWhen this object was deleted (soft delete)"2021-03-24 17:26:46.983Z"
createdByIdIDThe ID of the user who created this group"ckmnpybisiy5x08abky4g2d1f"
createdByUserThe user who created this groupSee Users

Queries​

group​

Read a single group. You must specify either the ID or the code.

Parameters​

NameDescriptionExample
idThe ID of the group to fetch"ckmnpybisiy5x08abky4g2d1f"
codeThe 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​

NameTypeDescriptionExample
namestringRequired. The name of the group"Commercial Projects"
codestringThe 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​

NameTypeDescriptionExample
idIDRequired. The ID of the group to update."ckmnpybisiy5x08abky4g2d1f"
namestringThe name of the group"Updated Project Name"
codestringThe 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"
}