Skip to content
Merged
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
16 changes: 16 additions & 0 deletions types/onfleet__node-onfleet/Resources/Tasks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ declare namespace Task {
signatureUploadId?: string | null;
}

type TaskCustomFieldValue = boolean | number | string | string[];

interface TaskCustomField {
description: string
asArray: boolean
visibility: string[]
editability: string[]
key: string
name: string
type: "single_line_text_field" | "multi_line_text_field" | "boolean" | "integer" | "decimal" | "date" | "Url"
contexts: any[]
value: TaskCustomFieldValue
}

interface OnfleetTask {
completeAfter: number;
completeBefore: number;
Expand Down Expand Up @@ -104,6 +118,7 @@ declare namespace Task {
captured: CapturedBarcode[];
}
| undefined;
customFields?: TaskCustomField[] | undefined;
}

interface CreateMultipleTasksProps {
Expand Down Expand Up @@ -140,6 +155,7 @@ declare namespace Task {
requirements?: TaskCompletionRequirements | undefined;
barcodes?: Barcode[] | undefined;
serviceTime?: number | undefined;
customFields?: Array<{ key: string; value: TaskCustomFieldValue }> | undefined;
}

interface AutomaticallyAssignTaskProps {
Expand Down
43 changes: 43 additions & 0 deletions types/onfleet__node-onfleet/onfleet__node-onfleet-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ async function testTasks(onfleet: Onfleet) {
task.completionDetails.photoUploadId;
task.completionDetails.photoUploadIds;
task.completionDetails.signatureUploadId;
if (task.customFields) {
for (const customField of task.customFields) {
customField.description;
customField.asArray;
customField.visibility;
customField.editability;
customField.key;
customField.name;
customField.type;
customField.contexts;
customField.value;
}
}
const result = await onfleet.tasks.get({ from: 1455072025000 });
for (const resultTask of result.tasks) {
resultTask.pickupTask;
Expand Down Expand Up @@ -105,6 +118,16 @@ async function testTasks(onfleet: Onfleet) {
type: "TEAM",
team: "teamId",
},
customFields: [
{
key: "newTest",
value: 1234
},
{
key:"test",
value:"order 123"
}
],
});

if (taskCreated.container.type === "TEAM") {
Expand All @@ -118,6 +141,16 @@ async function testTasks(onfleet: Onfleet) {
type: "WORKER",
worker: "workerId",
},
customFields: [
{
key: "newTest",
value: 1234
},
{
key:"test",
value:"order 123"
}
],
});

if (taskUpdated.container.type === "WORKER") {
Expand All @@ -132,6 +165,16 @@ async function testTasks(onfleet: Onfleet) {
{ blockCompletion: true },
{ data: "aGVsbG8gd29ybGQh", blockCompletion: true },
],
customFields: [
{
key: "newTest",
value: 1234
},
{
key:"test",
value:"order 123"
}
],
});

// test tasks.clone
Expand Down