sowell-models 1.22.0 → 1.22.2
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
|
@@ -4,10 +4,11 @@ import { orderBy } from "lodash"
|
|
|
4
4
|
|
|
5
5
|
import { ICompany, SPCompany } from "../Company"
|
|
6
6
|
import { ApplicationRecord } from "../ApplicationRecord"
|
|
7
|
+
import { SPCategoryItem } from "../category"
|
|
7
8
|
import { CollectionFindOptions, IClearable } from "../interfaces"
|
|
9
|
+
import { SPSpotItem } from "../Spot"
|
|
8
10
|
import { SPChecklistItem } from "../Checklist"
|
|
9
11
|
import { ILocation, SPLocationItem } from "../Location"
|
|
10
|
-
import { SPIssueReportItem } from "../IssueReport"
|
|
11
12
|
|
|
12
13
|
export interface IAreaType extends IModel {
|
|
13
14
|
_id?: string
|
|
@@ -71,7 +72,8 @@ export class SPAreaItem extends ApplicationRecord implements IArea {
|
|
|
71
72
|
@BelongsTo() company!: SPCompany
|
|
72
73
|
@HasOne() areaType!: SPAreaType
|
|
73
74
|
@HasMany() checklists!: SPChecklistItem[]
|
|
74
|
-
@HasMany()
|
|
75
|
+
@HasMany() spcategoryItems!: SPCategoryItem[]
|
|
76
|
+
@HasMany() spSpots!: SPSpotItem[]
|
|
75
77
|
get _id(): string | undefined {
|
|
76
78
|
return this.id
|
|
77
79
|
}
|
|
@@ -23,6 +23,7 @@ export interface IChecklist extends IModel {
|
|
|
23
23
|
periodicity?: string
|
|
24
24
|
defaultAgent?: string
|
|
25
25
|
allowedAgents?: string[]
|
|
26
|
+
skipProviderStep?: boolean
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export class ChecklistCollection
|
|
@@ -55,6 +56,7 @@ export class SPChecklistItem extends ApplicationRecord implements IChecklist {
|
|
|
55
56
|
@Attr() periodicity!: string
|
|
56
57
|
@Attr() allowedAgents!: string[]
|
|
57
58
|
@Attr() defaultAgent!: string
|
|
59
|
+
@Attr() skipProviderStep!: boolean
|
|
58
60
|
@BelongsTo() company!: SPCompany
|
|
59
61
|
@BelongsTo() family!: SPFamily
|
|
60
62
|
@HasOne() area!: SPAreaItem
|
|
@@ -11,7 +11,7 @@ import { IUser, SPUserItem } from "../User"
|
|
|
11
11
|
import { ICheckpoint, SPCheckpointItem } from "../Checkpoint"
|
|
12
12
|
import { SPVisitReport } from "../VisitReport"
|
|
13
13
|
import { IResidence } from "../Residence"
|
|
14
|
-
import { IArea
|
|
14
|
+
import { IArea } from "../AreaItem"
|
|
15
15
|
import { CollectionFindOptions, IClearable } from "../interfaces"
|
|
16
16
|
import { ISpot, SPSpotItem } from "./../Spot"
|
|
17
17
|
import arrayDiffBy from "../types"
|
|
@@ -92,7 +92,6 @@ export interface IIssueReport extends IModel {
|
|
|
92
92
|
origin?: IOrigin
|
|
93
93
|
assignee?: IUser
|
|
94
94
|
seen?: boolean
|
|
95
|
-
areaId?: number
|
|
96
95
|
validate?: () => string
|
|
97
96
|
}
|
|
98
97
|
|
|
@@ -164,7 +163,6 @@ export class SPIssueReportItem
|
|
|
164
163
|
@BelongsTo() reason!: SPReasonItem
|
|
165
164
|
@BelongsTo() origin?: SPOriginItem | undefined
|
|
166
165
|
@BelongsTo() assignee?: SPAssignee
|
|
167
|
-
@BelongsTo() area!: SPAreaItem
|
|
168
166
|
@HasMany() unseenIssues!: SPUnseenIssue[]
|
|
169
167
|
@HasMany() activities!: SPActivity[]
|
|
170
168
|
|
package/src/models/Spot/index.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SPAreaItem, IArea } from "../AreaItem/index"
|
|
1
2
|
import { Model, Attr, BelongsTo } from "spraypaint"
|
|
2
3
|
import { orderBy } from "lodash"
|
|
3
4
|
import { PouchCollection, PouchORM } from "pouchorm"
|
|
@@ -11,6 +12,7 @@ export interface ISpot extends IModel {
|
|
|
11
12
|
name: string
|
|
12
13
|
placeId?: string
|
|
13
14
|
place?: IPlace
|
|
15
|
+
area?: IArea
|
|
14
16
|
company?: ICompany
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -39,6 +41,7 @@ export class SPSpotItem extends ApplicationRecord implements ISpot {
|
|
|
39
41
|
static jsonapiType = "spots"
|
|
40
42
|
@Attr() name!: string
|
|
41
43
|
@BelongsTo() place!: SPPlaceItem
|
|
44
|
+
@BelongsTo() area!: SPAreaItem
|
|
42
45
|
@BelongsTo() company!: SPCompany
|
|
43
46
|
get _id(): string | undefined {
|
|
44
47
|
return this.id
|
|
@@ -1,85 +1,56 @@
|
|
|
1
|
-
import { Model, Attr, BelongsTo, HasMany } from
|
|
2
|
-
import { IModel, PouchCollection, PouchORM } from
|
|
3
|
-
import { orderBy } from
|
|
1
|
+
import { Model, Attr, BelongsTo, HasMany } from "spraypaint"
|
|
2
|
+
import { IModel, PouchCollection, PouchORM } from "pouchorm"
|
|
3
|
+
import { orderBy } from "lodash"
|
|
4
4
|
|
|
5
|
-
import { ApplicationRecord } from
|
|
6
|
-
import { ICompany, SPCompany } from
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { SPFamily } from '../Family';
|
|
12
|
-
|
|
13
|
-
export interface ICategoryType extends IModel {
|
|
14
|
-
_id?: string;
|
|
15
|
-
name: string;
|
|
16
|
-
code?: string;
|
|
17
|
-
areaType?: IAreaType;
|
|
18
|
-
}
|
|
5
|
+
import { ApplicationRecord } from "../ApplicationRecord"
|
|
6
|
+
import { ICompany, SPCompany } from "../Company"
|
|
7
|
+
import { IArea, SPAreaItem } from "../AreaItem"
|
|
8
|
+
import { SPCheckpointItem } from "../Checkpoint"
|
|
9
|
+
import { CollectionFindOptions, IClearable } from "../interfaces"
|
|
10
|
+
import { IReason, SPReasonItem } from "../Reason"
|
|
19
11
|
|
|
20
12
|
export interface ICategory extends IModel {
|
|
21
|
-
_id?: string
|
|
22
|
-
name: string
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
reasons?: IReason[];
|
|
13
|
+
_id?: string
|
|
14
|
+
name: string
|
|
15
|
+
order?: number
|
|
16
|
+
iconUrl?: string
|
|
17
|
+
company?: ICompany
|
|
18
|
+
areaId?: string
|
|
19
|
+
area?: IArea
|
|
20
|
+
reasons?: IReason[]
|
|
30
21
|
}
|
|
31
22
|
|
|
32
23
|
export class CategoryCollection
|
|
33
24
|
extends PouchCollection<ICategory>
|
|
34
|
-
implements IClearable
|
|
35
|
-
{
|
|
25
|
+
implements IClearable {
|
|
36
26
|
async beforeInit(): Promise<void> {
|
|
37
27
|
// NOTE: none
|
|
38
28
|
}
|
|
39
29
|
|
|
40
30
|
async clear(): Promise<void> {
|
|
41
|
-
await PouchORM.clearDatabase(
|
|
31
|
+
await PouchORM.clearDatabase("categories")
|
|
42
32
|
}
|
|
43
33
|
|
|
44
34
|
async find(
|
|
45
35
|
selector?: Record<string, any> | Partial<ICategory> | undefined,
|
|
46
|
-
opts?: CollectionFindOptions
|
|
36
|
+
opts?: CollectionFindOptions
|
|
47
37
|
): Promise<ICategory[]> {
|
|
48
|
-
const result = await super.find(selector, opts)
|
|
49
|
-
return orderBy(result, [
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
@Model()
|
|
54
|
-
export class SPCategoryTypeItem
|
|
55
|
-
extends ApplicationRecord
|
|
56
|
-
implements ICategoryType
|
|
57
|
-
{
|
|
58
|
-
static jsonapiType = 'category_types';
|
|
59
|
-
@Attr() name!: string;
|
|
60
|
-
@Attr() code?: string;
|
|
61
|
-
@BelongsTo() areaType!: SPAreaType;
|
|
62
|
-
@BelongsTo() family!: SPFamily[];
|
|
63
|
-
@HasMany() categories!: SPCategoryItem[];
|
|
64
|
-
get _id(): string | undefined {
|
|
65
|
-
return this.id;
|
|
38
|
+
const result = await super.find(selector, opts)
|
|
39
|
+
return orderBy(result, ["order"], ["asc"])
|
|
66
40
|
}
|
|
67
41
|
}
|
|
68
42
|
|
|
69
43
|
@Model()
|
|
70
44
|
export class SPCategoryItem extends ApplicationRecord implements ICategory {
|
|
71
|
-
static jsonapiType =
|
|
72
|
-
@Attr() name!: string
|
|
73
|
-
@Attr() order!: number
|
|
74
|
-
@Attr()
|
|
75
|
-
@
|
|
76
|
-
@
|
|
77
|
-
@BelongsTo() company!: SPCompany;
|
|
78
|
-
@BelongsTo() categoryType!: SPCategoryTypeItem;
|
|
79
|
-
@BelongsTo() areaType!: SPAreaType;
|
|
45
|
+
static jsonapiType = "categories"
|
|
46
|
+
@Attr() name!: string
|
|
47
|
+
@Attr() order!: number
|
|
48
|
+
@Attr() iconUrl!: string
|
|
49
|
+
@BelongsTo() company!: SPCompany
|
|
50
|
+
@BelongsTo() area!: SPAreaItem
|
|
80
51
|
get _id(): string | undefined {
|
|
81
|
-
return this.id
|
|
52
|
+
return this.id
|
|
82
53
|
}
|
|
83
|
-
@HasMany() checkpoints!: SPCheckpointItem[]
|
|
84
|
-
@HasMany() reasons!: SPReasonItem[]
|
|
54
|
+
@HasMany() checkpoints!: SPCheckpointItem[]
|
|
55
|
+
@HasMany() reasons!: SPReasonItem[]
|
|
85
56
|
}
|