storemw-core-api 1.0.146 → 1.0.148
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/app.js +1 -0
- package/dist/app.js.map +1 -1
- package/dist/controllers/index.d.ts +1 -0
- package/dist/controllers/index.js +6 -1
- package/dist/controllers/index.js.map +1 -1
- package/dist/controllers/scheduler/schedulerLogController.d.ts +9 -0
- package/dist/controllers/scheduler/schedulerLogController.js +133 -0
- package/dist/controllers/scheduler/schedulerLogController.js.map +1 -0
- package/dist/features/auth_token/authTokenRegistry.js +1 -1
- package/dist/features/auth_token/authTokenRegistry.js.map +1 -1
- package/dist/features/auth_token/authTokenType.d.ts +2 -1
- package/dist/features/auth_token/authTokenType.js.map +1 -1
- package/dist/features/core_config/coreConfigType.js.map +1 -1
- package/dist/features/file_storage/fileStorageType.d.ts +4 -3
- package/dist/features/file_storage/fileStorageType.js.map +1 -1
- package/dist/features/reset_password/resetPasswordType.d.ts +7 -6
- package/dist/features/reset_password/resetPasswordType.js.map +1 -1
- package/dist/features/smtp_email/smtpEmailType.d.ts +7 -6
- package/dist/features/smtp_email/smtpEmailType.js.map +1 -1
- package/dist/features/user_me/userMeRegistry.js +0 -18
- package/dist/features/user_me/userMeRegistry.js.map +1 -1
- package/dist/features/user_me/userMeType.d.ts +4 -3
- package/dist/features/user_me/userMeType.js.map +1 -1
- package/dist/middlewares/route/index.d.ts +1 -0
- package/dist/middlewares/route/index.js +7 -2
- package/dist/middlewares/route/index.js.map +1 -1
- package/dist/middlewares/route/validateSchedulerLog.d.ts +5 -0
- package/dist/middlewares/route/validateSchedulerLog.js +20 -0
- package/dist/middlewares/route/validateSchedulerLog.js.map +1 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/models/index.js +4 -1
- package/dist/models/index.js.map +1 -1
- package/dist/models/scheduler/SchedulerLogModel.d.ts +371 -0
- package/dist/models/scheduler/SchedulerLogModel.js +13 -0
- package/dist/models/scheduler/SchedulerLogModel.js.map +1 -0
- package/dist/routes/index.d.ts +1 -0
- package/dist/routes/index.js +3 -1
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/scheduler/schedulerLogRoutes.d.ts +2 -0
- package/dist/routes/scheduler/schedulerLogRoutes.js +13 -0
- package/dist/routes/scheduler/schedulerLogRoutes.js.map +1 -0
- package/dist/routes/scheduler/schedulerLogsRoutes.d.ts +2 -0
- package/dist/routes/scheduler/schedulerLogsRoutes.js +13 -0
- package/dist/routes/scheduler/schedulerLogsRoutes.js.map +1 -0
- package/dist/routes/scheduler/schedulersRoutes.d.ts +2 -0
- package/dist/routes/scheduler/schedulersRoutes.js +12 -0
- package/dist/routes/scheduler/schedulersRoutes.js.map +1 -0
- package/dist/schema/middleware/route/index.d.ts +2 -0
- package/dist/schema/middleware/route/index.js +3 -1
- package/dist/schema/middleware/route/index.js.map +1 -1
- package/dist/schema/middleware/route/schemaSchedulerLog.d.ts +4 -0
- package/dist/schema/middleware/route/schemaSchedulerLog.js +10 -0
- package/dist/schema/middleware/route/schemaSchedulerLog.js.map +1 -0
- package/dist/schema/payload/index.d.ts +2 -0
- package/dist/schema/payload/index.js +4 -1
- package/dist/schema/payload/index.js.map +1 -1
- package/dist/schema/payload/scheduler/schemaSchedulerLog.d.ts +267 -0
- package/dist/schema/payload/scheduler/schemaSchedulerLog.js +48 -0
- package/dist/schema/payload/scheduler/schemaSchedulerLog.js.map +1 -0
- package/dist/services/access_control/AccessControlService.js +2 -2
- package/dist/services/access_control/AccessControlService.js.map +1 -1
- package/dist/services/auth/AuthService.js +14 -2
- package/dist/services/auth/AuthService.js.map +1 -1
- package/dist/services/file/FileService.js +56 -50
- package/dist/services/file/FileService.js.map +1 -1
- package/dist/services/gateway/SmtpEmailService.js +12 -6
- package/dist/services/gateway/SmtpEmailService.js.map +1 -1
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +4 -1
- package/dist/services/index.js.map +1 -1
- package/dist/services/reset_password/ResetPasswordService.js +18 -12
- package/dist/services/reset_password/ResetPasswordService.js.map +1 -1
- package/dist/services/scheduler/SchedulerLogService.d.ts +101 -0
- package/dist/services/scheduler/SchedulerLogService.js +146 -0
- package/dist/services/scheduler/SchedulerLogService.js.map +1 -0
- package/dist/services/user/UserMeService.js +12 -3
- package/dist/services/user/UserMeService.js.map +1 -1
- package/dist/utils/featureUtils.d.ts +5 -0
- package/dist/utils/featureUtils.js +3 -0
- package/dist/utils/featureUtils.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/serviceUtils.d.ts +2 -18
- package/dist/utils/serviceUtils.js +0 -1
- package/dist/utils/serviceUtils.js.map +1 -1
- package/package.json +1 -1
- package/prisma/schema.prisma +30 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;AAAA,2DAAoE;AAA3D,0GAAA,WAAW,OAAA;AAAE,wGAAA,SAAS,OAAA;AAE/B,2EAA8G;AAArG,oHAAA,gBAAgB,OAAA;AAAE,sHAAA,kBAAkB,OAAA;AAAE,mHAAA,eAAe,OAAA;AAE9D,uFAAqF;AAA5E,4HAAA,oBAAoB,OAAA;AAE7B,uFAA2G;AAAlG,4HAAA,oBAAoB,OAAA;AAAE,4HAAA,oBAAoB,OAAA;AAEnD,oEAAkE;AAAzD,gHAAA,cAAc,OAAA;AAEvB,uEAAqE;AAA5D,kHAAA,eAAe,OAAA;AAGxB,0FAAyI;AAAhI,4HAAA,oBAAoB,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAAE,kIAAA,0BAA0B,OAAA;AAE9E,mGAAiG;AAAxF,kIAAA,uBAAuB,OAAA;AAGhC,2DAAyF;AAAhF,0GAAA,WAAW,OAAA;AAAE,wGAAA,SAAS,OAAA;AAAE,kHAAA,mBAAmB,OAAA;AAGpD,+DAA6D;AAApD,8GAAA,aAAa,OAAA;AAGtB,sGAAsG;AACtG,qNAAqN;AACrN,uFAAuF;AACvF,kLAAkL;AAElL,yEAAwF;AAA/E,sHAAA,iBAAiB,OAAA;AAAE,oHAAA,eAAe,OAAA;AAE3C,iEAA+D;AAAtD,8GAAA,aAAa,OAAA;AAEtB,uEAAqE;AAA5D,kHAAA,eAAe,OAAA;AAExB,2DAAoE;AAA3D,0GAAA,WAAW,OAAA;AAAE,wGAAA,SAAS,OAAA;AAE/B,2DAAyD;AAAhD,0GAAA,WAAW,OAAA;AAEpB,uEAAqE;AAA5D,kHAAA,eAAe,OAAA;AAExB,0FAAsI;AAA7H,8HAAA,qBAAqB,OAAA;AAAE,4HAAA,mBAAmB,OAAA;AAAE,gIAAA,uBAAuB,OAAA;AAE5E,yFAAuF;AAA9E,sIAAA,yBAAyB,OAAA;AAElC,kFAA8I;AAArI,wHAAA,kBAAkB,OAAA;AAAE,sHAAA,gBAAgB,OAAA;AAAE,6HAAA,uBAAuB,OAAA;AAAE,uHAAA,iBAAiB,OAAA;AAEzF,wEAAsE;AAA7D,oHAAA,gBAAgB,OAAA;AAGzB,+FAA+F;AAC/F,wIAAwI;AACxI,8EAA4E;AAAnE,4HAAA,oBAAoB,OAAA","sourcesContent":["export { AuthService, authTypes } from \"@/services/auth/AuthService\"\nexport type { AuthServiceProps, AuthType, AuthTokenResult, AuthJwtToken, AuthGetTokenProps } from \"@/services/auth/AuthService\"\nexport { AccessKeyService, accessKeyUserTypes, accessKeyStatus } from \"@/services/access_key/AccessKeyService\"\nexport type { AccessKeyServiceProps, AccessKeyStatus, AccessKeyUserType, AccessKeyCreateProps, AccessKeyRevokeProps } from \"@/services/access_key/AccessKeyService\"\nexport { AccessControlService } from \"@/services/access_control/AccessControlService\"\nexport type { AccessControlServiceProps, AccessControlScopeOrExtra, AccessControlListOptionsProps } from \"@/services/access_control/AccessControlService\"\nexport { ResetPasswordService, resetPasswordMethods } from \"@/services/reset_password/ResetPasswordService\"\nexport type { ResetPasswordServiceProps, ResetPasswordMethod, ResetPasswordRequestProps, ResetPasswordValidateCodeProps, ResetPasswordPerformProps } from \"@/services/reset_password/ResetPasswordService\"\nexport { AccountService } from \"@/services/account/AccountService\"\nexport type { AccountServiceProps, Account, AccountGetProps, AccountListProps, AccountCreateProps, AccountUpdateProps, AccountRemoveProps } from \"@/services/account/AccountService\"\nexport { BusinessService } from \"@/services/business/BusinessService\"\nexport type { BusinessServiceProps, Business, BusinessGetProps, BusinessListProps, BusinessCreateProps, BusinessUpdateProps } from \"@/services/business/BusinessService\"\n\nexport { SubscribePlanService, subscribeCurrencies, subscribePlanBillingCycles } from \"@/services/subscription/plan/SubscribePlanService\"\nexport type { SubscribePlanServiceProps, SubscribePlan, SubscribePlanBillingCycle, SubscribePlanCurrency, SubscribePlanGetProps, SubscribePlanListProps, SubscribePlanCreateProps, SubscribePlanUpdateProps } from \"@/services/subscription/plan/SubscribePlanService\"\nexport { AccountSubscribeService } from \"@/services/subscription/account/AccountSubscribeService\"\nexport type { AccountSubscribeServiceProps, AccountSubscribe, AccountSubscribeGetProps, AccountSubscribeListProps, AccountSubscribeCreateProps, AccountSubscribeCancelProps } from \"@/services/subscription/account/AccountSubscribeService\"\n\nexport { UserService, userTypes, userParentSqlSelect } from \"@/services/user/UserService\"\nexport type { UserServiceProps, UserType, UserGetProps, UserListProps, UserCreateProps, UserUpdateProps, UserRemoveProps, UserReplacePasswordProps } from \"@/services/user/UserService\"\n\nexport { UserMeService } from \"@/services/user/UserMeService\"\nexport type { UserMeServiceProps, UserMeUpdateProps, UserMeChangePasswordProps } from \"@/services/user/UserMeService\"\n\n// export { AdministratorService, administratorDataTypes } from \"@/services/user/AdministratorService\"\n// export type { AdministratorServiceProps, AdministratorGetProps, AdministratorListProps, AdministratorCreateProps, AdministratorUpdateProps, AdministratorRemoveProps } from \"@/services/user/AdministratorService\"\n// export { OperatorService, operatorDataTypes } from \"@/services/user/OperatorService\"\n// export type { OperatorServiceProps, OperatorGetProps, OperatorListProps, OperatorCreateProps, OperatorUpdateProps, OperatorRemoveProps } from \"@/services/user/OperatorService\"\n\nexport { UserBranchService, userBranchTypes } from \"@/services/branch/UserBranchService\"\nexport type { UserBranchServiceProps, UserBranchType, UserBranchGetProps, UserBranchListProps, UserBranchCreateProps, UserBranchUpdateProps, UserBranchRemoveProps } from \"@/services/branch/UserBranchService\"\nexport { RegionService } from \"@/services/region/RegionService\"\nexport type { RegionServiceProps, RegionType, RegionGetProps, RegionCreateProps, RegionListProps, RegionUpdateProps, RegionRemoveProps } from \"@/services/region/RegionService\"\nexport { DocumentService } from \"@/services/document/DocumentService\"\nexport type { DocumentServiceProps, DocumentType, DocumentGetProps, DocumentUpdateProps, DocumentCreateProps, DocumentListProps, DocumentRemoveProps } from \"@/services/document/DocumentService\"\nexport { ItemService, itemTypes } from \"@/services/item/ItemService\"\nexport type { ItemServiceProps, ItemType, ItemGetProps, ItemUpdateProps, ItemCreateProps, ItemListProps, ItemRemoveProps } from \"@/services/item/ItemService\"\nexport { FileService } from \"@/services/file/FileService\"\nexport type { FileImageCompressionOptions, FileVideoCompressionOptions, FileStorageProviderType, FileLocalProviderOptions, FileGoogleCloudProviderOptions, FileAwsS3ProviderOptions, FileCategoryName, FileUploadItem, FileServiceProps, FileGetProps, FileUploadProps, FileCreateProps, FileListProps, FileRemoveProps } from \"@/services/file/FileService\"\nexport { LocationService } from \"@/services/location/LocationService\"\nexport type { LocationServiceProps, LocationType, LocationGetProps, LocationUpdateProps, LocationCreateProps, LocationListProps, LocationRemoveProps } from \"@/services/location/LocationService\"\nexport { InjectionFieldService, injectionFieldTypes, injectionFieldDataTypes } from \"@/services/injection_field/InjectionFieldService\"\nexport type { InjectionFieldModuleRef, InjectionFieldServiceProps, InjectionFieldType, InjectionFieldDataType, InjectionFieldCreateProps, InjectionFieldListProps, InjectionFieldGetProps, InjectionFieldReplaceProps } from \"@/services/injection_field/InjectionFieldService\"\nexport { NumberDateSequenceService } from \"@/services/others/NumberDateSequenceService\"\nexport type { NumberDateSequenceModuleRef, NumberDateSequenceServiceProps, NumberDateSequenceInitProps, NumberDateSequenceCreateProps } from \"@/services/others/NumberDateSequenceService\"\nexport { OneTimeCodeService, oneTimeCodeTypes, oneTimeCodePurposeTypes, oneTimeCodeStatus } from \"@/services/one_time_code/OneTimeCodeService\"\nexport type { OneTimeCodeModuleRef, OneTimeCodeType, OneTimeCodePurposeType, OneTimeCodeStatus, OneTimeCodeServiceProps, OneTimeCodeCreateProps } from \"@/services/one_time_code/OneTimeCodeService\"\nexport { SmtpEmailService } from \"@/services/gateway/SmtpEmailService\"\nexport type { SmtpEmailServiceProps, SmtpEmailSendProps, SmtpEmailTransporterOptions } from \"@/services/gateway/SmtpEmailService\"\n\n// export { ChangePasswordUtilService } from \"@/services/utils/unuse/ChangePasswordUtilService\"\n// export type { ChangePasswordUtilServiceProps, ChangePasswordUtilChangeProps } from \"@/services/utils/unuse/ChangePasswordUtilService\"\nexport { AccessKeyUtilService } from \"@/services/utils/AccessKeyUtilService\"\nexport type { AccessKeyUtilServiceProps, AccessKeyUtilValidateProps, AccessKeyUtilAccountOwnerProps } from \"@/services/utils/AccessKeyUtilService\""]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;AAAA,2DAAoE;AAA3D,0GAAA,WAAW,OAAA;AAAE,wGAAA,SAAS,OAAA;AAE/B,2EAA8G;AAArG,oHAAA,gBAAgB,OAAA;AAAE,sHAAA,kBAAkB,OAAA;AAAE,mHAAA,eAAe,OAAA;AAE9D,uFAAqF;AAA5E,4HAAA,oBAAoB,OAAA;AAE7B,uFAA2G;AAAlG,4HAAA,oBAAoB,OAAA;AAAE,4HAAA,oBAAoB,OAAA;AAEnD,oEAAkE;AAAzD,gHAAA,cAAc,OAAA;AAEvB,uEAAqE;AAA5D,kHAAA,eAAe,OAAA;AAGxB,0FAAyI;AAAhI,4HAAA,oBAAoB,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAAE,kIAAA,0BAA0B,OAAA;AAE9E,mGAAiG;AAAxF,kIAAA,uBAAuB,OAAA;AAGhC,2DAAyF;AAAhF,0GAAA,WAAW,OAAA;AAAE,wGAAA,SAAS,OAAA;AAAE,kHAAA,mBAAmB,OAAA;AAGpD,+DAA6D;AAApD,8GAAA,aAAa,OAAA;AAGtB,sGAAsG;AACtG,qNAAqN;AACrN,uFAAuF;AACvF,kLAAkL;AAElL,yEAAwF;AAA/E,sHAAA,iBAAiB,OAAA;AAAE,oHAAA,eAAe,OAAA;AAE3C,iEAA+D;AAAtD,8GAAA,aAAa,OAAA;AAEtB,uEAAqE;AAA5D,kHAAA,eAAe,OAAA;AAExB,2DAAoE;AAA3D,0GAAA,WAAW,OAAA;AAAE,wGAAA,SAAS,OAAA;AAE/B,2DAAyD;AAAhD,0GAAA,WAAW,OAAA;AAEpB,uEAAqE;AAA5D,kHAAA,eAAe,OAAA;AAExB,0FAAsI;AAA7H,8HAAA,qBAAqB,OAAA;AAAE,4HAAA,mBAAmB,OAAA;AAAE,gIAAA,uBAAuB,OAAA;AAE5E,yFAAuF;AAA9E,sIAAA,yBAAyB,OAAA;AAElC,kFAA8I;AAArI,wHAAA,kBAAkB,OAAA;AAAE,sHAAA,gBAAgB,OAAA;AAAE,6HAAA,uBAAuB,OAAA;AAAE,uHAAA,iBAAiB,OAAA;AAEzF,wEAAsE;AAA7D,oHAAA,gBAAgB,OAAA;AAGzB,gFAAiG;AAAxF,0HAAA,mBAAmB,OAAA;AAAE,wHAAA,iBAAiB,OAAA;AAG/C,+FAA+F;AAC/F,wIAAwI;AACxI,8EAA4E;AAAnE,4HAAA,oBAAoB,OAAA","sourcesContent":["export { AuthService, authTypes } from \"@/services/auth/AuthService\"\nexport type { AuthServiceProps, AuthType, AuthTokenResult, AuthJwtToken, AuthGetTokenProps } from \"@/services/auth/AuthService\"\nexport { AccessKeyService, accessKeyUserTypes, accessKeyStatus } from \"@/services/access_key/AccessKeyService\"\nexport type { AccessKeyServiceProps, AccessKeyStatus, AccessKeyUserType, AccessKeyCreateProps, AccessKeyRevokeProps } from \"@/services/access_key/AccessKeyService\"\nexport { AccessControlService } from \"@/services/access_control/AccessControlService\"\nexport type { AccessControlServiceProps, AccessControlScopeOrExtra, AccessControlListOptionsProps } from \"@/services/access_control/AccessControlService\"\nexport { ResetPasswordService, resetPasswordMethods } from \"@/services/reset_password/ResetPasswordService\"\nexport type { ResetPasswordServiceProps, ResetPasswordMethod, ResetPasswordRequestProps, ResetPasswordValidateCodeProps, ResetPasswordPerformProps } from \"@/services/reset_password/ResetPasswordService\"\nexport { AccountService } from \"@/services/account/AccountService\"\nexport type { AccountServiceProps, Account, AccountGetProps, AccountListProps, AccountCreateProps, AccountUpdateProps, AccountRemoveProps } from \"@/services/account/AccountService\"\nexport { BusinessService } from \"@/services/business/BusinessService\"\nexport type { BusinessServiceProps, Business, BusinessGetProps, BusinessListProps, BusinessCreateProps, BusinessUpdateProps } from \"@/services/business/BusinessService\"\n\nexport { SubscribePlanService, subscribeCurrencies, subscribePlanBillingCycles } from \"@/services/subscription/plan/SubscribePlanService\"\nexport type { SubscribePlanServiceProps, SubscribePlan, SubscribePlanBillingCycle, SubscribePlanCurrency, SubscribePlanGetProps, SubscribePlanListProps, SubscribePlanCreateProps, SubscribePlanUpdateProps } from \"@/services/subscription/plan/SubscribePlanService\"\nexport { AccountSubscribeService } from \"@/services/subscription/account/AccountSubscribeService\"\nexport type { AccountSubscribeServiceProps, AccountSubscribe, AccountSubscribeGetProps, AccountSubscribeListProps, AccountSubscribeCreateProps, AccountSubscribeCancelProps } from \"@/services/subscription/account/AccountSubscribeService\"\n\nexport { UserService, userTypes, userParentSqlSelect } from \"@/services/user/UserService\"\nexport type { UserServiceProps, UserType, UserGetProps, UserListProps, UserCreateProps, UserUpdateProps, UserRemoveProps, UserReplacePasswordProps } from \"@/services/user/UserService\"\n\nexport { UserMeService } from \"@/services/user/UserMeService\"\nexport type { UserMeServiceProps, UserMeUpdateProps, UserMeChangePasswordProps } from \"@/services/user/UserMeService\"\n\n// export { AdministratorService, administratorDataTypes } from \"@/services/user/AdministratorService\"\n// export type { AdministratorServiceProps, AdministratorGetProps, AdministratorListProps, AdministratorCreateProps, AdministratorUpdateProps, AdministratorRemoveProps } from \"@/services/user/AdministratorService\"\n// export { OperatorService, operatorDataTypes } from \"@/services/user/OperatorService\"\n// export type { OperatorServiceProps, OperatorGetProps, OperatorListProps, OperatorCreateProps, OperatorUpdateProps, OperatorRemoveProps } from \"@/services/user/OperatorService\"\n\nexport { UserBranchService, userBranchTypes } from \"@/services/branch/UserBranchService\"\nexport type { UserBranchServiceProps, UserBranchType, UserBranchGetProps, UserBranchListProps, UserBranchCreateProps, UserBranchUpdateProps, UserBranchRemoveProps } from \"@/services/branch/UserBranchService\"\nexport { RegionService } from \"@/services/region/RegionService\"\nexport type { RegionServiceProps, RegionType, RegionGetProps, RegionCreateProps, RegionListProps, RegionUpdateProps, RegionRemoveProps } from \"@/services/region/RegionService\"\nexport { DocumentService } from \"@/services/document/DocumentService\"\nexport type { DocumentServiceProps, DocumentType, DocumentGetProps, DocumentUpdateProps, DocumentCreateProps, DocumentListProps, DocumentRemoveProps } from \"@/services/document/DocumentService\"\nexport { ItemService, itemTypes } from \"@/services/item/ItemService\"\nexport type { ItemServiceProps, ItemType, ItemGetProps, ItemUpdateProps, ItemCreateProps, ItemListProps, ItemRemoveProps } from \"@/services/item/ItemService\"\nexport { FileService } from \"@/services/file/FileService\"\nexport type { FileImageCompressionOptions, FileVideoCompressionOptions, FileStorageProviderType, FileLocalProviderOptions, FileGoogleCloudProviderOptions, FileAwsS3ProviderOptions, FileCategoryName, FileUploadItem, FileServiceProps, FileGetProps, FileUploadProps, FileCreateProps, FileListProps, FileRemoveProps } from \"@/services/file/FileService\"\nexport { LocationService } from \"@/services/location/LocationService\"\nexport type { LocationServiceProps, LocationType, LocationGetProps, LocationUpdateProps, LocationCreateProps, LocationListProps, LocationRemoveProps } from \"@/services/location/LocationService\"\nexport { InjectionFieldService, injectionFieldTypes, injectionFieldDataTypes } from \"@/services/injection_field/InjectionFieldService\"\nexport type { InjectionFieldModuleRef, InjectionFieldServiceProps, InjectionFieldType, InjectionFieldDataType, InjectionFieldCreateProps, InjectionFieldListProps, InjectionFieldGetProps, InjectionFieldReplaceProps } from \"@/services/injection_field/InjectionFieldService\"\nexport { NumberDateSequenceService } from \"@/services/others/NumberDateSequenceService\"\nexport type { NumberDateSequenceModuleRef, NumberDateSequenceServiceProps, NumberDateSequenceInitProps, NumberDateSequenceCreateProps } from \"@/services/others/NumberDateSequenceService\"\nexport { OneTimeCodeService, oneTimeCodeTypes, oneTimeCodePurposeTypes, oneTimeCodeStatus } from \"@/services/one_time_code/OneTimeCodeService\"\nexport type { OneTimeCodeModuleRef, OneTimeCodeType, OneTimeCodePurposeType, OneTimeCodeStatus, OneTimeCodeServiceProps, OneTimeCodeCreateProps } from \"@/services/one_time_code/OneTimeCodeService\"\nexport { SmtpEmailService } from \"@/services/gateway/SmtpEmailService\"\nexport type { SmtpEmailServiceProps, SmtpEmailSendProps, SmtpEmailTransporterOptions } from \"@/services/gateway/SmtpEmailService\"\n\nexport { SchedulerLogService, schedulerLogTypes } from \"@/services/scheduler/SchedulerLogService\"\nexport type { SchedulerLogServiceProps, SchedulerLogFlowType, SchedulerLogModuleRef, SchedulerLogRemoveProps, SchedulerLogCreateProps, SchedulerLogListProps, SchedulerLogGetProps } from \"@/services/scheduler/SchedulerLogService\"\n\n// export { ChangePasswordUtilService } from \"@/services/utils/unuse/ChangePasswordUtilService\"\n// export type { ChangePasswordUtilServiceProps, ChangePasswordUtilChangeProps } from \"@/services/utils/unuse/ChangePasswordUtilService\"\nexport { AccessKeyUtilService } from \"@/services/utils/AccessKeyUtilService\"\nexport type { AccessKeyUtilServiceProps, AccessKeyUtilValidateProps, AccessKeyUtilAccountOwnerProps } from \"@/services/utils/AccessKeyUtilService\""]}
|
|
@@ -249,13 +249,16 @@ const ResetPasswordService = (props) => {
|
|
|
249
249
|
// Call the consumer hook, if registered
|
|
250
250
|
if (features_1.ResetPasswordHook.onRequest) {
|
|
251
251
|
const responseCustomHook = await features_1.ResetPasswordHook.onRequest({
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
252
|
+
defaultServiceProps: rest,
|
|
253
|
+
callbackParams: {
|
|
254
|
+
userId,
|
|
255
|
+
userType,
|
|
256
|
+
resetPasswordMethod,
|
|
257
|
+
emailAddress,
|
|
258
|
+
mobileNumber,
|
|
259
|
+
oneTimeCode: oneTimeCode?.code ?? "",
|
|
260
|
+
user
|
|
261
|
+
}
|
|
259
262
|
});
|
|
260
263
|
responseOneTimeCode = { ...responseOneTimeCode, custom: responseCustomHook };
|
|
261
264
|
}
|
|
@@ -413,11 +416,14 @@ const ResetPasswordService = (props) => {
|
|
|
413
416
|
// Call the consumer hook, if registered
|
|
414
417
|
if (features_1.ResetPasswordHook.onSuccess) {
|
|
415
418
|
const responseCustomHook = await features_1.ResetPasswordHook.onSuccess({
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
419
|
+
defaultServiceProps: rest,
|
|
420
|
+
callbackParams: {
|
|
421
|
+
userId,
|
|
422
|
+
userType,
|
|
423
|
+
resetPasswordMethod,
|
|
424
|
+
oneTimeCode,
|
|
425
|
+
user
|
|
426
|
+
}
|
|
421
427
|
});
|
|
422
428
|
responseOnSuccess = { ...responseOnSuccess, custom: responseCustomHook };
|
|
423
429
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResetPasswordService.js","sourceRoot":"","sources":["../../../src/services/reset_password/ResetPasswordService.ts"],"names":[],"mappings":";;;AAAA,mCAAkH;AAElH,yDAAyD;AAEzD,oIAAoI;AAEpI,mCAAgC;AAEhC,qCAAuF;AACvF,yCAAmL;AAEnL,yCAA8C;AAEjC,QAAA,oBAAoB,GAAG;IAChC,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,UAAU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,SAAS,EAAE,MAAM;YACjB,YAAY,EAAE,QAAQ;YACtB,IAAI,EAAE;gBACF,WAAW;gBACX,WAAW,EAAE,gBAAgB;gBAC7B,MAAM;gBACN,QAAQ;aACX;SACJ,CAAC,CAAA;QAEF,2BAA2B;QAC3B,IAAI,iBAAiB,GAAG,MAAM,WAAW,CAAC,eAAe,CAAC;YACtD,EAAE,EAAE,MAAM;YACV,IAAI,EAAE;gBACF,mBAAmB,EAAE,WAAW;aACnC;YACD,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC;SAClC,CAAC,CAAA;QAEF,wCAAwC;QACxC,IAAI,4BAAiB,CAAC,SAAS,EAAE,CAAC;YAE9B,MAAM,kBAAkB,GAAG,MAAM,4BAAiB,CAAC,SAAS,CAAC;gBACzD,MAAM;gBACN,QAAQ;gBACR,mBAAmB;gBACnB,WAAW;gBACX,IAAI;aACP,CAAC,CAAA;YAEF,iBAAiB,GAAG,EAAE,GAAG,iBAAiB,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAA;QAE5E,CAAC;QAED,OAAO;YACH,GAAG,iBAAiB;YACpB,kBAAkB,EAAE,eAAe;SACtC,CAAA;IACL,CAAC,CAAA;IAED,OAAO;QACH,oBAAoB;QACpB,yBAAyB;QACzB,oBAAoB;KACvB,CAAA;AAEL,CAAC,CAAA;AAthBY,QAAA,oBAAoB,wBAshBhC","sourcesContent":["import { DefaultServiceProps, validateFormatEmailAddress, validateFormatMobileNumber, throwError } from \"@/utils\";\n\n// import { QueryList, QueryGet } from \"@/schema/common\";\n\n// import { buildSqlRelation, buildSqlRawSelect, buildSqlWhere, buildSqlSelect, buildSqlLimitOffset, buildSqlOrderBy } from \"@/lib\";\n\nimport { dayjs } from \"@/utils\";\n\nimport { ModelAccountFields, ModelOneTimeCodeFields, ModelUserFields } from \"@/models\";\nimport { UserService, AccountService, OneTimeCodeService, OneTimeCodeType, OneTimeCodeCreateProps, oneTimeCodeStatus, oneTimeCodePurposeTypes, AccountListProps } from \"@/services\"\n\nimport { ResetPasswordHook } from \"@/features\"\n\nexport const resetPasswordMethods = {\n email: \"email\",\n sms: \"sms\",\n whatapps: \"whatapps\",\n} as const\n\nexport type ResetPasswordMethod = typeof resetPasswordMethods[keyof typeof resetPasswordMethods]\n\nexport type ResetPasswordServiceProps = DefaultServiceProps & {\n};\n\ntype defaultResetPasswordProps = {\n isOperator: boolean\n accountId: string\n accountCode: string\n}\n\nexport type ResetPasswordRequestProps = {\n data: defaultResetPasswordProps & {\n emailAddress?: string\n mobileNumber?: string\n }\n}\n\nexport type ResetPasswordValidateCodeProps = {\n data: defaultResetPasswordProps & {\n oneTimeCode: string\n }\n}\n\nexport type ResetPasswordPerformProps = {\n data: defaultResetPasswordProps & {\n oneTimeCode: string\n newPassword: string\n }\n}\n\nexport const ResetPasswordService = (props: ResetPasswordServiceProps) => {\n\n const {\n ...rest\n } = props\n\n const globalAccountService = AccountService({ ...rest, isOperator: true })\n\n const validateAccount = async ({ accountId, accountCode }: {\n accountId: string,\n accountCode: string\n }) => {\n\n if (!accountId && !accountCode) {\n throwError(`AccountId or AccountCode is required`)\n }\n\n let filters: AccountListProps[\"filters\"] = []\n\n if (accountId !== \"\") {\n filters = [{\n field: `${ModelAccountFields.account_id}`,\n operator: \"=\",\n value: `${accountId}`\n }]\n }\n\n if (accountCode !== \"\") {\n filters = [{\n field: `${ModelAccountFields.account_code}`,\n operator: \"=\",\n value: `${accountCode}`\n }]\n }\n\n const { data: dataAccounts } = await globalAccountService.listAccounts({\n limit: 1,\n offset: 0,\n filters,\n sortfield: `${ModelAccountFields.account_id}`,\n sortorder: \"ASC\",\n datatypes: []\n })\n\n const dataAccount = dataAccounts.length > 0 ? dataAccounts[0] : {}\n\n if (!dataAccount?.account_id) {\n throwError(`Unable to retrieve account`)\n }\n\n return {\n accountId: dataAccount?.account_id ?? \"\",\n accountCode: dataAccount?.account_code ?? \"\"\n }\n\n }\n\n // get the user by email (non operator)\n const getUserByEmailNonOperator = async (\n accountId: ResetPasswordRequestProps[\"data\"][\"accountId\"],\n emailAddress: ResetPasswordRequestProps[\"data\"][\"emailAddress\"]\n ) => {\n\n const globalUserService = UserService({\n ...rest,\n accountId: Number(accountId), // need to override the account id,\n isOperator: false,\n userType: \"administrator\"\n })\n\n // get the user by email\n let { data: dataUser } = await globalUserService.listUsers({\n limit: 1,\n offset: 0,\n filters: [\n {\n field: `${ModelUserFields.email}`,\n operator: \"=\",\n value: `${emailAddress}`\n }\n ],\n sortfield: `${ModelUserFields.user_id}`,\n sortorder: \"ASC\",\n includePassword: false,\n skipFilterUserType: true,\n datatypes: []\n })\n\n return dataUser.length > 0 ? dataUser[0] : {}\n }\n\n // get the user by email (operator)\n const getUserByEmailOperator = async (\n emailAddress: ResetPasswordRequestProps[\"data\"][\"emailAddress\"]\n ) => {\n\n const globalUserService = UserService({\n ...rest,\n accountId: 0, // not important\n isOperator: true,\n userType: \"operator\"\n })\n\n // get the user by email\n let { data: dataUser } = await globalUserService.listUsers({\n limit: 1,\n offset: 0,\n filters: [\n {\n field: `${ModelUserFields.email}`,\n operator: \"=\",\n value: `${emailAddress}`\n },\n {\n field: `${ModelUserFields.user_type}`,\n operator: \"=\",\n value: `operator`\n }\n ],\n sortfield: `${ModelUserFields.user_id}`,\n sortorder: \"ASC\",\n includePassword: false,\n // skipFilterUserType: true,\n datatypes: []\n })\n\n return dataUser.length > 0 ? dataUser[0] : {}\n }\n\n // get the user by mobile (non operator)\n const getUserByMobileNonOperator = async (\n accountId: ResetPasswordRequestProps[\"data\"][\"accountId\"],\n mobileNumber: ResetPasswordRequestProps[\"data\"][\"mobileNumber\"]\n ) => {\n\n const globalUserService = UserService({\n ...rest,\n accountId: Number(accountId), // need to override the account id,\n isOperator: false,\n userType: \"administrator\"\n })\n\n // get the user by contact\n let { data: dataUser } = await globalUserService.listUsers({\n limit: 1,\n offset: 0,\n filters: [\n {\n field: `contact`,\n operator: \"=\",\n value: `${mobileNumber}`\n }\n ],\n sortfield: `${ModelUserFields.user_id}`,\n sortorder: \"ASC\",\n includePassword: false,\n skipFilterUserType: true,\n datatypes: []\n })\n\n return dataUser.length > 0 ? dataUser[0] : {}\n\n }\n\n // get the user by mobile (operator)\n const getUserByMobileOperator = async (\n mobileNumber: ResetPasswordRequestProps[\"data\"][\"mobileNumber\"]\n ) => {\n\n const globalUserService = UserService({\n ...rest,\n accountId: 0, // not important\n isOperator: true,\n userType: \"operator\"\n })\n\n // get the user by contact\n let { data: dataUser } = await globalUserService.listUsers({\n limit: 1,\n offset: 0,\n filters: [\n {\n field: `contact`,\n operator: \"=\",\n value: `${mobileNumber}`\n },\n {\n field: `${ModelUserFields.user_type}`,\n operator: \"=\",\n value: `operator`\n }\n ],\n sortfield: `${ModelUserFields.user_id}`,\n sortorder: \"ASC\",\n includePassword: false,\n skipFilterUserType: true,\n datatypes: []\n })\n\n return dataUser.length > 0 ? dataUser[0] : {}\n\n }\n\n const requestResetPassword = async ({ data }: ResetPasswordRequestProps) => {\n\n const isOperator = Boolean(data.isOperator) // check if reset password for operator user or other users(account related)\n const accountId = data.accountId ?? \"\"\n const accountCode = data.accountCode ?? \"\"\n\n let validatedAccountId = ``\n\n // only non operator will check the account\n if (isOperator === false) {\n let acc = await validateAccount({ accountCode, accountId })\n validatedAccountId = acc.accountId\n }\n\n // get the onSetup from hook\n const hookSetup = ResetPasswordHook.onSetup()\n\n const codeType: OneTimeCodeType = hookSetup.oneTimeCodeType\n const resetPasswordMethod: ResetPasswordMethod = hookSetup.resetPasswordMethod\n const emailAddress = data?.emailAddress ?? \"\"\n const mobileNumber = data?.mobileNumber ?? \"\"\n\n let user: any = {}\n\n const oneTimeCodeService = OneTimeCodeService({\n ...rest,\n accountId: isOperator ? 0 : Number(validatedAccountId),\n isOperator,\n field_ref: \"user\",\n field_module: \"administrator\"\n })\n\n if (!resetPasswordMethod) {\n throw new Error(`Invalid reset password method: ${hookSetup?.resetPasswordMethod ?? \"\"}`);\n }\n\n if (resetPasswordMethod === \"email\") {\n if (validateFormatEmailAddress(emailAddress) === false) {\n throw new Error(`Invalid email address: ${emailAddress}`);\n }\n\n // get the user by email\n user = isOperator ?\n await getUserByEmailOperator(emailAddress)\n :\n await getUserByEmailNonOperator(validatedAccountId, emailAddress)\n\n }\n\n if (resetPasswordMethod === \"sms\" || resetPasswordMethod === \"whatapps\") {\n if (validateFormatMobileNumber(mobileNumber) === false) {\n throw new Error(`Invalid mobile number: ${mobileNumber}`);\n }\n\n // get the user by email\n user = isOperator ?\n await getUserByMobileOperator(mobileNumber)\n :\n await getUserByMobileNonOperator(validatedAccountId, mobileNumber)\n\n }\n\n if (emailAddress === \"\" && mobileNumber === \"\") {\n throw new Error(`Either email address or mobile number is required`);\n }\n\n // verify the user\n if (!user?.user_id) {\n throw new Error(`Cannot find the user by ${resetPasswordMethod}: ${emailAddress ? emailAddress : mobileNumber}`);\n }\n\n // verify the user active\n if (Boolean(user?.status) === false) {\n throw new Error(`User is invalid status: ${user?.user_id ?? 0}`);\n }\n\n const userId = Number(user?.user_id ?? 0)\n const userType = user?.user_type ?? \"\"\n\n const codePayload: OneTimeCodeCreateProps = {\n field_ref: \"user\",\n field_module: userType,\n data: {\n purposeType: \"reset_password\",\n codeType,\n emailAddress,\n mobileNumber,\n userId,\n userType\n }\n }\n\n // generate the code \n const oneTimeCode = await oneTimeCodeService.createOneTimeCode(codePayload)\n\n // console.log('oneTimeCode', oneTimeCode)\n\n let responseOneTimeCode = await oneTimeCodeService.getOneTimeCode({ id: Number(oneTimeCode?.one_time_code_id ?? 0), datatypes: [] })\n\n // Call the consumer hook, if registered\n if (ResetPasswordHook.onRequest) {\n\n const responseCustomHook = await ResetPasswordHook.onRequest({\n userId,\n userType,\n resetPasswordMethod,\n emailAddress,\n mobileNumber,\n oneTimeCode: oneTimeCode?.code ?? \"\",\n user\n })\n\n responseOneTimeCode = { ...responseOneTimeCode, custom: responseCustomHook }\n\n }\n\n return responseOneTimeCode\n }\n\n const validateResetPasscodeCode = async ({ data }: ResetPasswordValidateCodeProps) => {\n\n const isOperator = Boolean(data.isOperator) // check if reset password for operator user or other users(account related)\n const accountId = data.accountId ?? \"\"\n const accountCode = data.accountCode ?? \"\"\n\n let validatedAccountId = ``\n\n // only non operator will check the account\n if (isOperator === false) {\n let acc = await validateAccount({ accountCode, accountId })\n validatedAccountId = acc.accountId\n }\n\n const oneTimeCode = data.oneTimeCode ?? \"\"\n\n if (!oneTimeCode) {\n throw new Error(`Reset passcode code cannot be empty`);\n }\n\n const oneTimeCodeService = OneTimeCodeService({\n ...rest,\n accountId: isOperator ? 0 : Number(validatedAccountId),\n isOperator,\n field_ref: \"user\",\n field_module: \"administrator\"\n })\n\n // check code exist\n const { data: existOneTimeCodes } = await oneTimeCodeService.listOneTimeCodes({\n limit: 1,\n offset: 0,\n filters: [\n {\n field: `${ModelOneTimeCodeFields.code}`,\n operator: \"=\",\n value: `${oneTimeCode}`\n },\n {\n field: `${ModelOneTimeCodeFields.purpose_type}`,\n operator: \"=\",\n value: `${oneTimeCodePurposeTypes.reset_password}`\n },\n ],\n sortfield: `${ModelOneTimeCodeFields.one_time_code_id}`,\n sortorder: \"ASC\",\n datatypes: [],\n revealCode: true // return the code as well\n })\n\n if (existOneTimeCodes.length <= 0) {\n throw new Error(`Invalid reset password code: ${oneTimeCode}`);\n }\n\n const existOneTimeCode = existOneTimeCodes[0]\n\n // check is not used before\n if (existOneTimeCode?.code_status !== oneTimeCodeStatus.active) {\n throw new Error(`Reset password code is not active/used: ${oneTimeCode}`);\n }\n\n const expiresAt = dayjs(existOneTimeCode?.expires_at)\n const codeIsExpired = dayjs().isAfter(expiresAt)\n\n // check code is expired\n if (codeIsExpired) {\n throw new Error(`Reset password code is expired: ${oneTimeCode}`);\n }\n\n // console.log('existOneTimeCode', existOneTimeCode)\n\n return existOneTimeCode\n }\n\n const performResetPassword = async ({ data }: ResetPasswordPerformProps) => {\n\n const isOperator = Boolean(data.isOperator) // check if reset password for operator user or other users(account related)\n const accountId = data.accountId ?? \"\"\n const accountCode = data.accountCode ?? \"\"\n\n let validatedAccountId = ``\n let validatedAccountCode = ``\n\n // only non operator will check the account\n if (isOperator === false) {\n let acc = await validateAccount({ accountCode, accountId })\n validatedAccountId = acc.accountId\n validatedAccountCode = acc.accountCode\n }\n\n // get the onSetup from hook\n const hookSetup = ResetPasswordHook.onSetup()\n\n // const codeType: OneTimeCodeType = hookSetup.oneTimeCodeType\n const resetPasswordMethod: ResetPasswordMethod = hookSetup.resetPasswordMethod\n const oneTimeCode = data?.oneTimeCode ?? \"\"\n const newPassword = data?.newPassword ?? \"\"\n\n if (!oneTimeCode) {\n throw new Error(`One Time Code is required`);\n }\n\n if (!newPassword) {\n throw new Error(`New password is required`);\n }\n\n const oneTimeCodeService = OneTimeCodeService({\n ...rest,\n accountId: isOperator ? 0 : Number(validatedAccountId),\n isOperator,\n field_ref: \"user\",\n field_module: \"administrator\"\n })\n\n\n // validate the one time code\n const validateOneTimeCode = await validateResetPasscodeCode({\n data: {\n isOperator,\n accountCode: validatedAccountCode,\n accountId: `${validatedAccountId}`,\n oneTimeCode\n }\n })\n\n // retrieve the user by the one time code\n const oneTimeCodeUserId = validateOneTimeCode?.user_id ?? \"\"\n const oneTimeCodeUserType = validateOneTimeCode?.user_type ?? \"\"\n\n if (!oneTimeCodeUserId) {\n throw new Error(`Invalid one time code userId: ${oneTimeCode}`);\n }\n\n if (!oneTimeCodeUserType) {\n throw new Error(`Invalid one time code userId Type: ${oneTimeCode}`);\n }\n\n // retrive the user information\n const userService = UserService({\n ...rest,\n isOperator: true, // skip the account id\n accountId: Number(validatedAccountId),\n userType: oneTimeCodeUserType\n })\n\n const user = await userService.getUser({\n id: Number(oneTimeCodeUserId),\n datatypes: [],\n skipFilterUserType: true,\n })\n\n // verify the user\n if (!user?.user_id) {\n throw new Error(`Cannot find the userId: ${Number(oneTimeCodeUserId)}`);\n }\n\n // verify the user active\n if (Boolean(user?.status) === false) {\n throw new Error(`User is invalid status: ${user?.user_id ?? 0}`);\n }\n\n const userId = Number(user?.user_id ?? 0)\n const userType = user?.user_type ?? \"\"\n\n // consume the one time code\n let responseConsume = await oneTimeCodeService.consumeOneTimeCode({\n field_ref: \"user\",\n field_module: userType,\n data: {\n oneTimeCode,\n purposeType: \"reset_password\",\n userId,\n userType\n }\n })\n\n // change password for user\n let responseOnSuccess = await userService.replacePassword({\n id: userId,\n data: {\n unhashLoginPassword: newPassword\n },\n isOperator: Boolean(isOperator)\n })\n\n // Call the consumer hook, if registered\n if (ResetPasswordHook.onSuccess) {\n\n const responseCustomHook = await ResetPasswordHook.onSuccess({\n userId,\n userType,\n resetPasswordMethod,\n oneTimeCode,\n user\n })\n\n responseOnSuccess = { ...responseOnSuccess, custom: responseCustomHook }\n\n }\n\n return {\n ...responseOnSuccess,\n consumeOneTimeCode: responseConsume\n }\n }\n\n return {\n requestResetPassword,\n validateResetPasscodeCode,\n performResetPassword\n }\n\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"ResetPasswordService.js","sourceRoot":"","sources":["../../../src/services/reset_password/ResetPasswordService.ts"],"names":[],"mappings":";;;AAAA,mCAAkH;AAElH,yDAAyD;AAEzD,oIAAoI;AAEpI,mCAAgC;AAEhC,qCAAuF;AACvF,yCAAmL;AAEnL,yCAA8C;AAEjC,QAAA,oBAAoB,GAAG;IAChC,KAAK,EAAE,OAAO;IACd,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,UAAU;CACd,CAAA;AAiCH,MAAM,oBAAoB,GAAG,CAAC,KAAgC,EAAE,EAAE;IAErE,MAAM,EACF,GAAG,IAAI,EACV,GAAG,KAAK,CAAA;IAET,MAAM,oBAAoB,GAAG,IAAA,yBAAc,EAAC,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IAE1E,MAAM,eAAe,GAAG,KAAK,EAAE,EAAE,SAAS,EAAE,WAAW,EAGtD,EAAE,EAAE;QAED,IAAI,CAAC,SAAS,IAAI,CAAC,WAAW,EAAE,CAAC;YAC7B,IAAA,kBAAU,EAAC,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AAU,CAAC;SAClC,CAAC,CAAA;QAEF,wCAAwC;QACxC,IAAI,4BAAiB,CAAC,SAAS,EAAE,CAAC;YAE9B,MAAM,kBAAkB,GAAG,MAAM,4BAAiB,CAAC,SAAS,CAAC;gBACzD,mBAAmB,EAAE,IAAI;gBACzB,cAAc,EAAE;oBACZ,MAAM;oBACN,QAAQ;oBACR,mBAAmB;oBACnB,WAAW;oBACX,IAAI;iBACP;aACJ,CAAC,CAAA;YAEF,iBAAiB,GAAG,EAAE,GAAG,iBAAiB,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAA;QAE5E,CAAC;QAED,OAAO;YACH,GAAG,iBAAiB;YACpB,kBAAkB,EAAE,eAAe;SACtC,CAAA;IACL,CAAC,CAAA;IAED,OAAO;QACH,oBAAoB;QACpB,yBAAyB;QACzB,oBAAoB;KACvB,CAAA;AAEL,CAAC,CAAA;AA5hBY,QAAA,oBAAoB,wBA4hBhC","sourcesContent":["import { DefaultServiceProps, validateFormatEmailAddress, validateFormatMobileNumber, throwError } from \"@/utils\";\n\n// import { QueryList, QueryGet } from \"@/schema/common\";\n\n// import { buildSqlRelation, buildSqlRawSelect, buildSqlWhere, buildSqlSelect, buildSqlLimitOffset, buildSqlOrderBy } from \"@/lib\";\n\nimport { dayjs } from \"@/utils\";\n\nimport { ModelAccountFields, ModelOneTimeCodeFields, ModelUserFields } from \"@/models\";\nimport { UserService, AccountService, OneTimeCodeService, OneTimeCodeType, OneTimeCodeCreateProps, oneTimeCodeStatus, oneTimeCodePurposeTypes, AccountListProps } from \"@/services\"\n\nimport { ResetPasswordHook } from \"@/features\"\n\nexport const resetPasswordMethods = {\n email: \"email\",\n sms: \"sms\",\n whatapps: \"whatapps\",\n} as const\n\nexport type ResetPasswordMethod = typeof resetPasswordMethods[keyof typeof resetPasswordMethods]\n\nexport type ResetPasswordServiceProps = DefaultServiceProps & {\n};\n\ntype defaultResetPasswordProps = {\n isOperator: boolean\n accountId: string\n accountCode: string\n}\n\nexport type ResetPasswordRequestProps = {\n data: defaultResetPasswordProps & {\n emailAddress?: string\n mobileNumber?: string\n }\n}\n\nexport type ResetPasswordValidateCodeProps = {\n data: defaultResetPasswordProps & {\n oneTimeCode: string\n }\n}\n\nexport type ResetPasswordPerformProps = {\n data: defaultResetPasswordProps & {\n oneTimeCode: string\n newPassword: string\n }\n}\n\nexport const ResetPasswordService = (props: ResetPasswordServiceProps) => {\n\n const {\n ...rest\n } = props\n\n const globalAccountService = AccountService({ ...rest, isOperator: true })\n\n const validateAccount = async ({ accountId, accountCode }: {\n accountId: string,\n accountCode: string\n }) => {\n\n if (!accountId && !accountCode) {\n throwError(`AccountId or AccountCode is required`)\n }\n\n let filters: AccountListProps[\"filters\"] = []\n\n if (accountId !== \"\") {\n filters = [{\n field: `${ModelAccountFields.account_id}`,\n operator: \"=\",\n value: `${accountId}`\n }]\n }\n\n if (accountCode !== \"\") {\n filters = [{\n field: `${ModelAccountFields.account_code}`,\n operator: \"=\",\n value: `${accountCode}`\n }]\n }\n\n const { data: dataAccounts } = await globalAccountService.listAccounts({\n limit: 1,\n offset: 0,\n filters,\n sortfield: `${ModelAccountFields.account_id}`,\n sortorder: \"ASC\",\n datatypes: []\n })\n\n const dataAccount = dataAccounts.length > 0 ? dataAccounts[0] : {}\n\n if (!dataAccount?.account_id) {\n throwError(`Unable to retrieve account`)\n }\n\n return {\n accountId: dataAccount?.account_id ?? \"\",\n accountCode: dataAccount?.account_code ?? \"\"\n }\n\n }\n\n // get the user by email (non operator)\n const getUserByEmailNonOperator = async (\n accountId: ResetPasswordRequestProps[\"data\"][\"accountId\"],\n emailAddress: ResetPasswordRequestProps[\"data\"][\"emailAddress\"]\n ) => {\n\n const globalUserService = UserService({\n ...rest,\n accountId: Number(accountId), // need to override the account id,\n isOperator: false,\n userType: \"administrator\"\n })\n\n // get the user by email\n let { data: dataUser } = await globalUserService.listUsers({\n limit: 1,\n offset: 0,\n filters: [\n {\n field: `${ModelUserFields.email}`,\n operator: \"=\",\n value: `${emailAddress}`\n }\n ],\n sortfield: `${ModelUserFields.user_id}`,\n sortorder: \"ASC\",\n includePassword: false,\n skipFilterUserType: true,\n datatypes: []\n })\n\n return dataUser.length > 0 ? dataUser[0] : {}\n }\n\n // get the user by email (operator)\n const getUserByEmailOperator = async (\n emailAddress: ResetPasswordRequestProps[\"data\"][\"emailAddress\"]\n ) => {\n\n const globalUserService = UserService({\n ...rest,\n accountId: 0, // not important\n isOperator: true,\n userType: \"operator\"\n })\n\n // get the user by email\n let { data: dataUser } = await globalUserService.listUsers({\n limit: 1,\n offset: 0,\n filters: [\n {\n field: `${ModelUserFields.email}`,\n operator: \"=\",\n value: `${emailAddress}`\n },\n {\n field: `${ModelUserFields.user_type}`,\n operator: \"=\",\n value: `operator`\n }\n ],\n sortfield: `${ModelUserFields.user_id}`,\n sortorder: \"ASC\",\n includePassword: false,\n // skipFilterUserType: true,\n datatypes: []\n })\n\n return dataUser.length > 0 ? dataUser[0] : {}\n }\n\n // get the user by mobile (non operator)\n const getUserByMobileNonOperator = async (\n accountId: ResetPasswordRequestProps[\"data\"][\"accountId\"],\n mobileNumber: ResetPasswordRequestProps[\"data\"][\"mobileNumber\"]\n ) => {\n\n const globalUserService = UserService({\n ...rest,\n accountId: Number(accountId), // need to override the account id,\n isOperator: false,\n userType: \"administrator\"\n })\n\n // get the user by contact\n let { data: dataUser } = await globalUserService.listUsers({\n limit: 1,\n offset: 0,\n filters: [\n {\n field: `contact`,\n operator: \"=\",\n value: `${mobileNumber}`\n }\n ],\n sortfield: `${ModelUserFields.user_id}`,\n sortorder: \"ASC\",\n includePassword: false,\n skipFilterUserType: true,\n datatypes: []\n })\n\n return dataUser.length > 0 ? dataUser[0] : {}\n\n }\n\n // get the user by mobile (operator)\n const getUserByMobileOperator = async (\n mobileNumber: ResetPasswordRequestProps[\"data\"][\"mobileNumber\"]\n ) => {\n\n const globalUserService = UserService({\n ...rest,\n accountId: 0, // not important\n isOperator: true,\n userType: \"operator\"\n })\n\n // get the user by contact\n let { data: dataUser } = await globalUserService.listUsers({\n limit: 1,\n offset: 0,\n filters: [\n {\n field: `contact`,\n operator: \"=\",\n value: `${mobileNumber}`\n },\n {\n field: `${ModelUserFields.user_type}`,\n operator: \"=\",\n value: `operator`\n }\n ],\n sortfield: `${ModelUserFields.user_id}`,\n sortorder: \"ASC\",\n includePassword: false,\n skipFilterUserType: true,\n datatypes: []\n })\n\n return dataUser.length > 0 ? dataUser[0] : {}\n\n }\n\n const requestResetPassword = async ({ data }: ResetPasswordRequestProps) => {\n\n const isOperator = Boolean(data.isOperator) // check if reset password for operator user or other users(account related)\n const accountId = data.accountId ?? \"\"\n const accountCode = data.accountCode ?? \"\"\n\n let validatedAccountId = ``\n\n // only non operator will check the account\n if (isOperator === false) {\n let acc = await validateAccount({ accountCode, accountId })\n validatedAccountId = acc.accountId\n }\n\n // get the onSetup from hook\n const hookSetup = ResetPasswordHook.onSetup()\n\n const codeType: OneTimeCodeType = hookSetup.oneTimeCodeType\n const resetPasswordMethod: ResetPasswordMethod = hookSetup.resetPasswordMethod\n const emailAddress = data?.emailAddress ?? \"\"\n const mobileNumber = data?.mobileNumber ?? \"\"\n\n let user: any = {}\n\n const oneTimeCodeService = OneTimeCodeService({\n ...rest,\n accountId: isOperator ? 0 : Number(validatedAccountId),\n isOperator,\n field_ref: \"user\",\n field_module: \"administrator\"\n })\n\n if (!resetPasswordMethod) {\n throw new Error(`Invalid reset password method: ${hookSetup?.resetPasswordMethod ?? \"\"}`);\n }\n\n if (resetPasswordMethod === \"email\") {\n if (validateFormatEmailAddress(emailAddress) === false) {\n throw new Error(`Invalid email address: ${emailAddress}`);\n }\n\n // get the user by email\n user = isOperator ?\n await getUserByEmailOperator(emailAddress)\n :\n await getUserByEmailNonOperator(validatedAccountId, emailAddress)\n\n }\n\n if (resetPasswordMethod === \"sms\" || resetPasswordMethod === \"whatapps\") {\n if (validateFormatMobileNumber(mobileNumber) === false) {\n throw new Error(`Invalid mobile number: ${mobileNumber}`);\n }\n\n // get the user by email\n user = isOperator ?\n await getUserByMobileOperator(mobileNumber)\n :\n await getUserByMobileNonOperator(validatedAccountId, mobileNumber)\n\n }\n\n if (emailAddress === \"\" && mobileNumber === \"\") {\n throw new Error(`Either email address or mobile number is required`);\n }\n\n // verify the user\n if (!user?.user_id) {\n throw new Error(`Cannot find the user by ${resetPasswordMethod}: ${emailAddress ? emailAddress : mobileNumber}`);\n }\n\n // verify the user active\n if (Boolean(user?.status) === false) {\n throw new Error(`User is invalid status: ${user?.user_id ?? 0}`);\n }\n\n const userId = Number(user?.user_id ?? 0)\n const userType = user?.user_type ?? \"\"\n\n const codePayload: OneTimeCodeCreateProps = {\n field_ref: \"user\",\n field_module: userType,\n data: {\n purposeType: \"reset_password\",\n codeType,\n emailAddress,\n mobileNumber,\n userId,\n userType\n }\n }\n\n // generate the code \n const oneTimeCode = await oneTimeCodeService.createOneTimeCode(codePayload)\n\n // console.log('oneTimeCode', oneTimeCode)\n\n let responseOneTimeCode = await oneTimeCodeService.getOneTimeCode({ id: Number(oneTimeCode?.one_time_code_id ?? 0), datatypes: [] })\n\n // Call the consumer hook, if registered\n if (ResetPasswordHook.onRequest) {\n\n const responseCustomHook = await ResetPasswordHook.onRequest({\n defaultServiceProps: rest,\n callbackParams: {\n userId,\n userType,\n resetPasswordMethod,\n emailAddress,\n mobileNumber,\n oneTimeCode: oneTimeCode?.code ?? \"\",\n user\n }\n })\n\n responseOneTimeCode = { ...responseOneTimeCode, custom: responseCustomHook }\n\n }\n\n return responseOneTimeCode\n }\n\n const validateResetPasscodeCode = async ({ data }: ResetPasswordValidateCodeProps) => {\n\n const isOperator = Boolean(data.isOperator) // check if reset password for operator user or other users(account related)\n const accountId = data.accountId ?? \"\"\n const accountCode = data.accountCode ?? \"\"\n\n let validatedAccountId = ``\n\n // only non operator will check the account\n if (isOperator === false) {\n let acc = await validateAccount({ accountCode, accountId })\n validatedAccountId = acc.accountId\n }\n\n const oneTimeCode = data.oneTimeCode ?? \"\"\n\n if (!oneTimeCode) {\n throw new Error(`Reset passcode code cannot be empty`);\n }\n\n const oneTimeCodeService = OneTimeCodeService({\n ...rest,\n accountId: isOperator ? 0 : Number(validatedAccountId),\n isOperator,\n field_ref: \"user\",\n field_module: \"administrator\"\n })\n\n // check code exist\n const { data: existOneTimeCodes } = await oneTimeCodeService.listOneTimeCodes({\n limit: 1,\n offset: 0,\n filters: [\n {\n field: `${ModelOneTimeCodeFields.code}`,\n operator: \"=\",\n value: `${oneTimeCode}`\n },\n {\n field: `${ModelOneTimeCodeFields.purpose_type}`,\n operator: \"=\",\n value: `${oneTimeCodePurposeTypes.reset_password}`\n },\n ],\n sortfield: `${ModelOneTimeCodeFields.one_time_code_id}`,\n sortorder: \"ASC\",\n datatypes: [],\n revealCode: true // return the code as well\n })\n\n if (existOneTimeCodes.length <= 0) {\n throw new Error(`Invalid reset password code: ${oneTimeCode}`);\n }\n\n const existOneTimeCode = existOneTimeCodes[0]\n\n // check is not used before\n if (existOneTimeCode?.code_status !== oneTimeCodeStatus.active) {\n throw new Error(`Reset password code is not active/used: ${oneTimeCode}`);\n }\n\n const expiresAt = dayjs(existOneTimeCode?.expires_at)\n const codeIsExpired = dayjs().isAfter(expiresAt)\n\n // check code is expired\n if (codeIsExpired) {\n throw new Error(`Reset password code is expired: ${oneTimeCode}`);\n }\n\n // console.log('existOneTimeCode', existOneTimeCode)\n\n return existOneTimeCode\n }\n\n const performResetPassword = async ({ data }: ResetPasswordPerformProps) => {\n\n const isOperator = Boolean(data.isOperator) // check if reset password for operator user or other users(account related)\n const accountId = data.accountId ?? \"\"\n const accountCode = data.accountCode ?? \"\"\n\n let validatedAccountId = ``\n let validatedAccountCode = ``\n\n // only non operator will check the account\n if (isOperator === false) {\n let acc = await validateAccount({ accountCode, accountId })\n validatedAccountId = acc.accountId\n validatedAccountCode = acc.accountCode\n }\n\n // get the onSetup from hook\n const hookSetup = ResetPasswordHook.onSetup()\n\n // const codeType: OneTimeCodeType = hookSetup.oneTimeCodeType\n const resetPasswordMethod: ResetPasswordMethod = hookSetup.resetPasswordMethod\n const oneTimeCode = data?.oneTimeCode ?? \"\"\n const newPassword = data?.newPassword ?? \"\"\n\n if (!oneTimeCode) {\n throw new Error(`One Time Code is required`);\n }\n\n if (!newPassword) {\n throw new Error(`New password is required`);\n }\n\n const oneTimeCodeService = OneTimeCodeService({\n ...rest,\n accountId: isOperator ? 0 : Number(validatedAccountId),\n isOperator,\n field_ref: \"user\",\n field_module: \"administrator\"\n })\n\n\n // validate the one time code\n const validateOneTimeCode = await validateResetPasscodeCode({\n data: {\n isOperator,\n accountCode: validatedAccountCode,\n accountId: `${validatedAccountId}`,\n oneTimeCode\n }\n })\n\n // retrieve the user by the one time code\n const oneTimeCodeUserId = validateOneTimeCode?.user_id ?? \"\"\n const oneTimeCodeUserType = validateOneTimeCode?.user_type ?? \"\"\n\n if (!oneTimeCodeUserId) {\n throw new Error(`Invalid one time code userId: ${oneTimeCode}`);\n }\n\n if (!oneTimeCodeUserType) {\n throw new Error(`Invalid one time code userId Type: ${oneTimeCode}`);\n }\n\n // retrive the user information\n const userService = UserService({\n ...rest,\n isOperator: true, // skip the account id\n accountId: Number(validatedAccountId),\n userType: oneTimeCodeUserType\n })\n\n const user = await userService.getUser({\n id: Number(oneTimeCodeUserId),\n datatypes: [],\n skipFilterUserType: true,\n })\n\n // verify the user\n if (!user?.user_id) {\n throw new Error(`Cannot find the userId: ${Number(oneTimeCodeUserId)}`);\n }\n\n // verify the user active\n if (Boolean(user?.status) === false) {\n throw new Error(`User is invalid status: ${user?.user_id ?? 0}`);\n }\n\n const userId = Number(user?.user_id ?? 0)\n const userType = user?.user_type ?? \"\"\n\n // consume the one time code\n let responseConsume = await oneTimeCodeService.consumeOneTimeCode({\n field_ref: \"user\",\n field_module: userType,\n data: {\n oneTimeCode,\n purposeType: \"reset_password\",\n userId,\n userType\n }\n })\n\n // change password for user\n let responseOnSuccess = await userService.replacePassword({\n id: userId,\n data: {\n unhashLoginPassword: newPassword\n },\n isOperator: Boolean(isOperator)\n })\n\n // Call the consumer hook, if registered\n if (ResetPasswordHook.onSuccess) {\n\n const responseCustomHook = await ResetPasswordHook.onSuccess({\n defaultServiceProps: rest,\n callbackParams: {\n userId,\n userType,\n resetPasswordMethod,\n oneTimeCode,\n user\n }\n })\n\n responseOnSuccess = { ...responseOnSuccess, custom: responseCustomHook }\n\n }\n\n return {\n ...responseOnSuccess,\n consumeOneTimeCode: responseConsume\n }\n }\n\n return {\n requestResetPassword,\n validateResetPasscodeCode,\n performResetPassword\n }\n\n}\n\n"]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { QueryList, QueryGet } from "../../schema/common";
|
|
2
|
+
import { DefaultServiceProps } from "../../utils";
|
|
3
|
+
import { InjectionFieldModuleRef } from "../../services";
|
|
4
|
+
export type SchedulerLogModuleRef = InjectionFieldModuleRef;
|
|
5
|
+
export type SchedulerLogServiceProps = DefaultServiceProps & {};
|
|
6
|
+
export type SchedulerLogGetProps = Omit<QueryGet, "datatypes"> & {
|
|
7
|
+
id: number;
|
|
8
|
+
};
|
|
9
|
+
export type SchedulerLogListProps = Omit<QueryList, "datatypes"> & {};
|
|
10
|
+
export type SchedulerLogRemoveProps = {
|
|
11
|
+
schedulerLogIds: BigInt[];
|
|
12
|
+
};
|
|
13
|
+
export declare const schedulerLogTypes: {
|
|
14
|
+
in: string;
|
|
15
|
+
out: string;
|
|
16
|
+
};
|
|
17
|
+
export type SchedulerLogFlowType = keyof typeof schedulerLogTypes;
|
|
18
|
+
export type SchedulerLog = {
|
|
19
|
+
schedulerTaskId: number;
|
|
20
|
+
flowType: SchedulerLogFlowType;
|
|
21
|
+
sourceType: string;
|
|
22
|
+
sourceEntityId: string;
|
|
23
|
+
sourceEntityLabel: string;
|
|
24
|
+
sourceEntityData: string;
|
|
25
|
+
destinationType: string;
|
|
26
|
+
destinationEntityId: string;
|
|
27
|
+
destinationEntityLabel: string;
|
|
28
|
+
destinationSubmitPayload: string;
|
|
29
|
+
destinationSubmitResponse: string;
|
|
30
|
+
logAction: string;
|
|
31
|
+
logLabel: string;
|
|
32
|
+
logStatus: boolean;
|
|
33
|
+
logMesssage: string;
|
|
34
|
+
};
|
|
35
|
+
export type SchedulerLogCreateProps = {
|
|
36
|
+
data: SchedulerLog & {
|
|
37
|
+
fieldRef: SchedulerLogModuleRef["field_ref"];
|
|
38
|
+
fieldModule: SchedulerLogModuleRef["field_module"];
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export declare const SchedulerLogService: (props: SchedulerLogServiceProps) => {
|
|
42
|
+
getSchedulerLog: ({ id }: SchedulerLogGetProps) => Promise<any>;
|
|
43
|
+
createSchedulerLog: ({ data }: SchedulerLogCreateProps) => Promise<{
|
|
44
|
+
createdatetime: Date | null;
|
|
45
|
+
createuserid: bigint;
|
|
46
|
+
updatedatetime: Date | null;
|
|
47
|
+
updateuserid: bigint;
|
|
48
|
+
isdelete: boolean | null;
|
|
49
|
+
istrash: boolean | null;
|
|
50
|
+
accountid: bigint;
|
|
51
|
+
field_ref: string;
|
|
52
|
+
field_module: string;
|
|
53
|
+
scheduler_log_id: bigint;
|
|
54
|
+
scheduler_task_id: bigint;
|
|
55
|
+
flow_type: string;
|
|
56
|
+
log_action: string;
|
|
57
|
+
log_label: string;
|
|
58
|
+
log_status: boolean | null;
|
|
59
|
+
log_message: string | null;
|
|
60
|
+
source_type: string | null;
|
|
61
|
+
source_entity_id: string | null;
|
|
62
|
+
source_entity_label: string | null;
|
|
63
|
+
source_entity_data: string | null;
|
|
64
|
+
destination_type: string | null;
|
|
65
|
+
destination_entity_id: string | null;
|
|
66
|
+
destination_entity_label: string | null;
|
|
67
|
+
destination_submit_payload: string | null;
|
|
68
|
+
destination_submit_response: string | null;
|
|
69
|
+
}>;
|
|
70
|
+
removeSchedulerLoges: ({ schedulerLogIds }: SchedulerLogRemoveProps) => Promise<{
|
|
71
|
+
createdatetime: Date | null;
|
|
72
|
+
createuserid: bigint;
|
|
73
|
+
updatedatetime: Date | null;
|
|
74
|
+
updateuserid: bigint;
|
|
75
|
+
isdelete: boolean | null;
|
|
76
|
+
istrash: boolean | null;
|
|
77
|
+
accountid: bigint;
|
|
78
|
+
field_ref: string;
|
|
79
|
+
field_module: string;
|
|
80
|
+
scheduler_log_id: bigint;
|
|
81
|
+
scheduler_task_id: bigint;
|
|
82
|
+
flow_type: string;
|
|
83
|
+
log_action: string;
|
|
84
|
+
log_label: string;
|
|
85
|
+
log_status: boolean | null;
|
|
86
|
+
log_message: string | null;
|
|
87
|
+
source_type: string | null;
|
|
88
|
+
source_entity_id: string | null;
|
|
89
|
+
source_entity_label: string | null;
|
|
90
|
+
source_entity_data: string | null;
|
|
91
|
+
destination_type: string | null;
|
|
92
|
+
destination_entity_id: string | null;
|
|
93
|
+
destination_entity_label: string | null;
|
|
94
|
+
destination_submit_payload: string | null;
|
|
95
|
+
destination_submit_response: string | null;
|
|
96
|
+
}[]>;
|
|
97
|
+
listSchedulerLoges: ({ limit, offset, filters, sortfield, sortorder }: SchedulerLogListProps) => Promise<{
|
|
98
|
+
data: any[];
|
|
99
|
+
total: number;
|
|
100
|
+
}>;
|
|
101
|
+
};
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SchedulerLogService = exports.schedulerLogTypes = void 0;
|
|
4
|
+
const utils_1 = require("../../utils");
|
|
5
|
+
const models_1 = require("../../models");
|
|
6
|
+
const lib_1 = require("../../lib");
|
|
7
|
+
exports.schedulerLogTypes = {
|
|
8
|
+
in: "in",
|
|
9
|
+
out: "out"
|
|
10
|
+
};
|
|
11
|
+
const getCreatePayload = (data) => {
|
|
12
|
+
return {
|
|
13
|
+
[`${models_1.ModelSchedulerLogFields.scheduler_task_id}`]: Number(data.schedulerTaskId),
|
|
14
|
+
[`${models_1.ModelSchedulerLogFields.flow_type}`]: data.flowType,
|
|
15
|
+
[`${models_1.ModelSchedulerLogFields.log_action}`]: data.logAction,
|
|
16
|
+
[`${models_1.ModelSchedulerLogFields.field_module}`]: data.fieldRef,
|
|
17
|
+
[`${models_1.ModelSchedulerLogFields.field_ref}`]: data.fieldModule,
|
|
18
|
+
[`${models_1.ModelSchedulerLogFields.source_type}`]: data.sourceType,
|
|
19
|
+
[`${models_1.ModelSchedulerLogFields.source_entity_id}`]: data.sourceEntityId,
|
|
20
|
+
[`${models_1.ModelSchedulerLogFields.source_entity_label}`]: data.sourceEntityLabel,
|
|
21
|
+
[`${models_1.ModelSchedulerLogFields.source_entity_data}`]: data.sourceEntityData,
|
|
22
|
+
[`${models_1.ModelSchedulerLogFields.destination_type}`]: data.destinationType,
|
|
23
|
+
[`${models_1.ModelSchedulerLogFields.destination_entity_id}`]: data.destinationEntityId,
|
|
24
|
+
[`${models_1.ModelSchedulerLogFields.destination_entity_label}`]: data.destinationEntityLabel,
|
|
25
|
+
[`${models_1.ModelSchedulerLogFields.destination_submit_payload}`]: data.destinationSubmitPayload,
|
|
26
|
+
[`${models_1.ModelSchedulerLogFields.destination_submit_response}`]: data.destinationSubmitResponse,
|
|
27
|
+
[`${models_1.ModelSchedulerLogFields.log_label}`]: data.logLabel,
|
|
28
|
+
[`${models_1.ModelSchedulerLogFields.log_message}`]: data.logMesssage,
|
|
29
|
+
[`${models_1.ModelSchedulerLogFields.log_status}`]: Boolean(data.logStatus),
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
let mainSqlSelect = {
|
|
33
|
+
[`slog.${models_1.ModelSchedulerLogFields.scheduler_log_id}`]: "scheduler_log_id",
|
|
34
|
+
[`slog.${models_1.ModelSchedulerLogFields.scheduler_task_id}`]: "scheduler_task_id",
|
|
35
|
+
[`slog.${models_1.ModelSchedulerLogFields.field_module}`]: "field_module",
|
|
36
|
+
[`slog.${models_1.ModelSchedulerLogFields.field_ref}`]: "field_ref",
|
|
37
|
+
[`slog.${models_1.ModelSchedulerLogFields.flow_type}`]: "flow_type",
|
|
38
|
+
[`slog.${models_1.ModelSchedulerLogFields.destination_type}`]: "destination_type",
|
|
39
|
+
[`slog.${models_1.ModelSchedulerLogFields.destination_entity_id}`]: "destination_entity_id",
|
|
40
|
+
[`slog.${models_1.ModelSchedulerLogFields.destination_entity_label}`]: "destination_entity_label",
|
|
41
|
+
[`slog.${models_1.ModelSchedulerLogFields.destination_submit_payload}`]: "destination_submit_payload",
|
|
42
|
+
[`slog.${models_1.ModelSchedulerLogFields.destination_submit_response}`]: "destination_submit_response",
|
|
43
|
+
[`slog.${models_1.ModelSchedulerLogFields.source_type}`]: "source_type",
|
|
44
|
+
[`slog.${models_1.ModelSchedulerLogFields.source_entity_id}`]: "source_entity_id",
|
|
45
|
+
[`slog.${models_1.ModelSchedulerLogFields.source_entity_label}`]: "source_entity_label",
|
|
46
|
+
[`slog.${models_1.ModelSchedulerLogFields.source_entity_data}`]: "source_entity_data",
|
|
47
|
+
[`slog.${models_1.ModelSchedulerLogFields.log_action}`]: "log_action",
|
|
48
|
+
[`slog.${models_1.ModelSchedulerLogFields.log_label}`]: "log_label",
|
|
49
|
+
[`slog.${models_1.ModelSchedulerLogFields.log_message}`]: "log_message",
|
|
50
|
+
[`slog.${models_1.ModelSchedulerLogFields.log_status}`]: "log_status",
|
|
51
|
+
};
|
|
52
|
+
let defaultSqlSelect = {
|
|
53
|
+
[`slog.${models_1.ModelSchedulerLogFields.createdatetime}`]: "createdatetime",
|
|
54
|
+
[`creator.${models_1.ModelUserFields.login_username}`]: "createusername",
|
|
55
|
+
[`slog.${models_1.ModelSchedulerLogFields.updatedatetime}`]: "updatedatetime",
|
|
56
|
+
[`updater.${models_1.ModelUserFields.login_username}`]: "updateusername",
|
|
57
|
+
[`slog.${models_1.ModelSchedulerLogFields.isdelete}`]: "isdelete",
|
|
58
|
+
[`slog.${models_1.ModelSchedulerLogFields.istrash}`]: "istrash",
|
|
59
|
+
[`slog.${models_1.ModelSchedulerLogFields.accountid}`]: "accountid",
|
|
60
|
+
};
|
|
61
|
+
const SchedulerLogService = (props) => {
|
|
62
|
+
const { ...rest } = props;
|
|
63
|
+
const schedulerLogModel = (0, models_1.SchedulerLogModel)({ ...rest });
|
|
64
|
+
const createSchedulerLog = async ({ data }) => {
|
|
65
|
+
const _data = getCreatePayload(data);
|
|
66
|
+
if (!_data) {
|
|
67
|
+
throw new Error(`Invalid create scheduler log payload: ${JSON.stringify(_data)}`);
|
|
68
|
+
}
|
|
69
|
+
let response = await schedulerLogModel.create({ data: _data });
|
|
70
|
+
return response;
|
|
71
|
+
};
|
|
72
|
+
const getSchedulerLog = async ({ id }) => {
|
|
73
|
+
let { data } = await listSchedulerLoges({
|
|
74
|
+
limit: 1,
|
|
75
|
+
offset: 0,
|
|
76
|
+
filters: [{ field: `${models_1.ModelSchedulerLogFields.scheduler_log_id}`, operator: "=", value: id }],
|
|
77
|
+
sortfield: `${models_1.ModelSchedulerLogFields.scheduler_log_id}`,
|
|
78
|
+
sortorder: "ASC",
|
|
79
|
+
});
|
|
80
|
+
return data[0] ?? null;
|
|
81
|
+
};
|
|
82
|
+
const listSchedulerLoges = async ({ limit, offset, filters = [], sortfield, sortorder }) => {
|
|
83
|
+
let data = [];
|
|
84
|
+
let sqlSelect = [
|
|
85
|
+
`COUNT(slog.*) OVER() as filtered_count`,
|
|
86
|
+
(0, lib_1.buildSqlSelect)(``, mainSqlSelect),
|
|
87
|
+
// buildSqlSelect(``, regionSqlSelect),
|
|
88
|
+
(0, lib_1.buildSqlSelect)(``, defaultSqlSelect)
|
|
89
|
+
];
|
|
90
|
+
let sqlRelation = [
|
|
91
|
+
// buildSqlRelation("left", "slog", "states", "slogstate", ["slog.state_id = slogstate.state_id", "slogstate.isdelete = false", "slogstate.istrash = false"]),
|
|
92
|
+
// buildSqlRelation("left", "slog", "countries", "slogcoun", ["slog.country_id = slogcoun.country_id", "slogcoun.isdelete = false", "slogcoun.istrash = false"]),
|
|
93
|
+
// buildSqlRelation("left", "slog", "areas", "slogarea", ["slog.area_id = slogarea.area_id", "slogarea.isdelete = false", "slogarea.istrash = false"]),
|
|
94
|
+
(0, lib_1.buildSqlRelation)("left", "slog", "users", "creator", ["slog.createuserid = creator.user_id", "creator.isdelete = false", "creator.istrash = false"]),
|
|
95
|
+
(0, lib_1.buildSqlRelation)("left", "slog", "users", "updater", ["slog.updateuserid = updater.user_id", "updater.isdelete = false", "updater.istrash = false"])
|
|
96
|
+
];
|
|
97
|
+
let sqlGroupBy = [
|
|
98
|
+
...Object.keys(mainSqlSelect),
|
|
99
|
+
// ...Object.keys(regionSqlSelect),
|
|
100
|
+
...Object.keys(defaultSqlSelect)
|
|
101
|
+
];
|
|
102
|
+
let filterColumns = {
|
|
103
|
+
...mainSqlSelect,
|
|
104
|
+
// ...regionSqlSelect,
|
|
105
|
+
...defaultSqlSelect
|
|
106
|
+
};
|
|
107
|
+
let sqlWhere = [
|
|
108
|
+
`slog.isdelete = false`,
|
|
109
|
+
`slog.istrash = false`,
|
|
110
|
+
...(filters.length ? [(0, lib_1.buildSqlWhere)(filters, filterColumns)?.where] : []),
|
|
111
|
+
];
|
|
112
|
+
let sqlOrderby = (0, lib_1.buildSqlOrderBy)(sortfield, sortorder);
|
|
113
|
+
let sqlLimitOffset = (0, lib_1.buildSqlLimitOffset)(limit, offset);
|
|
114
|
+
const sqlRaw = (0, lib_1.buildSqlRawSelect)({
|
|
115
|
+
tableName: "scheduler_logs",
|
|
116
|
+
mainAlias: "slog",
|
|
117
|
+
accountId: rest.accountId,
|
|
118
|
+
sqlSelect,
|
|
119
|
+
sqlRelation,
|
|
120
|
+
sqlWhere,
|
|
121
|
+
sqlGroupBy,
|
|
122
|
+
sqlOrderby,
|
|
123
|
+
sqlLimitOffset
|
|
124
|
+
});
|
|
125
|
+
data = await schedulerLogModel.raw(sqlRaw);
|
|
126
|
+
const response = {
|
|
127
|
+
data: data.map(({ filtered_count, ...rest }) => rest),
|
|
128
|
+
total: data.length ? Number(data[0].filtered_count) : 0
|
|
129
|
+
};
|
|
130
|
+
return response;
|
|
131
|
+
};
|
|
132
|
+
const removeSchedulerLoges = async ({ schedulerLogIds }) => {
|
|
133
|
+
if (!schedulerLogIds.length)
|
|
134
|
+
(0, utils_1.throwError)('schedulerLogIds is required');
|
|
135
|
+
const response = await schedulerLogModel.remove({ where: { [`${models_1.ModelSchedulerLogFields.scheduler_log_id}`]: { in: schedulerLogIds } } });
|
|
136
|
+
return response;
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
getSchedulerLog,
|
|
140
|
+
createSchedulerLog,
|
|
141
|
+
removeSchedulerLoges,
|
|
142
|
+
listSchedulerLoges
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
exports.SchedulerLogService = SchedulerLogService;
|
|
146
|
+
//# sourceMappingURL=SchedulerLogService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchedulerLogService.js","sourceRoot":"","sources":["../../../src/services/scheduler/SchedulerLogService.ts"],"names":[],"mappings":";;;AAAA,mCAA+C;AAE/C,qCAIkB;AAQlB,+BAAiI;AAiBpH,QAAA,iBAAiB,GAAG;IAC7B,EAAE,EAAE,IAAI;IACR,GAAG,EAAE,KAAK;CACb,CAAA;AAgCD,MAAM,gBAAgB,GAAG,CAAC,IAAqC,EAAE,EAAE;IAE/D,OAAO;QACH,CAAC,GAAG,gCAAuB,CAAC,iBAAiB,EAAE,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC;QAC9E,CAAC,GAAG,gCAAuB,CAAC,SAAS,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ;QACvD,CAAC,GAAG,gCAAuB,CAAC,UAAU,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS;QAEzD,CAAC,GAAG,gCAAuB,CAAC,YAAY,EAAE,CAAC,EAAE,IAAI,CAAC,QAAQ;QAC1D,CAAC,GAAG,gCAAuB,CAAC,SAAS,EAAE,CAAC,EAAE,IAAI,CAAC,WAAW;QAE1D,CAAC,GAAG,gCAAuB,CAAC,WAAW,EAAE,CAAC,E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ent":["import { logError, throwError } from \"@/utils\";\n\nimport {\n ModelUserFields,\n SchedulerLogModel,\n ModelSchedulerLogFields\n} from \"@/models\";\n\nimport { QueryList, QueryGet } from \"@/schema/common\";\n\nimport { DefaultServiceProps } from \"@/utils\";\n\nimport { InjectionFieldModuleRef } from \"@/services\"\n\nimport { buildSqlRelation, buildSqlRawSelect, buildSqlWhere, buildSqlSelect, buildSqlLimitOffset, buildSqlOrderBy } from \"@/lib\";\n\nexport type SchedulerLogModuleRef = InjectionFieldModuleRef\n\nexport type SchedulerLogServiceProps = DefaultServiceProps & {};\n\nexport type SchedulerLogGetProps = Omit<QueryGet, \"datatypes\"> & {\n id: number,\n};\n\nexport type SchedulerLogListProps = Omit<QueryList, \"datatypes\"> & {\n};\n\nexport type SchedulerLogRemoveProps = {\n schedulerLogIds: BigInt[]\n};\n\nexport const schedulerLogTypes = {\n in: \"in\",\n out: \"out\"\n}\n\nexport type SchedulerLogFlowType = keyof typeof schedulerLogTypes\n\nexport type SchedulerLog = {\n schedulerTaskId: number;\n flowType: SchedulerLogFlowType;\n\n sourceType: string;\n sourceEntityId: string;\n sourceEntityLabel: string;\n sourceEntityData: string;\n\n destinationType: string;\n destinationEntityId: string;\n destinationEntityLabel: string;\n destinationSubmitPayload: string;\n destinationSubmitResponse: string;\n\n logAction: string;\n logLabel: string;\n logStatus: boolean;\n logMesssage: string;\n}\n\nexport type SchedulerLogCreateProps = {\n data: SchedulerLog & {\n fieldRef: SchedulerLogModuleRef[\"field_ref\"],\n fieldModule: SchedulerLogModuleRef[\"field_module\"]\n }\n}\n\nconst getCreatePayload = (data: SchedulerLogCreateProps[\"data\"]) => {\n\n return {\n [`${ModelSchedulerLogFields.scheduler_task_id}`]: Number(data.schedulerTaskId),\n [`${ModelSchedulerLogFields.flow_type}`]: data.flowType,\n [`${ModelSchedulerLogFields.log_action}`]: data.logAction,\n\n [`${ModelSchedulerLogFields.field_module}`]: data.fieldRef,\n [`${ModelSchedulerLogFields.field_ref}`]: data.fieldModule,\n\n [`${ModelSchedulerLogFields.source_type}`]: data.sourceType,\n [`${ModelSchedulerLogFields.source_entity_id}`]: data.sourceEntityId,\n [`${ModelSchedulerLogFields.source_entity_label}`]: data.sourceEntityLabel,\n [`${ModelSchedulerLogFields.source_entity_data}`]: data.sourceEntityData,\n\n [`${ModelSchedulerLogFields.destination_type}`]: data.destinationType,\n [`${ModelSchedulerLogFields.destination_entity_id}`]: data.destinationEntityId,\n [`${ModelSchedulerLogFields.destination_entity_label}`]: data.destinationEntityLabel,\n [`${ModelSchedulerLogFields.destination_submit_payload}`]: data.destinationSubmitPayload,\n [`${ModelSchedulerLogFields.destination_submit_response}`]: data.destinationSubmitResponse,\n\n [`${ModelSchedulerLogFields.log_label}`]: data.logLabel,\n [`${ModelSchedulerLogFields.log_message}`]: data.logMesssage,\n [`${ModelSchedulerLogFields.log_status}`]: Boolean(data.logStatus),\n }\n\n}\n\nlet mainSqlSelect = {\n [`slog.${ModelSchedulerLogFields.scheduler_log_id}`]: \"scheduler_log_id\",\n [`slog.${ModelSchedulerLogFields.scheduler_task_id}`]: \"scheduler_task_id\",\n [`slog.${ModelSchedulerLogFields.field_module}`]: \"field_module\",\n [`slog.${ModelSchedulerLogFields.field_ref}`]: \"field_ref\",\n [`slog.${ModelSchedulerLogFields.flow_type}`]: \"flow_type\",\n [`slog.${ModelSchedulerLogFields.destination_type}`]: \"destination_type\",\n [`slog.${ModelSchedulerLogFields.destination_entity_id}`]: \"destination_entity_id\",\n [`slog.${ModelSchedulerLogFields.destination_entity_label}`]: \"destination_entity_label\",\n [`slog.${ModelSchedulerLogFields.destination_submit_payload}`]: \"destination_submit_payload\",\n [`slog.${ModelSchedulerLogFields.destination_submit_response}`]: \"destination_submit_response\",\n [`slog.${ModelSchedulerLogFields.source_type}`]: \"source_type\",\n [`slog.${ModelSchedulerLogFields.source_entity_id}`]: \"source_entity_id\",\n [`slog.${ModelSchedulerLogFields.source_entity_label}`]: \"source_entity_label\",\n [`slog.${ModelSchedulerLogFields.source_entity_data}`]: \"source_entity_data\",\n [`slog.${ModelSchedulerLogFields.log_action}`]: \"log_action\",\n [`slog.${ModelSchedulerLogFields.log_label}`]: \"log_label\",\n [`slog.${ModelSchedulerLogFields.log_message}`]: \"log_message\",\n [`slog.${ModelSchedulerLogFields.log_status}`]: \"log_status\",\n}\n\nlet defaultSqlSelect = {\n [`slog.${ModelSchedulerLogFields.createdatetime}`]: \"createdatetime\",\n [`creator.${ModelUserFields.login_username}`]: \"createusername\",\n [`slog.${ModelSchedulerLogFields.updatedatetime}`]: \"updatedatetime\",\n [`updater.${ModelUserFields.login_username}`]: \"updateusername\",\n [`slog.${ModelSchedulerLogFields.isdelete}`]: \"isdelete\",\n [`slog.${ModelSchedulerLogFields.istrash}`]: \"istrash\",\n [`slog.${ModelSchedulerLogFields.accountid}`]: \"accountid\",\n}\n\nexport const SchedulerLogService = (props: SchedulerLogServiceProps) => {\n\n const {\n ...rest\n } = props\n\n const schedulerLogModel = SchedulerLogModel({ ...rest })\n\n const createSchedulerLog = async ({ data }: SchedulerLogCreateProps) => {\n\n const _data = getCreatePayload(data)\n\n if (!_data) {\n throw new Error(`Invalid create scheduler log payload: ${JSON.stringify(_data)}`);\n }\n\n let response = await schedulerLogModel.create({ data: _data })\n\n return response\n }\n\n const getSchedulerLog = async ({ id }: SchedulerLogGetProps) => {\n\n let { data } = await listSchedulerLoges({\n limit: 1,\n offset: 0,\n filters: [{ field: `${ModelSchedulerLogFields.scheduler_log_id}`, operator: \"=\", value: id }],\n sortfield: `${ModelSchedulerLogFields.scheduler_log_id}`,\n sortorder: \"ASC\",\n })\n\n return data[0] ?? null;\n\n };\n\n const listSchedulerLoges = async ({ limit, offset, filters = [], sortfield, sortorder }: SchedulerLogListProps) => {\n\n let data = []\n\n let sqlSelect = [\n `COUNT(slog.*) OVER() as filtered_count`,\n buildSqlSelect(``, mainSqlSelect),\n // buildSqlSelect(``, regionSqlSelect),\n buildSqlSelect(``, defaultSqlSelect)\n ]\n\n let sqlRelation = [\n // buildSqlRelation(\"left\", \"slog\", \"states\", \"slogstate\", [\"slog.state_id = slogstate.state_id\", \"slogstate.isdelete = false\", \"slogstate.istrash = false\"]),\n // buildSqlRelation(\"left\", \"slog\", \"countries\", \"slogcoun\", [\"slog.country_id = slogcoun.country_id\", \"slogcoun.isdelete = false\", \"slogcoun.istrash = false\"]),\n // buildSqlRelation(\"left\", \"slog\", \"areas\", \"slogarea\", [\"slog.area_id = slogarea.area_id\", \"slogarea.isdelete = false\", \"slogarea.istrash = false\"]),\n buildSqlRelation(\"left\", \"slog\", \"users\", \"creator\", [\"slog.createuserid = creator.user_id\", \"creator.isdelete = false\", \"creator.istrash = false\"]),\n buildSqlRelation(\"left\", \"slog\", \"users\", \"updater\", [\"slog.updateuserid = updater.user_id\", \"updater.isdelete = false\", \"updater.istrash = false\"])\n ]\n\n let sqlGroupBy: string[] = [\n ...Object.keys(mainSqlSelect),\n // ...Object.keys(regionSqlSelect), \n ...Object.keys(defaultSqlSelect)\n ]\n\n let filterColumns = {\n ...mainSqlSelect,\n // ...regionSqlSelect, \n ...defaultSqlSelect\n }\n\n let sqlWhere = [\n `slog.isdelete = false`,\n `slog.istrash = false`,\n ...(filters.length ? [buildSqlWhere(filters, filterColumns)?.where] : []),\n ]\n\n let sqlOrderby = buildSqlOrderBy(sortfield, sortorder)\n let sqlLimitOffset = buildSqlLimitOffset(limit, offset)\n\n const sqlRaw = buildSqlRawSelect({\n tableName: \"scheduler_logs\",\n mainAlias: \"slog\",\n accountId: rest.accountId,\n sqlSelect,\n sqlRelation,\n sqlWhere,\n sqlGroupBy,\n sqlOrderby,\n sqlLimitOffset\n })\n\n data = await schedulerLogModel.raw(sqlRaw)\n\n const response = {\n data: data.map(({ filtered_count, ...rest }) => rest),\n total: data.length ? Number(data[0].filtered_count) : 0\n }\n\n return response\n\n };\n\n const removeSchedulerLoges = async ({ schedulerLogIds }: SchedulerLogRemoveProps) => {\n\n if (!schedulerLogIds.length) throwError('schedulerLogIds is required');\n\n const response = await schedulerLogModel.remove({ where: { [`${ModelSchedulerLogFields.scheduler_log_id}`]: { in: schedulerLogIds } } });\n\n return response\n };\n\n return {\n getSchedulerLog,\n createSchedulerLog,\n removeSchedulerLoges,\n listSchedulerLoges\n }\n\n}\n\n"]}
|
|
@@ -73,7 +73,10 @@ const UserMeService = (props) => {
|
|
|
73
73
|
// Call the consumer hook, if success
|
|
74
74
|
if (features_1.UserMeHook.onSuccessUpdateMe) {
|
|
75
75
|
await features_1.UserMeHook.onSuccessUpdateMe({
|
|
76
|
-
|
|
76
|
+
defaultServiceProps: rest,
|
|
77
|
+
callbackParams: {
|
|
78
|
+
userMe
|
|
79
|
+
}
|
|
77
80
|
});
|
|
78
81
|
}
|
|
79
82
|
return userMe;
|
|
@@ -84,7 +87,10 @@ const UserMeService = (props) => {
|
|
|
84
87
|
// Call the consumer hook, if remove
|
|
85
88
|
if (features_1.UserMeHook.onSuccessRemoveMe) {
|
|
86
89
|
await features_1.UserMeHook.onSuccessRemoveMe({
|
|
87
|
-
|
|
90
|
+
defaultServiceProps: rest,
|
|
91
|
+
callbackParams: {
|
|
92
|
+
userMe: currentMe
|
|
93
|
+
}
|
|
88
94
|
});
|
|
89
95
|
}
|
|
90
96
|
return response;
|
|
@@ -137,7 +143,10 @@ const UserMeService = (props) => {
|
|
|
137
143
|
// remove the password
|
|
138
144
|
delete user.password;
|
|
139
145
|
await features_1.UserMeHook.onSuccessChangePasswordMe({
|
|
140
|
-
|
|
146
|
+
defaultServiceProps: rest,
|
|
147
|
+
callbackParams: {
|
|
148
|
+
userMe: user
|
|
149
|
+
}
|
|
141
150
|
});
|
|
142
151
|
}
|
|
143
152
|
return responseUser;
|