sowell-models 1.5.0 → 1.7.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.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "SoWell models",
5
5
  "type": "module",
6
6
  "engines": {
@@ -9,7 +9,6 @@ import { ICheckpoint, SPCheckpointItem } from "../Checkpoint"
9
9
  import { CollectionFindOptions, IClearable } from "../interfaces"
10
10
  import { IArea, SPAreaItem } from "../AreaItem"
11
11
  import { IFamily, SPFamily } from "../Family"
12
- import { CleanerType } from "../VisitProp"
13
12
  export interface IChecklist extends IModel {
14
13
  _id?: string
15
14
  id?: string
@@ -21,7 +20,7 @@ export interface IChecklist extends IModel {
21
20
  area?: IArea
22
21
  checkpoints?: ICheckpoint[]
23
22
  family?: IFamily
24
- defaultCleaner?: CleanerType
23
+ allowedAgents?: string[]
25
24
  }
26
25
 
27
26
  export class ChecklistCollection
@@ -39,7 +38,7 @@ export class ChecklistCollection
39
38
  async find(
40
39
  selector?: Record<string, any> | Partial<IChecklist> | undefined,
41
40
  opts?: CollectionFindOptions
42
- ) {
41
+ ): Promise<IChecklist[]> {
43
42
  const result = await super.find(selector, opts)
44
43
  return orderBy(result, ["name"], ["asc"])
45
44
  }
@@ -51,7 +50,7 @@ export class SPChecklistItem extends ApplicationRecord implements IChecklist {
51
50
  @Attr() isPlanned!: boolean
52
51
  @Attr() iconUrl!: string
53
52
  @Attr({ persist: false }) updatedAt!: Date
54
- @Attr() defaultCleaner!: CleanerType
53
+ @Attr() allowedAgents!: string[]
55
54
  @BelongsTo() company!: SPCompany
56
55
  @BelongsTo() family!: SPFamily
57
56
  @HasOne() area!: SPAreaItem
@@ -11,14 +11,14 @@ export interface ICompany extends IModel {
11
11
  id?: string
12
12
  _id?: string
13
13
  name?: string
14
- config?: string[]
14
+ config?: Record<string, any>
15
15
  }
16
16
 
17
17
  @Model()
18
18
  export class SPCompany extends ApplicationRecord implements ICompany {
19
19
  static jsonapiType = "companies"
20
20
  @Attr() name!: string
21
- @Attr() config!: string[]
21
+ @Attr() config!: Record<string, any>
22
22
  @HasMany("areas") spAreaItems!: SPAreaItem[]
23
23
  @HasMany("agencies") spAgencyItems!: SPAgencyItem[]
24
24
  @HasMany("residences") spResidenceItems!: SPResidenceItem[]
@@ -7,7 +7,6 @@ import { ICheckpoint, SPCheckpointItem } from "../Checkpoint"
7
7
  import { IResidence, SPResidenceItem } from "../Residence"
8
8
  import { ISpot, SPSpotItem } from "../Spot"
9
9
 
10
- export type CleanerType = "reporter" | "tenant" | "provider" | "others"
11
10
  export interface IVisitProp extends IModel {
12
11
  _id?: string
13
12
  status?: "pending" | "missing"
@@ -19,14 +18,12 @@ export interface IVisitProp extends IModel {
19
18
  residenceId?: number
20
19
  spot?: ISpot
21
20
  spotId?: number
22
- cleaner?: CleanerType
23
21
  }
24
22
 
25
23
  @Model()
26
24
  export class SPVisitPropItem extends ApplicationRecord implements IVisitProp {
27
25
  static jsonapiType = "visit_props"
28
26
  @Attr() status!: "pending" | "missing"
29
- @Attr() cleaner!: CleanerType
30
27
  @Attr() placeId!: number
31
28
  @Attr() checkpointId!: number
32
29
  @Attr() residenceId!: number
@@ -5,7 +5,6 @@ import { IUser, SPUserItem } from "../User"
5
5
  import { IIssueReport, SPIssueReportItem } from "../IssueReport"
6
6
  import { ApplicationRecord } from "../ApplicationRecord"
7
7
  import { IVisitSchedule, SPVisitSchedule } from "../VisitSchedule"
8
- import { ICheckpoint } from "../Checkpoint"
9
8
  import * as yup from "yup"
10
9
  import { IChecklist, SPChecklistItem } from "../Checklist"
11
10
  import { IPlace, SPPlaceItem } from "../Place"
@@ -35,6 +34,7 @@ export interface VisitReportPayload {
35
34
  comment?: string
36
35
  isMissingProvider?: boolean
37
36
  validate?: (payload: VisitReportPayload) => string
37
+ agent?: string
38
38
  }
39
39
 
40
40
  export interface CheckpointProps {
@@ -51,14 +51,13 @@ export interface CheckpointProps {
51
51
  }
52
52
  category?: number
53
53
  comment?: string
54
- cleaner?: "tenant" | "provider" | "reporter" | "others"
55
54
  coefficient?: number
56
55
  }
57
56
 
58
57
  export interface IVisitReport extends IModel {
59
58
  id?: string
60
59
  createdAt?: Date
61
- checkpoints: ICheckpoint[] | CheckpointProps[]
60
+ checkpoints: CheckpointProps[]
62
61
  visitSchedule?: IVisitSchedule
63
62
  checklist?: IChecklist
64
63
  residence?: IResidence
@@ -73,6 +72,7 @@ export interface IVisitReport extends IModel {
73
72
  }
74
73
  score?: number
75
74
  isMissingProvider?: boolean
75
+ agent?: string
76
76
  validate?: (payload: VisitReportPayload) => string
77
77
  }
78
78
 
@@ -90,6 +90,7 @@ export class SPVisitReport extends ApplicationRecord implements IVisitReport {
90
90
  @Attr() comment!: string
91
91
  @Attr() imgs!: string[]
92
92
  @Attr() isMissingProvider!: boolean
93
+ @Attr() agent!: string
93
94
  @BelongsTo() author!: SPUserItem
94
95
  @BelongsTo() visitSchedule!: SPVisitSchedule
95
96
  @BelongsTo() checklist!: SPChecklistItem
@@ -14,8 +14,11 @@ export interface IVisitSchedule extends IModel {
14
14
  dueAt: Date
15
15
  checklistId?: string
16
16
  residence?: IResidence
17
+ residenceId?: string
17
18
  place?: IPlace
19
+ placeId?: string
18
20
  spot?: ISpot
21
+ spotId?: string
19
22
  checklist?: IChecklist
20
23
  }
21
24
 
@@ -48,6 +51,9 @@ export class SPVisitSchedule
48
51
  static jsonapiType = "visit_schedules"
49
52
  @Attr() dueAt!: Date
50
53
  @Attr() checklistId!: string
54
+ @Attr() residenceId!: string
55
+ @Attr() placeId!: string
56
+ @Attr() spotId!: string
51
57
  @BelongsTo() residence!: SPResidenceItem
52
58
  @BelongsTo() place!: SPPlaceItem
53
59
  @BelongsTo() spot!: SPSpotItem