sowell-models 1.7.0 → 1.8.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
|
import { Model, Attr } from "spraypaint"
|
|
2
|
-
import { ApplicationRecord } from "../ApplicationRecord"
|
|
3
2
|
import { ICompany } from "../Company"
|
|
3
|
+
import { SPUserItem } from "../User"
|
|
4
4
|
|
|
5
5
|
export interface Author {
|
|
6
6
|
_id?: string
|
|
@@ -10,7 +10,12 @@ export interface Author {
|
|
|
10
10
|
company?: ICompany
|
|
11
11
|
}
|
|
12
12
|
@Model()
|
|
13
|
-
export class SPAuthor extends
|
|
13
|
+
export class SPAuthor extends SPUserItem {
|
|
14
14
|
static jsonapiType = "authors"
|
|
15
15
|
@Attr() name!: string
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
@Model()
|
|
19
|
+
export class SPAssignee extends SPUserItem {
|
|
20
|
+
static jsonapiType = "assignees"
|
|
21
|
+
}
|
|
@@ -18,6 +18,7 @@ import arrayDiffBy from "../types"
|
|
|
18
18
|
import { IReason, SPReasonItem } from "../Reason"
|
|
19
19
|
import { IOrigin, SPOriginItem } from "../Origin"
|
|
20
20
|
import { SPUnseenIssue } from "../UnseenIssue"
|
|
21
|
+
import { SPAssignee } from "../Author"
|
|
21
22
|
export interface IssueReportPayload {
|
|
22
23
|
category?: string
|
|
23
24
|
agency?: string
|
|
@@ -33,6 +34,7 @@ export interface IssueReportPayload {
|
|
|
33
34
|
isTenantRequest?: boolean
|
|
34
35
|
reason?: string
|
|
35
36
|
origin?: string
|
|
37
|
+
assignee?: string
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export type Tab = "mySector" | "others"
|
|
@@ -76,6 +78,7 @@ export interface IIssueReport extends IModel {
|
|
|
76
78
|
isTenantRequest?:boolean
|
|
77
79
|
reason?: IReason
|
|
78
80
|
origin?: IOrigin
|
|
81
|
+
assignee?: IUser
|
|
79
82
|
seen?: boolean
|
|
80
83
|
validate?: () => string
|
|
81
84
|
}
|
|
@@ -94,7 +97,7 @@ export class IssueCollection
|
|
|
94
97
|
async find(
|
|
95
98
|
selector?: Record<string, any> | Partial<IIssueReport> | undefined,
|
|
96
99
|
opts?: CollectionFindOptions
|
|
97
|
-
) {
|
|
100
|
+
): Promise<IIssueReport[]> {
|
|
98
101
|
const result = await super.find(selector, opts)
|
|
99
102
|
return orderBy(result, ["name"], ["asc"])
|
|
100
103
|
}
|
|
@@ -136,9 +139,10 @@ export class SPIssueReportItem
|
|
|
136
139
|
@BelongsTo() checkpoint!: SPCheckpointItem
|
|
137
140
|
@BelongsTo() reason!: SPReasonItem
|
|
138
141
|
@BelongsTo() origin?: SPOriginItem | undefined
|
|
142
|
+
@BelongsTo() assignee?: SPAssignee
|
|
139
143
|
@HasMany() unseenIssues!: SPUnseenIssue[]
|
|
140
144
|
|
|
141
|
-
static async validate(payload: IssueReportPayload) {
|
|
145
|
+
static async validate(payload: IssueReportPayload): Promise<string> {
|
|
142
146
|
const schema = yup
|
|
143
147
|
.object()
|
|
144
148
|
.required()
|