@goweekdays/core 2.3.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @goweekdays/core
2
2
 
3
+ ## 2.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ee525e1: Add plan, promo, and subscription modules
8
+
3
9
  ## 2.3.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -390,7 +390,7 @@ type TOrg = {
390
390
  _id?: ObjectId;
391
391
  name: string;
392
392
  description?: string;
393
- email?: string;
393
+ email: string;
394
394
  contact?: string;
395
395
  createdBy: string | ObjectId;
396
396
  status?: string;
@@ -399,6 +399,8 @@ type TOrg = {
399
399
  deletedAt?: string | Date;
400
400
  };
401
401
  declare const schemaOrg: Joi.ObjectSchema<any>;
402
+ declare const schemaOrgAdd: Joi.ObjectSchema<any>;
403
+ declare const schemaOrgUpdate: Joi.ObjectSchema<any>;
402
404
  declare function modelOrg(value: TOrg): TOrg;
403
405
 
404
406
  declare function useOrgRepo(): {
@@ -419,10 +421,13 @@ declare function useOrgRepo(): {
419
421
  }, session?: ClientSession) => Promise<string>;
420
422
  deleteById: (_id: string | ObjectId) => Promise<string>;
421
423
  getByName: (name: string) => Promise<TOrg>;
424
+ updateById: (_id: string | ObjectId, options: Pick<TOrg, "name" | "description" | "email" | "contact">) => Promise<void>;
422
425
  };
423
426
 
424
427
  declare function useOrgService(): {
425
- add: (value: TOrg) => Promise<string>;
428
+ add: (value: TOrg & {
429
+ seats: number;
430
+ }) => Promise<string>;
426
431
  };
427
432
 
428
433
  declare function useOrgController(): {
@@ -431,6 +436,7 @@ declare function useOrgController(): {
431
436
  getByName: (req: Request, res: Response, next: NextFunction) => Promise<void>;
432
437
  getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
433
438
  getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
439
+ updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
434
440
  };
435
441
 
436
442
  type TPSGC = {
@@ -757,6 +763,122 @@ declare function useVerificationController(): {
757
763
  forgetPassword: (req: Request, res: Response, next: NextFunction) => Promise<void>;
758
764
  };
759
765
 
766
+ type TPlan = {
767
+ _id?: ObjectId;
768
+ name: string;
769
+ description?: string;
770
+ features?: string[];
771
+ price: number;
772
+ currency: string;
773
+ billingCycle: "monthly" | "yearly";
774
+ default?: boolean;
775
+ status?: "active" | "inactive";
776
+ createdAt?: Date | string;
777
+ updatedAt?: Date | string;
778
+ };
779
+ declare const currencies: string[];
780
+ declare const schemaPlan: Joi.ObjectSchema<any>;
781
+ declare function modelPlan(data: any): TPlan;
782
+
783
+ declare function usePlanRepo(): {
784
+ add: (value: TPlan) => Promise<string>;
785
+ getAll: ({ page, limit, search, status, }?: {
786
+ page?: number | undefined;
787
+ limit?: number | undefined;
788
+ search?: string | undefined;
789
+ status?: string | undefined;
790
+ }) => Promise<TPaginate<TPlan>>;
791
+ getById: (_id: string | ObjectId) => Promise<TPlan | null>;
792
+ getDefault: () => Promise<TPlan | null>;
793
+ deleteById: (_id: string | ObjectId) => Promise<string>;
794
+ };
795
+
796
+ declare function usePlanService(): {
797
+ addDefaultPlan: () => Promise<void>;
798
+ };
799
+
800
+ declare function usePlanController(): {
801
+ add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
802
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
803
+ getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
804
+ deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
805
+ getDefault: (req: Request, res: Response, next: NextFunction) => Promise<void>;
806
+ };
807
+
808
+ type TSubscription = {
809
+ _id?: ObjectId;
810
+ org: string | ObjectId;
811
+ seats: number;
812
+ paidSeats: number;
813
+ amount: number;
814
+ currency: string;
815
+ billingCycle: "monthly" | "yearly";
816
+ promoCode?: string;
817
+ status?: string;
818
+ nextBillingDate: Date | string;
819
+ createdAt?: Date | string;
820
+ updatedAt?: Date | string;
821
+ };
822
+ declare const schemaSubscription: Joi.ObjectSchema<any>;
823
+ declare const schemaSubscriptionUpdate: Joi.ObjectSchema<any>;
824
+ declare const schemaSubscriptionSeats: Joi.ObjectSchema<any>;
825
+ declare function modelSubscription(data: any): TSubscription;
826
+
827
+ declare function useSubscriptionRepo(): {
828
+ add: (value: TSubscription, session?: ClientSession) => Promise<string>;
829
+ getAll: ({ page, limit, search, status, }?: {
830
+ page?: number | undefined;
831
+ limit?: number | undefined;
832
+ search?: string | undefined;
833
+ status?: string | undefined;
834
+ }) => Promise<TPaginate<TSubscription>>;
835
+ getByOrg: (org: string | ObjectId) => Promise<TSubscription | null>;
836
+ getById: (_id: string | ObjectId) => Promise<TSubscription | null>;
837
+ deleteById: (_id: string | ObjectId) => Promise<string>;
838
+ updateById: (_id: string | ObjectId, options: {
839
+ seats: number;
840
+ paidSeats?: number;
841
+ amount?: number;
842
+ promoCode?: string;
843
+ }, session?: ClientSession) => Promise<string>;
844
+ };
845
+
846
+ declare function useSubscriptionController(): {
847
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
848
+ getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
849
+ getByOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
850
+ updateSeats: (req: Request, res: Response, next: NextFunction) => Promise<void>;
851
+ };
852
+
853
+ type TSubscriptionTransaction = {
854
+ _id?: ObjectId;
855
+ subscription: string | ObjectId;
856
+ amount: number;
857
+ currency: string;
858
+ type: "initiate" | "add-seat" | "remove-seat" | "renewal";
859
+ description?: string;
860
+ createdBy: string | ObjectId;
861
+ createdByName?: string;
862
+ createdAt?: Date | string;
863
+ updatedAt?: Date | string;
864
+ };
865
+ declare const schemaSubscriptionTransaction: Joi.ObjectSchema<any>;
866
+ declare function modelSubscriptionTransaction(data: TSubscriptionTransaction): TSubscriptionTransaction;
867
+
868
+ declare function useSubscriptionTransactionRepo(): {
869
+ add: (value: TSubscriptionTransaction, session?: ClientSession) => Promise<string>;
870
+ getAll: ({ page, limit, search, id }?: {
871
+ page?: number | undefined;
872
+ limit?: number | undefined;
873
+ search?: string | undefined;
874
+ id?: string | undefined;
875
+ }) => Promise<TPaginate<TSubscriptionTransaction>>;
876
+ };
877
+
878
+ declare function useSubscriptionTransactionController(): {
879
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
880
+ };
881
+
760
882
  type TApp = {
761
883
  _id?: ObjectId;
762
884
  code: string;
@@ -942,4 +1064,4 @@ declare const XENDIT_SECRET_KEY: string;
942
1064
  declare const XENDIT_BASE_URL: string;
943
1065
  declare const DOMAIN: string;
944
1066
 
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 };
1067
+ 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 };