sowell-models 1.18.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.
- package/README.md +1 -1
- package/build/index.d.ts +28 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +27 -0
- package/build/models/Agency/index.d.ts +26 -0
- package/build/models/Agency/index.d.ts.map +1 -0
- package/build/models/Agency/index.js +61 -0
- package/build/models/ApplicationRecord/index.d.ts +7 -0
- package/build/models/ApplicationRecord/index.d.ts.map +1 -0
- package/build/models/ApplicationRecord/index.js +18 -0
- package/build/models/AreaItem/index.d.ts +51 -0
- package/build/models/AreaItem/index.d.ts.map +1 -0
- package/build/models/AreaItem/index.js +101 -0
- package/build/models/Assignation/index.d.ts +17 -0
- package/build/models/Assignation/index.d.ts.map +1 -0
- package/build/models/Assignation/index.js +24 -0
- package/build/models/Author/index.d.ts +8 -0
- package/build/models/Author/index.d.ts.map +1 -0
- package/build/models/Author/index.js +22 -0
- package/build/models/Checklist/index.d.ts +41 -0
- package/build/models/Checklist/index.d.ts.map +1 -0
- package/build/models/Checklist/index.js +79 -0
- package/build/models/Checkpoint/index.d.ts +45 -0
- package/build/models/Checkpoint/index.d.ts.map +1 -0
- package/build/models/Checkpoint/index.js +85 -0
- package/build/models/Company/index.d.ts +22 -0
- package/build/models/Company/index.d.ts.map +1 -0
- package/build/models/Company/index.js +33 -0
- package/build/models/Export/index.d.ts +22 -0
- package/build/models/Export/index.d.ts.map +1 -0
- package/build/models/Export/index.js +34 -0
- package/build/models/Family/index.d.ts +20 -0
- package/build/models/Family/index.d.ts.map +1 -0
- package/build/models/Family/index.js +55 -0
- package/build/models/IssueReport/index.d.ts +135 -0
- package/build/models/IssueReport/index.d.ts.map +1 -0
- package/build/models/IssueReport/index.js +193 -0
- package/build/models/Location/index.d.ts +24 -0
- package/build/models/Location/index.d.ts.map +1 -0
- package/build/models/Location/index.js +33 -0
- package/build/models/Origin/index.d.ts +23 -0
- package/build/models/Origin/index.d.ts.map +1 -0
- package/build/models/Origin/index.js +58 -0
- package/build/models/Place/index.d.ts +49 -0
- package/build/models/Place/index.d.ts.map +1 -0
- package/build/models/Place/index.js +89 -0
- package/build/models/Provider/index.d.ts +22 -0
- package/build/models/Provider/index.d.ts.map +1 -0
- package/build/models/Provider/index.js +58 -0
- package/build/models/Reason/index.d.ts +24 -0
- package/build/models/Reason/index.d.ts.map +1 -0
- package/build/models/Reason/index.js +58 -0
- package/build/models/Residence/index.d.ts +30 -0
- package/build/models/Residence/index.d.ts.map +1 -0
- package/build/models/Residence/index.js +64 -0
- package/build/models/Sector/index.d.ts +33 -0
- package/build/models/Sector/index.d.ts.map +1 -0
- package/build/models/Sector/index.js +72 -0
- package/build/models/Spot/index.d.ts +28 -0
- package/build/models/Spot/index.d.ts.map +1 -0
- package/build/models/Spot/index.js +61 -0
- package/build/models/UnseenIssue/index.d.ts +14 -0
- package/build/models/UnseenIssue/index.d.ts.map +1 -0
- package/build/models/UnseenIssue/index.js +21 -0
- package/build/models/User/index.d.ts +53 -0
- package/build/models/User/index.d.ts.map +1 -0
- package/build/models/User/index.js +116 -0
- package/build/models/VisitProp/index.d.ts +31 -0
- package/build/models/VisitProp/index.d.ts.map +1 -0
- package/build/models/VisitProp/index.js +42 -0
- package/build/models/VisitReport/index.d.ts +95 -0
- package/build/models/VisitReport/index.d.ts.map +1 -0
- package/build/models/VisitReport/index.js +110 -0
- package/build/models/VisitSchedule/index.d.ts +42 -0
- package/build/models/VisitSchedule/index.d.ts.map +1 -0
- package/build/models/VisitSchedule/index.js +82 -0
- package/build/models/category/index.d.ts +34 -0
- package/build/models/category/index.d.ts.map +1 -0
- package/build/models/category/index.js +70 -0
- package/build/models/interfaces.d.ts +8 -0
- package/build/models/interfaces.d.ts.map +1 -0
- package/build/models/interfaces.js +1 -0
- package/build/models/types.d.ts +7 -0
- package/build/models/types.d.ts.map +1 -0
- package/build/models/types.js +9 -0
- package/build/utils/arrayDiffBy.d.ts +7 -0
- package/build/utils/arrayDiffBy.d.ts.map +1 -0
- package/build/utils/arrayDiffBy.js +9 -0
- package/package.json +24 -2
- package/src/index.ts +1 -0
- package/.editorconfig +0 -15
- package/.github/workflows/publish.yml +0 -24
- package/.github/workflows/remove-stale-branches.yml +0 -19
- package/.prettierrc +0 -6
- package/eslint.config.mjs +0 -43
- package/index.ts +0 -1
- package/tsconfig.json +0 -13
- package/tsconfig.release.json +0 -9
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SPAreaItem, IArea } from "../AreaItem/index";
|
|
2
|
+
import { PouchCollection } from "pouchorm";
|
|
3
|
+
import { IModel } from "pouchorm";
|
|
4
|
+
import { IPlace, SPPlaceItem } from "../Place";
|
|
5
|
+
import { ICompany, SPCompany } from "../Company";
|
|
6
|
+
import { CollectionFindOptions, IClearable } from "../interfaces";
|
|
7
|
+
import { ApplicationRecord } from "../ApplicationRecord";
|
|
8
|
+
export interface ISpot extends IModel {
|
|
9
|
+
name: string;
|
|
10
|
+
placeId?: string;
|
|
11
|
+
place?: IPlace;
|
|
12
|
+
area?: IArea;
|
|
13
|
+
company?: ICompany;
|
|
14
|
+
}
|
|
15
|
+
export declare class SpotCollection extends PouchCollection<ISpot> implements IClearable {
|
|
16
|
+
beforeInit(): Promise<void>;
|
|
17
|
+
clear(): Promise<void>;
|
|
18
|
+
find(selector?: Record<string, any> | Partial<ISpot> | undefined, opts?: CollectionFindOptions): Promise<ISpot[]>;
|
|
19
|
+
}
|
|
20
|
+
export declare class SPSpotItem extends ApplicationRecord implements ISpot {
|
|
21
|
+
static jsonapiType: string;
|
|
22
|
+
name: string;
|
|
23
|
+
place: SPPlaceItem;
|
|
24
|
+
area: SPAreaItem;
|
|
25
|
+
company: SPCompany;
|
|
26
|
+
get _id(): string | undefined;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/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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 { orderBy } from "lodash";
|
|
18
|
+
import { PouchCollection, PouchORM } from "pouchorm";
|
|
19
|
+
import { ApplicationRecord } from "../ApplicationRecord";
|
|
20
|
+
export class SpotCollection 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("spots");
|
|
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, ["name"], ["asc"]);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
let SPSpotItem = class SPSpotItem extends ApplicationRecord {
|
|
41
|
+
get _id() {
|
|
42
|
+
return this.id;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
SPSpotItem.jsonapiType = "spots";
|
|
46
|
+
__decorate([
|
|
47
|
+
Attr()
|
|
48
|
+
], SPSpotItem.prototype, "name", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
BelongsTo()
|
|
51
|
+
], SPSpotItem.prototype, "place", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
BelongsTo()
|
|
54
|
+
], SPSpotItem.prototype, "area", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
BelongsTo()
|
|
57
|
+
], SPSpotItem.prototype, "company", void 0);
|
|
58
|
+
SPSpotItem = __decorate([
|
|
59
|
+
Model()
|
|
60
|
+
], SPSpotItem);
|
|
61
|
+
export { SPSpotItem };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApplicationRecord } from "../ApplicationRecord";
|
|
2
|
+
import { IUser, SPUserItem } from "../User";
|
|
3
|
+
import { IIssueReport, SPIssueReportItem } from "../IssueReport";
|
|
4
|
+
import { IModel } from "pouchorm";
|
|
5
|
+
export interface IUnseenIssue extends IModel {
|
|
6
|
+
user?: IUser;
|
|
7
|
+
issueReport?: IIssueReport;
|
|
8
|
+
}
|
|
9
|
+
export declare class SPUnseenIssue extends ApplicationRecord implements IUnseenIssue {
|
|
10
|
+
static jsonapiType: string;
|
|
11
|
+
user: SPUserItem;
|
|
12
|
+
issueReport: SPIssueReportItem;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/UnseenIssue/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,MAAM,WAAW,YAAa,SAAQ,MAAM;IAC1C,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,WAAW,CAAC,EAAE,YAAY,CAAA;CAC3B;AAED,qBACa,aAAc,SAAQ,iBAAkB,YAAW,YAAY;IAC1E,MAAM,CAAC,WAAW,SAAkB;IACvB,IAAI,EAAG,UAAU,CAAA;IACjB,WAAW,EAAG,iBAAiB,CAAA;CAC7C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
import { BelongsTo, Model } from "spraypaint";
|
|
8
|
+
import { ApplicationRecord } from "../ApplicationRecord";
|
|
9
|
+
let SPUnseenIssue = class SPUnseenIssue extends ApplicationRecord {
|
|
10
|
+
};
|
|
11
|
+
SPUnseenIssue.jsonapiType = "unseen_issues";
|
|
12
|
+
__decorate([
|
|
13
|
+
BelongsTo()
|
|
14
|
+
], SPUnseenIssue.prototype, "user", void 0);
|
|
15
|
+
__decorate([
|
|
16
|
+
BelongsTo()
|
|
17
|
+
], SPUnseenIssue.prototype, "issueReport", void 0);
|
|
18
|
+
SPUnseenIssue = __decorate([
|
|
19
|
+
Model()
|
|
20
|
+
], SPUnseenIssue);
|
|
21
|
+
export { SPUnseenIssue };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ICompany, SPCompany } from "../Company";
|
|
2
|
+
import { ApplicationRecord } from "../ApplicationRecord";
|
|
3
|
+
import { IModel, PouchCollection } from "pouchorm";
|
|
4
|
+
import { IAssignation, SPAssignation } from "../Assignation";
|
|
5
|
+
import { SPUnseenIssue } from "../UnseenIssue";
|
|
6
|
+
export type PhoneNumber = {
|
|
7
|
+
msisdn: string;
|
|
8
|
+
};
|
|
9
|
+
export interface IUser extends IModel {
|
|
10
|
+
id?: string;
|
|
11
|
+
fname?: string;
|
|
12
|
+
lname?: string;
|
|
13
|
+
fullName?: string;
|
|
14
|
+
email?: string;
|
|
15
|
+
code?: string;
|
|
16
|
+
company?: ICompany;
|
|
17
|
+
img?: string;
|
|
18
|
+
password?: string;
|
|
19
|
+
assignationsCount?: number | null;
|
|
20
|
+
status?: string;
|
|
21
|
+
recipients?: PhoneNumber[];
|
|
22
|
+
assignations?: IAssignation[];
|
|
23
|
+
canUpdateIssueReports?: boolean;
|
|
24
|
+
emailNotificationsActivated?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare class UserCollection extends PouchCollection<IUser> {
|
|
27
|
+
beforeInit(): Promise<void>;
|
|
28
|
+
clear(): Promise<void>;
|
|
29
|
+
bulkUpsertIfNotExists(items: IUser[]): Promise<IUser[]>;
|
|
30
|
+
}
|
|
31
|
+
export declare class AssigneeCollection extends PouchCollection<IUser> {
|
|
32
|
+
beforeInit(): Promise<void>;
|
|
33
|
+
clear(): Promise<void>;
|
|
34
|
+
bulkUpsertIfNotExists(items: IUser[]): Promise<IUser[]>;
|
|
35
|
+
}
|
|
36
|
+
export declare class SPUserItem extends ApplicationRecord implements IUser {
|
|
37
|
+
static jsonapiType: string;
|
|
38
|
+
fname: string;
|
|
39
|
+
lname: string;
|
|
40
|
+
email: string;
|
|
41
|
+
fullName: string;
|
|
42
|
+
password: string;
|
|
43
|
+
status: string;
|
|
44
|
+
code: string;
|
|
45
|
+
recipients?: PhoneNumber[];
|
|
46
|
+
assignationsCount: number | null;
|
|
47
|
+
canUpdateIssueReports: boolean;
|
|
48
|
+
emailNotificationsActivated: boolean;
|
|
49
|
+
company: SPCompany;
|
|
50
|
+
assignations: SPAssignation[];
|
|
51
|
+
unseenIssues: SPUnseenIssue[];
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/User/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAY,MAAM,UAAU,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAE9C,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,WAAW,KAAM,SAAQ,MAAM;IACnC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,QAAQ,CAAA;IAClB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE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,EAAG,aAAa,EAAE,CAAA;CAC1C"}
|
|
@@ -0,0 +1,116 @@
|
|
|
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 { Attr, BelongsTo, HasMany, Model } from "spraypaint";
|
|
17
|
+
import { ApplicationRecord } from "../ApplicationRecord";
|
|
18
|
+
import { PouchCollection, PouchORM } from "pouchorm";
|
|
19
|
+
import arrayDiffBy from "../../utils/arrayDiffBy";
|
|
20
|
+
export class UserCollection extends PouchCollection {
|
|
21
|
+
beforeInit() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
yield this.addIndex(["id"]);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
clear() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
yield PouchORM.clearDatabase("users");
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
bulkUpsertIfNotExists(items) {
|
|
32
|
+
const _super = Object.create(null, {
|
|
33
|
+
find: { get: () => super.find },
|
|
34
|
+
bulkUpsert: { get: () => super.bulkUpsert }
|
|
35
|
+
});
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const existingItems = yield _super.find.call(this, {});
|
|
38
|
+
const diff = arrayDiffBy(existingItems, items, "id");
|
|
39
|
+
const upsertedIssueReport = yield _super.bulkUpsert.call(this, diff.missingLeft);
|
|
40
|
+
return upsertedIssueReport;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export class AssigneeCollection extends PouchCollection {
|
|
45
|
+
beforeInit() {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
yield this.addIndex(["id"]);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
clear() {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
yield PouchORM.clearDatabase("assignees");
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
bulkUpsertIfNotExists(items) {
|
|
56
|
+
const _super = Object.create(null, {
|
|
57
|
+
find: { get: () => super.find },
|
|
58
|
+
bulkUpsert: { get: () => super.bulkUpsert }
|
|
59
|
+
});
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const existingItems = yield _super.find.call(this, {});
|
|
62
|
+
const diff = arrayDiffBy(existingItems, items, "id");
|
|
63
|
+
const upsertedIssueReport = yield _super.bulkUpsert.call(this, diff.missingLeft);
|
|
64
|
+
return upsertedIssueReport;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
let SPUserItem = class SPUserItem extends ApplicationRecord {
|
|
69
|
+
};
|
|
70
|
+
SPUserItem.jsonapiType = "users";
|
|
71
|
+
__decorate([
|
|
72
|
+
Attr()
|
|
73
|
+
], SPUserItem.prototype, "fname", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
Attr()
|
|
76
|
+
], SPUserItem.prototype, "lname", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
Attr()
|
|
79
|
+
], SPUserItem.prototype, "email", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
Attr()
|
|
82
|
+
], SPUserItem.prototype, "fullName", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
Attr()
|
|
85
|
+
], SPUserItem.prototype, "password", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
Attr()
|
|
88
|
+
], SPUserItem.prototype, "status", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
Attr()
|
|
91
|
+
], SPUserItem.prototype, "code", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
Attr()
|
|
94
|
+
], SPUserItem.prototype, "recipients", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
Attr()
|
|
97
|
+
], SPUserItem.prototype, "assignationsCount", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
Attr()
|
|
100
|
+
], SPUserItem.prototype, "canUpdateIssueReports", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
Attr()
|
|
103
|
+
], SPUserItem.prototype, "emailNotificationsActivated", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
BelongsTo()
|
|
106
|
+
], SPUserItem.prototype, "company", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
HasMany()
|
|
109
|
+
], SPUserItem.prototype, "assignations", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
HasMany()
|
|
112
|
+
], SPUserItem.prototype, "unseenIssues", void 0);
|
|
113
|
+
SPUserItem = __decorate([
|
|
114
|
+
Model()
|
|
115
|
+
], SPUserItem);
|
|
116
|
+
export { SPUserItem };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IModel } from "pouchorm";
|
|
2
|
+
import { ApplicationRecord } from "../ApplicationRecord";
|
|
3
|
+
import { IPlace, SPPlaceItem } from "../Place";
|
|
4
|
+
import { ICheckpoint, SPCheckpointItem } from "../Checkpoint";
|
|
5
|
+
import { IResidence, SPResidenceItem } from "../Residence";
|
|
6
|
+
import { ISpot, SPSpotItem } from "../Spot";
|
|
7
|
+
export interface IVisitProp extends IModel {
|
|
8
|
+
_id?: string;
|
|
9
|
+
status?: "pending" | "missing";
|
|
10
|
+
place?: IPlace;
|
|
11
|
+
placeId?: number;
|
|
12
|
+
checkpoint?: ICheckpoint;
|
|
13
|
+
checkpointId?: number;
|
|
14
|
+
residence?: IResidence;
|
|
15
|
+
residenceId?: number;
|
|
16
|
+
spot?: ISpot;
|
|
17
|
+
spotId?: number;
|
|
18
|
+
}
|
|
19
|
+
export declare class SPVisitPropItem extends ApplicationRecord implements IVisitProp {
|
|
20
|
+
static jsonapiType: string;
|
|
21
|
+
status: "pending" | "missing";
|
|
22
|
+
placeId: number;
|
|
23
|
+
checkpointId: number;
|
|
24
|
+
residenceId: number;
|
|
25
|
+
spotId: number;
|
|
26
|
+
place: SPPlaceItem;
|
|
27
|
+
checkpoint: SPCheckpointItem;
|
|
28
|
+
residence: SPResidenceItem;
|
|
29
|
+
spot: SPSpotItem;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/VisitProp/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,UAAW,SAAQ,MAAM;IACxC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,WAAW,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,qBACa,eAAgB,SAAQ,iBAAkB,YAAW,UAAU;IAC1E,MAAM,CAAC,WAAW,SAAgB;IAC1B,MAAM,EAAG,SAAS,GAAG,SAAS,CAAA;IAC9B,OAAO,EAAG,MAAM,CAAA;IAChB,YAAY,EAAG,MAAM,CAAA;IACrB,WAAW,EAAG,MAAM,CAAA;IACpB,MAAM,EAAG,MAAM,CAAA;IACV,KAAK,EAAG,WAAW,CAAA;IACnB,UAAU,EAAG,gBAAgB,CAAA;IAC7B,SAAS,EAAG,eAAe,CAAA;IAC3B,IAAI,EAAG,UAAU,CAAA;CAC/B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
import { Model, Attr, BelongsTo } from "spraypaint";
|
|
8
|
+
import { ApplicationRecord } from "../ApplicationRecord";
|
|
9
|
+
let SPVisitPropItem = class SPVisitPropItem extends ApplicationRecord {
|
|
10
|
+
};
|
|
11
|
+
SPVisitPropItem.jsonapiType = "visit_props";
|
|
12
|
+
__decorate([
|
|
13
|
+
Attr()
|
|
14
|
+
], SPVisitPropItem.prototype, "status", void 0);
|
|
15
|
+
__decorate([
|
|
16
|
+
Attr()
|
|
17
|
+
], SPVisitPropItem.prototype, "placeId", void 0);
|
|
18
|
+
__decorate([
|
|
19
|
+
Attr()
|
|
20
|
+
], SPVisitPropItem.prototype, "checkpointId", void 0);
|
|
21
|
+
__decorate([
|
|
22
|
+
Attr()
|
|
23
|
+
], SPVisitPropItem.prototype, "residenceId", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
Attr()
|
|
26
|
+
], SPVisitPropItem.prototype, "spotId", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
BelongsTo()
|
|
29
|
+
], SPVisitPropItem.prototype, "place", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
BelongsTo()
|
|
32
|
+
], SPVisitPropItem.prototype, "checkpoint", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
BelongsTo()
|
|
35
|
+
], SPVisitPropItem.prototype, "residence", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
BelongsTo()
|
|
38
|
+
], SPVisitPropItem.prototype, "spot", void 0);
|
|
39
|
+
SPVisitPropItem = __decorate([
|
|
40
|
+
Model()
|
|
41
|
+
], SPVisitPropItem);
|
|
42
|
+
export { SPVisitPropItem };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { IModel } from "pouchorm";
|
|
2
|
+
import { IUser, SPUserItem } from "../User";
|
|
3
|
+
import { IIssueReport, SPIssueReportItem } from "../IssueReport";
|
|
4
|
+
import { ApplicationRecord } from "../ApplicationRecord";
|
|
5
|
+
import { IVisitSchedule, SPVisitSchedule } from "../VisitSchedule";
|
|
6
|
+
import { IChecklist, SPChecklistItem } from "../Checklist";
|
|
7
|
+
import { IPlace, SPPlaceItem } from "../Place";
|
|
8
|
+
import { IResidence, SPResidenceItem } from "../Residence";
|
|
9
|
+
import { ISpot, SPSpotItem } from "../Spot";
|
|
10
|
+
export declare enum CheckpointStatus {
|
|
11
|
+
NONE = "NONE",
|
|
12
|
+
OK = "OK",
|
|
13
|
+
KO = "KO",
|
|
14
|
+
MISSING = "MISSING",
|
|
15
|
+
PENDING = "PENDING"
|
|
16
|
+
}
|
|
17
|
+
export interface VisitReportPayload {
|
|
18
|
+
visitSchedule?: string;
|
|
19
|
+
checkpoints: CheckpointProps[];
|
|
20
|
+
residence?: string;
|
|
21
|
+
place?: string;
|
|
22
|
+
spot?: string;
|
|
23
|
+
checklist?: string;
|
|
24
|
+
isContradictory?: boolean;
|
|
25
|
+
assistedBy?: {
|
|
26
|
+
id: string;
|
|
27
|
+
fullName: string;
|
|
28
|
+
};
|
|
29
|
+
comment?: string;
|
|
30
|
+
isMissingProvider?: boolean;
|
|
31
|
+
validate?: (payload: VisitReportPayload) => string;
|
|
32
|
+
agent?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface CheckpointProps {
|
|
35
|
+
_id?: string;
|
|
36
|
+
id?: string;
|
|
37
|
+
label?: string;
|
|
38
|
+
status: CheckpointStatus;
|
|
39
|
+
issueReportId?: string;
|
|
40
|
+
issue?: {
|
|
41
|
+
description: string;
|
|
42
|
+
priority: string;
|
|
43
|
+
imgs?: {
|
|
44
|
+
base64: string[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
category?: number;
|
|
48
|
+
comment?: string;
|
|
49
|
+
coefficient?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface IVisitReport extends IModel {
|
|
52
|
+
id?: string;
|
|
53
|
+
createdAt?: Date;
|
|
54
|
+
checkpoints: CheckpointProps[];
|
|
55
|
+
visitSchedule?: IVisitSchedule;
|
|
56
|
+
checklist?: IChecklist;
|
|
57
|
+
residence?: IResidence;
|
|
58
|
+
place?: IPlace;
|
|
59
|
+
spot?: ISpot;
|
|
60
|
+
author?: IUser;
|
|
61
|
+
issueReports?: IIssueReport[];
|
|
62
|
+
isContradictory?: boolean;
|
|
63
|
+
assistedBy?: {
|
|
64
|
+
id: string;
|
|
65
|
+
full_name: string;
|
|
66
|
+
};
|
|
67
|
+
score?: number;
|
|
68
|
+
isMissingProvider?: boolean;
|
|
69
|
+
agent?: string;
|
|
70
|
+
validate?: (payload: VisitReportPayload) => string;
|
|
71
|
+
}
|
|
72
|
+
export declare class SPVisitReport extends ApplicationRecord implements IVisitReport {
|
|
73
|
+
static jsonapiType: string;
|
|
74
|
+
checkpoints: CheckpointProps[];
|
|
75
|
+
createdAt: Date;
|
|
76
|
+
score: number;
|
|
77
|
+
isContradictory: boolean;
|
|
78
|
+
assistedBy: {
|
|
79
|
+
id: string;
|
|
80
|
+
full_name: string;
|
|
81
|
+
};
|
|
82
|
+
comment: string;
|
|
83
|
+
imgs: string[];
|
|
84
|
+
isMissingProvider: boolean;
|
|
85
|
+
agent: string;
|
|
86
|
+
author: SPUserItem;
|
|
87
|
+
visitSchedule: SPVisitSchedule;
|
|
88
|
+
checklist: SPChecklistItem;
|
|
89
|
+
residence: SPResidenceItem;
|
|
90
|
+
place: SPPlaceItem;
|
|
91
|
+
spot: SPSpotItem;
|
|
92
|
+
issueReports: SPIssueReportItem[];
|
|
93
|
+
static validate(payload: VisitReportPayload): Promise<string>;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/VisitReport/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM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AAG;QACnB,EAAE,EAAE,MAAM,CAAA;QACV,SAAS,EAAE,MAAM,CAAA;KAClB,CAAA;IACO,OAAO,EAAG,MAAM,CAAA;IAChB,IAAI,EAAG,MAAM,EAAE,CAAA;IACf,iBAAiB,EAAG,OAAO,CAAA;IAC3B,KAAK,EAAG,MAAM,CAAA;IACT,MAAM,EAAG,UAAU,CAAA;IACnB,aAAa,EAAG,eAAe,CAAA;IAC/B,SAAS,EAAG,eAAe,CAAA;IAC3B,SAAS,EAAG,eAAe,CAAA;IAC3B,KAAK,EAAG,WAAW,CAAA;IACnB,IAAI,EAAG,UAAU,CAAA;IACnB,YAAY,EAAG,iBAAiB,EAAE,CAAA;WAEhC,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;CA8BpE"}
|
|
@@ -0,0 +1,110 @@
|
|
|
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 { ApplicationRecord } from "../ApplicationRecord";
|
|
18
|
+
import * as yup from "yup";
|
|
19
|
+
export var CheckpointStatus;
|
|
20
|
+
(function (CheckpointStatus) {
|
|
21
|
+
CheckpointStatus["NONE"] = "NONE";
|
|
22
|
+
CheckpointStatus["OK"] = "OK";
|
|
23
|
+
CheckpointStatus["KO"] = "KO";
|
|
24
|
+
CheckpointStatus["MISSING"] = "MISSING";
|
|
25
|
+
CheckpointStatus["PENDING"] = "PENDING";
|
|
26
|
+
})(CheckpointStatus || (CheckpointStatus = {}));
|
|
27
|
+
let SPVisitReport = class SPVisitReport extends ApplicationRecord {
|
|
28
|
+
static validate(payload) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const schema = yup
|
|
31
|
+
.object()
|
|
32
|
+
.required()
|
|
33
|
+
.shape({
|
|
34
|
+
checkpoints: yup.array().of(yup.object().shape({
|
|
35
|
+
id: yup.string().required(),
|
|
36
|
+
status: yup.string().required()
|
|
37
|
+
})),
|
|
38
|
+
visitSchedule: yup.string(),
|
|
39
|
+
checklist: yup.string(),
|
|
40
|
+
residence: yup.string(),
|
|
41
|
+
place: yup.string(),
|
|
42
|
+
spot: yup.string(),
|
|
43
|
+
comment: yup.string()
|
|
44
|
+
});
|
|
45
|
+
const isValid = yield schema.isValid(payload);
|
|
46
|
+
if (!isValid) {
|
|
47
|
+
try {
|
|
48
|
+
yield schema.validate(payload);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return error.message;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return "VALID";
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
SPVisitReport.jsonapiType = "visit_reports";
|
|
59
|
+
__decorate([
|
|
60
|
+
Attr()
|
|
61
|
+
], SPVisitReport.prototype, "checkpoints", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
Attr()
|
|
64
|
+
], SPVisitReport.prototype, "createdAt", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
Attr()
|
|
67
|
+
], SPVisitReport.prototype, "score", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
Attr()
|
|
70
|
+
], SPVisitReport.prototype, "isContradictory", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
Attr()
|
|
73
|
+
], SPVisitReport.prototype, "assistedBy", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
Attr()
|
|
76
|
+
], SPVisitReport.prototype, "comment", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
Attr()
|
|
79
|
+
], SPVisitReport.prototype, "imgs", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
Attr()
|
|
82
|
+
], SPVisitReport.prototype, "isMissingProvider", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
Attr()
|
|
85
|
+
], SPVisitReport.prototype, "agent", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
BelongsTo()
|
|
88
|
+
], SPVisitReport.prototype, "author", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
BelongsTo()
|
|
91
|
+
], SPVisitReport.prototype, "visitSchedule", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
BelongsTo()
|
|
94
|
+
], SPVisitReport.prototype, "checklist", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
BelongsTo()
|
|
97
|
+
], SPVisitReport.prototype, "residence", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
BelongsTo()
|
|
100
|
+
], SPVisitReport.prototype, "place", void 0);
|
|
101
|
+
__decorate([
|
|
102
|
+
BelongsTo()
|
|
103
|
+
], SPVisitReport.prototype, "spot", void 0);
|
|
104
|
+
__decorate([
|
|
105
|
+
HasMany()
|
|
106
|
+
], SPVisitReport.prototype, "issueReports", void 0);
|
|
107
|
+
SPVisitReport = __decorate([
|
|
108
|
+
Model()
|
|
109
|
+
], SPVisitReport);
|
|
110
|
+
export { SPVisitReport };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { IModel, PouchCollection } from "pouchorm";
|
|
2
|
+
import { ApplicationRecord } from "../ApplicationRecord";
|
|
3
|
+
import { IPlace, SPPlaceItem } from "../Place";
|
|
4
|
+
import { IChecklist, SPChecklistItem } from "../Checklist";
|
|
5
|
+
import { CollectionFindOptions, IClearable } from "../interfaces";
|
|
6
|
+
import { IResidence, SPResidenceItem } from "../Residence";
|
|
7
|
+
import { ISpot, SPSpotItem } from "../Spot";
|
|
8
|
+
export interface IVisitSchedule extends IModel {
|
|
9
|
+
_id?: string;
|
|
10
|
+
dueAt: Date;
|
|
11
|
+
lastDoneAt?: Date;
|
|
12
|
+
lateCount?: number;
|
|
13
|
+
checklistId?: string;
|
|
14
|
+
residence?: IResidence;
|
|
15
|
+
residenceId?: string;
|
|
16
|
+
place?: IPlace;
|
|
17
|
+
placeId?: string;
|
|
18
|
+
spot?: ISpot;
|
|
19
|
+
spotId?: string;
|
|
20
|
+
checklist?: IChecklist;
|
|
21
|
+
}
|
|
22
|
+
export declare class VisitSchedulesCollection extends PouchCollection<IVisitSchedule> implements IClearable {
|
|
23
|
+
beforeInit(): Promise<void>;
|
|
24
|
+
clear(): Promise<void>;
|
|
25
|
+
find(selector?: Record<string, any> | Partial<IVisitSchedule> | undefined, opts?: CollectionFindOptions): Promise<IVisitSchedule[]>;
|
|
26
|
+
}
|
|
27
|
+
export declare class SPVisitSchedule extends ApplicationRecord implements IVisitSchedule {
|
|
28
|
+
static jsonapiType: string;
|
|
29
|
+
dueAt: Date;
|
|
30
|
+
lastDoneAt?: Date;
|
|
31
|
+
lateCount?: number;
|
|
32
|
+
checklistId: string;
|
|
33
|
+
residenceId: string;
|
|
34
|
+
placeId: string;
|
|
35
|
+
spotId: string;
|
|
36
|
+
residence: SPResidenceItem;
|
|
37
|
+
place: SPPlaceItem;
|
|
38
|
+
spot: SPSpotItem;
|
|
39
|
+
checklist: SPChecklistItem;
|
|
40
|
+
get _id(): string | undefined;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/VisitSchedule/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,MAAM,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAE3C,MAAM,WAAW,cAAe,SAAQ,MAAM;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,IAAI,CAAA;IACX,UAAU,CAAC,EAAE,IAAI,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,UAAU,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,KAAK,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,UAAU,CAAA;CACvB;AAED,qBAAa,wBACX,SAAQ,eAAe,CAAC,cAAc,CACtC,YAAW,UAAU;IAEf,UAAU,IAAI,O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