sowell-models 1.17.0 → 1.19.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.
Files changed (100) hide show
  1. package/README.md +1 -1
  2. package/build/index.d.ts +28 -0
  3. package/build/index.d.ts.map +1 -0
  4. package/build/index.js +27 -0
  5. package/build/models/Agency/index.d.ts +26 -0
  6. package/build/models/Agency/index.d.ts.map +1 -0
  7. package/build/models/Agency/index.js +61 -0
  8. package/build/models/ApplicationRecord/index.d.ts +7 -0
  9. package/build/models/ApplicationRecord/index.d.ts.map +1 -0
  10. package/build/models/ApplicationRecord/index.js +18 -0
  11. package/build/models/AreaItem/index.d.ts +51 -0
  12. package/build/models/AreaItem/index.d.ts.map +1 -0
  13. package/build/models/AreaItem/index.js +101 -0
  14. package/build/models/Assignation/index.d.ts +17 -0
  15. package/build/models/Assignation/index.d.ts.map +1 -0
  16. package/build/models/Assignation/index.js +24 -0
  17. package/build/models/Author/index.d.ts +8 -0
  18. package/build/models/Author/index.d.ts.map +1 -0
  19. package/build/models/Author/index.js +22 -0
  20. package/build/models/Checklist/index.d.ts +41 -0
  21. package/build/models/Checklist/index.d.ts.map +1 -0
  22. package/build/models/Checklist/index.js +79 -0
  23. package/build/models/Checkpoint/index.d.ts +45 -0
  24. package/build/models/Checkpoint/index.d.ts.map +1 -0
  25. package/build/models/Checkpoint/index.js +85 -0
  26. package/build/models/Company/index.d.ts +22 -0
  27. package/build/models/Company/index.d.ts.map +1 -0
  28. package/build/models/Company/index.js +33 -0
  29. package/build/models/Export/index.d.ts +22 -0
  30. package/build/models/Export/index.d.ts.map +1 -0
  31. package/build/models/Export/index.js +34 -0
  32. package/build/models/Family/index.d.ts +20 -0
  33. package/build/models/Family/index.d.ts.map +1 -0
  34. package/build/models/Family/index.js +55 -0
  35. package/build/models/IssueReport/index.d.ts +135 -0
  36. package/build/models/IssueReport/index.d.ts.map +1 -0
  37. package/build/models/IssueReport/index.js +193 -0
  38. package/build/models/Location/index.d.ts +24 -0
  39. package/build/models/Location/index.d.ts.map +1 -0
  40. package/build/models/Location/index.js +33 -0
  41. package/build/models/Origin/index.d.ts +23 -0
  42. package/build/models/Origin/index.d.ts.map +1 -0
  43. package/build/models/Origin/index.js +58 -0
  44. package/build/models/Place/index.d.ts +49 -0
  45. package/build/models/Place/index.d.ts.map +1 -0
  46. package/build/models/Place/index.js +89 -0
  47. package/build/models/Provider/index.d.ts +22 -0
  48. package/build/models/Provider/index.d.ts.map +1 -0
  49. package/build/models/Provider/index.js +58 -0
  50. package/build/models/Reason/index.d.ts +24 -0
  51. package/build/models/Reason/index.d.ts.map +1 -0
  52. package/build/models/Reason/index.js +58 -0
  53. package/build/models/Residence/index.d.ts +30 -0
  54. package/build/models/Residence/index.d.ts.map +1 -0
  55. package/build/models/Residence/index.js +64 -0
  56. package/build/models/Sector/index.d.ts +33 -0
  57. package/build/models/Sector/index.d.ts.map +1 -0
  58. package/build/models/Sector/index.js +72 -0
  59. package/build/models/Spot/index.d.ts +28 -0
  60. package/build/models/Spot/index.d.ts.map +1 -0
  61. package/build/models/Spot/index.js +61 -0
  62. package/build/models/UnseenIssue/index.d.ts +14 -0
  63. package/build/models/UnseenIssue/index.d.ts.map +1 -0
  64. package/build/models/UnseenIssue/index.js +21 -0
  65. package/build/models/User/index.d.ts +53 -0
  66. package/build/models/User/index.d.ts.map +1 -0
  67. package/build/models/User/index.js +116 -0
  68. package/build/models/VisitProp/index.d.ts +31 -0
  69. package/build/models/VisitProp/index.d.ts.map +1 -0
  70. package/build/models/VisitProp/index.js +42 -0
  71. package/build/models/VisitReport/index.d.ts +95 -0
  72. package/build/models/VisitReport/index.d.ts.map +1 -0
  73. package/build/models/VisitReport/index.js +110 -0
  74. package/build/models/VisitSchedule/index.d.ts +42 -0
  75. package/build/models/VisitSchedule/index.d.ts.map +1 -0
  76. package/build/models/VisitSchedule/index.js +82 -0
  77. package/build/models/category/index.d.ts +34 -0
  78. package/build/models/category/index.d.ts.map +1 -0
  79. package/build/models/category/index.js +70 -0
  80. package/build/models/interfaces.d.ts +8 -0
  81. package/build/models/interfaces.d.ts.map +1 -0
  82. package/build/models/interfaces.js +1 -0
  83. package/build/models/types.d.ts +7 -0
  84. package/build/models/types.d.ts.map +1 -0
  85. package/build/models/types.js +9 -0
  86. package/build/utils/arrayDiffBy.d.ts +7 -0
  87. package/build/utils/arrayDiffBy.d.ts.map +1 -0
  88. package/build/utils/arrayDiffBy.js +9 -0
  89. package/package.json +24 -2
  90. package/src/index.ts +1 -0
  91. package/src/models/Reason/index.ts +2 -0
  92. package/src/models/category/index.ts +4 -2
  93. package/.editorconfig +0 -15
  94. package/.github/workflows/publish.yml +0 -24
  95. package/.github/workflows/remove-stale-branches.yml +0 -19
  96. package/.prettierrc +0 -6
  97. package/eslint.config.mjs +0 -43
  98. package/index.ts +0 -1
  99. package/tsconfig.json +0 -13
  100. package/tsconfig.release.json +0 -9
@@ -0,0 +1,82 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14
+ });
15
+ };
16
+ import { Model, Attr, BelongsTo } from "spraypaint";
17
+ import { PouchCollection, PouchORM } from "pouchorm";
18
+ import { orderBy } from "lodash";
19
+ import { ApplicationRecord } from "../ApplicationRecord";
20
+ export class VisitSchedulesCollection extends PouchCollection {
21
+ beforeInit() {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ });
24
+ }
25
+ clear() {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ yield PouchORM.clearDatabase("visit_schedules");
28
+ });
29
+ }
30
+ find(selector, opts) {
31
+ const _super = Object.create(null, {
32
+ find: { get: () => super.find }
33
+ });
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ const result = yield _super.find.call(this, selector, opts);
36
+ return orderBy(result, ["dueAt"], ["asc"]);
37
+ });
38
+ }
39
+ }
40
+ let SPVisitSchedule = class SPVisitSchedule extends ApplicationRecord {
41
+ get _id() {
42
+ return this.id;
43
+ }
44
+ };
45
+ SPVisitSchedule.jsonapiType = "visit_schedules";
46
+ __decorate([
47
+ Attr()
48
+ ], SPVisitSchedule.prototype, "dueAt", void 0);
49
+ __decorate([
50
+ Attr()
51
+ ], SPVisitSchedule.prototype, "lastDoneAt", void 0);
52
+ __decorate([
53
+ Attr()
54
+ ], SPVisitSchedule.prototype, "lateCount", void 0);
55
+ __decorate([
56
+ Attr()
57
+ ], SPVisitSchedule.prototype, "checklistId", void 0);
58
+ __decorate([
59
+ Attr()
60
+ ], SPVisitSchedule.prototype, "residenceId", void 0);
61
+ __decorate([
62
+ Attr()
63
+ ], SPVisitSchedule.prototype, "placeId", void 0);
64
+ __decorate([
65
+ Attr()
66
+ ], SPVisitSchedule.prototype, "spotId", void 0);
67
+ __decorate([
68
+ BelongsTo()
69
+ ], SPVisitSchedule.prototype, "residence", void 0);
70
+ __decorate([
71
+ BelongsTo()
72
+ ], SPVisitSchedule.prototype, "place", void 0);
73
+ __decorate([
74
+ BelongsTo()
75
+ ], SPVisitSchedule.prototype, "spot", void 0);
76
+ __decorate([
77
+ BelongsTo()
78
+ ], SPVisitSchedule.prototype, "checklist", void 0);
79
+ SPVisitSchedule = __decorate([
80
+ Model()
81
+ ], SPVisitSchedule);
82
+ export { SPVisitSchedule };
@@ -0,0 +1,34 @@
1
+ import { IModel, PouchCollection } from "pouchorm";
2
+ import { ApplicationRecord } from "../ApplicationRecord";
3
+ import { ICompany, SPCompany } from "../Company";
4
+ import { IArea, SPAreaItem } from "../AreaItem";
5
+ import { SPCheckpointItem } from "../Checkpoint";
6
+ import { CollectionFindOptions, IClearable } from "../interfaces";
7
+ import { IReason, SPReasonItem } from "../Reason";
8
+ export interface ICategory extends IModel {
9
+ _id?: string;
10
+ name: string;
11
+ order?: number;
12
+ iconUrl?: string;
13
+ company?: ICompany;
14
+ areaId?: string;
15
+ area?: IArea;
16
+ reasons?: IReason[];
17
+ }
18
+ export declare class CategoryCollection extends PouchCollection<ICategory> implements IClearable {
19
+ beforeInit(): Promise<void>;
20
+ clear(): Promise<void>;
21
+ find(selector?: Record<string, any> | Partial<ICategory> | undefined, opts?: CollectionFindOptions): Promise<ICategory[]>;
22
+ }
23
+ export declare class SPCategoryItem extends ApplicationRecord implements ICategory {
24
+ static jsonapiType: string;
25
+ name: string;
26
+ order: number;
27
+ iconUrl: string;
28
+ company: SPCompany;
29
+ area: SPAreaItem;
30
+ get _id(): string | undefined;
31
+ checkpoints: SPCheckpointItem[];
32
+ reasons: SPReasonItem[];
33
+ }
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/category/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,eAAe,EAAY,MAAM,UAAU,CAAA;AAG5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAEjD,MAAM,WAAW,SAAU,SAAQ,MAAM;IACvC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,QAAQ,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,EAAE,CAAA;CACpB;AAED,qBAAa,kBACX,SAAQ,eAAe,CAAC,SAAS,CACjC,YAAW,UAAU;IACf,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,IAAI,CACR,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,EAC/D,IAAI,CAAC,EAAE,qBAAqB,GAC3B,OAAO,CAAC,SAAS,EAAE,CAAC;CAIxB;AAED,qBACa,cAAe,SAAQ,iBAAkB,YAAW,SAAS;IACxE,MAAM,CAAC,WAAW,SAAe;IACzB,IAAI,EAAG,MAAM,CAAA;IACb,KAAK,EAAG,MAAM,CAAA;IACd,OAAO,EAAG,MAAM,CAAA;IACX,OAAO,EAAG,SAAS,CAAA;IACnB,IAAI,EAAG,UAAU,CAAA;IAC9B,IAAI,GAAG,IAAI,MAAM,GAAG,SAAS,CAE5B;IACU,WAAW,EAAG,gBAAgB,EAAE,CAAA;IAChC,OAAO,EAAG,YAAY,EAAE,CAAA;CACpC"}
@@ -0,0 +1,70 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
13
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
14
+ });
15
+ };
16
+ import { Model, Attr, BelongsTo, HasMany } from "spraypaint";
17
+ import { PouchCollection, PouchORM } from "pouchorm";
18
+ import { orderBy } from "lodash";
19
+ import { ApplicationRecord } from "../ApplicationRecord";
20
+ export class CategoryCollection extends PouchCollection {
21
+ beforeInit() {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ });
24
+ }
25
+ clear() {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ yield PouchORM.clearDatabase("categories");
28
+ });
29
+ }
30
+ find(selector, opts) {
31
+ const _super = Object.create(null, {
32
+ find: { get: () => super.find }
33
+ });
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ const result = yield _super.find.call(this, selector, opts);
36
+ return orderBy(result, ["order"], ["asc"]);
37
+ });
38
+ }
39
+ }
40
+ let SPCategoryItem = class SPCategoryItem extends ApplicationRecord {
41
+ get _id() {
42
+ return this.id;
43
+ }
44
+ };
45
+ SPCategoryItem.jsonapiType = "categories";
46
+ __decorate([
47
+ Attr()
48
+ ], SPCategoryItem.prototype, "name", void 0);
49
+ __decorate([
50
+ Attr()
51
+ ], SPCategoryItem.prototype, "order", void 0);
52
+ __decorate([
53
+ Attr()
54
+ ], SPCategoryItem.prototype, "iconUrl", void 0);
55
+ __decorate([
56
+ BelongsTo()
57
+ ], SPCategoryItem.prototype, "company", void 0);
58
+ __decorate([
59
+ BelongsTo()
60
+ ], SPCategoryItem.prototype, "area", void 0);
61
+ __decorate([
62
+ HasMany()
63
+ ], SPCategoryItem.prototype, "checkpoints", void 0);
64
+ __decorate([
65
+ HasMany()
66
+ ], SPCategoryItem.prototype, "reasons", void 0);
67
+ SPCategoryItem = __decorate([
68
+ Model()
69
+ ], SPCategoryItem);
70
+ export { SPCategoryItem };
@@ -0,0 +1,8 @@
1
+ export interface IClearable {
2
+ clear(): Promise<void>;
3
+ }
4
+ export interface CollectionFindOptions {
5
+ sort?: string[] | undefined;
6
+ limit?: number | undefined;
7
+ }
8
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/models/interfaces.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC3B"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { ValueIteratee } from "lodash";
2
+ export default function arrayDiffBy<T>(array1: T[], array2: T[], iteratee: ValueIteratee<T>): {
3
+ matched: T[];
4
+ missingRight: T[];
5
+ missingLeft: T[];
6
+ };
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/models/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,aAAa,EAAE,MAAM,QAAQ,CAAA;AAEpE,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,CAAC,EAAG,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;;;;EAO3F"}
@@ -0,0 +1,9 @@
1
+ import { intersectionBy, differenceBy } from "lodash";
2
+ export default function arrayDiffBy(array1, array2, iteratee) {
3
+ const result = {
4
+ matched: intersectionBy(array1, array2, iteratee),
5
+ missingRight: differenceBy(array1, array2, iteratee),
6
+ missingLeft: differenceBy(array2, array1, iteratee)
7
+ };
8
+ return result;
9
+ }
@@ -0,0 +1,7 @@
1
+ import { ValueIteratee } from "lodash";
2
+ export default function arrayDiffBy<T>(array1: T[], array2: T[], iteratee: ValueIteratee<T>): {
3
+ matched: T[];
4
+ missingRight: T[];
5
+ missingLeft: T[];
6
+ };
7
+ //# sourceMappingURL=arrayDiffBy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrayDiffBy.d.ts","sourceRoot":"","sources":["../../src/utils/arrayDiffBy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,aAAa,EAAE,MAAM,QAAQ,CAAA;AAEpE,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,CAAC,EACnC,MAAM,EAAE,CAAC,EAAE,EACX,MAAM,EAAE,CAAC,EAAE,EACX,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;;;;EAQ3B"}
@@ -0,0 +1,9 @@
1
+ import { intersectionBy, differenceBy } from "lodash";
2
+ export default function arrayDiffBy(array1, array2, iteratee) {
3
+ const result = {
4
+ matched: intersectionBy(array1, array2, iteratee),
5
+ missingRight: differenceBy(array1, array2, iteratee),
6
+ missingLeft: differenceBy(array2, array1, iteratee)
7
+ };
8
+ return result;
9
+ }
package/package.json CHANGED
@@ -1,8 +1,22 @@
1
1
  {
2
2
  "name": "sowell-models",
3
- "version": "1.17.0",
3
+ "version": "1.19.0",
4
4
  "description": "SoWell models",
5
5
  "type": "module",
6
+ "main": "./build/index.js",
7
+ "module": "./build/index.js",
8
+ "types": "./build/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./build/index.js",
12
+ "require": "./build/index.js",
13
+ "types": "./build/index.d.ts"
14
+ }
15
+ },
16
+ "files": [
17
+ "build/**/*",
18
+ "src/**/*"
19
+ ],
6
20
  "engines": {
7
21
  "node": ">= 20.9 < 21 || ^22"
8
22
  },
@@ -23,7 +37,15 @@
23
37
  },
24
38
  "scripts": {
25
39
  "clean": "rimraf coverage build tmp",
26
- "prebuild": "npm run lint",
40
+ "build": "npm run clean && tsc --project tsconfig.release.json",
41
+ "build:watch": "tsc --project tsconfig.release.json --watch",
42
+ "dev": "npm run build:watch",
43
+ "link:create": "npm run build && npm link",
44
+ "link:update": "npm run build",
45
+ "link:force": "npm run build && npm unlink && npm link",
46
+ "link:build-only": "npm run build && mv src src.tmp && yarn link && mv src.tmp src",
47
+ "prepublishOnly": "yarn build",
48
+ "release": "yarn build && npm publish --access public",
27
49
  "lint": "eslint .",
28
50
  "prettier": "prettier \"{src,__{tests}__}/**/*.{ts,mts}\" --config .prettierrc --write",
29
51
  "prettier:check": "prettier \"{src,__{tests}__}/**/*.{ts,mts}\" --config .prettierrc --check"
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ export * from './models/VisitReport';
15
15
  export * from './models/VisitSchedule';
16
16
  export * from './models/Spot';
17
17
  export * from './models/interfaces';
18
+ export * from './models/types';
18
19
  export * from './models/Sector';
19
20
  export * from './models/Assignation';
20
21
  export * from './models/Export';
@@ -10,6 +10,7 @@ export interface IReason extends IModel {
10
10
  id?: string;
11
11
  _id?: string;
12
12
  name: string;
13
+ order?: number;
13
14
  iconUrl?: string;
14
15
  }
15
16
 
@@ -38,6 +39,7 @@ export class ReasonCollection
38
39
  export class SPReasonItem extends ApplicationRecord implements IReason {
39
40
  static jsonapiType = 'reasons';
40
41
  @Attr() name!: string;
42
+ @Attr() order!: number;
41
43
  @Attr() iconUrl?: string;
42
44
  @BelongsTo() category!: SPCategoryItem;
43
45
  }
@@ -12,6 +12,7 @@ import { IReason, SPReasonItem } from "../Reason"
12
12
  export interface ICategory extends IModel {
13
13
  _id?: string
14
14
  name: string
15
+ order?: number
15
16
  iconUrl?: string
16
17
  company?: ICompany
17
18
  areaId?: string
@@ -33,9 +34,9 @@ export class CategoryCollection
33
34
  async find(
34
35
  selector?: Record<string, any> | Partial<ICategory> | undefined,
35
36
  opts?: CollectionFindOptions
36
- ) {
37
+ ): Promise<ICategory[]> {
37
38
  const result = await super.find(selector, opts)
38
- return orderBy(result, ["name"], ["asc"])
39
+ return orderBy(result, ["order"], ["asc"])
39
40
  }
40
41
  }
41
42
 
@@ -43,6 +44,7 @@ export class CategoryCollection
43
44
  export class SPCategoryItem extends ApplicationRecord implements ICategory {
44
45
  static jsonapiType = "categories"
45
46
  @Attr() name!: string
47
+ @Attr() order!: number
46
48
  @Attr() iconUrl!: string
47
49
  @BelongsTo() company!: SPCompany
48
50
  @BelongsTo() area!: SPAreaItem
package/.editorconfig DELETED
@@ -1,15 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- charset = utf-8
5
- end_of_line = lf
6
- trim_trailing_whitespace = true
7
- insert_final_newline = true
8
-
9
- [*.md]
10
- insert_final_newline = false
11
- trim_trailing_whitespace = false
12
-
13
- [*.{js,json,ts,mts,yml,yaml}]
14
- indent_size = 2
15
- indent_style = space
@@ -1,24 +0,0 @@
1
- name: npm-publish
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
-
8
- jobs:
9
- npm-publish:
10
- name: npm-publish
11
- runs-on: ubuntu-latest
12
- steps:
13
- - name: Checkout repository
14
- uses: actions/checkout@v4
15
- - name: Nodejs
16
- uses: actions/setup-node@v4
17
- with:
18
- node-version: "16"
19
- cache: yarn
20
- registry-url: https://registry.npmjs.org
21
- - name: publish
22
- run: npm publish --access public
23
- env:
24
- NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
@@ -1,19 +0,0 @@
1
- name: Remove stale branches
2
-
3
- on:
4
- workflow_dispatch:
5
- schedule:
6
- - cron: "0 0 * * *" # Everday at midnight
7
-
8
- jobs:
9
- remove-stale-branches:
10
- name: Remove Stale Branches
11
- runs-on: ubuntu-latest
12
- steps:
13
- - uses: fpicalausa/remove-stale-branches@v1.6.0
14
- with:
15
- dry-run: false # Check out the console output before setting this to false
16
- days-before-branch-stale: 180
17
- days-before-branch-delete: 0
18
- operations-per-run: 50
19
- exempt-authors-regex: "^dependabot"
package/.prettierrc DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "parser": "typescript",
3
- "semi": true,
4
- "singleQuote": true,
5
- "trailingComma": "all"
6
- }
package/eslint.config.mjs DELETED
@@ -1,43 +0,0 @@
1
- // @ts-check
2
- import eslint from '@eslint/js';
3
- import eslintConfigPrettier from 'eslint-config-prettier';
4
- import globals from 'globals';
5
- import tseslint from 'typescript-eslint';
6
-
7
- // This is just an example default config for ESLint.
8
- // You should change it to your needs following the documentation.
9
- export default tseslint.config(
10
- {
11
- ignores: ['**/build/**', '**/tmp/**', '**/coverage/**'],
12
- },
13
- eslint.configs.recommended,
14
- eslintConfigPrettier,
15
- {
16
- extends: [...tseslint.configs.recommended],
17
-
18
- files: ['**/*.ts', '**/*.mts'],
19
-
20
- plugins: {
21
- '@typescript-eslint': tseslint.plugin,
22
- },
23
-
24
- rules: {
25
- '@typescript-eslint/explicit-function-return-type': 'warn',
26
- '@typescript-eslint/no-explicit-any': 'warn'
27
- },
28
-
29
- languageOptions: {
30
- parser: tseslint.parser,
31
- ecmaVersion: 2020,
32
- sourceType: 'module',
33
-
34
- globals: {
35
- ...globals.node,
36
- },
37
-
38
- parserOptions: {
39
- project: './tsconfig.json',
40
- },
41
- },
42
- },
43
- );
package/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './src';
package/tsconfig.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "experimentalDecorators": true,
4
- "allowJs": true,
5
- "target": "es6",
6
- "moduleResolution": "node",
7
- "esModuleInterop": true,
8
- "skipLibCheck": true,
9
- "forceConsistentCasingInFileNames": true,
10
- "resolveJsonModule": true,
11
- "types": ["node"]
12
- }
13
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "sourceMap": false,
5
- "removeComments": true
6
- },
7
- "include": ["src"],
8
- "exclude": ["**/*.test.ts", "**/*.spec.ts"]
9
- }