sowell-models 1.8.0 → 1.8.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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sowell-models",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "description": "SoWell models",
5
5
  "type": "module",
6
6
  "engines": {
@@ -1,18 +1,8 @@
1
- import { Model, Attr } from "spraypaint"
2
- import { ICompany } from "../Company"
1
+ import { Model } from "spraypaint"
3
2
  import { SPUserItem } from "../User"
4
-
5
- export interface Author {
6
- _id?: string
7
- fname: string
8
- lname: string
9
- email?: string
10
- company?: ICompany
11
- }
12
3
  @Model()
13
4
  export class SPAuthor extends SPUserItem {
14
5
  static jsonapiType = "authors"
15
- @Attr() name!: string
16
6
  }
17
7
 
18
8
  @Model()
@@ -44,6 +44,24 @@ export class UserCollection extends PouchCollection<IUser> {
44
44
  }
45
45
  }
46
46
 
47
+ export class AssigneeCollection extends PouchCollection<IUser> {
48
+ async beforeInit(): Promise<void> {
49
+ await this.addIndex(["id"])
50
+ }
51
+
52
+ async clear(): Promise<void> {
53
+ await PouchORM.clearDatabase("assignees")
54
+ }
55
+
56
+ async bulkUpsertIfNotExists(items: IUser[]): Promise<IUser[]> {
57
+ const existingItems = await super.find({})
58
+ const diff = arrayDiffBy(existingItems, items, "id")
59
+ const upsertedIssueReport = await super.bulkUpsert(diff.missingLeft)
60
+ return upsertedIssueReport
61
+ }
62
+ }
63
+
64
+
47
65
  @Model()
48
66
  export class SPUserItem extends ApplicationRecord implements IUser {
49
67
  static jsonapiType = "users"