@eeplatform/core 1.8.9 → 1.8.10

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
  # @eeplatform/core
2
2
 
3
+ ## 1.8.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 364ae20: Revise role management, add app and permission management
8
+
3
9
  ## 1.8.9
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -441,59 +441,49 @@ declare function useFileController(): {
441
441
  type TRole = {
442
442
  _id?: ObjectId;
443
443
  id?: string | ObjectId;
444
- name?: string;
444
+ name: string;
445
445
  description?: string;
446
446
  permissions?: Array<string>;
447
- type?: string;
447
+ org?: string | ObjectId;
448
+ app: string;
448
449
  status?: string;
449
- default?: boolean;
450
450
  createdBy?: string | ObjectId;
451
- createdAt?: string;
452
- updatedAt?: string;
453
- deletedAt?: string;
451
+ createdAt?: string | Date;
452
+ updatedAt?: string | Date;
453
+ deletedAt?: string | Date;
454
454
  };
455
- type TMiniRole = Pick<TRole, "name" | "permissions">;
456
- declare class MRole implements TRole {
457
- _id: ObjectId;
458
- id: string | ObjectId;
459
- name?: string;
460
- description?: string;
461
- permissions?: Array<string>;
462
- type?: string;
463
- status?: string;
464
- default?: boolean;
465
- createdBy?: string | ObjectId;
466
- createdAt?: string;
467
- updatedAt?: string;
468
- deletedAt?: string;
469
- constructor(value: TRole);
470
- }
455
+ declare const schemaRole: Joi.ObjectSchema<any>;
456
+ declare const schemaRoleUpdate: Joi.ObjectSchema<any>;
457
+ declare function modelRole(value: TRole): TRole;
471
458
 
472
459
  declare function useRoleRepo(): {
473
460
  createIndexes: () => Promise<void>;
474
- createUniqueIndex: () => Promise<void>;
475
461
  addRole: (value: TRole, session?: ClientSession, clearCache?: boolean) => Promise<ObjectId>;
476
- getRoles: ({ search, page, limit, sort, type, id, }?: {
462
+ getRoles: ({ search, page, limit, sort, app, org, }?: {
477
463
  search?: string;
478
464
  page?: number;
479
465
  limit?: number;
480
466
  sort?: any;
481
- type?: string;
482
- id?: string | ObjectId;
467
+ app?: string;
468
+ org?: string | ObjectId;
483
469
  }) => Promise<{
484
470
  items: any[];
485
471
  pages: number;
486
472
  pageRange: string;
487
473
  } | TRole[]>;
488
474
  getRoleByUserId: (value: ObjectId | string) => Promise<TRole | null>;
489
- getRoleById: (_id: ObjectId | string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
475
+ getById: (_id: ObjectId | string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
490
476
  getRoleByName: (name: string) => Promise<mongodb.WithId<bson.Document> | TRole | null>;
491
- updateRole: (_id: string | ObjectId, value: TMiniRole, session?: ClientSession) => Promise<string>;
492
- deleteRole: (_id: ObjectId | string, session?: ClientSession) => Promise<string>;
477
+ updateRole: (_id: string | ObjectId, value: Pick<TRole, "name" | "permissions" | "description">, session?: ClientSession) => Promise<string>;
478
+ deleteById: (_id: ObjectId | string, session?: ClientSession) => Promise<string>;
493
479
  updatePermissionsById: (_id: string | ObjectId, permissions: TRole["permissions"], session?: ClientSession) => Promise<string>;
494
480
  delCachedData: () => void;
495
481
  };
496
482
 
483
+ declare function useRoleService(): {
484
+ deleteById: (id: string) => Promise<void>;
485
+ };
486
+
497
487
  declare function useRoleController(): {
498
488
  createRole: (req: Request, res: Response, next: NextFunction) => Promise<void>;
499
489
  getRoles: (req: Request, res: Response, next: NextFunction) => Promise<void>;
@@ -649,6 +639,7 @@ declare function useMemberRepo(): {
649
639
  createIndexes: () => Promise<void>;
650
640
  add: (value: TMember, session?: ClientSession) => Promise<string>;
651
641
  getById: (_id: string | ObjectId) => Promise<TMember | null>;
642
+ getByRole: (role: string | ObjectId) => Promise<TMember | null>;
652
643
  getByOrg: (org: string | ObjectId) => Promise<TMember | null>;
653
644
  getAll: ({ search, limit, page, user, org, type, status }?: {
654
645
  search: string;
@@ -969,4 +960,4 @@ declare const GEMINI_API_KEY: string;
969
960
  declare const ASSEMBLY_AI_API_KEY: string;
970
961
  declare const DOMAIN: string;
971
962
 
972
- export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, ASSEMBLY_AI_API_KEY, AudioFileData, AudioTranscriptionOptions, AudioTranscriptionResult, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, GEMINI_API_KEY, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MAddress, MFile, MMember, MONGO_DB, MONGO_URI, MOrg, MRole, MToken, MUser, MUserRole, MVerification, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PORT, PhonemeMatchOptions, PhonemeMatchResult, 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, TCounter, TFile, TMember, TMiniRole, TOrg, TPSGC, TPermission, TPermissionGroup, TRole, TToken, 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, schemaOrg, schemaPSGC, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, transactionSchema, useAddressController, useAddressRepo, useAppController, useAppRepo, useAppService, useAudioTranscriptionController, useAuthController, useAuthService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGeminiAiService, useGitHubService, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePSGCController, usePSGCRepo, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, useRoleController, useRoleRepo, useTokenRepo, useTranscribeService, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };
963
+ export { ACCESS_TOKEN_EXPIRY, ACCESS_TOKEN_SECRET, APP_ACCOUNT, APP_MAIN, ASSEMBLY_AI_API_KEY, AudioFileData, AudioTranscriptionOptions, AudioTranscriptionResult, DEFAULT_USER_EMAIL, DEFAULT_USER_FIRST_NAME, DEFAULT_USER_LAST_NAME, DEFAULT_USER_PASSWORD, DOMAIN, GEMINI_API_KEY, MAILER_EMAIL, MAILER_PASSWORD, MAILER_TRANSPORT_HOST, MAILER_TRANSPORT_PORT, MAILER_TRANSPORT_SECURE, MAddress, MFile, MMember, MONGO_DB, MONGO_URI, MOrg, MToken, MUser, MUserRole, MVerification, PAYPAL_API_URL, PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PORT, PhonemeMatchOptions, PhonemeMatchResult, 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, TCounter, TFile, TMember, TOrg, TPSGC, TPermission, TPermissionGroup, TRole, TToken, 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, schemaOrg, schemaPSGC, schemaPermission, schemaPermissionGroup, schemaPermissionGroupUpdate, schemaPermissionUpdate, schemaRole, schemaRoleUpdate, transactionSchema, useAddressController, useAddressRepo, useAppController, useAppRepo, useAppService, useAudioTranscriptionController, useAuthController, useAuthService, useCounterModel, useCounterRepo, useFileController, useFileRepo, useFileService, useGeminiAiService, useGitHubService, useMemberController, useMemberRepo, useOrgController, useOrgRepo, useOrgService, usePSGCController, usePSGCRepo, usePermissionController, usePermissionGroupController, usePermissionGroupRepo, usePermissionGroupService, usePermissionRepo, usePermissionService, useRoleController, useRoleRepo, useRoleService, useTokenRepo, useTranscribeService, useUserController, useUserRepo, useUserService, useUtilController, useVerificationController, useVerificationRepo, useVerificationService };