WORKFORCEOS

FRONTEND GUIDE FOR AI CODING AGENTS - PART 8 - ScheduleManagement Service

This document is a part of a REST API guide for the workforceos project. It is designed for AI agents that will generate frontend code to consume the project’s backend.

This document provides extensive instruction for the usage of scheduleManagement

Service Access

ScheduleManagement service management is handled through service specific base urls.

ScheduleManagement service may be deployed to the preview server, staging server, or production server. Therefore,it has 3 access URLs. The frontend application must support all deployment environments during development, and the user should be able to select the target API server on the login page (already handled in first part.).

For the scheduleManagement service, the base URLs are:

Tenant URL Prefix and Header Forwarding

Tenant context is resolved by frontend routing strategy:

Then backend API calls must always claim target tenant with header:

headers["mbx-company-codename"] = tenantCodenameFromUrl;

URL prefix/subdomain is frontend-only tenant selection. Use header forwarding for all tenant-scoped calls to scheduleManagement service.

Scope

ScheduleManagement Service Description

Microservice managing shift scheduling, shift templates, assignment of users/departments to shifts, and schedule conflict detection for WorkforceOS.

ScheduleManagement service provides apis and business logic for following data objects in workforceos application. Each data object may be either a central domain of the application data structure or a related helper data object for a central concept. Note that data object concept is equal to table concept in the database, in the service database each data object is represented as a db table scheme and the object instances as table rows.

shiftTemplate Data Object: Template for recurring or standard shift patterns. Owned by company. Used to quickly schedule repeatable work shifts; optionally scoped to a department.

shift Data Object: A scheduled shift for a company. Defines date, time span, location, and assignment to users/departments. Core entity for workforce operations.

ScheduleManagement Service Frontend Description By The Backend Architect

This service manages all backend logic and data storage for shift schedules, shift templates, and employee assignments. Shifts and templates are accessible for creation and viewing according to user role; only users with admin/manager roles can modify, while regular employees can view only their assigned shifts. Responses for get/list APIs are enriched to provide user and department names for frontend efficiency. Validation error messages should be displayed inline for any scheduling conflicts. Shift times and recurrences should be formatted in user local time via the frontend.

API Structure

Object Structure of a Successful Response

When the service processes requests successfully, it wraps the requested resource(s) within a JSON envelope. This envelope includes the data and essential metadata such as configuration details and pagination information, providing context to the client.

HTTP Status Codes:

Success Response Format:

For successful operations, the response includes a "status": "OK" property, signaling that the request executed successfully. The structure of a successful response is outlined below:

{
  "status":"OK",
  "statusCode": 200,   
  "elapsedMs":126,
  "ssoTime":120,
  "source": "db",
  "cacheKey": "hexCode",
  "userId": "ID",
  "sessionId": "ID",
  "requestId": "ID",
  "dataName":"products",
  "method":"GET",
  "action":"list",
  "appVersion":"Version",
  "rowCount":3,
  "products":[{},{},{}],
  "paging": {
    "pageNumber":1, 
    "pageRowCount":25, 
    "totalRowCount":3,
    "pageCount":1
  },
  "filters": [],
  "uiPermissions": []
}

Additional Data

Each API may include additional data besides the main data object, depending on the business logic of the API. These will be provided in each API’s response signature.

Error Response

If a request encounters an issue—whether due to a logical fault or a technical problem—the service responds with a standardized JSON error structure. The HTTP status code indicates the nature of the error, using commonly recognized codes for clarity:

Each error response is structured to provide meaningful insight into the problem, assisting in efficient diagnosis and resolution.

{
  "result": "ERR",
  "status": 400,
  "message": "errMsg_organizationIdisNotAValidID",
  "errCode": 400,
  "date": "2024-03-19T12:13:54.124Z",
  "detail": "String"
}

ShiftTemplate Data Object

Template for recurring or standard shift patterns. Owned by company. Used to quickly schedule repeatable work shifts; optionally scoped to a department.

ShiftTemplate Data Object Frontend Description By The Backend Architect

Shift templates allow admins/managers to create reusable patterns for common/cyclic shifts. They define default times, recurrence (RFC5545 rule, e.g. weekly), and optionally restrict assignment to a specific department. Used when building the schedule calendar.

ShiftTemplate Data Object Properties

ShiftTemplate data object has got following properties that are represented as table fields in the database scheme. These properties don’t stand just for data storage, but each may have different settings to manage the business logic.

Property Type IsArray Required Secret Description
name String false Yes No Display name for the template (e.g., ‘Morning Shift’).
description Text false No No Description/purpose of the shift template.
startTime String false Yes No Template start time in HH:mm format.
endTime String false Yes No Template end time in HH:mm format.
recurrenceRule String false Yes No RFC 5545 RRULE-formatted string describing recurrence (e.g., weekly, biweekly).
departmentId ID false No No Restricts applicability of template to a department if set.
companyId ID false Yes No An ID value to represent the tenant id of the company

Relation Properties

departmentId

Mindbricks supports relations between data objects, allowing you to define how objects are linked together. The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search. These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects. If the relation points to another service, frontend should use the referenced service api in case it needs related data. The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. In mmost cases the api response will provide the relational data as well as the main one.

In frontend, please ensure that,

1- instaead of these relational ids you show the main human readable field of the related target data (like name), 2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.

The target object is a sibling object, meaning that the relation is a many-to-one or one-to-one relationship from this object to the target.

Required: No

Filter Properties

name departmentId companyId

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria. These properties are automatically mapped as API parameters in the listing API’s.

Shift Data Object

A scheduled shift for a company. Defines date, time span, location, and assignment to users/departments. Core entity for workforce operations.

Shift Data Object Frontend Description By The Backend Architect

A shift marks a scheduled work period. It includes the date, start/end time, location, and which users or departments are assigned. Only admin/manager roles can create/modify shifts. Employees see only shifts assigned to them (directly or via their department). Changes should be reflected in shift lists in near real-time.

Shift Data Object Properties

Shift data object has got following properties that are represented as table fields in the database scheme. These properties don’t stand just for data storage, but each may have different settings to manage the business logic.

Property Type IsArray Required Secret Description
shiftDate Date false Yes No Date of shift (YYYY-MM-DD).
startTime String false Yes No Shift start time (HH:mm local time).
endTime String false Yes No Shift end time (HH:mm local time).
location String false No No Physical or logical location for the shift (if applicable).
departmentId ID false No No Limits or indicates department responsible for this shift.
assignedUserIds ID true No No User IDs assigned to the shift.
assignedDepartmentIds ID true No No Department IDs (userGroups) assigned to the shift; employees in these groups are considered assigned.
status Enum false Yes No Status of the shift (scheduled, completed, cancelled).
createdBy ID false Yes No User who created the shift.
companyId ID false Yes No An ID value to represent the tenant id of the company

Array Properties

assignedUserIds assignedDepartmentIds

Array properties can hold multiple values. Array properties should be respected according to their multiple structure in the frontend in any user input for them. Please use multiple input components for the array proeprties when needed.

Enum Properties

Enum properties are defined with a set of allowed values, ensuring that only valid options can be assigned to them. The enum options value will be stored as strings in the database, but when a data object is created an additional property with the same name plus an idx suffix will be created, which will hold the index of the selected enum option. You can use the {fieldName_idx} property to sort by the enum value or when your enum options represent a hiyerarchy of values. In the frontend input components, enum type properties should only accept values from an option component that lists the enum options.

Relation Properties

departmentId createdBy

Mindbricks supports relations between data objects, allowing you to define how objects are linked together. The relations may reference to a data object either in this service or in another service. Id the reference is remote, backend handles the relations through service communication or elastic search. These relations should be respected in the frontend so that instaead of showing the related objects id, the frontend should list human readable values from other data objects. If the relation points to another service, frontend should use the referenced service api in case it needs related data. The relation logic is montly handled in backend so the api responses feeds the frontend about the relational data. In mmost cases the api response will provide the relational data as well as the main one.

In frontend, please ensure that,

1- instaead of these relational ids you show the main human readable field of the related target data (like name), 2- if this data object needs a user input of these relational ids, you should provide a combobox with the list of possible records or (a searchbox) to select with the realted target data object main human readable field.

The target object is a sibling object, meaning that the relation is a many-to-one or one-to-one relationship from this object to the target.

Required: No

The target object is a sibling object, meaning that the relation is a many-to-one or one-to-one relationship from this object to the target.

Required: No

Filter Properties

shiftDate departmentId assignedUserIds assignedDepartmentIds status companyId

Filter properties are used to define parameters that can be used in query filters, allowing for dynamic data retrieval based on user input or predefined criteria. These properties are automatically mapped as API parameters in the listing API’s.

Default CRUD APIs

For each data object, the backend architect may designate default APIs for standard operations (create, update, delete, get, list). These are the APIs that frontend CRUD forms and AI agents should use for basic record management. If no default is explicitly set (isDefaultApi), the frontend generator auto-discovers the most general API for each operation.

ShiftTemplate Default APIs

Display Label Property: name — Use this property as the human-readable label when displaying records of this data object (e.g., in dropdowns, references).

Operation API Name Route Explicitly Set
Create createShiftTemplate /v1/shifttemplates Yes
Update updateShiftTemplate /v1/shifttemplates/:shiftTemplateId Yes
Delete deleteShiftTemplate /v1/shifttemplates/:shiftTemplateId Yes
Get getShiftTemplate /v1/shifttemplates/:shiftTemplateId Yes
List listShiftTemplates /v1/shifttemplates Yes

Shift Default APIs

Operation API Name Route Explicitly Set
Create createShift /v1/shifts Yes
Update updateShift /v1/shifts/:shiftId Yes
Delete deleteShift /v1/shifts/:shiftId Yes
Get getShift /v1/shifts/:shiftId Yes
List listShifts /v1/shifts Yes

When building CRUD forms for a data object, use the default create/update APIs listed above. The form fields should correspond to the API’s body parameters. For relation fields, render a dropdown loaded from the related object’s list API using the display label property.

API Reference

Create Shifttemplate API

[Default create API] — This is the designated default create API for the shiftTemplate data object. Frontend generators and AI agents should use this API for standard CRUD operations. Create a new shift template for the company.

Rest Route

The createShiftTemplate API REST controller can be triggered via the following route:

/v1/shifttemplates

Rest Request Parameters

The createShiftTemplate api has got 6 regular request parameters

Parameter Type Required Population
name String true request.body?.[“name”]
description Text false request.body?.[“description”]
startTime String true request.body?.[“startTime”]
endTime String true request.body?.[“endTime”]
recurrenceRule String true request.body?.[“recurrenceRule”]
departmentId ID false request.body?.[“departmentId”]
name : Display name for the template (e.g., ‘Morning Shift’).
description : Description/purpose of the shift template.
startTime : Template start time in HH:mm format.
endTime : Template end time in HH:mm format.
recurrenceRule : RFC 5545 RRULE-formatted string describing recurrence (e.g., weekly, biweekly).
departmentId : Restricts applicability of template to a department if set.

REST Request To access the api you can use the REST controller with the path POST /v1/shifttemplates

  axios({
    method: 'POST',
    url: '/v1/shifttemplates',
    data: {
            name:"String",  
            description:"Text",  
            startTime:"String",  
            endTime:"String",  
            recurrenceRule:"String",  
            departmentId:"ID",  
    
    },
    params: {
    
        }
  });

REST Response

{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "shiftTemplate",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"shiftTemplate": {
		"id": "ID",
		"name": "String",
		"description": "Text",
		"startTime": "String",
		"endTime": "String",
		"recurrenceRule": "String",
		"departmentId": "ID",
		"companyId": "ID",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}

Update Shifttemplate API

[Default update API] — This is the designated default update API for the shiftTemplate data object. Frontend generators and AI agents should use this API for standard CRUD operations. Update an existing shift template.

Rest Route

The updateShiftTemplate API REST controller can be triggered via the following route:

/v1/shifttemplates/:shiftTemplateId

Rest Request Parameters

The updateShiftTemplate api has got 7 regular request parameters

Parameter Type Required Population
shiftTemplateId ID true request.params?.[“shiftTemplateId”]
name String false request.body?.[“name”]
description Text false request.body?.[“description”]
startTime String false request.body?.[“startTime”]
endTime String false request.body?.[“endTime”]
recurrenceRule String false request.body?.[“recurrenceRule”]
departmentId ID false request.body?.[“departmentId”]
shiftTemplateId : This id paremeter is used to select the required data object that will be updated
name : Display name for the template (e.g., ‘Morning Shift’).
description : Description/purpose of the shift template.
startTime : Template start time in HH:mm format.
endTime : Template end time in HH:mm format.
recurrenceRule : RFC 5545 RRULE-formatted string describing recurrence (e.g., weekly, biweekly).
departmentId : Restricts applicability of template to a department if set.

REST Request To access the api you can use the REST controller with the path PATCH /v1/shifttemplates/:shiftTemplateId

  axios({
    method: 'PATCH',
    url: `/v1/shifttemplates/${shiftTemplateId}`,
    data: {
            name:"String",  
            description:"Text",  
            startTime:"String",  
            endTime:"String",  
            recurrenceRule:"String",  
            departmentId:"ID",  
    
    },
    params: {
    
        }
  });

REST Response

{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "shiftTemplate",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"shiftTemplate": {
		"id": "ID",
		"name": "String",
		"description": "Text",
		"startTime": "String",
		"endTime": "String",
		"recurrenceRule": "String",
		"departmentId": "ID",
		"companyId": "ID",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}

Delete Shifttemplate API

[Default delete API] — This is the designated default delete API for the shiftTemplate data object. Frontend generators and AI agents should use this API for standard CRUD operations. Delete a shift template by id.

Rest Route

The deleteShiftTemplate API REST controller can be triggered via the following route:

/v1/shifttemplates/:shiftTemplateId

Rest Request Parameters

The deleteShiftTemplate api has got 1 regular request parameter

Parameter Type Required Population
shiftTemplateId ID true request.params?.[“shiftTemplateId”]
shiftTemplateId : This id paremeter is used to select the required data object that will be deleted

REST Request To access the api you can use the REST controller with the path DELETE /v1/shifttemplates/:shiftTemplateId

  axios({
    method: 'DELETE',
    url: `/v1/shifttemplates/${shiftTemplateId}`,
    data: {
    
    },
    params: {
    
        }
  });

REST Response

{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "shiftTemplate",
	"method": "DELETE",
	"action": "delete",
	"appVersion": "Version",
	"rowCount": 1,
	"shiftTemplate": {
		"id": "ID",
		"name": "String",
		"description": "Text",
		"startTime": "String",
		"endTime": "String",
		"recurrenceRule": "String",
		"departmentId": "ID",
		"companyId": "ID",
		"isActive": false,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}

Get Shifttemplate API

[Default get API] — This is the designated default get API for the shiftTemplate data object. Frontend generators and AI agents should use this API for standard CRUD operations. Get detailed info for a shift template.

Rest Route

The getShiftTemplate API REST controller can be triggered via the following route:

/v1/shifttemplates/:shiftTemplateId

Rest Request Parameters

The getShiftTemplate api has got 1 regular request parameter

Parameter Type Required Population
shiftTemplateId ID true request.params?.[“shiftTemplateId”]
shiftTemplateId : This id paremeter is used to query the required data object.

REST Request To access the api you can use the REST controller with the path GET /v1/shifttemplates/:shiftTemplateId

  axios({
    method: 'GET',
    url: `/v1/shifttemplates/${shiftTemplateId}`,
    data: {
    
    },
    params: {
    
        }
  });

REST Response

{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "shiftTemplate",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"shiftTemplate": {
		"id": "ID",
		"name": "String",
		"description": "Text",
		"startTime": "String",
		"endTime": "String",
		"recurrenceRule": "String",
		"departmentId": "ID",
		"companyId": "ID",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}

List Shifttemplates API

[Default list API] — This is the designated default list API for the shiftTemplate data object. Frontend generators and AI agents should use this API for standard CRUD operations. List all shift templates for the company, filterable by department.

Rest Route

The listShiftTemplates API REST controller can be triggered via the following route:

/v1/shifttemplates

Rest Request Parameters

Filter Parameters

The listShiftTemplates api supports 2 optional filter parameters for filtering list results:

name (String): Display name for the template (e.g., ‘Morning Shift’).

departmentId (ID): Restricts applicability of template to a department if set.

REST Request To access the api you can use the REST controller with the path GET /v1/shifttemplates

  axios({
    method: 'GET',
    url: '/v1/shifttemplates',
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // name: '<value>' // Filter by name
        // departmentId: '<value>' // Filter by departmentId
            }
  });

REST Response

{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "shiftTemplates",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"shiftTemplates": [
		{
			"id": "ID",
			"name": "String",
			"description": "Text",
			"startTime": "String",
			"endTime": "String",
			"recurrenceRule": "String",
			"departmentId": "ID",
			"companyId": "ID",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID",
			"department": [
				null,
				null,
				null
			]
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}

Create Shift API

[Default create API] — This is the designated default create API for the shift data object. Frontend generators and AI agents should use this API for standard CRUD operations. Create a shift for a specific date, with assigned users or departments. Enforces conflict detection: blocks if any assigned user has an overlapping shift OR an approved leave request covering the shift date.

Rest Route

The createShift API REST controller can be triggered via the following route:

/v1/shifts

Rest Request Parameters

The createShift api has got 8 regular request parameters

Parameter Type Required Population
shiftDate Date true request.body?.[“shiftDate”]
startTime String true request.body?.[“startTime”]
endTime String true request.body?.[“endTime”]
location String false request.body?.[“location”]
departmentId ID false request.body?.[“departmentId”]
assignedUserIds ID false request.body?.[“assignedUserIds”]
assignedDepartmentIds ID false request.body?.[“assignedDepartmentIds”]
status Enum true request.body?.[“status”]
shiftDate : Date of shift (YYYY-MM-DD).
startTime : Shift start time (HH:mm local time).
endTime : Shift end time (HH:mm local time).
location : Physical or logical location for the shift (if applicable).
departmentId : Limits or indicates department responsible for this shift.
assignedUserIds : User IDs assigned to the shift.
assignedDepartmentIds : Department IDs (userGroups) assigned to the shift; employees in these groups are considered assigned.
status : Status of the shift (scheduled, completed, cancelled).

REST Request To access the api you can use the REST controller with the path POST /v1/shifts

  axios({
    method: 'POST',
    url: '/v1/shifts',
    data: {
            shiftDate:"Date",  
            startTime:"String",  
            endTime:"String",  
            location:"String",  
            departmentId:"ID",  
            assignedUserIds:"ID",  
            assignedDepartmentIds:"ID",  
            status:"Enum",  
    
    },
    params: {
    
        }
  });

REST Response

{
	"status": "OK",
	"statusCode": "201",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "shift",
	"method": "POST",
	"action": "create",
	"appVersion": "Version",
	"rowCount": 1,
	"shift": {
		"id": "ID",
		"shiftDate": "Date",
		"startTime": "String",
		"endTime": "String",
		"location": "String",
		"departmentId": "ID",
		"assignedUserIds": "ID",
		"assignedDepartmentIds": "ID",
		"status": "Enum",
		"status_idx": "Integer",
		"createdBy": "ID",
		"companyId": "ID",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}

Update Shift API

[Default update API] — This is the designated default update API for the shift data object. Frontend generators and AI agents should use this API for standard CRUD operations. Update details or assignment of an existing shift. Runs conflict detection on new assignments: blocks if any assigned user has an overlapping shift OR an approved leave request covering the shift date.

Rest Route

The updateShift API REST controller can be triggered via the following route:

/v1/shifts/:shiftId

Rest Request Parameters

The updateShift api has got 9 regular request parameters

Parameter Type Required Population
shiftId ID true request.params?.[“shiftId”]
shiftDate Date true request.body?.[“shiftDate”]
startTime String true request.body?.[“startTime”]
endTime String true request.body?.[“endTime”]
location String false request.body?.[“location”]
departmentId ID false request.body?.[“departmentId”]
assignedUserIds ID false request.body?.[“assignedUserIds”]
assignedDepartmentIds ID false request.body?.[“assignedDepartmentIds”]
status Enum false request.body?.[“status”]
shiftId : This id paremeter is used to select the required data object that will be updated
shiftDate : Date of shift (YYYY-MM-DD).
startTime : Shift start time (HH:mm local time).
endTime : Shift end time (HH:mm local time).
location : Physical or logical location for the shift (if applicable).
departmentId : Limits or indicates department responsible for this shift.
assignedUserIds : User IDs assigned to the shift.
assignedDepartmentIds : Department IDs (userGroups) assigned to the shift; employees in these groups are considered assigned.
status : Status of the shift (scheduled, completed, cancelled).

REST Request To access the api you can use the REST controller with the path PATCH /v1/shifts/:shiftId

  axios({
    method: 'PATCH',
    url: `/v1/shifts/${shiftId}`,
    data: {
            shiftDate:"Date",  
            startTime:"String",  
            endTime:"String",  
            location:"String",  
            departmentId:"ID",  
            assignedUserIds:"ID",  
            assignedDepartmentIds:"ID",  
            status:"Enum",  
    
    },
    params: {
    
        }
  });

REST Response

{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "shift",
	"method": "PATCH",
	"action": "update",
	"appVersion": "Version",
	"rowCount": 1,
	"shift": {
		"id": "ID",
		"shiftDate": "Date",
		"startTime": "String",
		"endTime": "String",
		"location": "String",
		"departmentId": "ID",
		"assignedUserIds": "ID",
		"assignedDepartmentIds": "ID",
		"status": "Enum",
		"status_idx": "Integer",
		"createdBy": "ID",
		"companyId": "ID",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}

Delete Shift API

[Default delete API] — This is the designated default delete API for the shift data object. Frontend generators and AI agents should use this API for standard CRUD operations. Delete a shift by id.

Rest Route

The deleteShift API REST controller can be triggered via the following route:

/v1/shifts/:shiftId

Rest Request Parameters

The deleteShift api has got 1 regular request parameter

Parameter Type Required Population
shiftId ID true request.params?.[“shiftId”]
shiftId : This id paremeter is used to select the required data object that will be deleted

REST Request To access the api you can use the REST controller with the path DELETE /v1/shifts/:shiftId

  axios({
    method: 'DELETE',
    url: `/v1/shifts/${shiftId}`,
    data: {
    
    },
    params: {
    
        }
  });

REST Response

{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "shift",
	"method": "DELETE",
	"action": "delete",
	"appVersion": "Version",
	"rowCount": 1,
	"shift": {
		"id": "ID",
		"shiftDate": "Date",
		"startTime": "String",
		"endTime": "String",
		"location": "String",
		"departmentId": "ID",
		"assignedUserIds": "ID",
		"assignedDepartmentIds": "ID",
		"status": "Enum",
		"status_idx": "Integer",
		"createdBy": "ID",
		"companyId": "ID",
		"isActive": false,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID"
	}
}

Get Shift API

[Default get API] — This is the designated default get API for the shift data object. Frontend generators and AI agents should use this API for standard CRUD operations. Get details for a specific shift (enriched with user and department info for assignments).

Rest Route

The getShift API REST controller can be triggered via the following route:

/v1/shifts/:shiftId

Rest Request Parameters

The getShift api has got 1 regular request parameter

Parameter Type Required Population
shiftId ID true request.params?.[“shiftId”]
shiftId : This id paremeter is used to query the required data object.

REST Request To access the api you can use the REST controller with the path GET /v1/shifts/:shiftId

  axios({
    method: 'GET',
    url: `/v1/shifts/${shiftId}`,
    data: {
    
    },
    params: {
    
        }
  });

REST Response

{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "shift",
	"method": "GET",
	"action": "get",
	"appVersion": "Version",
	"rowCount": 1,
	"shift": {
		"id": "ID",
		"shiftDate": "Date",
		"startTime": "String",
		"endTime": "String",
		"location": "String",
		"departmentId": "ID",
		"assignedUserIds": "ID",
		"assignedDepartmentIds": "ID",
		"status": "Enum",
		"status_idx": "Integer",
		"createdBy": "ID",
		"companyId": "ID",
		"isActive": true,
		"recordVersion": "Integer",
		"createdAt": "Date",
		"updatedAt": "Date",
		"_owner": "ID",
		"assignedUsers": {
			"fullname": "String",
			"avatar": "String"
		},
		"createdByUser": {
			"fullname": "String",
			"avatar": "String"
		}
	}
}

List Shifts API

[Default list API] — This is the designated default list API for the shift data object. Frontend generators and AI agents should use this API for standard CRUD operations. List all shifts, filterable by date, assigned user, department, status, etc. Employees can see only shifts assigned to them or their department.

Rest Route

The listShifts API REST controller can be triggered via the following route:

/v1/shifts

Rest Request Parameters

Filter Parameters

The listShifts api supports 7 optional filter parameters for filtering list results:

shiftDate (Date): Date of shift (YYYY-MM-DD).

departmentId (ID): Limits or indicates department responsible for this shift.

assignedUserIds (ID array): User IDs assigned to the shift.

assignedUserIds_op (String): Operator for filtering array property “assignedUserIds”. Use “contains” to check if array contains the value, or “overlap” to check if arrays have common elements.

assignedDepartmentIds (ID array): Department IDs (userGroups) assigned to the shift; employees in these groups are considered assigned.

assignedDepartmentIds_op (String): Operator for filtering array property “assignedDepartmentIds”. Use “contains” to check if array contains the value, or “overlap” to check if arrays have common elements.

status (Enum): Status of the shift (scheduled, completed, cancelled).

REST Request To access the api you can use the REST controller with the path GET /v1/shifts

  axios({
    method: 'GET',
    url: '/v1/shifts',
    data: {
    
    },
    params: {
    
        // Filter parameters (see Filter Parameters section above)
        // shiftDate: '<value>' // Filter by shiftDate
        // departmentId: '<value>' // Filter by departmentId
        // assignedUserIds: '<value>' // Filter by assignedUserIds
        // assignedUserIds_op: '<value>' // Filter by assignedUserIds_op
        // assignedDepartmentIds: '<value>' // Filter by assignedDepartmentIds
        // assignedDepartmentIds_op: '<value>' // Filter by assignedDepartmentIds_op
        // status: '<value>' // Filter by status
            }
  });

REST Response

{
	"status": "OK",
	"statusCode": "200",
	"elapsedMs": 126,
	"ssoTime": 120,
	"source": "db",
	"cacheKey": "hexCode",
	"userId": "ID",
	"sessionId": "ID",
	"requestId": "ID",
	"dataName": "shifts",
	"method": "GET",
	"action": "list",
	"appVersion": "Version",
	"rowCount": "\"Number\"",
	"shifts": [
		{
			"id": "ID",
			"shiftDate": "Date",
			"startTime": "String",
			"endTime": "String",
			"location": "String",
			"departmentId": "ID",
			"assignedUserIds": "ID",
			"assignedDepartmentIds": "ID",
			"status": "Enum",
			"status_idx": "Integer",
			"createdBy": "ID",
			"companyId": "ID",
			"isActive": true,
			"recordVersion": "Integer",
			"createdAt": "Date",
			"updatedAt": "Date",
			"_owner": "ID",
			"assignedUsers": [
				{
					"fullname": "String",
					"avatar": "String"
				},
				{},
				{}
			],
			"assignedDepartments": [
				null,
				null,
				null
			],
			"department": [
				null,
				null,
				null
			],
			"createdByUser": [
				{
					"fullname": "String",
					"avatar": "String"
				},
				{},
				{}
			]
		},
		{},
		{}
	],
	"paging": {
		"pageNumber": "Number",
		"pageRowCount": "NUmber",
		"totalRowCount": "Number",
		"pageCount": "Number"
	},
	"filters": [],
	"uiPermissions": []
}

After this prompt, the user may give you new instructions to update the output of this prompt or provide subsequent prompts about the project.