turf-common 1.0.15 → 1.0.16-beta.10
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 +9 -0
- package/build/enums/organization-status.enum.d.ts +15 -0
- package/build/enums/organization-status.enum.js +31 -0
- package/build/enums/pitch-status.enum.d.ts +12 -0
- package/build/enums/pitch-status.enum.js +13 -0
- package/build/exceptions/app-badrequest.exception.d.ts +0 -3
- package/build/exceptions/app-badrequest.exception.js +0 -9
- package/build/index.d.ts +2 -0
- package/build/index.js +3 -0
- package/build/interface/get-turf-entity.interface.d.ts +34 -0
- package/build/interface/get-turf-entity.interface.js +2 -0
- package/build/types/entity/entity-audit-column.type.d.ts +12 -0
- package/build/types/entity/entity-audit-column.type.js +9 -0
- package/build/types/entity/organization-entity.type.d.ts +20 -0
- package/build/types/entity/organization-entity.type.js +2 -0
- package/build/types/entity/pitch-entity.type.d.ts +9 -0
- package/build/types/entity/pitch-entity.type.js +2 -0
- package/build/types/entity/subscription-pitch-mapping.type.d.ts +7 -0
- package/build/types/entity/subscription-pitch-mapping.type.js +2 -0
- package/build/types/entity/turf-entity.type.d.ts +45 -0
- package/build/types/entity/turf-entity.type.js +71 -0
- package/package.json +33 -27
package/README.md
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum OrganizationStatus {
|
|
2
|
+
REGISTRATION = "registration",
|
|
3
|
+
REGISTRATION_INVALID = "registration_invalid",
|
|
4
|
+
REGISTRATION_APPROVED = "registration_approved",
|
|
5
|
+
SETUP_INVALID = "setup_invalid",
|
|
6
|
+
SETUP_DONE = "setup_done",
|
|
7
|
+
PAYMENT_INVALID = "payment_invalid",
|
|
8
|
+
PAYMENT_DONE = "payment_done",
|
|
9
|
+
ACCOUNT_ACTIVE = "account_active",
|
|
10
|
+
ACCOUNT_SUSPENDED = "account_suspended"
|
|
11
|
+
}
|
|
12
|
+
export declare namespace OrganizationStatus {
|
|
13
|
+
function allowPermissionSuperAdmin(): OrganizationStatus[];
|
|
14
|
+
function allowPermissionOwner(): OrganizationStatus[];
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OrganizationStatus = void 0;
|
|
4
|
+
var OrganizationStatus;
|
|
5
|
+
(function (OrganizationStatus) {
|
|
6
|
+
OrganizationStatus["REGISTRATION"] = "registration";
|
|
7
|
+
OrganizationStatus["REGISTRATION_INVALID"] = "registration_invalid";
|
|
8
|
+
OrganizationStatus["REGISTRATION_APPROVED"] = "registration_approved";
|
|
9
|
+
OrganizationStatus["SETUP_INVALID"] = "setup_invalid";
|
|
10
|
+
OrganizationStatus["SETUP_DONE"] = "setup_done";
|
|
11
|
+
OrganizationStatus["PAYMENT_INVALID"] = "payment_invalid";
|
|
12
|
+
OrganizationStatus["PAYMENT_DONE"] = "payment_done";
|
|
13
|
+
OrganizationStatus["ACCOUNT_ACTIVE"] = "account_active";
|
|
14
|
+
OrganizationStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
|
|
15
|
+
})(OrganizationStatus || (exports.OrganizationStatus = OrganizationStatus = {}));
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
17
|
+
(function (OrganizationStatus) {
|
|
18
|
+
function allowPermissionSuperAdmin() {
|
|
19
|
+
return Object.values(OrganizationStatus).filter(function (status) {
|
|
20
|
+
return status !== OrganizationStatus.SETUP_DONE &&
|
|
21
|
+
status !== OrganizationStatus.REGISTRATION;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
OrganizationStatus.allowPermissionSuperAdmin = allowPermissionSuperAdmin;
|
|
25
|
+
function allowPermissionOwner() {
|
|
26
|
+
return Object.values(OrganizationStatus).filter(function (status) {
|
|
27
|
+
return status === OrganizationStatus.SETUP_DONE;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
OrganizationStatus.allowPermissionOwner = allowPermissionOwner;
|
|
31
|
+
})(OrganizationStatus || (exports.OrganizationStatus = OrganizationStatus = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum PitchStatus {
|
|
2
|
+
ACTIVE = "active",
|
|
3
|
+
DELETE = "delete",
|
|
4
|
+
DEACTIVE = "deactive",
|
|
5
|
+
NEW = "new",
|
|
6
|
+
SETUP_INVALID = "setup_invalid",
|
|
7
|
+
PAYMENT_INVALID = "payment_invalid",
|
|
8
|
+
ACCOUNT_SUSPENDED = "account_suspended"
|
|
9
|
+
}
|
|
10
|
+
export type IPitchStatus = {
|
|
11
|
+
[key in PitchStatus]: number;
|
|
12
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PitchStatus = void 0;
|
|
4
|
+
var PitchStatus;
|
|
5
|
+
(function (PitchStatus) {
|
|
6
|
+
PitchStatus["ACTIVE"] = "active";
|
|
7
|
+
PitchStatus["DELETE"] = "delete";
|
|
8
|
+
PitchStatus["DEACTIVE"] = "deactive";
|
|
9
|
+
PitchStatus["NEW"] = "new";
|
|
10
|
+
PitchStatus["SETUP_INVALID"] = "setup_invalid";
|
|
11
|
+
PitchStatus["PAYMENT_INVALID"] = "payment_invalid";
|
|
12
|
+
PitchStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
|
|
13
|
+
})(PitchStatus || (exports.PitchStatus = PitchStatus = {}));
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { IAppBadRequestException } from "../types/app-badrequest-exception.type";
|
|
2
2
|
export declare class AppBadRequestException extends Error {
|
|
3
|
-
private _error;
|
|
4
|
-
private key;
|
|
5
3
|
constructor(appBadRequestException: IAppBadRequestException);
|
|
6
|
-
get error(): IAppBadRequestException;
|
|
7
4
|
}
|
|
@@ -21,17 +21,8 @@ var AppBadRequestException = /** @class */ (function (_super) {
|
|
|
21
21
|
function AppBadRequestException(appBadRequestException) {
|
|
22
22
|
var _this = _super.call(this) || this;
|
|
23
23
|
_this.message = appBadRequestException.message.join(",");
|
|
24
|
-
_this._error = appBadRequestException;
|
|
25
|
-
_this.key = appBadRequestException.key;
|
|
26
24
|
return _this;
|
|
27
25
|
}
|
|
28
|
-
Object.defineProperty(AppBadRequestException.prototype, "error", {
|
|
29
|
-
get: function () {
|
|
30
|
-
return this._error;
|
|
31
|
-
},
|
|
32
|
-
enumerable: false,
|
|
33
|
-
configurable: true
|
|
34
|
-
});
|
|
35
26
|
return AppBadRequestException;
|
|
36
27
|
}(Error));
|
|
37
28
|
exports.AppBadRequestException = AppBadRequestException;
|
package/build/index.d.ts
CHANGED
|
@@ -5,4 +5,6 @@ export * from "./exceptions/app-badrequest.exception";
|
|
|
5
5
|
export * from "./types/app-badrequest-exception.type";
|
|
6
6
|
export * from "./types/booking-modification.type";
|
|
7
7
|
export * from "./interface/get-booking-codes-per-thirty-min.interface";
|
|
8
|
+
export * from "./interface/get-turf-entity.interface";
|
|
8
9
|
export * from "./enums/modification-discount-policy.enum";
|
|
10
|
+
export * from "./types/entity/entity-audit-column.type";
|
package/build/index.js
CHANGED
|
@@ -21,4 +21,7 @@ __exportStar(require("./exceptions/app-badrequest.exception"), exports);
|
|
|
21
21
|
__exportStar(require("./types/app-badrequest-exception.type"), exports);
|
|
22
22
|
__exportStar(require("./types/booking-modification.type"), exports);
|
|
23
23
|
__exportStar(require("./interface/get-booking-codes-per-thirty-min.interface"), exports);
|
|
24
|
+
__exportStar(require("./interface/get-turf-entity.interface"), exports);
|
|
24
25
|
__exportStar(require("./enums/modification-discount-policy.enum"), exports);
|
|
26
|
+
__exportStar(require("./types/entity/entity-audit-column.type"), exports);
|
|
27
|
+
// export * from "./types/entity/turf-entity.type";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface ITurf {
|
|
2
|
+
id: number;
|
|
3
|
+
turfName: string;
|
|
4
|
+
numberOfPitches: number;
|
|
5
|
+
address: string;
|
|
6
|
+
createdOn: Date;
|
|
7
|
+
updatedOn: Date;
|
|
8
|
+
createdBy: number;
|
|
9
|
+
updatedBy: number;
|
|
10
|
+
org_id: number;
|
|
11
|
+
totalPitchCount?: number;
|
|
12
|
+
activePitchCount?: number;
|
|
13
|
+
deletePitchCount?: number;
|
|
14
|
+
deactivePitchCount?: number;
|
|
15
|
+
newPitchCount?: number;
|
|
16
|
+
setup_invalidPitchCount?: number;
|
|
17
|
+
payment_invalidPitchCount?: number;
|
|
18
|
+
account_suspendedPitchCount?: number;
|
|
19
|
+
pitches: IPitch[];
|
|
20
|
+
}
|
|
21
|
+
export interface IPitch {
|
|
22
|
+
turf: number;
|
|
23
|
+
number: number;
|
|
24
|
+
name: string;
|
|
25
|
+
status: string;
|
|
26
|
+
sports: ISport[];
|
|
27
|
+
createdOn: Date;
|
|
28
|
+
updatedOn: Date;
|
|
29
|
+
createdBy: number;
|
|
30
|
+
updatedBy: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ISport {
|
|
33
|
+
name: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface IEntityAuditColumn {
|
|
2
|
+
createdOn: Date;
|
|
3
|
+
updatedOn: Date;
|
|
4
|
+
createdBy: number;
|
|
5
|
+
updatedBy: number;
|
|
6
|
+
}
|
|
7
|
+
export declare class EntityAuditColumnModel implements IEntityAuditColumn {
|
|
8
|
+
createdOn: Date;
|
|
9
|
+
updatedOn: Date;
|
|
10
|
+
createdBy: number;
|
|
11
|
+
updatedBy: number;
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EntityAuditColumnModel = void 0;
|
|
4
|
+
var EntityAuditColumnModel = /** @class */ (function () {
|
|
5
|
+
function EntityAuditColumnModel() {
|
|
6
|
+
}
|
|
7
|
+
return EntityAuditColumnModel;
|
|
8
|
+
}());
|
|
9
|
+
exports.EntityAuditColumnModel = EntityAuditColumnModel;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { OrganizationStatus } from "../../enums/organization-status.enum";
|
|
2
|
+
import { ITurfEntity } from "./turf-entity.type";
|
|
3
|
+
export type IOrganizationEntity = {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
email: string;
|
|
7
|
+
contact_no: string;
|
|
8
|
+
type: string;
|
|
9
|
+
pan_no: string;
|
|
10
|
+
pan_file_path: string;
|
|
11
|
+
gst_no: string;
|
|
12
|
+
gst_file_path: string;
|
|
13
|
+
deed: string;
|
|
14
|
+
deed_file_path: string;
|
|
15
|
+
status: OrganizationStatus;
|
|
16
|
+
registrationId: number;
|
|
17
|
+
};
|
|
18
|
+
export interface IOrganizationRel {
|
|
19
|
+
turfs: ITurfEntity[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
2
|
+
import { ITurfEntity } from "./turf-entity.type";
|
|
3
|
+
export interface IPitchEntity extends IEntityAuditColumn {
|
|
4
|
+
turf: ITurfEntity;
|
|
5
|
+
number: number;
|
|
6
|
+
name: string;
|
|
7
|
+
status: string;
|
|
8
|
+
sports: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { IPitchStatus } from "../../enums/pitch-status.enum";
|
|
2
|
+
import { ITurf } from "../../interface/get-turf-entity.interface";
|
|
3
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
4
|
+
import { IOrganizationEntity } from "./organization-entity.type";
|
|
5
|
+
import { IPitchEntity } from "./pitch-entity.type";
|
|
6
|
+
export interface ITurfEntity extends IEntityAuditColumn {
|
|
7
|
+
id: number;
|
|
8
|
+
turfName: string;
|
|
9
|
+
numberOfPitches: number;
|
|
10
|
+
address: string;
|
|
11
|
+
org_id: number;
|
|
12
|
+
adhocRefund: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ITurfEntityRel {
|
|
15
|
+
pitches: IPitchEntity[];
|
|
16
|
+
organization: IOrganizationEntity;
|
|
17
|
+
}
|
|
18
|
+
export interface ITurfModel extends ITurfEntity, ITurfEntityRel {
|
|
19
|
+
getPitchStatusCount(): IPitchStatus;
|
|
20
|
+
getModifiedTurfEntity(): ITurf;
|
|
21
|
+
}
|
|
22
|
+
export declare class TurfModel implements ITurfModel {
|
|
23
|
+
id: number;
|
|
24
|
+
turfName: string;
|
|
25
|
+
numberOfPitches: number;
|
|
26
|
+
address: string;
|
|
27
|
+
org_id: number;
|
|
28
|
+
adhocRefund: boolean;
|
|
29
|
+
createdOn: Date;
|
|
30
|
+
updatedOn: Date;
|
|
31
|
+
createdBy: number;
|
|
32
|
+
updatedBy: number;
|
|
33
|
+
pitches: IPitchEntity[];
|
|
34
|
+
organization: IOrganizationEntity;
|
|
35
|
+
constructor(data: ITurfEntity);
|
|
36
|
+
getPitchStatusCount(): IPitchStatus;
|
|
37
|
+
getModifiedTurfEntity(): ITurf;
|
|
38
|
+
static toMap(turfEntities: ITurfModel[]): {
|
|
39
|
+
[key: number]: ITurf;
|
|
40
|
+
};
|
|
41
|
+
static toKeyValue(turfEntities: ITurfEntity[]): {
|
|
42
|
+
[key: number]: ITurfEntity;
|
|
43
|
+
};
|
|
44
|
+
static fromEntity(data: ITurfEntity): ITurfModel;
|
|
45
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TurfModel = void 0;
|
|
4
|
+
var pitch_status_enum_1 = require("../../enums/pitch-status.enum");
|
|
5
|
+
var TurfModel = /** @class */ (function () {
|
|
6
|
+
function TurfModel(data) {
|
|
7
|
+
Object.assign(this, data);
|
|
8
|
+
}
|
|
9
|
+
TurfModel.prototype.getPitchStatusCount = function () {
|
|
10
|
+
var statusCount = {};
|
|
11
|
+
for (var _i = 0, _a = Object.values(pitch_status_enum_1.PitchStatus); _i < _a.length; _i++) {
|
|
12
|
+
var status_1 = _a[_i];
|
|
13
|
+
statusCount[status_1] = 0;
|
|
14
|
+
}
|
|
15
|
+
for (var _b = 0, _c = this.pitches; _b < _c.length; _b++) {
|
|
16
|
+
var pitch = _c[_b];
|
|
17
|
+
statusCount[pitch.status] += 1;
|
|
18
|
+
}
|
|
19
|
+
return statusCount;
|
|
20
|
+
};
|
|
21
|
+
TurfModel.prototype.getModifiedTurfEntity = function () {
|
|
22
|
+
return {
|
|
23
|
+
id: this.id,
|
|
24
|
+
turfName: this.turfName,
|
|
25
|
+
numberOfPitches: this.numberOfPitches,
|
|
26
|
+
address: this.address,
|
|
27
|
+
org_id: this.org_id,
|
|
28
|
+
updatedBy: this.updatedBy,
|
|
29
|
+
updatedOn: this.updatedOn,
|
|
30
|
+
createdBy: this.createdBy,
|
|
31
|
+
createdOn: this.createdOn,
|
|
32
|
+
pitches: this.pitches.map(function (_a) {
|
|
33
|
+
var turf = _a.turf, number = _a.number, name = _a.name, status = _a.status, sports = _a.sports, createdBy = _a.createdBy, createdOn = _a.createdOn, updatedBy = _a.updatedBy, updatedOn = _a.updatedOn;
|
|
34
|
+
return ({
|
|
35
|
+
turf: turf.id,
|
|
36
|
+
number: number,
|
|
37
|
+
name: name,
|
|
38
|
+
status: status,
|
|
39
|
+
sports: sports.split(",").map(function (sport) { return ({ name: sport }); }),
|
|
40
|
+
createdBy: createdBy,
|
|
41
|
+
createdOn: createdOn,
|
|
42
|
+
updatedBy: updatedBy,
|
|
43
|
+
updatedOn: updatedOn,
|
|
44
|
+
});
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
TurfModel.toMap = function (turfEntities) {
|
|
49
|
+
var response = {};
|
|
50
|
+
turfEntities.forEach(function (turfEntity) {
|
|
51
|
+
if (!response[turfEntity.id]) {
|
|
52
|
+
response[turfEntity.id] = turfEntity.getModifiedTurfEntity();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return response;
|
|
56
|
+
};
|
|
57
|
+
TurfModel.toKeyValue = function (turfEntities) {
|
|
58
|
+
var response = {};
|
|
59
|
+
turfEntities.forEach(function (turfEntity) {
|
|
60
|
+
if (!response[turfEntity.id]) {
|
|
61
|
+
response[turfEntity.id] = turfEntity;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return response;
|
|
65
|
+
};
|
|
66
|
+
TurfModel.fromEntity = function (data) {
|
|
67
|
+
return new TurfModel(data);
|
|
68
|
+
};
|
|
69
|
+
return TurfModel;
|
|
70
|
+
}());
|
|
71
|
+
exports.TurfModel = TurfModel;
|
package/package.json
CHANGED
|
@@ -1,27 +1,33 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "turf-common",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "./build/index.js",
|
|
6
|
-
"types": "./build/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"build/**/*"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"clean": "del build",
|
|
12
|
-
"build": "npm run clean && tsc",
|
|
13
|
-
"version:deploy": "npm version patch && git push && npm run build && npm publish",
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "turf-common",
|
|
3
|
+
"version": "1.0.16-beta.10",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "./build/index.js",
|
|
6
|
+
"types": "./build/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"build/**/*"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"clean": "del build",
|
|
12
|
+
"build": "npm run clean && tsc",
|
|
13
|
+
"version:deploy": "npm version patch && git push && npm run build && npm publish",
|
|
14
|
+
"version:deploy:beta": "npm version prerelease --preid beta && git push && npm run build && npm publish --tag beta",
|
|
15
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
16
|
+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" 2>&1| tee eslint.log",
|
|
17
|
+
"lint:fix": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "github__bellex-dev__turf-common:bellex-dev/turf-common.git"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [],
|
|
24
|
+
"author": "",
|
|
25
|
+
"license": "ISC",
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
28
|
+
"@typescript-eslint/parser": "^6.7.2",
|
|
29
|
+
"del-cli": "^5.1.0",
|
|
30
|
+
"eslint": "^8.50.0",
|
|
31
|
+
"typescript": "^5.2.2"
|
|
32
|
+
}
|
|
33
|
+
}
|