sowell-models 1.16.0 → 1.18.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sowell-models",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "description": "SoWell models",
5
5
  "type": "module",
6
6
  "engines": {
@@ -10,6 +10,7 @@ export interface IReason extends IModel {
10
10
  id?: string;
11
11
  _id?: string;
12
12
  name: string;
13
+ order?: number;
13
14
  iconUrl?: string;
14
15
  }
15
16
 
@@ -38,6 +39,7 @@ export class ReasonCollection
38
39
  export class SPReasonItem extends ApplicationRecord implements IReason {
39
40
  static jsonapiType = 'reasons';
40
41
  @Attr() name!: string;
42
+ @Attr() order!: number;
41
43
  @Attr() iconUrl?: string;
42
44
  @BelongsTo() category!: SPCategoryItem;
43
45
  }
@@ -13,6 +13,7 @@ export interface IVisitSchedule extends IModel {
13
13
  _id?: string
14
14
  dueAt: Date
15
15
  lastDoneAt?: Date
16
+ lateCount?: number
16
17
  checklistId?: string
17
18
  residence?: IResidence
18
19
  residenceId?: string
@@ -52,6 +53,7 @@ export class SPVisitSchedule
52
53
  static jsonapiType = "visit_schedules"
53
54
  @Attr() dueAt!: Date
54
55
  @Attr() lastDoneAt?: Date
56
+ @Attr() lateCount?: number
55
57
  @Attr() checklistId!: string
56
58
  @Attr() residenceId!: string
57
59
  @Attr() placeId!: string
@@ -12,6 +12,7 @@ import { IReason, SPReasonItem } from "../Reason"
12
12
  export interface ICategory extends IModel {
13
13
  _id?: string
14
14
  name: string
15
+ order?: number
15
16
  iconUrl?: string
16
17
  company?: ICompany
17
18
  areaId?: string
@@ -33,9 +34,9 @@ export class CategoryCollection
33
34
  async find(
34
35
  selector?: Record<string, any> | Partial<ICategory> | undefined,
35
36
  opts?: CollectionFindOptions
36
- ) {
37
+ ): Promise<ICategory[]> {
37
38
  const result = await super.find(selector, opts)
38
- return orderBy(result, ["name"], ["asc"])
39
+ return orderBy(result, ["order"], ["asc"])
39
40
  }
40
41
  }
41
42
 
@@ -43,6 +44,7 @@ export class CategoryCollection
43
44
  export class SPCategoryItem extends ApplicationRecord implements ICategory {
44
45
  static jsonapiType = "categories"
45
46
  @Attr() name!: string
47
+ @Attr() order!: number
46
48
  @Attr() iconUrl!: string
47
49
  @BelongsTo() company!: SPCompany
48
50
  @BelongsTo() area!: SPAreaItem