@goweekdays/core 2.3.1 → 2.4.1
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/CHANGELOG.md +12 -0
- package/dist/index.d.ts +130 -7
- package/dist/index.js +2054 -731
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2049 -718
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/tsconfig.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @goweekdays/core
|
|
2
2
|
|
|
3
|
+
## 2.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 661c346: Add getAllByAppUser endpoint to member controller
|
|
8
|
+
|
|
9
|
+
## 2.4.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- ee525e1: Add plan, promo, and subscription modules
|
|
14
|
+
|
|
3
15
|
## 2.3.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -319,13 +319,13 @@ declare function useMemberRepo(): {
|
|
|
319
319
|
getById: (_id: string | ObjectId) => Promise<TMember | null>;
|
|
320
320
|
getByRole: (role: string | ObjectId) => Promise<TMember | null>;
|
|
321
321
|
getAll: ({ search, limit, page, user, org, app, status }?: {
|
|
322
|
-
search
|
|
323
|
-
limit
|
|
324
|
-
page
|
|
322
|
+
search?: string | undefined;
|
|
323
|
+
limit?: number | undefined;
|
|
324
|
+
page?: number | undefined;
|
|
325
325
|
user?: string | ObjectId | undefined;
|
|
326
326
|
org?: string | ObjectId | undefined;
|
|
327
327
|
app: string;
|
|
328
|
-
status
|
|
328
|
+
status?: string | undefined;
|
|
329
329
|
}) => Promise<Record<string, any>>;
|
|
330
330
|
getOrgsByUserId: ({ search, page, limit, sort, user, status, }?: {
|
|
331
331
|
user: string | ObjectId;
|
|
@@ -384,13 +384,14 @@ declare function useMemberController(): {
|
|
|
384
384
|
updateRoleById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
385
385
|
updateStatusById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
386
386
|
deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
387
|
+
getAllByAppUser: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
387
388
|
};
|
|
388
389
|
|
|
389
390
|
type TOrg = {
|
|
390
391
|
_id?: ObjectId;
|
|
391
392
|
name: string;
|
|
392
393
|
description?: string;
|
|
393
|
-
email
|
|
394
|
+
email: string;
|
|
394
395
|
contact?: string;
|
|
395
396
|
createdBy: string | ObjectId;
|
|
396
397
|
status?: string;
|
|
@@ -399,6 +400,8 @@ type TOrg = {
|
|
|
399
400
|
deletedAt?: string | Date;
|
|
400
401
|
};
|
|
401
402
|
declare const schemaOrg: Joi.ObjectSchema<any>;
|
|
403
|
+
declare const schemaOrgAdd: Joi.ObjectSchema<any>;
|
|
404
|
+
declare const schemaOrgUpdate: Joi.ObjectSchema<any>;
|
|
402
405
|
declare function modelOrg(value: TOrg): TOrg;
|
|
403
406
|
|
|
404
407
|
declare function useOrgRepo(): {
|
|
@@ -419,10 +422,13 @@ declare function useOrgRepo(): {
|
|
|
419
422
|
}, session?: ClientSession) => Promise<string>;
|
|
420
423
|
deleteById: (_id: string | ObjectId) => Promise<string>;
|
|
421
424
|
getByName: (name: string) => Promise<TOrg>;
|
|
425
|
+
updateById: (_id: string | ObjectId, options: Pick<TOrg, "name" | "description" | "email" | "contact">) => Promise<void>;
|
|
422
426
|
};
|
|
423
427
|
|
|
424
428
|
declare function useOrgService(): {
|
|
425
|
-
add: (value: TOrg
|
|
429
|
+
add: (value: TOrg & {
|
|
430
|
+
seats: number;
|
|
431
|
+
}) => Promise<string>;
|
|
426
432
|
};
|
|
427
433
|
|
|
428
434
|
declare function useOrgController(): {
|
|
@@ -431,6 +437,7 @@ declare function useOrgController(): {
|
|
|
431
437
|
getByName: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
432
438
|
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
433
439
|
getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
440
|
+
updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
434
441
|
};
|
|
435
442
|
|
|
436
443
|
type TPSGC = {
|
|
@@ -757,6 +764,122 @@ declare function useVerificationController(): {
|
|
|
757
764
|
forgetPassword: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
758
765
|
};
|
|
759
766
|
|
|
767
|
+
type TPlan = {
|
|
768
|
+
_id?: ObjectId;
|
|
769
|
+
name: string;
|
|
770
|
+
description?: string;
|
|
771
|
+
features?: string[];
|
|
772
|
+
price: number;
|
|
773
|
+
currency: string;
|
|
774
|
+
billingCycle: "monthly" | "yearly";
|
|
775
|
+
default?: boolean;
|
|
776
|
+
status?: "active" | "inactive";
|
|
777
|
+
createdAt?: Date | string;
|
|
778
|
+
updatedAt?: Date | string;
|
|
779
|
+
};
|
|
780
|
+
declare const currencies: string[];
|
|
781
|
+
declare const schemaPlan: Joi.ObjectSchema<any>;
|
|
782
|
+
declare function modelPlan(data: any): TPlan;
|
|
783
|
+
|
|
784
|
+
declare function usePlanRepo(): {
|
|
785
|
+
add: (value: TPlan) => Promise<string>;
|
|
786
|
+
getAll: ({ page, limit, search, status, }?: {
|
|
787
|
+
page?: number | undefined;
|
|
788
|
+
limit?: number | undefined;
|
|
789
|
+
search?: string | undefined;
|
|
790
|
+
status?: string | undefined;
|
|
791
|
+
}) => Promise<TPaginate<TPlan>>;
|
|
792
|
+
getById: (_id: string | ObjectId) => Promise<TPlan | null>;
|
|
793
|
+
getDefault: () => Promise<TPlan | null>;
|
|
794
|
+
deleteById: (_id: string | ObjectId) => Promise<string>;
|
|
795
|
+
};
|
|
796
|
+
|
|
797
|
+
declare function usePlanService(): {
|
|
798
|
+
addDefaultPlan: () => Promise<void>;
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
declare function usePlanController(): {
|
|
802
|
+
add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
803
|
+
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
804
|
+
getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
805
|
+
deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
806
|
+
getDefault: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
807
|
+
};
|
|
808
|
+
|
|
809
|
+
type TSubscription = {
|
|
810
|
+
_id?: ObjectId;
|
|
811
|
+
org: string | ObjectId;
|
|
812
|
+
seats: number;
|
|
813
|
+
paidSeats: number;
|
|
814
|
+
amount: number;
|
|
815
|
+
currency: string;
|
|
816
|
+
billingCycle: "monthly" | "yearly";
|
|
817
|
+
promoCode?: string;
|
|
818
|
+
status?: string;
|
|
819
|
+
nextBillingDate: Date | string;
|
|
820
|
+
createdAt?: Date | string;
|
|
821
|
+
updatedAt?: Date | string;
|
|
822
|
+
};
|
|
823
|
+
declare const schemaSubscription: Joi.ObjectSchema<any>;
|
|
824
|
+
declare const schemaSubscriptionUpdate: Joi.ObjectSchema<any>;
|
|
825
|
+
declare const schemaSubscriptionSeats: Joi.ObjectSchema<any>;
|
|
826
|
+
declare function modelSubscription(data: any): TSubscription;
|
|
827
|
+
|
|
828
|
+
declare function useSubscriptionRepo(): {
|
|
829
|
+
add: (value: TSubscription, session?: ClientSession) => Promise<string>;
|
|
830
|
+
getAll: ({ page, limit, search, status, }?: {
|
|
831
|
+
page?: number | undefined;
|
|
832
|
+
limit?: number | undefined;
|
|
833
|
+
search?: string | undefined;
|
|
834
|
+
status?: string | undefined;
|
|
835
|
+
}) => Promise<TPaginate<TSubscription>>;
|
|
836
|
+
getByOrg: (org: string | ObjectId) => Promise<TSubscription | null>;
|
|
837
|
+
getById: (_id: string | ObjectId) => Promise<TSubscription | null>;
|
|
838
|
+
deleteById: (_id: string | ObjectId) => Promise<string>;
|
|
839
|
+
updateById: (_id: string | ObjectId, options: {
|
|
840
|
+
seats: number;
|
|
841
|
+
paidSeats?: number;
|
|
842
|
+
amount?: number;
|
|
843
|
+
promoCode?: string;
|
|
844
|
+
}, session?: ClientSession) => Promise<string>;
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
declare function useSubscriptionController(): {
|
|
848
|
+
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
849
|
+
getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
850
|
+
getByOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
851
|
+
updateSeats: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
852
|
+
};
|
|
853
|
+
|
|
854
|
+
type TSubscriptionTransaction = {
|
|
855
|
+
_id?: ObjectId;
|
|
856
|
+
subscription: string | ObjectId;
|
|
857
|
+
amount: number;
|
|
858
|
+
currency: string;
|
|
859
|
+
type: "initiate" | "add-seat" | "remove-seat" | "renewal";
|
|
860
|
+
description?: string;
|
|
861
|
+
createdBy: string | ObjectId;
|
|
862
|
+
createdByName?: string;
|
|
863
|
+
createdAt?: Date | string;
|
|
864
|
+
updatedAt?: Date | string;
|
|
865
|
+
};
|
|
866
|
+
declare const schemaSubscriptionTransaction: Joi.ObjectSchema<any>;
|
|
867
|
+
declare function modelSubscriptionTransaction(data: TSubscriptionTransaction): TSubscriptionTransaction;
|
|
868
|
+
|
|
869
|
+
declare function useSubscriptionTransactionRepo(): {
|
|
870
|
+
add: (value: TSubscriptionTransaction, session?: ClientSession) => Promise<string>;
|
|
871
|
+
getAll: ({ page, limit, search, id }?: {
|
|
872
|
+
page?: number | undefined;
|
|
873
|
+
limit?: number | undefined;
|
|
874
|
+
search?: string | undefined;
|
|
875
|
+
id?: string | undefined;
|
|
876
|
+
}) => Promise<TPaginate<TSubscriptionTransaction>>;
|
|
877
|
+
};
|
|
878
|
+
|
|
879
|
+
declare function useSubscriptionTransactionController(): {
|
|
880
|
+
getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
881
|
+
};
|
|
882
|
+
|
|
760
883
|
type TApp = {
|
|
761
884
|
_id?: ObjectId;
|
|
762
885
|
code: string;
|
|
@@ -942,4 +1065,4 @@ declare const XENDIT_SECRET_KEY: string;
|
|
|
942
1065
|
declare const XENDIT_BASE_URL: string;
|
|
943
1066
|
declare const DOMAIN: string;
|
|
944
1067
|
|
|
945
|
-
export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MAddress, MBuilding, MBuildingUnit, MFile, MONGO_DB, MONGO_URI, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PORT, REDIS_HOST, REDIS_PASSWORD, REDIS_PORT, REFRESH_TOKEN_EXPIRY, REFRESH_TOKEN_SECRET, SECRET_KEY, SPACES_ACCESS_KEY, SPACES_BUCKET, SPACES_ENDPOINT, SPACES_REGION, SPACES_SECRET_KEY, TAddress, TApp, TBuilding, TBuildingUnit, TCounter, TFile, TMember, TOrg, TPSGC, TPermission, TPermissionGroup, TRole, TUser, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, addressSchema, isDev, modelApp, modelMember, modelOrg, modelPSGC, modelPermission, modelPermissionGroup, modelRole, modelUser, modelVerification, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, schemaInviteMember, schemaMember, schemaMemberRole, schemaMemberStatus, schemaOrg, schemaPSGC, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaRole, schemaRoleUpdate, schemaUpdateOptions, schemaUser, schemaVerification, transactionSchema, useAddressController, useAddressRepo, useAppController, useAppRepo, useAppService, useAuthController, useAuthService, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGitHubService, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePSGCController, usePSGCRepo, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, useRoleController, useRoleRepo, useRoleService, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };
|
|
1068
|
+
export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MAddress, MBuilding, MBuildingUnit, MFile, MONGO_DB, MONGO_URI, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PORT, REDIS_HOST, REDIS_PASSWORD, REDIS_PORT, REFRESH_TOKEN_EXPIRY, REFRESH_TOKEN_SECRET, SECRET_KEY, SPACES_ACCESS_KEY, SPACES_BUCKET, SPACES_ENDPOINT, SPACES_REGION, SPACES_SECRET_KEY, TAddress, TApp, TBuilding, TBuildingUnit, TCounter, TFile, TMember, TOrg, TPSGC, TPermission, TPermissionGroup, TPlan, TRole, TSubscription, TSubscriptionTransaction, TUser, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, addressSchema, currencies, isDev, modelApp, modelMember, modelOrg, modelPSGC, modelPermission, modelPermissionGroup, modelPlan, modelRole, modelSubscription, modelSubscriptionTransaction, modelUser, modelVerification, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, schemaInviteMember, schemaMember, schemaMemberRole, schemaMemberStatus, schemaOrg, schemaOrgAdd, schemaOrgUpdate, schemaPSGC, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaPlan, schemaRole, schemaRoleUpdate, schemaSubscription, schemaSubscriptionSeats, schemaSubscriptionTransaction, schemaSubscriptionUpdate, schemaUpdateOptions, schemaUser, schemaVerification, transactionSchema, useAddressController, useAddressRepo, useAppController, useAppRepo, useAppService, useAuthController, useAuthService, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGitHubService, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePSGCController, usePSGCRepo, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, usePlanController, usePlanRepo, usePlanService, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionTransactionController, useSubscriptionTransactionRepo, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };
|