sowell-models 1.1.1 → 1.3.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,10 +1,10 @@
1
1
  {
2
2
  "name": "sowell-models",
3
- "version": "1.1.1",
3
+ "version": "1.3.0",
4
4
  "description": "SoWell models",
5
5
  "type": "module",
6
6
  "engines": {
7
- "node": ">= 20.9 < 21"
7
+ "node": ">= 20.9 < 21 || ^20.10.0"
8
8
  },
9
9
  "devDependencies": {
10
10
  "@eslint/js": "~9.10",
@@ -1,41 +1,42 @@
1
- import { Model, Attr, BelongsTo } from "spraypaint"
2
- import { IModel, PouchCollection, PouchORM } from "pouchorm"
3
- import { orderBy } from "lodash"
1
+ import { Model, Attr, BelongsTo } from 'spraypaint';
2
+ import { IModel, PouchCollection, PouchORM } from 'pouchorm';
3
+ import { orderBy } from 'lodash';
4
4
 
5
- import { ApplicationRecord } from "../ApplicationRecord"
6
- import { CollectionFindOptions, IClearable } from "../interfaces"
7
- import { SPCategoryItem } from "../category"
5
+ import { ApplicationRecord } from '../ApplicationRecord';
6
+ import { CollectionFindOptions, IClearable } from '../interfaces';
7
+ import { SPCategoryItem } from '../category';
8
8
 
9
9
  export interface IReason extends IModel {
10
- _id?: string
11
- name: string
10
+ _id?: string;
11
+ name: string;
12
+ iconUrl?: string;
12
13
  }
13
14
 
14
15
  export class ReasonCollection
15
16
  extends PouchCollection<IReason>
16
- implements IClearable {
17
+ implements IClearable
18
+ {
17
19
  async beforeInit(): Promise<void> {
18
20
  // NOTE: none
19
21
  }
20
22
 
21
23
  async clear(): Promise<void> {
22
- await PouchORM.clearDatabase("reasons")
24
+ await PouchORM.clearDatabase('reasons');
23
25
  }
24
26
 
25
27
  async find(
26
28
  selector?: Record<string, any> | Partial<IReason> | undefined,
27
- opts?: CollectionFindOptions
28
- ) {
29
- const result = await super.find(selector, opts)
30
- return orderBy(result, ["name"], ["asc"])
29
+ opts?: CollectionFindOptions,
30
+ ): Promise<IReason[]> {
31
+ const result = await super.find(selector, opts);
32
+ return orderBy(result, ['name'], ['asc']);
31
33
  }
32
34
  }
33
35
 
34
36
  @Model()
35
- export class SPReasonItem
36
- extends ApplicationRecord
37
- implements IReason {
38
- static jsonapiType = "reasons"
39
- @Attr() name!: string
40
- @BelongsTo() category!: SPCategoryItem
37
+ export class SPReasonItem extends ApplicationRecord implements IReason {
38
+ static jsonapiType = 'reasons';
39
+ @Attr() name!: string;
40
+ @Attr() iconUrl?: string;
41
+ @BelongsTo() category!: SPCategoryItem;
41
42
  }