@goweekdays/core 2.1.3 → 2.2.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.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5f5ef8e: Implemented role services
8
+
9
+ ## 2.1.4
10
+
11
+ ### Patch Changes
12
+
13
+ - 4f0a0c3: Fix role management
14
+
3
15
  ## 2.1.3
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -319,6 +319,7 @@ declare function useMemberRepo(): {
319
319
  createTextIndex: () => Promise<void>;
320
320
  add: (value: TMember, session?: ClientSession) => Promise<string>;
321
321
  getById: (_id: string | ObjectId) => Promise<TMember | null>;
322
+ getByRole: (role: string | ObjectId) => Promise<TMember | null>;
322
323
  getAll: ({ search, limit, page, user, org, type, status }?: {
323
324
  search: string;
324
325
  limit: number;
@@ -379,6 +380,7 @@ type TOrg = {
379
380
  type?: string;
380
381
  email?: string;
381
382
  contact?: string;
383
+ createdBy: string | ObjectId;
382
384
  status?: string;
383
385
  createdAt?: string | Date;
384
386
  updatedAt?: string | Date;
@@ -474,29 +476,17 @@ type TRole = {
474
476
  description?: string;
475
477
  permissions?: Array<string>;
476
478
  type?: string;
479
+ org?: string | ObjectId;
477
480
  status?: string;
478
481
  default?: boolean;
479
482
  createdBy?: string | ObjectId;
480
- createdAt?: string;
481
- updatedAt?: string;
482
- deletedAt?: string;
483
+ createdAt?: string | Date;
484
+ updatedAt?: string | Date;
485
+ deletedAt?: string | Date;
483
486
  };
484
487
  type TMiniRole = Pick<TRole, "name" | "permissions">;
485
- declare class MRole implements TRole {
486
- _id: ObjectId;
487
- id: string | ObjectId;
488
- name?: string;
489
- description?: string;
490
- permissions?: Array<string>;
491
- type?: string;
492
- status?: string;
493
- default?: boolean;
494
- createdBy?: string | ObjectId;
495
- createdAt?: string;
496
- updatedAt?: string;
497
- deletedAt?: string;
498
- constructor(value: TRole);
499
- }
488
+ declare const schemaRole: Joi.ObjectSchema<any>;
489
+ declare function modelRole(value: TRole): TRole;
500
490
 
501
491
  declare function useRoleRepo(): {
502
492
  createIndex: () => Promise<void>;
@@ -516,14 +506,18 @@ declare function useRoleRepo(): {
516
506
  pageRange: string;
517
507
  } | TRole[]>;
518
508
  getRoleByUserId: (value: ObjectId | string) => Promise<TRole | null>;
519
- getRoleById: (_id: ObjectId | string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
509
+ getById: (_id: ObjectId | string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
520
510
  getRoleByName: (name: string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
521
511
  updateRole: (_id: string | ObjectId, value: TMiniRole, session?: ClientSession) => Promise<string>;
522
- deleteRole: (_id: ObjectId | string, session?: ClientSession) => Promise<string>;
512
+ deleteById: (_id: ObjectId | string, session?: ClientSession) => Promise<string>;
523
513
  updatePermissionsById: (_id: string | ObjectId, permissions: TRole["permissions"], session?: ClientSession) => Promise<string>;
524
514
  delCachedData: () => void;
525
515
  };
526
516
 
517
+ declare function useRoleService(): {
518
+ deleteById: (id: string) => Promise<void>;
519
+ };
520
+
527
521
  declare function useRoleController(): {
528
522
  createRole: (req: Request, res: Response, next: NextFunction) => Promise<void>;
529
523
  getRoles: (req: Request, res: Response, next: NextFunction) => Promise<void>;
@@ -827,6 +821,7 @@ declare function useAppRepo(): {
827
821
  };
828
822
 
829
823
  declare function useAppService(): {
824
+ addDefaultApps: () => Promise<void>;
830
825
  deleteById: (id: string) => Promise<string>;
831
826
  };
832
827
 
@@ -842,6 +837,7 @@ type TPermission = {
842
837
  _id?: ObjectId;
843
838
  app: string;
844
839
  key: string;
840
+ name: string;
845
841
  group: string;
846
842
  description: string;
847
843
  deprecated?: boolean;
@@ -974,4 +970,4 @@ declare const XENDIT_SECRET_KEY: string;
974
970
  declare const XENDIT_BASE_URL: string;
975
971
  declare const DOMAIN: string;
976
972
 
977
- 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, MOrg, MRole, MUser, MUserRole, MVerification, OrgTypes, 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, modelPSGC, modelPermission, modelPermissionGroup, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, schemaOrg, schemaPSGC, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, 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, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };
973
+ 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, MOrg, MUser, MUserRole, MVerification, OrgTypes, 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, modelPSGC, modelPermission, modelPermissionGroup, modelRole, schemaApp, schemaAppUpdate, schemaBuilding, schemaBuildingUnit, 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 };