rl-core-api 0.1.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/README.md +99 -0
- package/dist/app.module.d.ts +2 -0
- package/dist/app.module.js +19 -0
- package/dist/core/auth/authenticatedUser.interface.d.ts +16 -0
- package/dist/core/auth/authenticatedUser.interface.js +2 -0
- package/dist/core/auth/cookie.util.d.ts +9 -0
- package/dist/core/auth/cookie.util.js +28 -0
- package/dist/core/auth/decorators/currentUser.decorator.d.ts +2 -0
- package/dist/core/auth/decorators/currentUser.decorator.js +9 -0
- package/dist/core/auth/decorators/public.decorator.d.ts +3 -0
- package/dist/core/auth/decorators/public.decorator.js +7 -0
- package/dist/core/auth/decorators/requirePermission.decorator.d.ts +5 -0
- package/dist/core/auth/decorators/requirePermission.decorator.js +10 -0
- package/dist/core/auth/guards/appThrottler.guard.d.ts +5 -0
- package/dist/core/auth/guards/appThrottler.guard.js +23 -0
- package/dist/core/auth/guards/csrf.guard.d.ts +8 -0
- package/dist/core/auth/guards/csrf.guard.js +55 -0
- package/dist/core/auth/guards/jwtAuth.guard.d.ts +10 -0
- package/dist/core/auth/guards/jwtAuth.guard.js +37 -0
- package/dist/core/auth/guards/permissions.guard.d.ts +7 -0
- package/dist/core/auth/guards/permissions.guard.js +42 -0
- package/dist/core/bootstrap/bootstrapCore.util.d.ts +9 -0
- package/dist/core/bootstrap/bootstrapCore.util.js +67 -0
- package/dist/core/config/config.module.d.ts +8 -0
- package/dist/core/config/config.module.js +34 -0
- package/dist/core/config/env.schema.d.ts +65 -0
- package/dist/core/config/env.schema.js +94 -0
- package/dist/core/config/env.service.d.ts +7 -0
- package/dist/core/config/env.service.js +27 -0
- package/dist/core/context/auditContext.d.ts +7 -0
- package/dist/core/context/auditContext.js +5 -0
- package/dist/core/core.module.d.ts +11 -0
- package/dist/core/core.module.js +73 -0
- package/dist/core/database/base.schema.d.ts +7 -0
- package/dist/core/database/base.schema.js +49 -0
- package/dist/core/database/createDataSource.util.d.ts +8 -0
- package/dist/core/database/createDataSource.util.js +27 -0
- package/dist/core/database/migrations/1710000000000-InitialSchema.d.ts +6 -0
- package/dist/core/database/migrations/1710000000000-InitialSchema.js +272 -0
- package/dist/core/database/migrations/1786060800000-FirstAccessTokenType.d.ts +6 -0
- package/dist/core/database/migrations/1786060800000-FirstAccessTokenType.js +19 -0
- package/dist/core/database/migrations/1786147200000-PermanentAccountLock.d.ts +6 -0
- package/dist/core/database/migrations/1786147200000-PermanentAccountLock.js +15 -0
- package/dist/core/database/migrations/1786233600000-Notifications.d.ts +6 -0
- package/dist/core/database/migrations/1786233600000-Notifications.js +59 -0
- package/dist/core/database/migrations/index.d.ts +3 -0
- package/dist/core/database/migrations/index.js +13 -0
- package/dist/core/database/seeds/runSeeds.d.ts +1 -0
- package/dist/core/database/seeds/runSeeds.js +20 -0
- package/dist/core/database/seeds/seedAdmin.d.ts +2 -0
- package/dist/core/database/seeds/seedAdmin.js +44 -0
- package/dist/core/database/seeds/seedPermissions.d.ts +2 -0
- package/dist/core/database/seeds/seedPermissions.js +93 -0
- package/dist/core/events/appEvent.enum.d.ts +31 -0
- package/dist/core/events/appEvent.enum.js +12 -0
- package/dist/core/filters/allExceptions.filter.d.ts +5 -0
- package/dist/core/filters/allExceptions.filter.js +61 -0
- package/dist/core/filters/appErrorCode.enum.d.ts +9 -0
- package/dist/core/filters/appErrorCode.enum.js +13 -0
- package/dist/core/health/health.controller.d.ts +11 -0
- package/dist/core/health/health.controller.js +56 -0
- package/dist/core/logger/winston.config.d.ts +2 -0
- package/dist/core/logger/winston.config.js +74 -0
- package/dist/core/mailer/mailer.module.d.ts +2 -0
- package/dist/core/mailer/mailer.module.js +21 -0
- package/dist/core/mailer/mailer.service.d.ts +14 -0
- package/dist/core/mailer/mailer.service.js +148 -0
- package/dist/core/openapi/exportOpenapi.d.ts +1 -0
- package/dist/core/openapi/exportOpenapi.js +25 -0
- package/dist/core/query/applyFilter.util.d.ts +11 -0
- package/dist/core/query/applyFilter.util.js +122 -0
- package/dist/core/query/filter.constants.d.ts +7 -0
- package/dist/core/query/filter.constants.js +64 -0
- package/dist/core/query/filterField.interface.d.ts +35 -0
- package/dist/core/query/filterField.interface.js +2 -0
- package/dist/core/query/filterFieldType.enum.d.ts +10 -0
- package/dist/core/query/filterFieldType.enum.js +14 -0
- package/dist/core/query/filterOperator.enum.d.ts +23 -0
- package/dist/core/query/filterOperator.enum.js +28 -0
- package/dist/core/query/filterSchema.response.d.ts +17 -0
- package/dist/core/query/filterSchema.response.js +82 -0
- package/dist/core/query/filterSort.util.d.ts +7 -0
- package/dist/core/query/filterSort.util.js +11 -0
- package/dist/core/query/paginateWithFilter.util.d.ts +11 -0
- package/dist/core/query/paginateWithFilter.util.js +37 -0
- package/dist/core/query/parseFilter.util.d.ts +2 -0
- package/dist/core/query/parseFilter.util.js +220 -0
- package/dist/core/utils/codedError.util.d.ts +5 -0
- package/dist/core/utils/codedError.util.js +23 -0
- package/dist/core/utils/crypto.util.d.ts +2 -0
- package/dist/core/utils/crypto.util.js +39 -0
- package/dist/core/utils/hash.util.d.ts +6 -0
- package/dist/core/utils/hash.util.js +67 -0
- package/dist/core/utils/ip.util.d.ts +1 -0
- package/dist/core/utils/ip.util.js +15 -0
- package/dist/core/utils/pagination.util.d.ts +21 -0
- package/dist/core/utils/pagination.util.js +98 -0
- package/dist/core/utils/paginationMeta.response.d.ts +7 -0
- package/dist/core/utils/paginationMeta.response.js +32 -0
- package/dist/core/utils/password.constants.d.ts +2 -0
- package/dist/core/utils/password.constants.js +5 -0
- package/dist/core/websocket/baseGateway.d.ts +21 -0
- package/dist/core/websocket/baseGateway.js +63 -0
- package/dist/core/websocket/socket.constants.d.ts +4 -0
- package/dist/core/websocket/socket.constants.js +9 -0
- package/dist/core/websocket/socketEvent.envelope.d.ts +8 -0
- package/dist/core/websocket/socketEvent.envelope.js +11 -0
- package/dist/core/websocket/socketOrigin.util.d.ts +2 -0
- package/dist/core/websocket/socketOrigin.util.js +15 -0
- package/dist/core/websocket/wsAuth.service.d.ts +20 -0
- package/dist/core/websocket/wsAuth.service.js +97 -0
- package/dist/core/websocket/wsUserResolver.interface.d.ts +5 -0
- package/dist/core/websocket/wsUserResolver.interface.js +4 -0
- package/dist/coreEntities.d.ts +12 -0
- package/dist/coreEntities.js +35 -0
- package/dist/dataSource.d.ts +3 -0
- package/dist/dataSource.js +13 -0
- package/dist/features/audit/audit.module.d.ts +2 -0
- package/dist/features/audit/audit.module.js +44 -0
- package/dist/features/audit/domain/audit.service.d.ts +34 -0
- package/dist/features/audit/domain/audit.service.js +93 -0
- package/dist/features/audit/domain/classifyError.util.d.ts +2 -0
- package/dist/features/audit/domain/classifyError.util.js +24 -0
- package/dist/features/audit/domain/index.d.ts +2 -0
- package/dist/features/audit/domain/index.js +18 -0
- package/dist/features/audit/infra/auditData.subscriber.d.ts +17 -0
- package/dist/features/audit/infra/auditData.subscriber.js +139 -0
- package/dist/features/audit/infra/index.d.ts +7 -0
- package/dist/features/audit/infra/index.js +23 -0
- package/dist/features/audit/infra/repositories/auditChange.repository.d.ts +7 -0
- package/dist/features/audit/infra/repositories/auditChange.repository.js +35 -0
- package/dist/features/audit/infra/repositories/auditDataChange.repository.d.ts +7 -0
- package/dist/features/audit/infra/repositories/auditDataChange.repository.js +35 -0
- package/dist/features/audit/infra/repositories/errorLog.repository.d.ts +7 -0
- package/dist/features/audit/infra/repositories/errorLog.repository.js +35 -0
- package/dist/features/audit/infra/schema/auditChange.schema.d.ts +14 -0
- package/dist/features/audit/infra/schema/auditChange.schema.js +68 -0
- package/dist/features/audit/infra/schema/auditDataChange.schema.d.ts +15 -0
- package/dist/features/audit/infra/schema/auditDataChange.schema.js +56 -0
- package/dist/features/audit/infra/schema/errorLog.schema.d.ts +21 -0
- package/dist/features/audit/infra/schema/errorLog.schema.js +69 -0
- package/dist/features/audit/presentation/audit.controller.d.ts +16 -0
- package/dist/features/audit/presentation/audit.controller.js +107 -0
- package/dist/features/audit/presentation/audit.interceptor.d.ts +8 -0
- package/dist/features/audit/presentation/audit.interceptor.js +78 -0
- package/dist/features/audit/presentation/filters/audit.filters.d.ts +4 -0
- package/dist/features/audit/presentation/filters/audit.filters.js +154 -0
- package/dist/features/audit/presentation/index.d.ts +2 -0
- package/dist/features/audit/presentation/index.js +18 -0
- package/dist/features/audit/presentation/responses/auditDataChange.response.d.ts +25 -0
- package/dist/features/audit/presentation/responses/auditDataChange.response.js +96 -0
- package/dist/features/audit/presentation/responses/log.response.d.ts +45 -0
- package/dist/features/audit/presentation/responses/log.response.js +164 -0
- package/dist/features/auth/auth.module.d.ts +2 -0
- package/dist/features/auth/auth.module.js +55 -0
- package/dist/features/auth/domain/auth.service.d.ts +66 -0
- package/dist/features/auth/domain/auth.service.js +289 -0
- package/dist/features/auth/domain/index.d.ts +5 -0
- package/dist/features/auth/domain/index.js +21 -0
- package/dist/features/auth/domain/jwtPayload.interface.d.ts +11 -0
- package/dist/features/auth/domain/jwtPayload.interface.js +2 -0
- package/dist/features/auth/domain/token.service.d.ts +56 -0
- package/dist/features/auth/domain/token.service.js +205 -0
- package/dist/features/auth/domain/twoFactor.service.d.ts +19 -0
- package/dist/features/auth/domain/twoFactor.service.js +103 -0
- package/dist/features/auth/domain/wsUserResolver.service.d.ts +10 -0
- package/dist/features/auth/domain/wsUserResolver.service.js +34 -0
- package/dist/features/auth/infra/index.d.ts +2 -0
- package/dist/features/auth/infra/index.js +18 -0
- package/dist/features/auth/infra/repositories/authToken.repository.d.ts +5 -0
- package/dist/features/auth/infra/repositories/authToken.repository.js +25 -0
- package/dist/features/auth/infra/schema/authToken.schema.d.ts +21 -0
- package/dist/features/auth/infra/schema/authToken.schema.js +73 -0
- package/dist/features/auth/presentation/auth.controller.d.ts +56 -0
- package/dist/features/auth/presentation/auth.controller.js +242 -0
- package/dist/features/auth/presentation/commands/clientType.enum.d.ts +4 -0
- package/dist/features/auth/presentation/commands/clientType.enum.js +8 -0
- package/dist/features/auth/presentation/commands/login.command.d.ts +4 -0
- package/dist/features/auth/presentation/commands/login.command.js +28 -0
- package/dist/features/auth/presentation/commands/password.command.d.ts +7 -0
- package/dist/features/auth/presentation/commands/password.command.js +37 -0
- package/dist/features/auth/presentation/commands/refreshToken.command.d.ts +3 -0
- package/dist/features/auth/presentation/commands/refreshToken.command.js +26 -0
- package/dist/features/auth/presentation/commands/twoFactor.command.d.ts +12 -0
- package/dist/features/auth/presentation/commands/twoFactor.command.js +68 -0
- package/dist/features/auth/presentation/index.d.ts +7 -0
- package/dist/features/auth/presentation/index.js +23 -0
- package/dist/features/auth/presentation/responses/sessionUser.response.d.ts +19 -0
- package/dist/features/auth/presentation/responses/sessionUser.response.js +90 -0
- package/dist/features/auth/presentation/strategies/jwt.strategy.d.ts +18 -0
- package/dist/features/auth/presentation/strategies/jwt.strategy.js +59 -0
- package/dist/features/auth/token.module.d.ts +2 -0
- package/dist/features/auth/token.module.js +23 -0
- package/dist/features/maintenance/domain/cleanup.service.d.ts +22 -0
- package/dist/features/maintenance/domain/cleanup.service.js +142 -0
- package/dist/features/maintenance/maintenance.module.d.ts +2 -0
- package/dist/features/maintenance/maintenance.module.js +24 -0
- package/dist/features/notifications/domain/enums/channelType.enum.d.ts +7 -0
- package/dist/features/notifications/domain/enums/channelType.enum.js +11 -0
- package/dist/features/notifications/domain/enums/deliveryStatus.enum.d.ts +8 -0
- package/dist/features/notifications/domain/enums/deliveryStatus.enum.js +12 -0
- package/dist/features/notifications/domain/enums/notificationType.enum.d.ts +6 -0
- package/dist/features/notifications/domain/enums/notificationType.enum.js +10 -0
- package/dist/features/notifications/domain/enums/scopeType.enum.d.ts +5 -0
- package/dist/features/notifications/domain/enums/scopeType.enum.js +9 -0
- package/dist/features/notifications/domain/notifications.service.d.ts +45 -0
- package/dist/features/notifications/domain/notifications.service.js +101 -0
- package/dist/features/notifications/infra/repositories/notification.repository.d.ts +14 -0
- package/dist/features/notifications/infra/repositories/notification.repository.js +74 -0
- package/dist/features/notifications/infra/repositories/notificationRead.repository.d.ts +6 -0
- package/dist/features/notifications/infra/repositories/notificationRead.repository.js +40 -0
- package/dist/features/notifications/infra/repositories/notificationScope.repository.d.ts +5 -0
- package/dist/features/notifications/infra/repositories/notificationScope.repository.js +25 -0
- package/dist/features/notifications/infra/schema/notification.schema.d.ts +13 -0
- package/dist/features/notifications/infra/schema/notification.schema.js +52 -0
- package/dist/features/notifications/infra/schema/notificationRead.schema.d.ts +7 -0
- package/dist/features/notifications/infra/schema/notificationRead.schema.js +38 -0
- package/dist/features/notifications/infra/schema/notificationScope.schema.d.ts +9 -0
- package/dist/features/notifications/infra/schema/notificationScope.schema.js +43 -0
- package/dist/features/notifications/notifications.module.d.ts +2 -0
- package/dist/features/notifications/notifications.module.js +45 -0
- package/dist/features/notifications/presentation/commands/createNotification.command.d.ts +13 -0
- package/dist/features/notifications/presentation/commands/createNotification.command.js +72 -0
- package/dist/features/notifications/presentation/domainEvents.listener.d.ts +13 -0
- package/dist/features/notifications/presentation/domainEvents.listener.js +121 -0
- package/dist/features/notifications/presentation/notifications.controller.d.ts +16 -0
- package/dist/features/notifications/presentation/notifications.controller.js +108 -0
- package/dist/features/notifications/presentation/notifications.gateway.d.ts +13 -0
- package/dist/features/notifications/presentation/notifications.gateway.js +58 -0
- package/dist/features/notifications/presentation/notifications.publisher.d.ts +9 -0
- package/dist/features/notifications/presentation/notifications.publisher.js +42 -0
- package/dist/features/notifications/presentation/responses/notification.response.d.ts +18 -0
- package/dist/features/notifications/presentation/responses/notification.response.js +72 -0
- package/dist/features/rbac/domain/index.d.ts +2 -0
- package/dist/features/rbac/domain/index.js +18 -0
- package/dist/features/rbac/domain/rbac.catalog.d.ts +21 -0
- package/dist/features/rbac/domain/rbac.catalog.js +153 -0
- package/dist/features/rbac/domain/rbac.service.d.ts +68 -0
- package/dist/features/rbac/domain/rbac.service.js +436 -0
- package/dist/features/rbac/infra/index.d.ts +12 -0
- package/dist/features/rbac/infra/index.js +28 -0
- package/dist/features/rbac/infra/repositories/action.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/action.repository.js +25 -0
- package/dist/features/rbac/infra/repositories/group.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/group.repository.js +25 -0
- package/dist/features/rbac/infra/repositories/permission.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/permission.repository.js +25 -0
- package/dist/features/rbac/infra/repositories/resource.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/resource.repository.js +25 -0
- package/dist/features/rbac/infra/repositories/role.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/role.repository.js +25 -0
- package/dist/features/rbac/infra/repositories/scope.repository.d.ts +5 -0
- package/dist/features/rbac/infra/repositories/scope.repository.js +25 -0
- package/dist/features/rbac/infra/schema/action.schema.d.ts +6 -0
- package/dist/features/rbac/infra/schema/action.schema.js +36 -0
- package/dist/features/rbac/infra/schema/group.schema.d.ts +12 -0
- package/dist/features/rbac/infra/schema/group.schema.js +60 -0
- package/dist/features/rbac/infra/schema/permission.schema.d.ts +15 -0
- package/dist/features/rbac/infra/schema/permission.schema.js +66 -0
- package/dist/features/rbac/infra/schema/resource.schema.d.ts +6 -0
- package/dist/features/rbac/infra/schema/resource.schema.js +36 -0
- package/dist/features/rbac/infra/schema/role.schema.d.ts +8 -0
- package/dist/features/rbac/infra/schema/role.schema.js +46 -0
- package/dist/features/rbac/infra/schema/scope.schema.d.ts +6 -0
- package/dist/features/rbac/infra/schema/scope.schema.js +36 -0
- package/dist/features/rbac/presentation/commands/createAction.command.d.ts +4 -0
- package/dist/features/rbac/presentation/commands/createAction.command.js +32 -0
- package/dist/features/rbac/presentation/commands/createGroup.command.d.ts +7 -0
- package/dist/features/rbac/presentation/commands/createGroup.command.js +54 -0
- package/dist/features/rbac/presentation/commands/createPermission.command.d.ts +4 -0
- package/dist/features/rbac/presentation/commands/createPermission.command.js +35 -0
- package/dist/features/rbac/presentation/commands/createResource.command.d.ts +4 -0
- package/dist/features/rbac/presentation/commands/createResource.command.js +32 -0
- package/dist/features/rbac/presentation/commands/createRole.command.d.ts +5 -0
- package/dist/features/rbac/presentation/commands/createRole.command.js +38 -0
- package/dist/features/rbac/presentation/commands/createScope.command.d.ts +4 -0
- package/dist/features/rbac/presentation/commands/createScope.command.js +32 -0
- package/dist/features/rbac/presentation/commands/updateAction.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updateAction.command.js +24 -0
- package/dist/features/rbac/presentation/commands/updateGroup.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updateGroup.command.js +24 -0
- package/dist/features/rbac/presentation/commands/updatePermission.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updatePermission.command.js +24 -0
- package/dist/features/rbac/presentation/commands/updateResource.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updateResource.command.js +24 -0
- package/dist/features/rbac/presentation/commands/updateRole.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updateRole.command.js +24 -0
- package/dist/features/rbac/presentation/commands/updateScope.command.d.ts +6 -0
- package/dist/features/rbac/presentation/commands/updateScope.command.js +24 -0
- package/dist/features/rbac/presentation/index.d.ts +13 -0
- package/dist/features/rbac/presentation/index.js +29 -0
- package/dist/features/rbac/presentation/rbac.controller.d.ts +54 -0
- package/dist/features/rbac/presentation/rbac.controller.js +413 -0
- package/dist/features/rbac/presentation/responses/rbac.response.d.ts +47 -0
- package/dist/features/rbac/presentation/responses/rbac.response.js +161 -0
- package/dist/features/rbac/rbac.module.d.ts +2 -0
- package/dist/features/rbac/rbac.module.js +55 -0
- package/dist/features/users/domain/avatar.service.d.ts +4 -0
- package/dist/features/users/domain/avatar.service.js +61 -0
- package/dist/features/users/domain/index.d.ts +2 -0
- package/dist/features/users/domain/index.js +18 -0
- package/dist/features/users/domain/users.service.d.ts +46 -0
- package/dist/features/users/domain/users.service.js +291 -0
- package/dist/features/users/infra/index.d.ts +4 -0
- package/dist/features/users/infra/index.js +20 -0
- package/dist/features/users/infra/repositories/passwordHistory.repository.d.ts +5 -0
- package/dist/features/users/infra/repositories/passwordHistory.repository.js +25 -0
- package/dist/features/users/infra/repositories/user.repository.d.ts +8 -0
- package/dist/features/users/infra/repositories/user.repository.js +56 -0
- package/dist/features/users/infra/schema/passwordHistory.schema.d.ts +5 -0
- package/dist/features/users/infra/schema/passwordHistory.schema.js +29 -0
- package/dist/features/users/infra/schema/user.schema.d.ts +28 -0
- package/dist/features/users/infra/schema/user.schema.js +153 -0
- package/dist/features/users/presentation/commands/changePassword.command.d.ts +4 -0
- package/dist/features/users/presentation/commands/changePassword.command.js +29 -0
- package/dist/features/users/presentation/commands/createUser.command.d.ts +8 -0
- package/dist/features/users/presentation/commands/createUser.command.js +56 -0
- package/dist/features/users/presentation/commands/updateProfile.command.d.ts +5 -0
- package/dist/features/users/presentation/commands/updateProfile.command.js +38 -0
- package/dist/features/users/presentation/commands/updateUser.command.d.ts +5 -0
- package/dist/features/users/presentation/commands/updateUser.command.js +8 -0
- package/dist/features/users/presentation/filters/users.filters.d.ts +3 -0
- package/dist/features/users/presentation/filters/users.filters.js +62 -0
- package/dist/features/users/presentation/index.d.ts +5 -0
- package/dist/features/users/presentation/index.js +21 -0
- package/dist/features/users/presentation/responses/user.response.d.ts +25 -0
- package/dist/features/users/presentation/responses/user.response.js +95 -0
- package/dist/features/users/presentation/users.controller.d.ts +30 -0
- package/dist/features/users/presentation/users.controller.js +247 -0
- package/dist/features/users/users.module.d.ts +2 -0
- package/dist/features/users/users.module.js +42 -0
- package/dist/index.d.ts +61 -0
- package/dist/index.js +149 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +5 -0
- package/dist/rlCore.module.d.ts +10 -0
- package/dist/rlCore.module.js +42 -0
- package/package.json +139 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.User = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
15
|
+
const typeorm_1 = require("typeorm");
|
|
16
|
+
const base_schema_1 = require("../../../../core/database/base.schema");
|
|
17
|
+
const group_schema_1 = require("../../../rbac/infra/schema/group.schema");
|
|
18
|
+
const permission_schema_1 = require("../../../rbac/infra/schema/permission.schema");
|
|
19
|
+
const role_schema_1 = require("../../../rbac/infra/schema/role.schema");
|
|
20
|
+
const MAX_LOGIN_ATTEMPTS = Number(process.env.LOGIN_MAX_ATTEMPTS ?? 10);
|
|
21
|
+
let User = class User extends base_schema_1.BaseEntity {
|
|
22
|
+
get fullName() {
|
|
23
|
+
return [this.name, this.lastName].filter(Boolean).join(" ");
|
|
24
|
+
}
|
|
25
|
+
isLocked(maxAttempts) {
|
|
26
|
+
return this.failedLoginAttempts >= maxAttempts;
|
|
27
|
+
}
|
|
28
|
+
get locked() {
|
|
29
|
+
return this.isLocked(MAX_LOGIN_ATTEMPTS);
|
|
30
|
+
}
|
|
31
|
+
remainingAttempts(maxAttempts) {
|
|
32
|
+
return Math.max(0, maxAttempts - this.failedLoginAttempts);
|
|
33
|
+
}
|
|
34
|
+
isPasswordExpired(maxAgeDays) {
|
|
35
|
+
if (!this.passwordChangedAt) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
const ageMs = Date.now() - this.passwordChangedAt.getTime();
|
|
39
|
+
return ageMs > maxAgeDays * 24 * 60 * 60 * 1000;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.User = User;
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, swagger_1.ApiProperty)(),
|
|
45
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 100 }),
|
|
46
|
+
__metadata("design:type", String)
|
|
47
|
+
], User.prototype, "name", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, swagger_1.ApiProperty)({ required: false, nullable: true }),
|
|
50
|
+
(0, typeorm_1.Column)({ name: "last_name", type: "varchar", length: 100, nullable: true }),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], User.prototype, "lastName", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, swagger_1.ApiProperty)({ required: false, nullable: true }),
|
|
55
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 20, nullable: true }),
|
|
56
|
+
__metadata("design:type", Object)
|
|
57
|
+
], User.prototype, "phone", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, swagger_1.ApiProperty)({ required: false, nullable: true }),
|
|
60
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 500, nullable: true }),
|
|
61
|
+
__metadata("design:type", Object)
|
|
62
|
+
], User.prototype, "avatar", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
(0, swagger_1.ApiProperty)(),
|
|
65
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 255, unique: true }),
|
|
66
|
+
__metadata("design:type", String)
|
|
67
|
+
], User.prototype, "email", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, class_transformer_1.Exclude)(),
|
|
70
|
+
(0, typeorm_1.Column)({ type: "varchar", length: 255 }),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], User.prototype, "password", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, class_transformer_1.Exclude)(),
|
|
75
|
+
(0, typeorm_1.Column)({ name: "password_changed_at", type: "datetime", nullable: true }),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], User.prototype, "passwordChangedAt", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, class_transformer_1.Exclude)(),
|
|
80
|
+
(0, typeorm_1.Column)({ name: "must_change_password", type: "boolean", default: false }),
|
|
81
|
+
__metadata("design:type", Boolean)
|
|
82
|
+
], User.prototype, "mustChangePassword", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, swagger_1.ApiProperty)(),
|
|
85
|
+
(0, typeorm_1.Column)({ name: "is_active", type: "boolean", default: true }),
|
|
86
|
+
__metadata("design:type", Boolean)
|
|
87
|
+
], User.prototype, "isActive", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, swagger_1.ApiProperty)({ description: "2FA TOTP já configurado e confirmado" }),
|
|
90
|
+
(0, typeorm_1.Column)({ name: "two_factor_enabled", type: "boolean", default: false }),
|
|
91
|
+
__metadata("design:type", Boolean)
|
|
92
|
+
], User.prototype, "twoFactorEnabled", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, class_transformer_1.Exclude)(),
|
|
95
|
+
(0, typeorm_1.Column)({
|
|
96
|
+
name: "two_factor_secret",
|
|
97
|
+
type: "varchar",
|
|
98
|
+
length: 255,
|
|
99
|
+
nullable: true,
|
|
100
|
+
}),
|
|
101
|
+
__metadata("design:type", Object)
|
|
102
|
+
], User.prototype, "twoFactorSecret", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, swagger_1.ApiProperty)({ required: false, nullable: true }),
|
|
105
|
+
(0, typeorm_1.Column)({ name: "two_factor_confirmed_at", type: "datetime", nullable: true }),
|
|
106
|
+
__metadata("design:type", Object)
|
|
107
|
+
], User.prototype, "twoFactorConfirmedAt", void 0);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, class_transformer_1.Exclude)(),
|
|
110
|
+
(0, typeorm_1.Column)({ name: "backup_codes", type: "json", nullable: true }),
|
|
111
|
+
__metadata("design:type", Object)
|
|
112
|
+
], User.prototype, "backupCodes", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, class_transformer_1.Exclude)(),
|
|
115
|
+
(0, typeorm_1.Column)({ name: "failed_login_attempts", type: "int", default: 0 }),
|
|
116
|
+
__metadata("design:type", Number)
|
|
117
|
+
], User.prototype, "failedLoginAttempts", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, typeorm_1.ManyToMany)(() => role_schema_1.Role),
|
|
120
|
+
(0, typeorm_1.JoinTable)({
|
|
121
|
+
name: "user_roles",
|
|
122
|
+
joinColumn: { name: "user_id", referencedColumnName: "id" },
|
|
123
|
+
inverseJoinColumn: { name: "role_id", referencedColumnName: "id" },
|
|
124
|
+
}),
|
|
125
|
+
__metadata("design:type", Array)
|
|
126
|
+
], User.prototype, "roles", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, typeorm_1.ManyToMany)(() => permission_schema_1.Permission),
|
|
129
|
+
(0, typeorm_1.JoinTable)({
|
|
130
|
+
name: "user_permissions",
|
|
131
|
+
joinColumn: { name: "user_id", referencedColumnName: "id" },
|
|
132
|
+
inverseJoinColumn: { name: "permission_id", referencedColumnName: "id" },
|
|
133
|
+
}),
|
|
134
|
+
__metadata("design:type", Array)
|
|
135
|
+
], User.prototype, "directPermissions", void 0);
|
|
136
|
+
__decorate([
|
|
137
|
+
(0, typeorm_1.ManyToMany)(() => group_schema_1.Group),
|
|
138
|
+
(0, typeorm_1.JoinTable)({
|
|
139
|
+
name: "user_groups",
|
|
140
|
+
joinColumn: { name: "user_id", referencedColumnName: "id" },
|
|
141
|
+
inverseJoinColumn: { name: "group_id", referencedColumnName: "id" },
|
|
142
|
+
}),
|
|
143
|
+
__metadata("design:type", Array)
|
|
144
|
+
], User.prototype, "groups", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
(0, swagger_1.ApiProperty)({ description: "Conta travada por excesso de tentativas" }),
|
|
147
|
+
(0, class_transformer_1.Expose)(),
|
|
148
|
+
__metadata("design:type", Boolean),
|
|
149
|
+
__metadata("design:paramtypes", [])
|
|
150
|
+
], User.prototype, "locked", null);
|
|
151
|
+
exports.User = User = __decorate([
|
|
152
|
+
(0, typeorm_1.Entity)("users")
|
|
153
|
+
], User);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ChangePasswordCommand = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
const password_constants_1 = require("../../../../core/utils/password.constants");
|
|
16
|
+
class ChangePasswordCommand {
|
|
17
|
+
}
|
|
18
|
+
exports.ChangePasswordCommand = ChangePasswordCommand;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, swagger_1.ApiProperty)(),
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], ChangePasswordCommand.prototype, "currentPassword", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, swagger_1.ApiProperty)(),
|
|
26
|
+
(0, class_validator_1.IsString)(),
|
|
27
|
+
(0, class_validator_1.Matches)(password_constants_1.STRONG_PASSWORD_REGEX, { message: password_constants_1.WEAK_PASSWORD_MESSAGE }),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], ChangePasswordCommand.prototype, "newPassword", void 0);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CreateUserCommand = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class CreateUserCommand {
|
|
16
|
+
}
|
|
17
|
+
exports.CreateUserCommand = CreateUserCommand;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, swagger_1.ApiProperty)(),
|
|
20
|
+
(0, class_validator_1.IsString)(),
|
|
21
|
+
(0, class_validator_1.Length)(2, 100),
|
|
22
|
+
__metadata("design:type", String)
|
|
23
|
+
], CreateUserCommand.prototype, "name", void 0);
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, swagger_1.ApiProperty)({ required: false }),
|
|
26
|
+
(0, class_validator_1.IsOptional)(),
|
|
27
|
+
(0, class_validator_1.IsString)(),
|
|
28
|
+
(0, class_validator_1.Length)(2, 100),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], CreateUserCommand.prototype, "lastName", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, swagger_1.ApiProperty)({ required: false }),
|
|
33
|
+
(0, class_validator_1.IsOptional)(),
|
|
34
|
+
(0, class_validator_1.IsString)(),
|
|
35
|
+
(0, class_validator_1.Length)(8, 20),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], CreateUserCommand.prototype, "phone", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, swagger_1.ApiProperty)(),
|
|
40
|
+
(0, class_validator_1.IsEmail)(),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], CreateUserCommand.prototype, "email", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, swagger_1.ApiProperty)({ required: false, default: true }),
|
|
45
|
+
(0, class_validator_1.IsOptional)(),
|
|
46
|
+
(0, class_validator_1.IsBoolean)(),
|
|
47
|
+
__metadata("design:type", Boolean)
|
|
48
|
+
], CreateUserCommand.prototype, "isActive", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, swagger_1.ApiProperty)({ required: false, type: [String], format: "uuid" }),
|
|
51
|
+
(0, class_validator_1.IsOptional)(),
|
|
52
|
+
(0, class_validator_1.IsArray)(),
|
|
53
|
+
(0, class_validator_1.ArrayUnique)(),
|
|
54
|
+
(0, class_validator_1.IsUUID)("all", { each: true }),
|
|
55
|
+
__metadata("design:type", Array)
|
|
56
|
+
], CreateUserCommand.prototype, "roleIds", void 0);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.UpdateProfileCommand = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_validator_1 = require("class-validator");
|
|
15
|
+
class UpdateProfileCommand {
|
|
16
|
+
}
|
|
17
|
+
exports.UpdateProfileCommand = UpdateProfileCommand;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, swagger_1.ApiProperty)({ required: false }),
|
|
20
|
+
(0, class_validator_1.IsOptional)(),
|
|
21
|
+
(0, class_validator_1.IsString)(),
|
|
22
|
+
(0, class_validator_1.Length)(2, 100),
|
|
23
|
+
__metadata("design:type", String)
|
|
24
|
+
], UpdateProfileCommand.prototype, "name", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, swagger_1.ApiProperty)({ required: false }),
|
|
27
|
+
(0, class_validator_1.IsOptional)(),
|
|
28
|
+
(0, class_validator_1.IsString)(),
|
|
29
|
+
(0, class_validator_1.Length)(2, 100),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], UpdateProfileCommand.prototype, "lastName", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, swagger_1.ApiProperty)({ required: false }),
|
|
34
|
+
(0, class_validator_1.IsOptional)(),
|
|
35
|
+
(0, class_validator_1.IsString)(),
|
|
36
|
+
(0, class_validator_1.Length)(8, 20),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], UpdateProfileCommand.prototype, "phone", void 0);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateUserCommand = void 0;
|
|
4
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
5
|
+
const createUser_command_1 = require("./createUser.command");
|
|
6
|
+
class UpdateUserCommand extends (0, swagger_1.PartialType)(createUser_command_1.CreateUserCommand) {
|
|
7
|
+
}
|
|
8
|
+
exports.UpdateUserCommand = UpdateUserCommand;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.USERS_SEARCH_FIELDS = exports.USERS_FILTER_CATALOG = void 0;
|
|
4
|
+
const filterFieldType_enum_1 = require("../../../../core/query/filterFieldType.enum");
|
|
5
|
+
exports.USERS_FILTER_CATALOG = [
|
|
6
|
+
{
|
|
7
|
+
field: "name",
|
|
8
|
+
column: "name",
|
|
9
|
+
label: "Nome",
|
|
10
|
+
type: filterFieldType_enum_1.FilterFieldType.Text,
|
|
11
|
+
sortable: true,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
field: "lastName",
|
|
15
|
+
column: "lastName",
|
|
16
|
+
label: "Sobrenome",
|
|
17
|
+
type: filterFieldType_enum_1.FilterFieldType.Text,
|
|
18
|
+
sortable: true,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
field: "email",
|
|
22
|
+
column: "email",
|
|
23
|
+
label: "E-mail",
|
|
24
|
+
type: filterFieldType_enum_1.FilterFieldType.Text,
|
|
25
|
+
sortable: true,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
field: "phone",
|
|
29
|
+
column: "phone",
|
|
30
|
+
label: "Telefone",
|
|
31
|
+
type: filterFieldType_enum_1.FilterFieldType.Text,
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
field: "isActive",
|
|
35
|
+
column: "isActive",
|
|
36
|
+
label: "Ativo",
|
|
37
|
+
type: filterFieldType_enum_1.FilterFieldType.Boolean,
|
|
38
|
+
sortable: true,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
field: "twoFactorEnabled",
|
|
42
|
+
column: "twoFactorEnabled",
|
|
43
|
+
label: "2FA configurado",
|
|
44
|
+
type: filterFieldType_enum_1.FilterFieldType.Boolean,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
field: "createdAt",
|
|
48
|
+
column: "createdAt",
|
|
49
|
+
label: "Criado em",
|
|
50
|
+
type: filterFieldType_enum_1.FilterFieldType.DateTime,
|
|
51
|
+
sortable: true,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
field: "roleName",
|
|
55
|
+
column: "name",
|
|
56
|
+
label: "Papel",
|
|
57
|
+
type: filterFieldType_enum_1.FilterFieldType.Select,
|
|
58
|
+
optionsUrl: "/rbac/roles",
|
|
59
|
+
relation: { property: "roles", alias: "roles", kind: "toMany" },
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
exports.USERS_SEARCH_FIELDS = ["name", "email"];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./commands/changePassword.command"), exports);
|
|
18
|
+
__exportStar(require("./commands/createUser.command"), exports);
|
|
19
|
+
__exportStar(require("./commands/updateProfile.command"), exports);
|
|
20
|
+
__exportStar(require("./commands/updateUser.command"), exports);
|
|
21
|
+
__exportStar(require("./users.controller"), exports);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PaginationMetaResponse } from "../../../../core/utils/paginationMeta.response";
|
|
2
|
+
export declare class UserRoleResponse {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class UserResponse {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
lastName?: string | null;
|
|
10
|
+
email: string;
|
|
11
|
+
phone?: string | null;
|
|
12
|
+
avatar?: string | null;
|
|
13
|
+
isActive: boolean;
|
|
14
|
+
locked: boolean;
|
|
15
|
+
twoFactorEnabled: boolean;
|
|
16
|
+
twoFactorConfirmedAt?: Date | null;
|
|
17
|
+
roles?: UserRoleResponse[];
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
updatedAt: Date;
|
|
20
|
+
deletedAt?: Date | null;
|
|
21
|
+
}
|
|
22
|
+
export declare class PaginatedUsersResponse {
|
|
23
|
+
items: UserResponse[];
|
|
24
|
+
meta: PaginationMetaResponse;
|
|
25
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PaginatedUsersResponse = exports.UserResponse = exports.UserRoleResponse = void 0;
|
|
13
|
+
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const paginationMeta_response_1 = require("../../../../core/utils/paginationMeta.response");
|
|
15
|
+
class UserRoleResponse {
|
|
16
|
+
}
|
|
17
|
+
exports.UserRoleResponse = UserRoleResponse;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, swagger_1.ApiProperty)({ format: "uuid" }),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], UserRoleResponse.prototype, "id", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, swagger_1.ApiProperty)({ example: "admin" }),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], UserRoleResponse.prototype, "name", void 0);
|
|
26
|
+
class UserResponse {
|
|
27
|
+
}
|
|
28
|
+
exports.UserResponse = UserResponse;
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, swagger_1.ApiProperty)({ format: "uuid" }),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], UserResponse.prototype, "id", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, swagger_1.ApiProperty)(),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], UserResponse.prototype, "name", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, swagger_1.ApiProperty)({ type: String, required: false, nullable: true }),
|
|
39
|
+
__metadata("design:type", Object)
|
|
40
|
+
], UserResponse.prototype, "lastName", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, swagger_1.ApiProperty)({ example: "admin@admin.com" }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], UserResponse.prototype, "email", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, swagger_1.ApiProperty)({ type: String, required: false, nullable: true }),
|
|
47
|
+
__metadata("design:type", Object)
|
|
48
|
+
], UserResponse.prototype, "phone", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, swagger_1.ApiProperty)({ type: String, required: false, nullable: true }),
|
|
51
|
+
__metadata("design:type", Object)
|
|
52
|
+
], UserResponse.prototype, "avatar", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, swagger_1.ApiProperty)(),
|
|
55
|
+
__metadata("design:type", Boolean)
|
|
56
|
+
], UserResponse.prototype, "isActive", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, swagger_1.ApiProperty)({ description: "Conta travada por excesso de tentativas" }),
|
|
59
|
+
__metadata("design:type", Boolean)
|
|
60
|
+
], UserResponse.prototype, "locked", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, swagger_1.ApiProperty)({ description: "2FA TOTP já configurado e confirmado" }),
|
|
63
|
+
__metadata("design:type", Boolean)
|
|
64
|
+
], UserResponse.prototype, "twoFactorEnabled", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, swagger_1.ApiProperty)({ type: String, format: "date-time", required: false, nullable: true }),
|
|
67
|
+
__metadata("design:type", Object)
|
|
68
|
+
], UserResponse.prototype, "twoFactorConfirmedAt", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, swagger_1.ApiProperty)({ type: [UserRoleResponse], required: false }),
|
|
71
|
+
__metadata("design:type", Array)
|
|
72
|
+
], UserResponse.prototype, "roles", void 0);
|
|
73
|
+
__decorate([
|
|
74
|
+
(0, swagger_1.ApiProperty)({ format: "date-time" }),
|
|
75
|
+
__metadata("design:type", Date)
|
|
76
|
+
], UserResponse.prototype, "createdAt", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, swagger_1.ApiProperty)({ format: "date-time" }),
|
|
79
|
+
__metadata("design:type", Date)
|
|
80
|
+
], UserResponse.prototype, "updatedAt", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, swagger_1.ApiProperty)({ type: String, format: "date-time", required: false, nullable: true }),
|
|
83
|
+
__metadata("design:type", Object)
|
|
84
|
+
], UserResponse.prototype, "deletedAt", void 0);
|
|
85
|
+
class PaginatedUsersResponse {
|
|
86
|
+
}
|
|
87
|
+
exports.PaginatedUsersResponse = PaginatedUsersResponse;
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, swagger_1.ApiProperty)({ type: [UserResponse] }),
|
|
90
|
+
__metadata("design:type", Array)
|
|
91
|
+
], PaginatedUsersResponse.prototype, "items", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, swagger_1.ApiProperty)({ type: paginationMeta_response_1.PaginationMetaResponse }),
|
|
94
|
+
__metadata("design:type", paginationMeta_response_1.PaginationMetaResponse)
|
|
95
|
+
], PaginatedUsersResponse.prototype, "meta", void 0);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AuthenticatedUser } from "../../../core/auth/authenticatedUser.interface";
|
|
2
|
+
import { FilterFieldResponse } from "../../../core/query/filterSchema.response";
|
|
3
|
+
import { Paginated, PaginationQuery } from "../../../core/utils/pagination.util";
|
|
4
|
+
import { AvatarService } from "../domain/avatar.service";
|
|
5
|
+
import { UsersService } from "../domain/users.service";
|
|
6
|
+
import { User } from "../infra/schema/user.schema";
|
|
7
|
+
import { ChangePasswordCommand } from "./commands/changePassword.command";
|
|
8
|
+
import { CreateUserCommand } from "./commands/createUser.command";
|
|
9
|
+
import { UpdateProfileCommand } from "./commands/updateProfile.command";
|
|
10
|
+
import { UpdateUserCommand } from "./commands/updateUser.command";
|
|
11
|
+
export declare class UsersController {
|
|
12
|
+
private readonly users;
|
|
13
|
+
private readonly avatar;
|
|
14
|
+
constructor(users: UsersService, avatar: AvatarService);
|
|
15
|
+
me(userId: string): Promise<User>;
|
|
16
|
+
updateMe(userId: string, dto: UpdateProfileCommand): Promise<User>;
|
|
17
|
+
changeMyPassword(userId: string, dto: ChangePasswordCommand): Promise<void>;
|
|
18
|
+
uploadAvatar(userId: string, file: Express.Multer.File): Promise<User>;
|
|
19
|
+
deleteAvatar(userId: string): Promise<void>;
|
|
20
|
+
list(query: PaginationQuery, actor: AuthenticatedUser): Promise<Paginated<User>>;
|
|
21
|
+
filterSchema(actor: AuthenticatedUser): FilterFieldResponse[];
|
|
22
|
+
findOne(id: string): Promise<User>;
|
|
23
|
+
create(dto: CreateUserCommand, actor: AuthenticatedUser): Promise<User>;
|
|
24
|
+
update(id: string, dto: UpdateUserCommand, actor: AuthenticatedUser): Promise<User>;
|
|
25
|
+
setActive(id: string, state: string): Promise<User>;
|
|
26
|
+
sendPasswordResetLink(id: string): Promise<void>;
|
|
27
|
+
sendFirstAccessLink(id: string): Promise<void>;
|
|
28
|
+
adminResetTwoFactor(id: string): Promise<void>;
|
|
29
|
+
remove(id: string, current: AuthenticatedUser): Promise<void>;
|
|
30
|
+
}
|