@goweekdays/core 2.10.1 → 2.11.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,17 @@
1
1
  # @goweekdays/core
2
2
 
3
+ ## 2.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - eaba24c: implement subscription seats and promo code update
8
+
9
+ ## 2.10.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 4902c2a: Fix organization, no subscription by default
14
+
3
15
  ## 2.10.1
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -398,6 +398,7 @@ declare function useOrgRepo(): {
398
398
  getByEmail: (email: string) => Promise<TOrg | null>;
399
399
  updateById: (_id: string | ObjectId, options: Pick<TOrg, "name" | "description" | "email" | "contact">) => Promise<void>;
400
400
  updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<string>;
401
+ companySearch: (name: string) => Promise<bson.Document[]>;
401
402
  };
402
403
 
403
404
  declare function useOrgService(): {
@@ -417,6 +418,7 @@ declare function useOrgController(): {
417
418
  getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
418
419
  getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
419
420
  updateById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
421
+ companySearch: (req: Request, res: Response, next: NextFunction) => Promise<void>;
420
422
  };
421
423
 
422
424
  type TPromo = {
@@ -765,9 +767,7 @@ declare function useVerificationService(): {
765
767
  }) => Promise<bson.ObjectId>;
766
768
  cancelInviteMember: (id: string) => Promise<string>;
767
769
  forgetPassword: (email: string) => Promise<string>;
768
- orgSetupFee: (value: TOrg & {
769
- seats: number;
770
- }) => Promise<{
770
+ orgSetupFee: (value: TOrg) => Promise<{
771
771
  paypalOrderLink: any;
772
772
  }>;
773
773
  };
@@ -843,9 +843,19 @@ type TSubscription = {
843
843
  createdAt?: Date | string;
844
844
  updatedAt?: Date | string;
845
845
  };
846
+ declare const schemaSubscriptionCompute: Joi.ObjectSchema<any>;
847
+ declare const schemaSubscribe: Joi.ObjectSchema<any>;
848
+ type TSubscribe = {
849
+ seats: number;
850
+ plan: string;
851
+ promoCode?: string;
852
+ org: string;
853
+ user: string;
854
+ };
846
855
  declare const schemaSubscription: Joi.ObjectSchema<any>;
847
856
  declare const schemaSubscriptionUpdate: Joi.ObjectSchema<any>;
848
857
  declare const schemaSubscriptionSeats: Joi.ObjectSchema<any>;
858
+ declare const schemaSubscriptionPromoCode: Joi.ObjectSchema<any>;
849
859
  declare function modelSubscription(data: any): TSubscription;
850
860
 
851
861
  declare function useSubscriptionRepo(): {
@@ -875,18 +885,33 @@ declare function useSubscriptionRepo(): {
875
885
  };
876
886
 
877
887
  declare function useSubscriptionController(): {
888
+ computeFee: (req: Request, res: Response, next: NextFunction) => Promise<void>;
889
+ add: (req: Request, res: Response, next: NextFunction) => Promise<void>;
878
890
  getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
879
891
  getById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
880
892
  getByOrg: (req: Request, res: Response, next: NextFunction) => Promise<void>;
881
893
  updateSeats: (req: Request, res: Response, next: NextFunction) => Promise<void>;
894
+ updatePromoCode: (req: Request, res: Response, next: NextFunction) => Promise<void>;
882
895
  };
883
896
 
884
897
  declare function useSubscriptionService(): {
885
- updateSeats: ({ id, user, amount, seats, }?: {
886
- id?: string | undefined;
887
- user?: string | undefined;
888
- amount?: number | undefined;
889
- seats?: number | undefined;
898
+ add: (value: TSubscribe) => Promise<string>;
899
+ computeFee: (value: {
900
+ seats: number;
901
+ promoCode?: string;
902
+ org: string;
903
+ plan: string;
904
+ }) => Promise<{
905
+ monthlyAmount: number;
906
+ proratedAmount: number;
907
+ subscriptionAmount: number;
908
+ currency: string;
909
+ }>;
910
+ updateSeats: (value: TSubscribe) => Promise<string>;
911
+ updatePromoCode: (value: {
912
+ org: string;
913
+ promoCode?: string;
914
+ user: string;
890
915
  }) => Promise<string>;
891
916
  processInvoices: () => Promise<void>;
892
917
  processSuspensions: () => Promise<void>;
@@ -900,7 +925,7 @@ type TSubscriptionTransaction = {
900
925
  subscription: string | ObjectId;
901
926
  amount: number;
902
927
  currency: string;
903
- type: "initiate" | "add-seat" | "remove-seat" | "renewal";
928
+ type: "initiate" | "add-seat" | "remove-seat" | "renewal" | "promo-applied" | "promo-removed" | "promo-expired" | "promo-updated";
904
929
  description?: string;
905
930
  createdBy: string | ObjectId;
906
931
  createdByName?: string;
@@ -1077,6 +1102,8 @@ type TJobPost = {
1077
1102
  _id?: ObjectId;
1078
1103
  org: ObjectId | string;
1079
1104
  orgName?: string;
1105
+ company: ObjectId;
1106
+ companyName?: string;
1080
1107
  title: string;
1081
1108
  setup: string;
1082
1109
  location: string;
@@ -1227,4 +1254,4 @@ declare const XENDIT_BASE_URL: string;
1227
1254
  declare const DOMAIN: string;
1228
1255
  declare const APP_ORG: string;
1229
1256
 
1230
- export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, APP_ORG, 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, MBuilding, MBuildingUnit, MFile, MONGO_DB, MONGO_URI, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PAYPAL_WEBHOOK_ID, PORT, PaypalWebhookHeaders, 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, TApp, TBuilding, TBuildingUnit, TCounter, TFile, TJobPost, TLedgerBill, TMember, TOrg, TPermission, TPermissionGroup, TPlan, TPromo, TRole, TSubscription, TSubscriptionTransaction, TUser, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, currencies, isDev, ledgerBillStatuses, ledgerBillTypes, modelApp, modelJobPost, modelLedgerBill, modelMember, modelOrg, modelPermission, modelPermissionGroup, modelPlan, modelPromo, modelRole, modelSubscription, modelSubscriptionTransaction, modelUser, modelVerification, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, schemaInviteMember, schemaJobPost, schemaJobPostUpdate, schemaLedgerBill, schemaLedgerBillingSummary, schemaMember, schemaMemberRole, schemaMemberStatus, schemaOrg, schemaOrgAdd, schemaOrgUpdate, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaPlan, schemaPromo, schemaRole, schemaRoleUpdate, schemaSubscription, schemaSubscriptionSeats, schemaSubscriptionTransaction, schemaSubscriptionUpdate, schemaUpdateOptions, schemaUser, schemaVerification, transactionSchema, useAppController, useAppRepo, useAppService, useAuthController, useAuthService, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGitHubService, useJobPostController, useJobPostRepo, useJobPostService, useLedgerBillingController, useLedgerBillingRepo, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePaypalService, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, usePlanController, usePlanRepo, usePlanService, usePromoController, usePromoRepo, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useSubscriptionTransactionController, useSubscriptionTransactionRepo, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };
1257
+ export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, APP_ORG, 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, MBuilding, MBuildingUnit, MFile, MONGO_DB, MONGO_URI, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PAYPAL_WEBHOOK_ID, PORT, PaypalWebhookHeaders, 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, TApp, TBuilding, TBuildingUnit, TCounter, TFile, TJobPost, TLedgerBill, TMember, TOrg, TPermission, TPermissionGroup, TPlan, TPromo, TRole, TSubscribe, TSubscription, TSubscriptionTransaction, TUser, TVerification, TVerificationMetadata, VERIFICATION_FORGET_PASSWORD_DURATION, VERIFICATION_USER_INVITE_DURATION, XENDIT_BASE_URL, XENDIT_SECRET_KEY, currencies, isDev, ledgerBillStatuses, ledgerBillTypes, modelApp, modelJobPost, modelLedgerBill, modelMember, modelOrg, modelPermission, modelPermissionGroup, modelPlan, modelPromo, modelRole, modelSubscription, modelSubscriptionTransaction, modelUser, modelVerification, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, schemaInviteMember, schemaJobPost, schemaJobPostUpdate, schemaLedgerBill, schemaLedgerBillingSummary, schemaMember, schemaMemberRole, schemaMemberStatus, schemaOrg, schemaOrgAdd, schemaOrgUpdate, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaPlan, schemaPromo, schemaRole, schemaRoleUpdate, schemaSubscribe, schemaSubscription, schemaSubscriptionCompute, schemaSubscriptionPromoCode, schemaSubscriptionSeats, schemaSubscriptionTransaction, schemaSubscriptionUpdate, schemaUpdateOptions, schemaUser, schemaVerification, transactionSchema, useAppController, useAppRepo, useAppService, useAuthController, useAuthService, useBuildingController, useBuildingRepo, useBuildingService, useBuildingUnitController, useBuildingUnitRepo, useBuildingUnitService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGitHubService, useJobPostController, useJobPostRepo, useJobPostService, useLedgerBillingController, useLedgerBillingRepo, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePaypalService, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, usePlanController, usePlanRepo, usePlanService, usePromoController, usePromoRepo, useRoleController, useRoleRepo, useRoleService, useSubscriptionController, useSubscriptionRepo, useSubscriptionService, useSubscriptionTransactionController, useSubscriptionTransactionRepo, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };