@ibiliaze/global-vars 1.208.0 → 1.210.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.
|
@@ -463,6 +463,7 @@ export interface NotificationBase<Id, TDate> {
|
|
|
463
463
|
}
|
|
464
464
|
export interface OccupanceSaleBase<Id> {
|
|
465
465
|
name: string;
|
|
466
|
+
surname: string;
|
|
466
467
|
customerId: Id;
|
|
467
468
|
email: string;
|
|
468
469
|
tel: string;
|
|
@@ -526,12 +527,14 @@ export type FlatOccupance<Id, TDate> = {
|
|
|
526
527
|
orderId: string;
|
|
527
528
|
customerId: Id;
|
|
528
529
|
name: string;
|
|
530
|
+
surname: string;
|
|
529
531
|
email: string;
|
|
530
532
|
tel: string;
|
|
531
533
|
seat: number;
|
|
532
534
|
row: number;
|
|
533
535
|
categoryId: Id;
|
|
534
536
|
categoryName: string;
|
|
537
|
+
categoryPrice: number;
|
|
535
538
|
categoryColor?: string;
|
|
536
539
|
seasonId?: Id;
|
|
537
540
|
seasonName?: string;
|
|
@@ -709,13 +712,6 @@ export interface RoleBase<Id, TDate> {
|
|
|
709
712
|
createdAt?: TDate;
|
|
710
713
|
updatedAt?: TDate;
|
|
711
714
|
}
|
|
712
|
-
export interface SaleItemBase<Id> {
|
|
713
|
-
itemId: Id;
|
|
714
|
-
itemName: string;
|
|
715
|
-
itemType: 'product' | 'ticket' | 'project';
|
|
716
|
-
amount: number;
|
|
717
|
-
quantity: number;
|
|
718
|
-
}
|
|
719
715
|
export interface ItemBase<Id, TDate> {
|
|
720
716
|
_id?: Id;
|
|
721
717
|
cartId: string;
|
|
@@ -731,48 +727,32 @@ export interface ItemBase<Id, TDate> {
|
|
|
731
727
|
createdAt?: TDate;
|
|
732
728
|
updatedAt?: TDate;
|
|
733
729
|
}
|
|
730
|
+
export interface SaleItemBase<Id> {
|
|
731
|
+
itemId: Id;
|
|
732
|
+
itemName: string;
|
|
733
|
+
itemType: 'product' | 'ticket' | 'project';
|
|
734
|
+
amount: number;
|
|
735
|
+
quantity: number;
|
|
736
|
+
}
|
|
734
737
|
export interface SaleBase<Id, TDate> {
|
|
735
738
|
_id?: Id;
|
|
736
|
-
customerId: Id;
|
|
737
|
-
email: string;
|
|
738
|
-
saleName?: string;
|
|
739
|
-
name?: string;
|
|
740
|
-
surname?: string;
|
|
741
|
-
tel?: string;
|
|
742
|
-
address?: string;
|
|
743
|
-
promoCode?: string;
|
|
744
|
-
promoDiscount?: string;
|
|
745
739
|
subscription: boolean;
|
|
746
740
|
orderId: string;
|
|
741
|
+
promoCodeId?: Id;
|
|
747
742
|
newClient?: boolean;
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
743
|
+
customer: Pick<CustomerBase<Id, TDate>, '_id' | 'name' | 'surname' | 'email' | 'tel'>;
|
|
744
|
+
item?: Pick<ItemBase<Id, TDate>, '_id' | 'name' | 'quantity' | 'price'>;
|
|
745
|
+
category?: Pick<EventCategoryBase<Id>, 'categoryId' | 'name' | 'price' | 'color'>;
|
|
746
|
+
event?: Pick<EventBase<Id, TDate>, '_id' | 'name' | 'date'>;
|
|
747
|
+
section?: Pick<SectionBase<Id, TDate>, '_id' | 'name' | 'area' | 'block' | 'gate' | 'venueId'>;
|
|
748
|
+
seat?: Pick<SeatBase<Id, TDate>, '_id' | 'name'>;
|
|
749
|
+
occupance?: Pick<OccupanceBase<Id, TDate>, '_id'>;
|
|
750
|
+
season?: Pick<SeasonBase<Id, TDate>, '_id' | 'name'>;
|
|
751
|
+
flow?: Pick<FlowBase<Id, TDate>, '_id' | 'name' | 'type'>;
|
|
752
|
+
product?: Pick<ProductBase<Id, TDate>, '_id' | 'productName' | 'price'>;
|
|
751
753
|
createdAt?: TDate;
|
|
752
754
|
updatedAt?: TDate;
|
|
753
755
|
}
|
|
754
|
-
export interface SaleInsightData {
|
|
755
|
-
period: string;
|
|
756
|
-
salesData: {
|
|
757
|
-
[key: string]: number;
|
|
758
|
-
} | null;
|
|
759
|
-
expensesData: {
|
|
760
|
-
[key: string]: number;
|
|
761
|
-
} | null;
|
|
762
|
-
totalSales: number | null;
|
|
763
|
-
totalExpenses: number | null;
|
|
764
|
-
numberOfSalesData: {
|
|
765
|
-
[key: string]: number;
|
|
766
|
-
} | null;
|
|
767
|
-
numberOfExpensesData: {
|
|
768
|
-
[key: string]: number;
|
|
769
|
-
} | null;
|
|
770
|
-
growthData: {
|
|
771
|
-
[key: string]: number;
|
|
772
|
-
} | null;
|
|
773
|
-
numberOfSales: number | null;
|
|
774
|
-
numberOfExpenses: number | null;
|
|
775
|
-
}
|
|
776
756
|
export interface SectionBase<Id, TDate> {
|
|
777
757
|
_id?: Id;
|
|
778
758
|
name: string;
|
|
@@ -801,6 +781,7 @@ export interface UserBase<Id, TDate> {
|
|
|
801
781
|
password: string;
|
|
802
782
|
tel: string;
|
|
803
783
|
name: string;
|
|
784
|
+
surname: string;
|
|
804
785
|
avatar?: string;
|
|
805
786
|
roles?: Id[];
|
|
806
787
|
flowIds?: Id[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SaleBase
|
|
1
|
+
import type { SaleBase } from '../inputsDefault';
|
|
2
2
|
import type { SaleCustomer, SaleFlows, SalePayments, SalePerformanceBase, SaleRevenue, SaleSectors } from '../sale';
|
|
3
3
|
export declare const saleRoleDefs: <TId, TDate>() => readonly [{
|
|
4
4
|
readonly method: "post";
|
|
@@ -142,19 +142,6 @@ export declare const saleRoleDefs: <TId, TDate>() => readonly [{
|
|
|
142
142
|
readonly response_404: {
|
|
143
143
|
message: string;
|
|
144
144
|
};
|
|
145
|
-
}, {
|
|
146
|
-
readonly method: "get";
|
|
147
|
-
readonly path: "/sale/insight/:period/:date";
|
|
148
|
-
readonly role: "getSaleInsightByPeriodDate";
|
|
149
|
-
readonly name: "Get sale insights";
|
|
150
|
-
readonly response_200: SaleInsightData;
|
|
151
|
-
readonly response_400: {
|
|
152
|
-
message: string;
|
|
153
|
-
};
|
|
154
|
-
readonly response_500: {
|
|
155
|
-
message: string;
|
|
156
|
-
error: string;
|
|
157
|
-
};
|
|
158
145
|
}, {
|
|
159
146
|
readonly method: "put";
|
|
160
147
|
readonly path: "/sale/:id";
|
|
@@ -91,15 +91,6 @@ const saleRoleDefs = () => {
|
|
|
91
91
|
response_200: {},
|
|
92
92
|
response_404: {},
|
|
93
93
|
},
|
|
94
|
-
{
|
|
95
|
-
method: 'get',
|
|
96
|
-
path: '/sale/insight/:period/:date',
|
|
97
|
-
role: 'getSaleInsightByPeriodDate',
|
|
98
|
-
name: 'Get sale insights',
|
|
99
|
-
response_200: {},
|
|
100
|
-
response_400: {},
|
|
101
|
-
response_500: {},
|
|
102
|
-
},
|
|
103
94
|
{
|
|
104
95
|
method: 'put',
|
|
105
96
|
path: '/sale/:id',
|
|
@@ -1734,19 +1734,6 @@ export declare const apis: <TId, TDate>() => readonly [{
|
|
|
1734
1734
|
readonly response_404: {
|
|
1735
1735
|
message: string;
|
|
1736
1736
|
};
|
|
1737
|
-
}, {
|
|
1738
|
-
readonly method: "get";
|
|
1739
|
-
readonly path: "/sale/insight/:period/:date";
|
|
1740
|
-
readonly role: "getSaleInsightByPeriodDate";
|
|
1741
|
-
readonly name: "Get sale insights";
|
|
1742
|
-
readonly response_200: import("./inputsDefault").SaleInsightData;
|
|
1743
|
-
readonly response_400: {
|
|
1744
|
-
message: string;
|
|
1745
|
-
};
|
|
1746
|
-
readonly response_500: {
|
|
1747
|
-
message: string;
|
|
1748
|
-
error: string;
|
|
1749
|
-
};
|
|
1750
1737
|
}, {
|
|
1751
1738
|
readonly method: "put";
|
|
1752
1739
|
readonly path: "/sale/:id";
|
|
@@ -4382,19 +4369,6 @@ declare const allApis: readonly [{
|
|
|
4382
4369
|
readonly response_404: {
|
|
4383
4370
|
message: string;
|
|
4384
4371
|
};
|
|
4385
|
-
}, {
|
|
4386
|
-
readonly method: "get";
|
|
4387
|
-
readonly path: "/sale/insight/:period/:date";
|
|
4388
|
-
readonly role: "getSaleInsightByPeriodDate";
|
|
4389
|
-
readonly name: "Get sale insights";
|
|
4390
|
-
readonly response_200: import("./inputsDefault").SaleInsightData;
|
|
4391
|
-
readonly response_400: {
|
|
4392
|
-
message: string;
|
|
4393
|
-
};
|
|
4394
|
-
readonly response_500: {
|
|
4395
|
-
message: string;
|
|
4396
|
-
error: string;
|
|
4397
|
-
};
|
|
4398
4372
|
}, {
|
|
4399
4373
|
readonly method: "put";
|
|
4400
4374
|
readonly path: "/sale/:id";
|
package/dist/ticketops/sale.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { DayOfWeek } from '../globals';
|
|
2
|
+
import { SaleBase } from './inputsDefault';
|
|
3
|
+
export declare function getPrice<TId, Tdate>({ sale }: {
|
|
4
|
+
sale: SaleBase<TId, Tdate>;
|
|
5
|
+
}): number;
|
|
2
6
|
export type SaleRevenue = {
|
|
3
7
|
totalTicketsSold: number;
|
|
4
8
|
numberofEvents: number;
|
package/dist/ticketops/sale.js
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPrice = getPrice;
|
|
4
|
+
function getPrice({ sale }) {
|
|
5
|
+
try {
|
|
6
|
+
let price = 0;
|
|
7
|
+
if (sale?.product?.price)
|
|
8
|
+
price = sale?.product?.price;
|
|
9
|
+
if (sale?.category?.price)
|
|
10
|
+
price = sale?.category?.price;
|
|
11
|
+
if (sale?.item?.price)
|
|
12
|
+
price = sale?.item?.price;
|
|
13
|
+
return price;
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
console.error(e);
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ibiliaze/global-vars",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.210.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "tsc",
|
|
24
24
|
"pub": "npm publish --access public",
|
|
25
|
-
"git": "git add .; git commit -m 'changes'; git tag -a v1.
|
|
25
|
+
"git": "git add .; git commit -m 'changes'; git tag -a v1.210.0 -m 'v1.210.0'; git push origin v1.210.0; git push",
|
|
26
26
|
"push": "npm run build; npm run git; npm run pub"
|
|
27
27
|
},
|
|
28
28
|
"author": "Ibi Hasanli",
|