forked from mirrors/homebox
feat: add scheduled maintenance tasks (#320)
* add scheduled maintenance tasks * fix failing typecheck
This commit is contained in:
parent
70297b9d27
commit
025521431e
25 changed files with 521 additions and 121 deletions
|
@ -135,7 +135,8 @@ describe("user should be able to create an item and add an attachment", () => {
|
|||
const { response, data } = await api.items.maintenance.create(item.id, {
|
||||
name: faker.vehicle.model(),
|
||||
description: faker.lorem.paragraph(1),
|
||||
date: faker.date.past(1),
|
||||
completedDate: faker.date.past(1),
|
||||
scheduledDate: "null",
|
||||
cost: faker.datatype.number(100).toString(),
|
||||
});
|
||||
|
||||
|
|
|
@ -59,9 +59,14 @@ export class FieldsAPI extends BaseAPI {
|
|||
}
|
||||
}
|
||||
|
||||
type MaintenanceEntryQuery = {
|
||||
scheduled?: boolean;
|
||||
completed?: boolean;
|
||||
};
|
||||
|
||||
export class MaintenanceAPI extends BaseAPI {
|
||||
getLog(itemId: string) {
|
||||
return this.http.get<MaintenanceLog>({ url: route(`/items/${itemId}/maintenance`) });
|
||||
getLog(itemId: string, q: MaintenanceEntryQuery = {}) {
|
||||
return this.http.get<MaintenanceLog>({ url: route(`/items/${itemId}/maintenance`, q) });
|
||||
}
|
||||
|
||||
create(itemId: string, data: MaintenanceEntryCreate) {
|
||||
|
|
|
@ -227,28 +227,37 @@ export interface LocationUpdate {
|
|||
}
|
||||
|
||||
export interface MaintenanceEntry {
|
||||
/** Sold */
|
||||
completedDate: Date | string;
|
||||
/** @example "0" */
|
||||
cost: string;
|
||||
date: Date | string;
|
||||
description: string;
|
||||
id: string;
|
||||
name: string;
|
||||
/** Sold */
|
||||
scheduledDate: Date | string;
|
||||
}
|
||||
|
||||
export interface MaintenanceEntryCreate {
|
||||
/** Sold */
|
||||
completedDate: Date | string;
|
||||
/** @example "0" */
|
||||
cost: string;
|
||||
date: Date | string;
|
||||
description: string;
|
||||
name: string;
|
||||
/** Sold */
|
||||
scheduledDate: Date | string;
|
||||
}
|
||||
|
||||
export interface MaintenanceEntryUpdate {
|
||||
/** Sold */
|
||||
completedDate: Date | string;
|
||||
/** @example "0" */
|
||||
cost: string;
|
||||
date: Date | string;
|
||||
description: string;
|
||||
name: string;
|
||||
/** Sold */
|
||||
scheduledDate: Date | string;
|
||||
}
|
||||
|
||||
export interface MaintenanceLog {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue