@goweekdays/core 2.2.1 → 2.2.2

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.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 1cd6d1e: Fix sign up and member invite
8
+
3
9
  ## 2.2.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -305,13 +305,12 @@ type TMember = {
305
305
  user: string | ObjectId;
306
306
  role: string | ObjectId;
307
307
  roleName?: string;
308
- type: string;
308
+ app: string;
309
309
  status?: string;
310
310
  createdAt?: string | Date;
311
311
  updatedAt?: string | Date;
312
312
  deletedAt?: string | Date;
313
313
  };
314
- declare function MMember(value: TMember): TMember;
315
314
  declare const schemaMember: Joi.ObjectSchema<any>;
316
315
  declare function modelMember(value: TMember): TMember;
317
316
 
@@ -322,13 +321,13 @@ declare function useMemberRepo(): {
322
321
  add: (value: TMember, session?: ClientSession) => Promise<string>;
323
322
  getById: (_id: string | ObjectId) => Promise<TMember | null>;
324
323
  getByRole: (role: string | ObjectId) => Promise<TMember | null>;
325
- getAll: ({ search, limit, page, user, org, type, status }?: {
324
+ getAll: ({ search, limit, page, user, org, app, status }?: {
326
325
  search: string;
327
326
  limit: number;
328
327
  page: number;
329
328
  user?: string | ObjectId | undefined;
330
329
  org?: string | ObjectId | undefined;
331
- type: string;
330
+ app: string;
332
331
  status: string;
333
332
  }) => Promise<Record<string, any>>;
334
333
  getOrgsByUserId: ({ search, page, limit, sort, user, status, }?: {
@@ -365,9 +364,15 @@ declare function useMemberRepo(): {
365
364
  countByOrg: (org: string | ObjectId) => Promise<number>;
366
365
  countByUser: (user: string | ObjectId) => Promise<number>;
367
366
  getByUserType: (user: string | ObjectId, type: string, org?: string | ObjectId) => Promise<TMember | null>;
367
+ getByApp: (options: {
368
+ app: string;
369
+ user?: string | ObjectId;
370
+ org?: string | ObjectId;
371
+ }) => Promise<TMember | null>;
368
372
  };
369
373
 
370
374
  declare function useMemberController(): {
375
+ getByApp: (req: Request, res: Response, next: NextFunction) => Promise<void>;
371
376
  getByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
372
377
  getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
373
378
  getOrgsByMembership: (req: Request, res: Response, next: NextFunction) => Promise<void>;
@@ -476,8 +481,8 @@ type TRole = {
476
481
  description?: string;
477
482
  permissions?: Array<string>;
478
483
  org?: string | ObjectId;
484
+ app: string;
479
485
  status?: string;
480
- default?: boolean;
481
486
  createdBy?: string | ObjectId;
482
487
  createdAt?: string | Date;
483
488
  updatedAt?: string | Date;
@@ -488,17 +493,15 @@ declare const schemaRole: Joi.ObjectSchema<any>;
488
493
  declare function modelRole(value: TRole): TRole;
489
494
 
490
495
  declare function useRoleRepo(): {
491
- createIndex: () => Promise<void>;
492
- createTextIndex: () => Promise<void>;
493
- createUniqueIndex: () => Promise<void>;
496
+ createIndexes: () => Promise<void>;
494
497
  addRole: (value: TRole, session?: ClientSession, clearCache?: boolean) => Promise<ObjectId>;
495
- getRoles: ({ search, page, limit, sort, type, id, }?: {
498
+ getRoles: ({ search, page, limit, sort, app, org, }?: {
496
499
  search?: string | undefined;
497
500
  page?: number | undefined;
498
501
  limit?: number | undefined;
499
502
  sort?: any;
500
- type?: string | undefined;
501
- id?: string | ObjectId | undefined;
503
+ app?: string | undefined;
504
+ org?: string | ObjectId | undefined;
502
505
  }) => Promise<{
503
506
  items: any[];
504
507
  pages: number;
@@ -527,75 +530,40 @@ declare function useRoleController(): {
527
530
  updatePermissionsById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
528
531
  };
529
532
 
530
- type TUserRole = {
531
- name: string;
532
- app: string;
533
- role: ObjectId | string;
534
- status?: string;
535
- };
536
- declare class MUserRole implements TUserRole {
537
- name: string;
538
- app: string;
539
- role: ObjectId | string;
540
- status?: string;
541
- constructor(value: TUserRole);
542
- }
543
533
  type TUser = {
544
534
  _id?: ObjectId;
545
535
  email: string;
546
536
  password: string;
547
- prefix?: string;
548
537
  firstName: string;
549
538
  middleName?: string;
550
539
  lastName: string;
551
- suffix?: string;
552
- birthMonth?: string;
553
- birthDay?: number;
554
- birthYear?: number;
555
- gender?: string;
556
540
  defaultOrg?: ObjectId | string;
557
- xenditCustomerId?: string;
558
- type?: string;
559
541
  status?: string;
560
- referralCode?: string;
561
- referredBy?: string;
562
- createdAt?: string;
563
- updatedAt?: string;
564
- deletedAt?: string;
542
+ createdAt?: string | Date;
543
+ updatedAt?: string | Date;
544
+ deletedAt?: string | Date;
565
545
  };
566
- declare class MUser implements TUser {
567
- _id?: ObjectId;
546
+ declare const schemaUser: Joi.ObjectSchema<any>;
547
+ declare function modelUser(data: TUser): {
548
+ _id: ObjectId | undefined;
568
549
  email: string;
569
550
  password: string;
570
- prefix?: string;
571
551
  firstName: string;
572
- middleName?: string;
552
+ middleName: string;
573
553
  lastName: string;
574
- suffix?: string;
575
- birthMonth?: string;
576
- birthDay?: number;
577
- birthYear?: number;
578
- gender?: string;
579
- roles?: TUserRole[];
580
- status?: string;
581
- type?: string;
582
- xenditCustomerId?: string | undefined;
583
- referralCode?: string;
584
- referredBy?: string;
585
- createdAt?: string;
586
- updatedAt?: string;
587
- deletedAt?: string;
588
- defaultOrg?: ObjectId | string;
589
- constructor(value: TUser);
590
- }
554
+ defaultOrg: string | ObjectId;
555
+ status: string;
556
+ createdAt: string | Date;
557
+ updatedAt: string | Date;
558
+ deletedAt: string | Date;
559
+ };
591
560
 
592
561
  declare function useUserRepo(): {
593
- createTextIndex: () => Promise<void>;
594
- createUniqueIndex: () => Promise<void>;
595
- createUser: (value: TUser, session?: ClientSession) => Promise<ObjectId>;
562
+ createIndexes: () => Promise<void>;
563
+ add: (value: TUser, session?: ClientSession) => Promise<ObjectId>;
596
564
  getUserByEmail: (email: string) => Promise<TUser | null>;
597
565
  getUserById: (_id: string | ObjectId) => Promise<TUser | null>;
598
- getUsers: ({ search, page, limit, sort, status, type, }?: {
566
+ getAll: ({ search, page, limit, sort, status, type, }?: {
599
567
  search?: string | undefined;
600
568
  page?: number | undefined;
601
569
  limit?: number | undefined;
@@ -623,22 +591,11 @@ declare function useUserRepo(): {
623
591
  field: string;
624
592
  value: string | ObjectId;
625
593
  }, session?: ClientSession) => Promise<mongodb.UpdateResult<bson.Document>>;
626
- addUserRole: ({ _id, role }?: {
627
- _id: string | ObjectId;
628
- role: TUserRole;
629
- }, session?: ClientSession) => Promise<void>;
630
594
  getUserByReferralCode: (referralCode: string) => Promise<TUser | null>;
631
595
  };
632
596
 
633
597
  declare function useUserService(): {
634
- getUsers: ({ search, page, status, type, limit, }?: {
635
- search?: string | undefined;
636
- page?: number | undefined;
637
- status?: string | undefined;
638
- type?: string | undefined;
639
- limit?: number | undefined;
640
- }) => Promise<Record<string, any>>;
641
- createUser: (value: Pick<TUser, "prefix" | "firstName" | "middleName" | "lastName" | "email" | "password" | "suffix">) => Promise<ObjectId>;
598
+ createUser: (value: TUser) => Promise<ObjectId>;
642
599
  resetPassword: (id: string, newPassword: string, passwordConfirmation: string) => Promise<string>;
643
600
  updateName: (_id: string, firstName?: string, lastName?: string) => Promise<string>;
644
601
  updateBirthday: (_id: string, month: string, day: number, year: number) => Promise<string>;
@@ -652,7 +609,7 @@ declare function useUserService(): {
652
609
  user: string;
653
610
  previousProfile?: string | undefined;
654
611
  }) => Promise<string>;
655
- createUserByInvite: ({ id, firstName, lastName, password, }?: {
612
+ addViaInvite: ({ id, firstName, lastName, password, }?: {
656
613
  id?: string | undefined;
657
614
  firstName?: string | undefined;
658
615
  lastName?: string | undefined;
@@ -668,13 +625,13 @@ declare function useUserService(): {
668
625
  };
669
626
 
670
627
  declare function useUserController(): {
671
- getUsers: (req: Request, res: Response, next: NextFunction) => Promise<void>;
628
+ getAll: (req: Request, res: Response, next: NextFunction) => Promise<void>;
672
629
  getUserById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
673
630
  updateName: (req: Request, res: Response, next: NextFunction) => Promise<void>;
674
631
  updateBirthday: (req: Request, res: Response, next: NextFunction) => Promise<void>;
675
632
  updateUserFieldById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
676
633
  updateUserProfile: (req: Request, res: Response, next: NextFunction) => Promise<void>;
677
- createUserByVerification: (req: Request, res: Response, next: NextFunction) => Promise<void>;
634
+ addViaInvite: (req: Request, res: Response, next: NextFunction) => Promise<void>;
678
635
  };
679
636
 
680
637
  declare function useGitHubService(): {
@@ -697,7 +654,7 @@ declare const transactionSchema: Joi.ObjectSchema<any>;
697
654
  type TVerificationMetadata = {
698
655
  name?: string;
699
656
  app?: string;
700
- role?: string;
657
+ role?: string | ObjectId;
701
658
  roleName?: string;
702
659
  referralCode?: string;
703
660
  org?: string | ObjectId;
@@ -709,21 +666,13 @@ type TVerification = {
709
666
  email: string;
710
667
  metadata?: TVerificationMetadata;
711
668
  status?: string;
712
- createdAt: string | Date;
713
- updatedAt?: string | Date | null;
714
- expireAt: string | Date;
669
+ createdAt?: string | Date;
670
+ updatedAt?: string | Date;
671
+ expireAt?: string | Date;
715
672
  };
716
- declare class MVerification implements TVerification {
717
- _id?: ObjectId;
718
- type: string;
719
- email: string;
720
- metadata?: TVerificationMetadata;
721
- status?: string;
722
- createdAt: string | Date;
723
- updatedAt?: string | Date | null;
724
- expireAt: string | Date;
725
- constructor(value: TVerification);
726
- }
673
+ declare const schemaInviteMember: Joi.ObjectSchema<any>;
674
+ declare const schemaVerification: Joi.ObjectSchema<any>;
675
+ declare function modelVerification(value: TVerification): TVerification;
727
676
 
728
677
  declare function useVerificationRepo(): {
729
678
  createIndexes: () => Promise<void>;
@@ -772,7 +721,13 @@ declare function useVerificationService(): {
772
721
  updateStatusById: (_id: string, status: string) => Promise<string>;
773
722
  signUp: ({ email, metadata, }: {
774
723
  email: string;
775
- metadata: Record<string, any>;
724
+ metadata?: TVerificationMetadata | undefined;
725
+ }) => Promise<bson.ObjectId>;
726
+ inviteMember: (value: {
727
+ email: string;
728
+ role: string;
729
+ app: string;
730
+ org?: string;
776
731
  }) => Promise<bson.ObjectId>;
777
732
  };
778
733
 
@@ -782,6 +737,8 @@ declare function useVerificationController(): {
782
737
  createForgetPassword: (req: Request, res: Response, next: NextFunction) => Promise<void>;
783
738
  verify: (req: Request, res: Response, next: NextFunction) => Promise<void>;
784
739
  cancelUserInvitation: (req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
740
+ inviteMember: (req: Request, res: Response, next: NextFunction) => Promise<void>;
741
+ signUp: (req: Request, res: Response, next: NextFunction) => Promise<void>;
785
742
  };
786
743
 
787
744
  type TApp = {
@@ -969,4 +926,4 @@ declare const XENDIT_SECRET_KEY: string;
969
926
  declare const XENDIT_BASE_URL: string;
970
927
  declare const DOMAIN: string;
971
928
 
972
- 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, MMember, MONGO_DB, MONGO_URI, MUser, MUserRole, MVerification, 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, TMiniRole, TOrg, TPSGC, TPermission, TPermissionGroup, TRole, TUser, TUserRole, 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, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, schemaMember, schemaOrg, schemaPSGC, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaRole, schemaUpdateOptions, 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 };
929
+ 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, TMiniRole, 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, schemaOrg, schemaPSGC, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaRole, 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 };