storemw-core-api 1.0.163 → 1.0.164
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/dist/lib/model_factory/ModelFactory.d.ts +7 -6
- package/dist/lib/model_factory/ModelFactory.js +595 -197
- package/dist/lib/model_factory/ModelFactory.js.map +1 -1
- package/dist/models/access_control/AccessControlRoleModel.d.ts +4 -5
- package/dist/models/access_control/AccessControlRolePolicyModel.d.ts +4 -5
- package/dist/models/access_control/AccessControlUserRoleModel.d.ts +4 -5
- package/dist/models/account/AccountModel.d.ts +4 -5
- package/dist/models/auth/AccessKeyModel.d.ts +4 -5
- package/dist/models/branch/UserBranchModel.d.ts +4 -5
- package/dist/models/branch_user/BranchUserModel.d.ts +4 -5
- package/dist/models/business/BusinessModel.d.ts +4 -5
- package/dist/models/document/DocumentAmountModel.d.ts +4 -5
- package/dist/models/document/DocumentDocumentModel.d.ts +4 -5
- package/dist/models/document/DocumentItemModel.d.ts +4 -5
- package/dist/models/document/DocumentLocationModel.d.ts +4 -5
- package/dist/models/document/DocumentModel.d.ts +4 -5
- package/dist/models/document/DocumentPaymentModel.d.ts +4 -5
- package/dist/models/document/DocumentProfileModel.d.ts +4 -5
- package/dist/models/document/DocumentTotalModel.d.ts +4 -5
- package/dist/models/file/FileModel.d.ts +4 -5
- package/dist/models/group/GroupModel.d.ts +4 -5
- package/dist/models/group/GroupOwnerModel.d.ts +4 -5
- package/dist/models/injection_field/DocumentInjectionFieldModel.d.ts +4 -5
- package/dist/models/injection_field/InjectionFieldModel.d.ts +4 -5
- package/dist/models/injection_field/ItemInjectionFieldModel.d.ts +4 -5
- package/dist/models/injection_field/LogisticInjectionFieldModel.d.ts +4 -5
- package/dist/models/injection_field/RepositoryInjectionFieldModel.d.ts +4 -5
- package/dist/models/injection_field/UserInjectionFieldModel.d.ts +4 -5
- package/dist/models/item/BrandModel.d.ts +4 -5
- package/dist/models/item/CategoryModel.d.ts +4 -5
- package/dist/models/item/ItemModel.d.ts +4 -5
- package/dist/models/item/ProductModel.d.ts +4 -5
- package/dist/models/item/UomModel.d.ts +4 -5
- package/dist/models/location/LocationModel.d.ts +4 -5
- package/dist/models/location/LocationRackModel.d.ts +4 -5
- package/dist/models/location/LocationSlotModel.d.ts +4 -5
- package/dist/models/others/NumberDateSequenceModel.d.ts +4 -5
- package/dist/models/others/OneTimeCodeModel.d.ts +4 -5
- package/dist/models/region/AreaModel.d.ts +4 -5
- package/dist/models/region/CountryModel.d.ts +4 -5
- package/dist/models/region/StateModel.d.ts +4 -5
- package/dist/models/repository/RepositoryCartonModel.d.ts +4 -5
- package/dist/models/repository/RepositoryContainerModel.d.ts +4 -5
- package/dist/models/repository/RepositoryModel.d.ts +4 -5
- package/dist/models/repository/RepositoryPackageItemModel.d.ts +4 -5
- package/dist/models/repository/RepositoryPackageModel.d.ts +4 -5
- package/dist/models/repository/RepositoryPalletModel.d.ts +4 -5
- package/dist/models/scheduler/SchedulerLogModel.d.ts +4 -5
- package/dist/models/scheduler/SchedulerRequestModel.d.ts +4 -5
- package/dist/models/subscription/account/AccountSubscribeModel.d.ts +4 -5
- package/dist/models/subscription/plan/SubscribePlanModel.d.ts +4 -5
- package/dist/models/user/AdministratorModel.d.ts +4 -5
- package/dist/models/user/AgentModel.d.ts +4 -5
- package/dist/models/user/CustomerModel.d.ts +4 -5
- package/dist/models/user/DriverModel.d.ts +4 -5
- package/dist/models/user/MemberModel.d.ts +4 -5
- package/dist/models/user/OperatorModel.d.ts +4 -5
- package/dist/models/user/RetailerModel.d.ts +4 -5
- package/dist/models/user/UserModel.d.ts +4 -5
- package/dist/models/user/UserPropModel.d.ts +4 -5
- package/dist/models/user/WorkerModel.d.ts +4 -5
- package/dist/schema/payload/document/schemaDocumentCashSales.d.ts +64 -64
- package/dist/schema/payload/document/schemaDocumentDeliveryOrder.d.ts +64 -64
- package/dist/schema/payload/document/schemaDocumentProformaSales.d.ts +64 -64
- package/dist/schema/payload/document/schemaDocumentReplacementDeliveryOrder.d.ts +64 -64
- package/dist/schema/payload/document/schemaDocumentSalesOrder.d.ts +64 -64
- package/dist/utils/serviceUtils.d.ts +2 -0
- package/dist/utils/serviceUtils.js.map +1 -1
- package/package.json +1 -1
|
@@ -191,14 +191,6 @@ export declare const schemaDocumentSalesOrderCreatePayload: z.ZodObject<{
|
|
|
191
191
|
profileName?: string | undefined;
|
|
192
192
|
personName?: string | undefined;
|
|
193
193
|
};
|
|
194
|
-
totals?: {
|
|
195
|
-
description: string;
|
|
196
|
-
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
197
|
-
totalAmount: number;
|
|
198
|
-
totalPercentage: number;
|
|
199
|
-
documentTotalId?: number | undefined;
|
|
200
|
-
referId?: string | undefined;
|
|
201
|
-
}[] | undefined;
|
|
202
194
|
items?: {
|
|
203
195
|
quantity: number;
|
|
204
196
|
itemId: number;
|
|
@@ -209,6 +201,14 @@ export declare const schemaDocumentSalesOrderCreatePayload: z.ZodObject<{
|
|
|
209
201
|
uomId?: number | undefined;
|
|
210
202
|
uomPrice?: number | undefined;
|
|
211
203
|
}[] | undefined;
|
|
204
|
+
totals?: {
|
|
205
|
+
description: string;
|
|
206
|
+
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
207
|
+
totalAmount: number;
|
|
208
|
+
totalPercentage: number;
|
|
209
|
+
documentTotalId?: number | undefined;
|
|
210
|
+
referId?: string | undefined;
|
|
211
|
+
}[] | undefined;
|
|
212
212
|
remark?: string | undefined;
|
|
213
213
|
documentNumber?: string | undefined;
|
|
214
214
|
documentReferenceId1?: string | undefined;
|
|
@@ -249,14 +249,6 @@ export declare const schemaDocumentSalesOrderCreatePayload: z.ZodObject<{
|
|
|
249
249
|
profileName?: string | undefined;
|
|
250
250
|
personName?: string | undefined;
|
|
251
251
|
};
|
|
252
|
-
totals?: {
|
|
253
|
-
description: string;
|
|
254
|
-
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
255
|
-
documentTotalId?: number | undefined;
|
|
256
|
-
referId?: string | undefined;
|
|
257
|
-
totalAmount?: unknown;
|
|
258
|
-
totalPercentage?: unknown;
|
|
259
|
-
}[] | undefined;
|
|
260
252
|
items?: {
|
|
261
253
|
quantity: number;
|
|
262
254
|
itemId: number;
|
|
@@ -267,6 +259,14 @@ export declare const schemaDocumentSalesOrderCreatePayload: z.ZodObject<{
|
|
|
267
259
|
uomId?: number | undefined;
|
|
268
260
|
uomPrice?: number | undefined;
|
|
269
261
|
}[] | undefined;
|
|
262
|
+
totals?: {
|
|
263
|
+
description: string;
|
|
264
|
+
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
265
|
+
documentTotalId?: number | undefined;
|
|
266
|
+
referId?: string | undefined;
|
|
267
|
+
totalAmount?: unknown;
|
|
268
|
+
totalPercentage?: unknown;
|
|
269
|
+
}[] | undefined;
|
|
270
270
|
remark?: string | undefined;
|
|
271
271
|
documentNumber?: string | undefined;
|
|
272
272
|
documentReferenceId1?: string | undefined;
|
|
@@ -313,14 +313,6 @@ export declare const schemaDocumentSalesOrderCreatePayload: z.ZodObject<{
|
|
|
313
313
|
profileName?: string | undefined;
|
|
314
314
|
personName?: string | undefined;
|
|
315
315
|
};
|
|
316
|
-
totals?: {
|
|
317
|
-
description: string;
|
|
318
|
-
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
319
|
-
totalAmount: number;
|
|
320
|
-
totalPercentage: number;
|
|
321
|
-
documentTotalId?: number | undefined;
|
|
322
|
-
referId?: string | undefined;
|
|
323
|
-
}[] | undefined;
|
|
324
316
|
items?: {
|
|
325
317
|
quantity: number;
|
|
326
318
|
itemId: number;
|
|
@@ -331,6 +323,14 @@ export declare const schemaDocumentSalesOrderCreatePayload: z.ZodObject<{
|
|
|
331
323
|
uomId?: number | undefined;
|
|
332
324
|
uomPrice?: number | undefined;
|
|
333
325
|
}[] | undefined;
|
|
326
|
+
totals?: {
|
|
327
|
+
description: string;
|
|
328
|
+
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
329
|
+
totalAmount: number;
|
|
330
|
+
totalPercentage: number;
|
|
331
|
+
documentTotalId?: number | undefined;
|
|
332
|
+
referId?: string | undefined;
|
|
333
|
+
}[] | undefined;
|
|
334
334
|
remark?: string | undefined;
|
|
335
335
|
documentNumber?: string | undefined;
|
|
336
336
|
documentReferenceId1?: string | undefined;
|
|
@@ -377,14 +377,6 @@ export declare const schemaDocumentSalesOrderCreatePayload: z.ZodObject<{
|
|
|
377
377
|
profileName?: string | undefined;
|
|
378
378
|
personName?: string | undefined;
|
|
379
379
|
};
|
|
380
|
-
totals?: {
|
|
381
|
-
description: string;
|
|
382
|
-
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
383
|
-
documentTotalId?: number | undefined;
|
|
384
|
-
referId?: string | undefined;
|
|
385
|
-
totalAmount?: unknown;
|
|
386
|
-
totalPercentage?: unknown;
|
|
387
|
-
}[] | undefined;
|
|
388
380
|
items?: {
|
|
389
381
|
quantity: number;
|
|
390
382
|
itemId: number;
|
|
@@ -395,6 +387,14 @@ export declare const schemaDocumentSalesOrderCreatePayload: z.ZodObject<{
|
|
|
395
387
|
uomId?: number | undefined;
|
|
396
388
|
uomPrice?: number | undefined;
|
|
397
389
|
}[] | undefined;
|
|
390
|
+
totals?: {
|
|
391
|
+
description: string;
|
|
392
|
+
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
393
|
+
documentTotalId?: number | undefined;
|
|
394
|
+
referId?: string | undefined;
|
|
395
|
+
totalAmount?: unknown;
|
|
396
|
+
totalPercentage?: unknown;
|
|
397
|
+
}[] | undefined;
|
|
398
398
|
remark?: string | undefined;
|
|
399
399
|
documentNumber?: string | undefined;
|
|
400
400
|
documentReferenceId1?: string | undefined;
|
|
@@ -597,14 +597,6 @@ export declare const schemaDocumentSalesOrderUpdatePayload: z.ZodObject<{
|
|
|
597
597
|
profileName?: string | undefined;
|
|
598
598
|
personName?: string | undefined;
|
|
599
599
|
};
|
|
600
|
-
totals?: {
|
|
601
|
-
description: string;
|
|
602
|
-
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
603
|
-
totalAmount: number;
|
|
604
|
-
totalPercentage: number;
|
|
605
|
-
documentTotalId?: number | undefined;
|
|
606
|
-
referId?: string | undefined;
|
|
607
|
-
}[] | undefined;
|
|
608
600
|
items?: {
|
|
609
601
|
quantity: number;
|
|
610
602
|
itemId: number;
|
|
@@ -615,6 +607,14 @@ export declare const schemaDocumentSalesOrderUpdatePayload: z.ZodObject<{
|
|
|
615
607
|
uomId?: number | undefined;
|
|
616
608
|
uomPrice?: number | undefined;
|
|
617
609
|
}[] | undefined;
|
|
610
|
+
totals?: {
|
|
611
|
+
description: string;
|
|
612
|
+
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
613
|
+
totalAmount: number;
|
|
614
|
+
totalPercentage: number;
|
|
615
|
+
documentTotalId?: number | undefined;
|
|
616
|
+
referId?: string | undefined;
|
|
617
|
+
}[] | undefined;
|
|
618
618
|
remark?: string | undefined;
|
|
619
619
|
documentReferenceId1?: string | undefined;
|
|
620
620
|
documentReferenceLabel1?: string | undefined;
|
|
@@ -654,14 +654,6 @@ export declare const schemaDocumentSalesOrderUpdatePayload: z.ZodObject<{
|
|
|
654
654
|
profileName?: string | undefined;
|
|
655
655
|
personName?: string | undefined;
|
|
656
656
|
};
|
|
657
|
-
totals?: {
|
|
658
|
-
description: string;
|
|
659
|
-
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
660
|
-
documentTotalId?: number | undefined;
|
|
661
|
-
referId?: string | undefined;
|
|
662
|
-
totalAmount?: unknown;
|
|
663
|
-
totalPercentage?: unknown;
|
|
664
|
-
}[] | undefined;
|
|
665
657
|
items?: {
|
|
666
658
|
quantity: number;
|
|
667
659
|
itemId: number;
|
|
@@ -672,6 +664,14 @@ export declare const schemaDocumentSalesOrderUpdatePayload: z.ZodObject<{
|
|
|
672
664
|
uomId?: number | undefined;
|
|
673
665
|
uomPrice?: number | undefined;
|
|
674
666
|
}[] | undefined;
|
|
667
|
+
totals?: {
|
|
668
|
+
description: string;
|
|
669
|
+
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
670
|
+
documentTotalId?: number | undefined;
|
|
671
|
+
referId?: string | undefined;
|
|
672
|
+
totalAmount?: unknown;
|
|
673
|
+
totalPercentage?: unknown;
|
|
674
|
+
}[] | undefined;
|
|
675
675
|
remark?: string | undefined;
|
|
676
676
|
documentReferenceId1?: string | undefined;
|
|
677
677
|
documentReferenceLabel1?: string | undefined;
|
|
@@ -717,14 +717,6 @@ export declare const schemaDocumentSalesOrderUpdatePayload: z.ZodObject<{
|
|
|
717
717
|
profileName?: string | undefined;
|
|
718
718
|
personName?: string | undefined;
|
|
719
719
|
};
|
|
720
|
-
totals?: {
|
|
721
|
-
description: string;
|
|
722
|
-
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
723
|
-
totalAmount: number;
|
|
724
|
-
totalPercentage: number;
|
|
725
|
-
documentTotalId?: number | undefined;
|
|
726
|
-
referId?: string | undefined;
|
|
727
|
-
}[] | undefined;
|
|
728
720
|
items?: {
|
|
729
721
|
quantity: number;
|
|
730
722
|
itemId: number;
|
|
@@ -735,6 +727,14 @@ export declare const schemaDocumentSalesOrderUpdatePayload: z.ZodObject<{
|
|
|
735
727
|
uomId?: number | undefined;
|
|
736
728
|
uomPrice?: number | undefined;
|
|
737
729
|
}[] | undefined;
|
|
730
|
+
totals?: {
|
|
731
|
+
description: string;
|
|
732
|
+
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
733
|
+
totalAmount: number;
|
|
734
|
+
totalPercentage: number;
|
|
735
|
+
documentTotalId?: number | undefined;
|
|
736
|
+
referId?: string | undefined;
|
|
737
|
+
}[] | undefined;
|
|
738
738
|
remark?: string | undefined;
|
|
739
739
|
documentReferenceId1?: string | undefined;
|
|
740
740
|
documentReferenceLabel1?: string | undefined;
|
|
@@ -780,14 +780,6 @@ export declare const schemaDocumentSalesOrderUpdatePayload: z.ZodObject<{
|
|
|
780
780
|
profileName?: string | undefined;
|
|
781
781
|
personName?: string | undefined;
|
|
782
782
|
};
|
|
783
|
-
totals?: {
|
|
784
|
-
description: string;
|
|
785
|
-
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
786
|
-
documentTotalId?: number | undefined;
|
|
787
|
-
referId?: string | undefined;
|
|
788
|
-
totalAmount?: unknown;
|
|
789
|
-
totalPercentage?: unknown;
|
|
790
|
-
}[] | undefined;
|
|
791
783
|
items?: {
|
|
792
784
|
quantity: number;
|
|
793
785
|
itemId: number;
|
|
@@ -798,6 +790,14 @@ export declare const schemaDocumentSalesOrderUpdatePayload: z.ZodObject<{
|
|
|
798
790
|
uomId?: number | undefined;
|
|
799
791
|
uomPrice?: number | undefined;
|
|
800
792
|
}[] | undefined;
|
|
793
|
+
totals?: {
|
|
794
|
+
description: string;
|
|
795
|
+
totalType: "discount" | "rounding_down" | "tax" | "rouding_up";
|
|
796
|
+
documentTotalId?: number | undefined;
|
|
797
|
+
referId?: string | undefined;
|
|
798
|
+
totalAmount?: unknown;
|
|
799
|
+
totalPercentage?: unknown;
|
|
800
|
+
}[] | undefined;
|
|
801
801
|
remark?: string | undefined;
|
|
802
802
|
documentReferenceId1?: string | undefined;
|
|
803
803
|
documentReferenceLabel1?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Request } from "express";
|
|
2
|
+
import type { Prisma } from "@prisma/client";
|
|
2
3
|
export type DefaultServiceProps = {
|
|
3
4
|
accountId: number;
|
|
4
5
|
actionUserId: number;
|
|
@@ -8,6 +9,7 @@ export type DefaultServiceProps = {
|
|
|
8
9
|
accessKey?: string;
|
|
9
10
|
accessKeyId?: string;
|
|
10
11
|
req?: Request;
|
|
12
|
+
tx?: Prisma.TransactionClient;
|
|
11
13
|
};
|
|
12
14
|
export declare const getDefaultServiceProps: (req: Request) => DefaultServiceProps;
|
|
13
15
|
export declare const generateServiceProps: ({ buildType, accessKey }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serviceUtils.js","sourceRoot":"","sources":["../../src/utils/serviceUtils.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"serviceUtils.js","sourceRoot":"","sources":["../../src/utils/serviceUtils.ts"],"names":[],"mappings":";;;AAIA,yCAA6D;AAC7D,qDAA8C;AAE9C,uDAAyD;AAelD,MAAM,sBAAsB,GAAG,CAAC,GAAY,EAAuB,EAAE;IAExE,MAAM,kBAAkB,GAAI,GAAW,EAAE,IAAI,IAAI,EAAE,CAAA;IACnD,MAAM,SAAS,GAAI,GAAW,EAAE,SAAS,IAAI,EAAE,CAAA;IAC/C,MAAM,YAAY,GAAI,GAAW,EAAE,YAAY,IAAI,EAAE,CAAA;IACrD,MAAM,cAAc,GAAI,GAAW,EAAE,cAAc,IAAI,EAAE,CAAA;IAEzD,MAAM,EACF,SAAS,GAAG,EAAE,EACd,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,EAAE,EACd,WAAW,GAAG,EAAE,EACnB,GAAG,kBAAkB,CAAA;IAEtB,OAAO;QACH,SAAS;QACT,YAAY;QACZ,cAAc;QACd,SAAS;QACT,UAAU;QACV,SAAS;QACT,WAAW;QACX,GAAG;KACN,CAAA;AACL,CAAC,CAAA;AAxBY,QAAA,sBAAsB,0BAwBlC;AAEM,MAAM,oBAAoB,GAAG,KAAK,EAAE,EACvC,SAAS,GAAG,YAAY,EACxB,SAAS,EAIZ,EAAgC,EAAE;IAE/B,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,sCAAoB,GAAE,CAAA;IAEzC,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,IAAA,2BAAU,EAAC,kEAAkE,CAAC,CAAA;IAClF,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,IAAA,2BAAU,EAAC,8DAA8D,CAAC,CAAA;IAC9E,CAAC;IAED,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,IAAA,2BAAU,EAAC,kEAAkE,CAAC,CAAA;IAClF,CAAC;IAED,MAAM,oBAAoB,GAAG,IAAA,+BAAoB,EAAC;QAC9C,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;QACf,cAAc,EAAE,EAAE;QAClB,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,EAAE;QACf,iBAAiB,EAAE,UAAU;KAChC,CAAC,CAAA;IAEF,MAAM,kBAAkB,GAAG,MAAM,oBAAoB,CAAC,iBAAiB,CAAC;QACpE,IAAI,EAAE;YACF,SAAS;SACZ;KACJ,CAAC,CAAA;IAEF,8EAA8E;IAE9E,OAAO;QACH,SAAS,EAAE,MAAM,CAAC,kBAAkB,EAAE,SAAS,CAAC;QAChD,YAAY,EAAE,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC;QACjD,cAAc,EAAE,kBAAkB,EAAE,SAAS,IAAI,EAAE;QACnD,SAAS,EAAE,EAAE;QACb,SAAS;QACT,WAAW,EAAE,kBAAkB,EAAE,aAAa,IAAI,EAAE;QACpD,UAAU,EAAE,kBAAkB,EAAE,SAAS,KAAK,oBAAS,CAAC,QAAQ;KACnE,CAAA;AAEL,CAAC,CAAA;AAnDY,QAAA,oBAAoB,wBAmDhC","sourcesContent":["import { Request } from \"express\";\n\nimport type { Prisma } from \"@prisma/client\";\n\nimport { AccessKeyUtilService, userTypes } from \"@/services\";\nimport { throwError } from \"./exceptionUtils\";\n\nimport { getCoreConfiguration } from \"./coreConfigUtils\";\n\nexport type DefaultServiceProps = {\n accountId: number,\n actionUserId: number,\n actionUserType: string,\n authToken: string,\n isOperator: boolean,\n accessKey?: string,\n accessKeyId?: string\n req?: Request,\n // ✅ ADD THIS\n tx?: Prisma.TransactionClient\n}\n\nexport const getDefaultServiceProps = (req: Request): DefaultServiceProps => {\n\n const requestAuthContext = (req as any)?.auth ?? {}\n const accountId = (req as any)?.accountId ?? \"\"\n const actionUserId = (req as any)?.actionUserId ?? \"\"\n const actionUserType = (req as any)?.actionUserType ?? \"\"\n\n const {\n authToken = '',\n isOperator = false,\n accessKey = '',\n accessKeyId = ''\n } = requestAuthContext\n\n return {\n accountId,\n actionUserId,\n actionUserType,\n authToken,\n isOperator,\n accessKey,\n accessKeyId,\n req\n }\n}\n\nexport const generateServiceProps = async ({\n buildType = \"access_key\",\n accessKey\n}: {\n buildType?: \"access_key\",\n accessKey: string,\n}): Promise<DefaultServiceProps> => {\n\n const { prisma } = getCoreConfiguration()\n\n if (!buildType) {\n throwError(`Build Type is required in generate service props from access key`)\n }\n\n if (!prisma) {\n throwError(`Prisma is required in generate service props from access key`)\n }\n\n if (!accessKey) {\n throwError(`Access Key is required in generate service props from access key`)\n }\n\n const accessKeyUtilService = AccessKeyUtilService({\n accountId: 0,\n actionUserId: 0,\n actionUserType: \"\",\n authToken: '',\n isOperator: true,\n accessKey: '',\n accessKeyId: '',\n accessKeyUserType: \"operator\"\n })\n\n const validatedAccessKey = await accessKeyUtilService.validateAccessKey({\n data: {\n accessKey\n }\n })\n\n // console.log('defaultServiceProps', defaultServiceProps, validatedAccessKey)\n\n return {\n accountId: Number(validatedAccessKey?.accountid),\n actionUserId: Number(validatedAccessKey?.user_id),\n actionUserType: validatedAccessKey?.user_type ?? \"\",\n authToken: \"\",\n accessKey,\n accessKeyId: validatedAccessKey?.access_key_id ?? \"\",\n isOperator: validatedAccessKey?.user_type === userTypes.operator,\n }\n\n}"]}
|