@spytecgps/nova-orm 0.0.193 → 0.0.195

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ import { Task } from '../../entities';
2
+ import { NovaDataSource } from '../../novaDataSource';
3
+ import { Logger } from '../../types/logger';
4
+ import { CreateTaskParams } from '../../types/tasks';
5
+ export declare const createTask: (novaDataSource: NovaDataSource, params: CreateTaskParams, logger: Logger) => Promise<Task>;
@@ -0,0 +1,4 @@
1
+ import { NovaDataSource } from '../../novaDataSource';
2
+ import { Logger } from '../../types/logger';
3
+ import { DeleteTaskScheduleDevicesParams } from '../../types/tasks';
4
+ export declare const deleteTaskScheduleDevices: (novaDataSource: NovaDataSource, params: DeleteTaskScheduleDevicesParams, logger: Logger) => Promise<boolean>;
@@ -1,5 +1,5 @@
1
- import { DeviceTask, TaskSchedule } from '../../entities';
2
- import { AddTaskScheduleDevicesParams, CreateTaskScheduleParams, DeleteTaskScheduleParams, GetDeviceTasksParams, GetTaskScheduleParams, GetTaskSchedulesParams, SetTaskScheduleDevicesParams, UpdateTaskScheduleParams } from '../../types/tasks';
1
+ import { DeviceTask, Task, TaskSchedule } from '../../entities';
2
+ import { AddTaskScheduleDevicesParams, CreateTaskParams, CreateTaskScheduleParams, DeleteTaskScheduleDevicesParams, DeleteTaskScheduleParams, GetDeviceTasksParams, GetTaskScheduleParams, GetTaskSchedulesParams, SetTaskScheduleDevicesParams, UpdateTaskScheduleParams } from '../../types/tasks';
3
3
  import { BaseRepository } from '../baseRepository';
4
4
  export declare class TasksRepository extends BaseRepository {
5
5
  /**
@@ -123,7 +123,7 @@ export declare class TasksRepository extends BaseRepository {
123
123
  */
124
124
  setTaskScheduleDevices(params: SetTaskScheduleDevicesParams): Promise<boolean>;
125
125
  /**
126
- * Adds the supplied imeis to the TaskScheduleDevices table, associated with a task schedule id.
126
+ * Adds the supplied imeis to the DeviceTask table, associated with a task schedule id.
127
127
  * This operation adds the imeis if they do not exist and does not remove or modifies other records.
128
128
  * @param params params containing information to add task schedule devices
129
129
  * params.taskScheduleId: the task schedule ID, required.
@@ -132,4 +132,30 @@ export declare class TasksRepository extends BaseRepository {
132
132
  * If the task schedule does not exist, the function will return false
133
133
  */
134
134
  addTaskScheduleDevices(params: AddTaskScheduleDevicesParams): Promise<boolean>;
135
+ /**
136
+ * Deletes the supplied imeis from the DeviceTask table, associated with a task schedule id.
137
+ * This operation deletes the imeis if they exist and does not remove or modifies other records.
138
+ * @param params params containing information to delete task schedule devices
139
+ * params.taskScheduleId: the task schedule ID, required.
140
+ * params.imeis: the IMEIs, required.
141
+ * @returns Promise<boolean> whether the task schedule devices were deleted
142
+ */
143
+ deleteTaskScheduleDevices(params: DeleteTaskScheduleDevicesParams): Promise<boolean>;
144
+ /**
145
+ * Create a new task
146
+ * @param params params containing information to create task
147
+ * params.id: the ID, optional. If not provided, a new ID will be generated
148
+ * params.taskScheduleId: the task schedule ID, required
149
+ * params.imei: the IMEI, required
150
+ * params.clientId: the client ID, required
151
+ * params.startDate: the starting date, optional
152
+ * params.startingOdometer: the starting odometer, optional
153
+ * params.startingActiveHours: the starting active hours, optional
154
+ * One of the following is required:
155
+ * params.dueDate: the due date, required
156
+ * params.dueOdometer: the due odometer, required
157
+ * params.dueActiveHours: the due active hours, required
158
+ * @returns Promise<Task> the created task
159
+ */
160
+ createTask(params: CreateTaskParams): Promise<Task>;
135
161
  }
@@ -93,3 +93,19 @@ export interface AddTaskScheduleDevicesParams {
93
93
  taskScheduleId: number;
94
94
  imeis: string[];
95
95
  }
96
+ export interface DeleteTaskScheduleDevicesParams {
97
+ taskScheduleId: number;
98
+ imeis: string[];
99
+ }
100
+ export interface CreateTaskParams {
101
+ id?: number;
102
+ taskScheduleId: number;
103
+ imei: string;
104
+ clientId: number;
105
+ dueDate?: Date;
106
+ dueOdometer?: number;
107
+ dueActiveHours?: number;
108
+ startDate?: Date;
109
+ startingOdometer?: number;
110
+ startingActiveHours?: number;
111
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "0.0.193",
3
+ "version": "0.0.195",
4
4
  "description": "ORM with PlanetScale",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",