@goweekdays/core 2.2.2 → 2.3.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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @goweekdays/core
2
2
 
3
+ ## 2.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c39a016: Fix role, member, and user management
8
+
9
+ ## 2.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 5a0cab6: Revamp member and verification management
14
+
3
15
  ## 2.2.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -50,8 +50,6 @@ declare function useAuthService(): {
50
50
  declare function useAuthController(): {
51
51
  login: (req: Request, res: Response, next: NextFunction) => Promise<void>;
52
52
  logout: (req: Request, res: Response, next: NextFunction) => Promise<void>;
53
- resetPassword: (req: Request, res: Response, next: NextFunction) => Promise<void>;
54
- signUp: (req: Request, res: Response, next: NextFunction) => Promise<void>;
55
53
  };
56
54
 
57
55
  type TBuilding = {
@@ -312,12 +310,11 @@ type TMember = {
312
310
  deletedAt?: string | Date;
313
311
  };
314
312
  declare const schemaMember: Joi.ObjectSchema<any>;
313
+ declare const schemaMemberRole: Joi.ObjectSchema<any>;
314
+ declare const schemaMemberStatus: Joi.ObjectSchema<any>;
315
315
  declare function modelMember(value: TMember): TMember;
316
316
 
317
317
  declare function useMemberRepo(): {
318
- createIndex: () => Promise<void>;
319
- createUniqueIndex: () => Promise<void>;
320
- createTextIndex: () => Promise<void>;
321
318
  add: (value: TMember, session?: ClientSession) => Promise<string>;
322
319
  getById: (_id: string | ObjectId) => Promise<TMember | null>;
323
320
  getByRole: (role: string | ObjectId) => Promise<TMember | null>;
@@ -369,6 +366,12 @@ declare function useMemberRepo(): {
369
366
  user?: string | ObjectId;
370
367
  org?: string | ObjectId;
371
368
  }) => Promise<TMember | null>;
369
+ updateRoleById: (_id: string | ObjectId, value: {
370
+ role: string | ObjectId;
371
+ roleName: string;
372
+ }, session?: ClientSession) => Promise<string>;
373
+ updateStatusById: (_id: string | ObjectId, status: string, session?: ClientSession) => Promise<string>;
374
+ deleteById: (_id: string | ObjectId, session?: ClientSession) => Promise<string>;
372
375
  };
373
376
 
374
377
  declare function useMemberController(): {
@@ -378,6 +381,9 @@ declare function useMemberController(): {
378
381
  getOrgsByMembership: (req: Request, res: Response, next: NextFunction) => Promise<void>;
379
382
  updateStatusByUserId: (req: Request, res: Response, next: NextFunction) => Promise<void>;
380
383
  getByUserType: (req: Request, res: Response, next: NextFunction) => Promise<void>;
384
+ updateRoleById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
385
+ updateStatusById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
386
+ deleteById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
381
387
  };
382
388
 
383
389
  type TOrg = {
@@ -477,7 +483,7 @@ declare function usePSGCController(): {
477
483
  type TRole = {
478
484
  _id?: ObjectId;
479
485
  id?: string | ObjectId;
480
- name?: string;
486
+ name: string;
481
487
  description?: string;
482
488
  permissions?: Array<string>;
483
489
  org?: string | ObjectId;
@@ -488,8 +494,8 @@ type TRole = {
488
494
  updatedAt?: string | Date;
489
495
  deletedAt?: string | Date;
490
496
  };
491
- type TMiniRole = Pick<TRole, "name" | "permissions">;
492
497
  declare const schemaRole: Joi.ObjectSchema<any>;
498
+ declare const schemaRoleUpdate: Joi.ObjectSchema<any>;
493
499
  declare function modelRole(value: TRole): TRole;
494
500
 
495
501
  declare function useRoleRepo(): {
@@ -510,7 +516,7 @@ declare function useRoleRepo(): {
510
516
  getRoleByUserId: (value: ObjectId | string) => Promise<TRole | null>;
511
517
  getById: (_id: ObjectId | string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
512
518
  getRoleByName: (name: string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
513
- updateRole: (_id: string | ObjectId, value: TMiniRole, session?: ClientSession) => Promise<string>;
519
+ updateRole: (_id: string | ObjectId, value: Pick<TRole, "name" | "permissions" | "description">, session?: ClientSession) => Promise<string>;
514
520
  deleteById: (_id: ObjectId | string, session?: ClientSession) => Promise<string>;
515
521
  updatePermissionsById: (_id: string | ObjectId, permissions: TRole["permissions"], session?: ClientSession) => Promise<string>;
516
522
  delCachedData: () => void;
@@ -595,8 +601,12 @@ declare function useUserRepo(): {
595
601
  };
596
602
 
597
603
  declare function useUserService(): {
598
- createUser: (value: TUser) => Promise<ObjectId>;
599
- resetPassword: (id: string, newPassword: string, passwordConfirmation: string) => Promise<string>;
604
+ createUser: (value: TUser) => Promise<bson.ObjectId>;
605
+ resetPassword: (value: {
606
+ id: string;
607
+ newPassword: string;
608
+ confirmPassword: string;
609
+ }) => Promise<string>;
600
610
  updateName: (_id: string, firstName?: string, lastName?: string) => Promise<string>;
601
611
  updateBirthday: (_id: string, month: string, day: number, year: number) => Promise<string>;
602
612
  updateUserFieldById: ({ _id, field, value }?: {
@@ -614,13 +624,13 @@ declare function useUserService(): {
614
624
  firstName?: string | undefined;
615
625
  lastName?: string | undefined;
616
626
  password?: string | undefined;
617
- }) => Promise<string | ObjectId>;
627
+ }) => Promise<string | bson.ObjectId>;
618
628
  createUserBySignUp: ({ id, firstName, lastName, password, }?: {
619
629
  id?: string | undefined;
620
630
  firstName?: string | undefined;
621
631
  lastName?: string | undefined;
622
632
  password?: string | undefined;
623
- }) => Promise<ObjectId>;
633
+ }) => Promise<bson.ObjectId>;
624
634
  createDefaultUser: () => Promise<string>;
625
635
  };
626
636
 
@@ -632,6 +642,7 @@ declare function useUserController(): {
632
642
  updateUserFieldById: (req: Request, res: Response, next: NextFunction) => Promise<void>;
633
643
  updateUserProfile: (req: Request, res: Response, next: NextFunction) => Promise<void>;
634
644
  addViaInvite: (req: Request, res: Response, next: NextFunction) => Promise<void>;
645
+ resetPassword: (req: Request, res: Response, next: NextFunction) => Promise<void>;
635
646
  };
636
647
 
637
648
  declare function useGitHubService(): {
@@ -677,7 +688,7 @@ declare function modelVerification(value: TVerification): TVerification;
677
688
  declare function useVerificationRepo(): {
678
689
  createIndexes: () => Promise<void>;
679
690
  add: (value: TVerification, session?: ClientSession) => Promise<ObjectId>;
680
- getVerifications: ({ search, page, limit, sort, status, type, email, app, }?: {
691
+ getVerifications: ({ search, page, limit, sort, status, type, email, app, org, }?: {
681
692
  search?: string | undefined;
682
693
  page?: number | undefined;
683
694
  limit?: number | undefined;
@@ -686,6 +697,7 @@ declare function useVerificationRepo(): {
686
697
  type?: string | string[] | undefined;
687
698
  email?: string | undefined;
688
699
  app?: string | undefined;
700
+ org?: string | ObjectId | undefined;
689
701
  }) => Promise<{
690
702
  items: any[];
691
703
  pages: number;
@@ -729,6 +741,8 @@ declare function useVerificationService(): {
729
741
  app: string;
730
742
  org?: string;
731
743
  }) => Promise<bson.ObjectId>;
744
+ cancelInviteMember: (id: string) => Promise<string>;
745
+ forgetPassword: (email: string) => Promise<string>;
732
746
  };
733
747
 
734
748
  declare function useVerificationController(): {
@@ -739,6 +753,8 @@ declare function useVerificationController(): {
739
753
  cancelUserInvitation: (req: Request, res: Response, next: NextFunction) => Promise<Response<any, Record<string, any>> | undefined>;
740
754
  inviteMember: (req: Request, res: Response, next: NextFunction) => Promise<void>;
741
755
  signUp: (req: Request, res: Response, next: NextFunction) => Promise<void>;
756
+ cancelInviteMember: (req: Request, res: Response, next: NextFunction) => Promise<void>;
757
+ forgetPassword: (req: Request, res: Response, next: NextFunction) => Promise<void>;
742
758
  };
743
759
 
744
760
  type TApp = {
@@ -926,4 +942,4 @@ declare const XENDIT_SECRET_KEY: string;
926
942
  declare const XENDIT_BASE_URL: string;
927
943
  declare const DOMAIN: string;
928
944
 
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 };
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 };