@neohm/nestend 3.0.3 → 3.0.4
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 +114 -71
- package/dist/admin/admin.module.d.ts.map +1 -1
- package/dist/admin/admin.module.js +9 -2
- package/dist/admin/admin.module.js.map +1 -1
- package/dist/admin/controllers/admin.scheduled.task.controller.js +1 -1
- package/dist/admin/controllers/admin.scheduled.task.controller.js.map +1 -1
- package/dist/admin/controllers/admin.tenant.controller.d.ts +5 -1
- package/dist/admin/controllers/admin.tenant.controller.d.ts.map +1 -1
- package/dist/admin/controllers/admin.tenant.controller.js +10 -4
- package/dist/admin/controllers/admin.tenant.controller.js.map +1 -1
- package/dist/admin/controllers/admin.user.controller.d.ts +5 -1
- package/dist/admin/controllers/admin.user.controller.d.ts.map +1 -1
- package/dist/admin/controllers/admin.user.controller.js +10 -4
- package/dist/admin/controllers/admin.user.controller.js.map +1 -1
- package/dist/admin/libraries/admin.user.data.processor.d.ts.map +1 -1
- package/dist/admin/libraries/admin.user.data.processor.js +2 -1
- package/dist/admin/libraries/admin.user.data.processor.js.map +1 -1
- package/dist/admin/libraries/bulk.user.data.processor.d.ts.map +1 -1
- package/dist/admin/libraries/bulk.user.data.processor.js +4 -3
- package/dist/admin/libraries/bulk.user.data.processor.js.map +1 -1
- package/dist/admin/libraries/client.user.data.processor.d.ts +9 -1
- package/dist/admin/libraries/client.user.data.processor.d.ts.map +1 -1
- package/dist/admin/libraries/client.user.data.processor.js +42 -2
- package/dist/admin/libraries/client.user.data.processor.js.map +1 -1
- package/dist/admin/libraries/tenant.data.processor.d.ts +8 -1
- package/dist/admin/libraries/tenant.data.processor.d.ts.map +1 -1
- package/dist/admin/libraries/tenant.data.processor.js +40 -2
- package/dist/admin/libraries/tenant.data.processor.js.map +1 -1
- package/dist/auth/controllers/admin.auth.controller.js +1 -1
- package/dist/auth/controllers/admin.auth.controller.js.map +1 -1
- package/dist/auth/controllers/auth.controller.js +1 -1
- package/dist/auth/controllers/auth.controller.js.map +1 -1
- package/dist/auth/processors/change.password.data.processor.d.ts.map +1 -1
- package/dist/auth/processors/change.password.data.processor.js.map +1 -1
- package/dist/auth/processors/register.user.data.processor.d.ts.map +1 -1
- package/dist/auth/processors/register.user.data.processor.js +2 -1
- package/dist/auth/processors/register.user.data.processor.js.map +1 -1
- package/dist/auth/services/admin.auth.service.d.ts.map +1 -1
- package/dist/auth/services/admin.auth.service.js +1 -0
- package/dist/auth/services/admin.auth.service.js.map +1 -1
- package/dist/auth/services/auth.service.d.ts.map +1 -1
- package/dist/auth/services/auth.service.js +1 -0
- package/dist/auth/services/auth.service.js.map +1 -1
- package/dist/auth/utilities/auth.utilities.d.ts +2 -0
- package/dist/auth/utilities/auth.utilities.d.ts.map +1 -1
- package/dist/auth/utilities/auth.utilities.js +7 -0
- package/dist/auth/utilities/auth.utilities.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -6
- package/dist/index.js.map +1 -1
- package/dist/migrations/1749600000021.CreateSysEmailNotificationLogsTable.js +2 -2
- package/dist/notification/dtos/email.notification.options.dto.d.ts +3 -3
- package/dist/notification/dtos/email.notification.options.dto.js +3 -3
- package/dist/notification/entities/email.notification.log.entity.d.ts +1 -1
- package/dist/notification/entities/email.notification.log.entity.js +1 -1
- package/dist/notification/enums/email.notification.default.enum.d.ts +5 -1
- package/dist/notification/enums/email.notification.default.enum.d.ts.map +1 -1
- package/dist/notification/enums/email.notification.default.enum.js +4 -0
- package/dist/notification/enums/email.notification.default.enum.js.map +1 -1
- package/dist/notification/enums/email.template.identifier.enum.d.ts +5 -0
- package/dist/notification/enums/email.template.identifier.enum.d.ts.map +1 -0
- package/dist/notification/enums/email.template.identifier.enum.js +9 -0
- package/dist/notification/enums/email.template.identifier.enum.js.map +1 -0
- package/dist/notification/es6.classes.d.ts.map +1 -1
- package/dist/notification/es6.classes.js +10 -2
- package/dist/notification/es6.classes.js.map +1 -1
- package/dist/notification/libraries/process.email.notification.js +6 -6
- package/dist/notification/services/email.notification.service.js +9 -9
- package/dist/notification/types/email.notification.types.d.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -82,32 +82,32 @@ app.useGlobalInterceptors(
|
|
|
82
82
|
|
|
83
83
|
## Feature Map
|
|
84
84
|
|
|
85
|
-
| Area | Key exports | Notes
|
|
86
|
-
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
87
|
-
| Entities | `RootEntity`, `CommonEntity`, `CommonAdminEntity`, `UserEntity`, `AdminUserEntity`, `SystemRoleEntity`, `SystemAdminRoleEntity`, ... | uuid PK, soft deletes, `created_by`, jsonb `attributes`; entity-level `findOneOrNew`, `softDelete`, `hardDelete`, `restore`, `paginate` statics
|
|
88
|
-
| Migrations | `CreateSysUsersTable...` (26 files, one per table), `MigrationUtility`, `SeederUtility` | fluent `this.string()`, `this.numeric()`, `addRecord()` seeding
|
|
89
|
-
| Queue | `QueueModule`, `QueueService`, `CommonJob`, `JobConsumer` | BullMQ `@Processor`/`WorkerHost` consumer; auto-discovered jobs, duplicate prevention, recurring schedulers, 1-day TTL, retries, failures persisted to `sys_failed_jobs`
|
|
90
|
-
| Scheduled events | `SystemScheduledTaskEntity`, `ScheduledEventEntity`, `SetScheduledEventJob`, `DispatchScheduledEventJob` | schedule definitions in `sys_scheduled_tasks` → events in `sys_scheduled_events`; worker-driven materialisation + fire-once dispatch, cadence via `SCHEDULED_EVENT_MIN`
|
|
85
|
+
| Area | Key exports | Notes |
|
|
86
|
+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
87
|
+
| Entities | `RootEntity`, `CommonEntity`, `CommonAdminEntity`, `UserEntity`, `AdminUserEntity`, `SystemRoleEntity`, `SystemAdminRoleEntity`, ... | uuid PK, soft deletes, `created_by`, jsonb `attributes`; entity-level `findOneOrNew`, `softDelete`, `hardDelete`, `restore`, `paginate` statics |
|
|
88
|
+
| Migrations | `CreateSysUsersTable...` (26 files, one per table), `MigrationUtility`, `SeederUtility` | fluent `this.string()`, `this.numeric()`, `addRecord()` seeding |
|
|
89
|
+
| Queue | `QueueModule`, `QueueService`, `CommonJob`, `JobConsumer` | BullMQ `@Processor`/`WorkerHost` consumer; auto-discovered jobs, duplicate prevention, recurring schedulers, 1-day TTL, retries, failures persisted to `sys_failed_jobs` |
|
|
90
|
+
| Scheduled events | `SystemScheduledTaskEntity`, `ScheduledEventEntity`, `SetScheduledEventJob`, `DispatchScheduledEventJob` | schedule definitions in `sys_scheduled_tasks` → events in `sys_scheduled_events`; worker-driven materialisation + fire-once dispatch, cadence via `SCHEDULED_EVENT_MIN` |
|
|
91
91
|
| Auth | `AuthModule`, `AuthService.validateRole()`, `Auth`, `JwtMiddleware`, `GoogleAuthService` | imperative auth (open by default); JwtMiddleware resolves the user into `Auth`'s AsyncLocalStorage context per request; access + rotating refresh tokens; session-based logout invalidation (`sys_auth_sessions`); Google SSO via ID token at `POST /auth/google` |
|
|
92
|
-
| Admin auth | `AdminAuthService.validateRole()`, `AdminAuth`, `AdminJwtMiddleware`, `AdminAuthController` (`/admin/auth`) | fully separate stack for back-office admins — own users table (`sys_admin_users`), own roles (`sys_admin_roles`/`sys_auser_roles`), own sessions/refresh tokens (shared tables, `is_admin` flag)
|
|
93
|
-
| API keys | `ApiKeyService`, `ApiKeyGuard` / `ApiKeyMiddleware`, `@ApiKeyScopes()`, `ScopeEntity`, `ApiScopeEntity`
|
|
94
|
-
| Multi-tenancy | `TenantModule`, `TenantEntity`, `TenantCommonEntity`, `TenantContextService`, `TenantContextMiddleware` | AsyncLocalStorage tenant context; resolve by header, slug, or domain; tenants are onboarded by admins (`TenantEntity.creator` → `AdminUserEntity`)
|
|
95
|
-
| Admin | `AdminModule`, `AdminAccessService`, `TenantDataProcessor`, `ClientUserDataProcessor`, `BulkUserDataProcessor`, `AdminUserDataProcessor`, list processors | back-office APIs: tenant onboarding, client/admin user registration (single + bulk, no role granting), tenant + scheduled-task listing; 4-tier `GlobalAdminRoles` gate over `sys_admin_roles`; Swagger at `/docs` (hidden in production)
|
|
96
|
-
| Notifications | `NotificationModule`, `NotificationService`, `FcmPushNotificationService` | in-app rows + FCM push (optional `firebase-admin`); device token registry
|
|
97
|
-
| Email (SES) | `EmailNotificationService`, `ProcessEmailNotification`, `EmailTemplateEntity`, `EmailNotificationLogEntity` | templates in `sys_email_templates` rendered by a remote service, dispatched via SES per recipient (to/cc/bcc); logged to `sys_email_notification_logs` outside production; dispatch skipped when `AWS_SES_FROM_ADDRESS` unset
|
|
98
|
-
| Audit | `AuditService` | `saveAuditLog(old, new)` with changed-value diffing into `sys_audit_logs`
|
|
99
|
-
| Feature flags | `FeatureFlagService` | on/off, percentage rollouts, allow lists — stored as `feature.*` system properties
|
|
100
|
-
| Cache | `CacheService` | Redis, TTL objects (`{days, hours, min}`), transparent encryption
|
|
101
|
-
| Encryption | `EncryptionService` | AES-256-GCM, scrypt-derived keys
|
|
102
|
-
| System properties | `SystemPropertyModule`, `SystemPropertyService` | cached + optionally encrypted key/value settings in `sys_properties`
|
|
103
|
-
| Documents | `DocumentModule`, `DocumentService`, `S3BucketDocumentService`, `MinioBucketDocumentService` | `uploadDocument(multerFiles) → links[]`; driver chosen via `DOCUMENT_STORAGE_DRIVER`
|
|
104
|
-
| HTTP | `CommonController`, `GlobalExceptionFilter`, common DTOs | health endpoint base controller, uniform error envelope
|
|
105
|
-
| Raw SQL | `SqlService`, `SqlTarget` | named `:key` placeholders always bound as driver params, `:...key` array expansion; runs on the read replica (`DB_READ_*`) with transparent primary fallback; `fetchOne`/`fetchScalar`/`exists`/`count`/`paginate` helpers
|
|
106
|
-
| List endpoints | `CommonListProcessor`, `CommonListFilterDto`, `FilterDto`, `FILTER_OPERATORS` | allowlisted columns, parameterised operators (`eq`…`isNull`), typed value casting (`str`/`num`/`date`/`bool`/`null`), multi-sort + paginated on the read replica
|
|
107
|
-
| Outbound HTTP | `RemoteRequestService`, `ApiRequestTypeEnum`, `ApiContentTypeEnum` | injectable `fetch` wrapper (global via `CommonModule`); `getApiResponse<T>()` parses JSON/text and throws `OperationException` on non-2xx, `getApiRawResponse()` returns the raw `Response`; JSON + form-urlencoded body serialisation
|
|
108
|
-
| Observability | `LoggingInterceptor`, `MonitoringInterceptor`, `MonitoringService` | Sentry auto-registers when `@sentry/node` + `SENTRY_DSN` present; pluggable `MonitoringAdapter`
|
|
109
|
-
| Jobs/Events | `CommonJob`, `JobConsumer`, `CommonSubscriber`, `CommonDataProcessor` | dispatch/handle separation, discovery-based registration, worker-event lifecycle, column-change detection, field error collection
|
|
110
|
-
| Constants & maps | `baseEntityConstants`, `baseJobConstants`, `baseEntityMaps`, `baseJobMaps` | centralised dotted identifiers (`as const`) plus identifier → class maps of every concrete entity and job (abstract bases excluded); map keys are computed from the constants, so renames propagate at compile time
|
|
92
|
+
| Admin auth | `AdminAuthService.validateRole()`, `AdminAuth`, `AdminJwtMiddleware`, `AdminAuthController` (`/admin/auth`) | fully separate stack for back-office admins — own users table (`sys_admin_users`), own roles (`sys_admin_roles`/`sys_auser_roles`), own sessions/refresh tokens (shared tables, `is_admin` flag) |
|
|
93
|
+
| API keys | `ApiKeyService`, `ApiKeyGuard` / `ApiKeyMiddleware`, `@ApiKeyScopes()`, `ScopeEntity`, `ApiScopeEntity` | hashed keys in `sys_api_keys` (admin-owned), scopes, expiry/revocation, `x-api-key` header; normalized scopes catalogue in `sys_scopes`/`sys_api_scopes` |
|
|
94
|
+
| Multi-tenancy | `TenantModule`, `TenantEntity`, `TenantCommonEntity`, `TenantContextService`, `TenantContextMiddleware` | AsyncLocalStorage tenant context; resolve by header, slug, or domain; tenants are onboarded by admins (`TenantEntity.creator` → `AdminUserEntity`) |
|
|
95
|
+
| Admin | `AdminModule`, `AdminAccessService`, `TenantDataProcessor`, `ClientUserDataProcessor`, `BulkUserDataProcessor`, `AdminUserDataProcessor`, list processors | back-office APIs: tenant onboarding, client/admin user registration (single + bulk, no role granting), tenant + scheduled-task listing; 4-tier `GlobalAdminRoles` gate over `sys_admin_roles`; Swagger at `/docs` (hidden in production) |
|
|
96
|
+
| Notifications | `NotificationModule`, `NotificationService`, `FcmPushNotificationService` | in-app rows + FCM push (optional `firebase-admin`); device token registry |
|
|
97
|
+
| Email (SES) | `EmailNotificationService`, `ProcessEmailNotification`, `EmailTemplateEntity`, `EmailNotificationLogEntity` | templates in `sys_email_templates` rendered by a remote service, dispatched via SES per recipient (to/cc/bcc); logged to `sys_email_notification_logs` outside production; dispatch skipped when `AWS_SES_FROM_ADDRESS` unset |
|
|
98
|
+
| Audit | `AuditService` | `saveAuditLog(old, new)` with changed-value diffing into `sys_audit_logs` |
|
|
99
|
+
| Feature flags | `FeatureFlagService` | on/off, percentage rollouts, allow lists — stored as `feature.*` system properties |
|
|
100
|
+
| Cache | `CacheService` | Redis, TTL objects (`{days, hours, min}`), transparent encryption |
|
|
101
|
+
| Encryption | `EncryptionService` | AES-256-GCM, scrypt-derived keys |
|
|
102
|
+
| System properties | `SystemPropertyModule`, `SystemPropertyService` | cached + optionally encrypted key/value settings in `sys_properties` |
|
|
103
|
+
| Documents | `DocumentModule`, `DocumentService`, `S3BucketDocumentService`, `MinioBucketDocumentService` | `uploadDocument(multerFiles) → links[]`; driver chosen via `DOCUMENT_STORAGE_DRIVER` |
|
|
104
|
+
| HTTP | `CommonController`, `GlobalExceptionFilter`, common DTOs | health endpoint base controller, uniform error envelope |
|
|
105
|
+
| Raw SQL | `SqlService`, `SqlTarget` | named `:key` placeholders always bound as driver params, `:...key` array expansion; runs on the read replica (`DB_READ_*`) with transparent primary fallback; `fetchOne`/`fetchScalar`/`exists`/`count`/`paginate` helpers |
|
|
106
|
+
| List endpoints | `CommonListProcessor`, `CommonListFilterDto`, `FilterDto`, `FILTER_OPERATORS` | allowlisted columns, parameterised operators (`eq`…`isNull`), typed value casting (`str`/`num`/`date`/`bool`/`null`), multi-sort + paginated on the read replica |
|
|
107
|
+
| Outbound HTTP | `RemoteRequestService`, `ApiRequestTypeEnum`, `ApiContentTypeEnum` | injectable `fetch` wrapper (global via `CommonModule`); `getApiResponse<T>()` parses JSON/text and throws `OperationException` on non-2xx, `getApiRawResponse()` returns the raw `Response`; JSON + form-urlencoded body serialisation |
|
|
108
|
+
| Observability | `LoggingInterceptor`, `MonitoringInterceptor`, `MonitoringService` | Sentry auto-registers when `@sentry/node` + `SENTRY_DSN` present; pluggable `MonitoringAdapter` |
|
|
109
|
+
| Jobs/Events | `CommonJob`, `JobConsumer`, `CommonSubscriber`, `CommonDataProcessor` | dispatch/handle separation, discovery-based registration, worker-event lifecycle, column-change detection, field error collection |
|
|
110
|
+
| Constants & maps | `baseEntityConstants`, `baseJobConstants`, `baseEntityMaps`, `baseJobMaps` | centralised dotted identifiers (`as const`) plus identifier → class maps of every concrete entity and job (abstract bases excluded); map keys are computed from the constants, so renames propagate at compile time |
|
|
111
111
|
|
|
112
112
|
## Environment Variables
|
|
113
113
|
|
|
@@ -136,22 +136,22 @@ queries). Comma-separate `DB_READ_HOST` for multiple replicas; unset `DB_READ_*`
|
|
|
136
136
|
values fall back to the primary's. Leave `DB_READ_HOST` empty to route replica
|
|
137
137
|
queries to the primary.
|
|
138
138
|
|
|
139
|
-
| Variable | Default
|
|
140
|
-
| ------------------ |
|
|
141
|
-
| `DB_READ_HOST` | _(empty)_
|
|
142
|
-
| `DB_READ_PORT` | `DB_PORT`
|
|
143
|
-
| `DB_READ_USERNAME` | `DB_USERNAME`
|
|
144
|
-
| `DB_READ_PASSWORD` | `DB_PASSWORD`
|
|
145
|
-
| `DB_READ_NAME` | `DB_NAME`
|
|
139
|
+
| Variable | Default | Description |
|
|
140
|
+
| ------------------ | ------------- | --------------------- |
|
|
141
|
+
| `DB_READ_HOST` | _(empty)_ | Replica host(s) |
|
|
142
|
+
| `DB_READ_PORT` | `DB_PORT` | Replica port |
|
|
143
|
+
| `DB_READ_USERNAME` | `DB_USERNAME` | Replica user |
|
|
144
|
+
| `DB_READ_PASSWORD` | `DB_PASSWORD` | Replica password |
|
|
145
|
+
| `DB_READ_NAME` | `DB_NAME` | Replica database name |
|
|
146
146
|
|
|
147
147
|
### JWT / Auth
|
|
148
148
|
|
|
149
|
-
| Variable | Default
|
|
150
|
-
| ---------------------- |
|
|
151
|
-
| `ACCESS_TOKEN_SECRET` | —
|
|
152
|
-
| `REFRESH_TOKEN_SECRET` | —
|
|
153
|
-
| `ACCESS_TOKEN_EXPIRY` | `1h`
|
|
154
|
-
| `REFRESH_TOKEN_EXPIRY` | `30d`
|
|
149
|
+
| Variable | Default | Description |
|
|
150
|
+
| ---------------------- | --------- | ---------------------------------------------------------------------------------------------- |
|
|
151
|
+
| `ACCESS_TOKEN_SECRET` | — | **Required.** Secret for signing access tokens. Min 32 chars |
|
|
152
|
+
| `REFRESH_TOKEN_SECRET` | — | **Required.** Secret for signing refresh tokens. Min 32 chars |
|
|
153
|
+
| `ACCESS_TOKEN_EXPIRY` | `1h` | Access token lifetime (`60s`, `15m`, `1h`, `7d`, …) |
|
|
154
|
+
| `REFRESH_TOKEN_EXPIRY` | `30d` | Refresh token lifetime |
|
|
155
155
|
| `GOOGLE_CLIENT_ID` | _(empty)_ | OAuth client id whose ID tokens are accepted at `POST /auth/google`. Empty disables Google SSO |
|
|
156
156
|
|
|
157
157
|
#### Authentication (imperative)
|
|
@@ -169,7 +169,10 @@ logic, so layering tenant/plan/role checks is just more code.
|
|
|
169
169
|
`AuthController` (mounted at `/auth`) exposes the ready-made flows: `POST
|
|
170
170
|
/auth/login`, `/auth/google`, `/auth/register`, `/auth/refresh`, `/auth/logout`,
|
|
171
171
|
`/auth/change-password`, and `GET /auth/me`. Passwords are hashed/verified via
|
|
172
|
-
`AuthUtility` (bcrypt); the write flows use the processor lifecycle.
|
|
172
|
+
`AuthUtility` (bcrypt); the write flows use the processor lifecycle. Credential
|
|
173
|
+
misses spend the same bcrypt work as a wrong password
|
|
174
|
+
(`AuthUtility.compareAgainstDummy()`), so response timing does not reveal
|
|
175
|
+
whether an account exists. Every
|
|
173
176
|
`issueTokens()` call (login or refresh) creates a fresh `sys_auth_sessions` row
|
|
174
177
|
and embeds its identifier in the access token as `sid`; `logout()` revokes the
|
|
175
178
|
refresh token and invalidates that session, so a still-unexpired access token
|
|
@@ -255,19 +258,19 @@ admin with the `admin` role can grant `sys_admin_roles` to other admins via
|
|
|
255
258
|
|
|
256
259
|
### Queue (BullMQ / Redis)
|
|
257
260
|
|
|
258
|
-
| Variable
|
|
259
|
-
|
|
|
260
|
-
| `BULL_REDIS_HOST`
|
|
261
|
-
| `BULL_REDIS_PORT`
|
|
262
|
-
| `BULL_REDIS_PASSWORD`
|
|
263
|
-
| `BULL_REDIS_DB`
|
|
264
|
-
| `BULL_QUEUE_NAME`
|
|
265
|
-
| `BULL_WORKERS`
|
|
266
|
-
| `BULL_QUEUE_WORKER`
|
|
267
|
-
| `BULL_JOB_TTL_SECONDS`
|
|
268
|
-
| `MAX_JOB_RETRIES`
|
|
269
|
-
| `SCHEDULED_EVENT_MIN`
|
|
270
|
-
| `ENABLE_SCHEDULED_EVENTS_EXECUTION` | _unset_
|
|
261
|
+
| Variable | Default | Description |
|
|
262
|
+
| ----------------------------------- | ------------- | --------------------------------------------------------------------------------------------------- |
|
|
263
|
+
| `BULL_REDIS_HOST` | `localhost` | Redis host for BullMQ |
|
|
264
|
+
| `BULL_REDIS_PORT` | `6379` | Redis port |
|
|
265
|
+
| `BULL_REDIS_PASSWORD` | _(empty)_ | Redis password |
|
|
266
|
+
| `BULL_REDIS_DB` | `0` | Redis DB index |
|
|
267
|
+
| `BULL_QUEUE_NAME` | `myapp-queue` | Name of the BullMQ queue |
|
|
268
|
+
| `BULL_WORKERS` | `2` | Concurrent worker threads per process |
|
|
269
|
+
| `BULL_QUEUE_WORKER` | `false` | Set `true` on consumer instances only — API servers should leave this `false` |
|
|
270
|
+
| `BULL_JOB_TTL_SECONDS` | `86400` | Retention (seconds) for completed/failed jobs before removal from the queue + Redis (default 1 day) |
|
|
271
|
+
| `MAX_JOB_RETRIES` | `3` | Max attempts per job (BullMQ `attempts` default) and the scheduled-event retry ceiling |
|
|
272
|
+
| `SCHEDULED_EVENT_MIN` | `0` | `SetScheduledEventJob` cadence in minutes (every N minutes); `0`/unset disables self-scheduling |
|
|
273
|
+
| `ENABLE_SCHEDULED_EVENTS_EXECUTION` | _unset_ | Must be exactly `true` to arm scheduled-event materialisation and dispatch |
|
|
271
274
|
|
|
272
275
|
#### Jobs
|
|
273
276
|
|
|
@@ -533,10 +536,25 @@ dispatch is skipped entirely — so development stays send-free by default.
|
|
|
533
536
|
await new ProcessEmailNotification(emailNotificationService).process({
|
|
534
537
|
identifier: 'user.welcome',
|
|
535
538
|
data: { name: 'Jane' }, // payload for the remote template renderer
|
|
536
|
-
|
|
539
|
+
emailRecipients: [{ recipient: 'jane@example.com', cc: ['ops@example.com'] }],
|
|
537
540
|
});
|
|
538
541
|
```
|
|
539
542
|
|
|
543
|
+
The templates the library itself dispatches are named by the
|
|
544
|
+
`EmailTemplateIdentifier` enum — seed a matching `sys_email_templates` row for each
|
|
545
|
+
one you want delivered:
|
|
546
|
+
|
|
547
|
+
| Identifier | Sent by | Recipient | `data` keys |
|
|
548
|
+
| ----------------------- | ------------------------- | ------------------ | --------------------------------------------------------------------------- |
|
|
549
|
+
| `tenant-onboarded` | `TenantDataProcessor` | tenant's POC email | `tenant_name`, `tenant_poc`, `tenant_email`, `onboarded_on`, support fields |
|
|
550
|
+
| `tenant-user-onboarded` | `ClientUserDataProcessor` | the new user | `user_name`, `user_email`, `tenant_name`, `onboarded_on`, support fields |
|
|
551
|
+
|
|
552
|
+
Both add `support_email` and `support_link`, read from the `support_email` /
|
|
553
|
+
`support_link` system properties and falling back to the placeholders in
|
|
554
|
+
`EmailNotificationDefault`. Neither send can fail its flow: the row is committed
|
|
555
|
+
first, so a missing template or SES error is logged as a warning and the request
|
|
556
|
+
still succeeds.
|
|
557
|
+
|
|
540
558
|
## List Endpoints & Filtering
|
|
541
559
|
|
|
542
560
|
List endpoints are `POST .../list` routes backed by `CommonListProcessor`: a
|
|
@@ -550,13 +568,13 @@ into the SQL.
|
|
|
550
568
|
Each `FilterDto` is `{ identifier, operator, value, value_type }`. The raw
|
|
551
569
|
string `value` is cast per its declared `value_type` before binding:
|
|
552
570
|
|
|
553
|
-
| `value_type` | Cast
|
|
554
|
-
| ------------ |
|
|
555
|
-
| `str` | used as-is
|
|
556
|
-
| `num` | `Number(value)` — rejects empty / non-numeric input
|
|
557
|
-
| `date` | `new Date(value)` — rejects invalid dates
|
|
571
|
+
| `value_type` | Cast |
|
|
572
|
+
| ------------ | ----------------------------------------------------------------------------- |
|
|
573
|
+
| `str` | used as-is |
|
|
574
|
+
| `num` | `Number(value)` — rejects empty / non-numeric input |
|
|
575
|
+
| `date` | `new Date(value)` — rejects invalid dates |
|
|
558
576
|
| `bool` | case-insensitive `'true'` / `'false'` → real boolean, rejects everything else |
|
|
559
|
-
| `null` | bound as SQL `NULL`
|
|
577
|
+
| `null` | bound as SQL `NULL` |
|
|
560
578
|
|
|
561
579
|
Operators: `eq`, `ne`, `in`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`,
|
|
562
580
|
`between`, `isNull`. Multi-value operators (`in`, `between`) take
|
|
@@ -568,11 +586,26 @@ comma-separated values and cast each part; `isNull` reads its value truthily
|
|
|
568
586
|
"page": 1,
|
|
569
587
|
"limit": 10,
|
|
570
588
|
"filters": [
|
|
571
|
-
{
|
|
572
|
-
|
|
573
|
-
|
|
589
|
+
{
|
|
590
|
+
"identifier": "tenant_name",
|
|
591
|
+
"operator": "ilike",
|
|
592
|
+
"value": "acme",
|
|
593
|
+
"value_type": "str",
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
"identifier": "is_active",
|
|
597
|
+
"operator": "eq",
|
|
598
|
+
"value": "true",
|
|
599
|
+
"value_type": "bool",
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
"identifier": "created_at",
|
|
603
|
+
"operator": "between",
|
|
604
|
+
"value": "2026-01-01, 2026-06-30",
|
|
605
|
+
"value_type": "date",
|
|
606
|
+
},
|
|
574
607
|
],
|
|
575
|
-
"sorts": [{ "identifier": "created_at", "direction": "DESC" }]
|
|
608
|
+
"sorts": [{ "identifier": "created_at", "direction": "DESC" }],
|
|
576
609
|
}
|
|
577
610
|
```
|
|
578
611
|
|
|
@@ -594,11 +627,11 @@ satisfies any junior requirement. They're held by admins only
|
|
|
594
627
|
(`sys_admin_users`, via `sys_auser_roles`) — never by tenant users:
|
|
595
628
|
|
|
596
629
|
| Role (`sys_admin_roles.identifier`) | Capability |
|
|
597
|
-
|
|
|
598
|
-
| `global.super.admin`
|
|
599
|
-
| `global.admin`
|
|
600
|
-
| `global.content.manager`
|
|
601
|
-
| `global.content.reader`
|
|
630
|
+
| ----------------------------------- | ---------------------------------------------------- |
|
|
631
|
+
| `global.super.admin` | View/change/delete everything, including tenant info |
|
|
632
|
+
| `global.admin` | Tenant listing and admin-user management |
|
|
633
|
+
| `global.content.manager` | View/change/edit everything except tenant info |
|
|
634
|
+
| `global.content.reader` | Read-only access to non-tenant content |
|
|
602
635
|
|
|
603
636
|
`AdminAccessService` exposes `validateSuperAdmin()`, `validateAdmin()`,
|
|
604
637
|
`validateContentManager()` and `validateContentReader()`. Each authenticates
|
|
@@ -608,8 +641,8 @@ pass the actor to a processor.
|
|
|
608
641
|
|
|
609
642
|
### Endpoints
|
|
610
643
|
|
|
611
|
-
| Route
|
|
612
|
-
|
|
|
644
|
+
| Route | Min. role | Processor |
|
|
645
|
+
| ---------------------------------- | --------------- | ---------------------------- |
|
|
613
646
|
| `POST /admin/tenants` | super admin | `TenantDataProcessor` |
|
|
614
647
|
| `POST /admin/tenants/list` | admin | `TenantListProcessor` |
|
|
615
648
|
| `POST /admin/users/clients` | super admin | `ClientUserDataProcessor` |
|
|
@@ -631,10 +664,20 @@ at `/admin/auth` (`AdminAuthController`) — see
|
|
|
631
664
|
@Post()
|
|
632
665
|
async onboard(@Body() dto: AddTenantDto) {
|
|
633
666
|
const { user } = await this.adminAccessService.validateSuperAdmin();
|
|
634
|
-
return new TenantDataProcessor(
|
|
667
|
+
return new TenantDataProcessor(
|
|
668
|
+
user,
|
|
669
|
+
this.emailNotificationService,
|
|
670
|
+
this.systemPropertyService,
|
|
671
|
+
).process(dto);
|
|
635
672
|
}
|
|
636
673
|
```
|
|
637
674
|
|
|
675
|
+
Onboarding a tenant (`tenant-onboarded`) or a single client user
|
|
676
|
+
(`tenant-user-onboarded`) also sends a templated welcome email — see
|
|
677
|
+
[Templated Email](#templated-email-aws-ses) for the payloads. That is why
|
|
678
|
+
`AdminModule` imports `NotificationModule` and `SystemPropertyModule`; bulk
|
|
679
|
+
registration deliberately sends nothing.
|
|
680
|
+
|
|
638
681
|
Data processors extend `CommonDataProcessor` and are created per request
|
|
639
682
|
(`new XxxDataProcessor(...deps).process(dto)`); list processors return a
|
|
640
683
|
`PaginatedResult`. Bulk registration validates the entire batch before any insert.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.module.d.ts","sourceRoot":"","sources":["../../src/admin/admin.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAIvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"admin.module.d.ts","sourceRoot":"","sources":["../../src/admin/admin.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAU,MAAM,gBAAgB,CAAC;AAIvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG9D,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAc9D,qBAMa,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,OAAO,GAAE,kBAAuB,GAAG,aAAa;CAcjE"}
|
|
@@ -12,12 +12,19 @@ const common_1 = require("@nestjs/common");
|
|
|
12
12
|
const auth_module_1 = require("../auth/auth.module");
|
|
13
13
|
const tenant_module_1 = require("../tenant/tenant.module");
|
|
14
14
|
const es6_classes_1 = require("./es6.classes");
|
|
15
|
+
const notification_module_1 = require("../notification/notification.module");
|
|
16
|
+
const system_property_module_1 = require("../common/system.property.module");
|
|
15
17
|
const [AdminAccessService] = es6_classes_1.es6Classes.services;
|
|
16
18
|
let AdminModule = AdminModule_1 = class AdminModule {
|
|
17
19
|
static register(options = {}) {
|
|
18
20
|
return {
|
|
19
21
|
module: AdminModule_1,
|
|
20
|
-
imports: [
|
|
22
|
+
imports: [
|
|
23
|
+
auth_module_1.AuthModule.register(options),
|
|
24
|
+
tenant_module_1.TenantModule.register(options),
|
|
25
|
+
notification_module_1.NotificationModule.register(options),
|
|
26
|
+
system_property_module_1.SystemPropertyModule.register(options),
|
|
27
|
+
],
|
|
21
28
|
controllers: [...es6_classes_1.es6Classes.controllers],
|
|
22
29
|
providers: [...es6_classes_1.es6Classes.services],
|
|
23
30
|
exports: [...es6_classes_1.es6Classes.services],
|
|
@@ -27,7 +34,7 @@ let AdminModule = AdminModule_1 = class AdminModule {
|
|
|
27
34
|
exports.AdminModule = AdminModule;
|
|
28
35
|
exports.AdminModule = AdminModule = AdminModule_1 = __decorate([
|
|
29
36
|
(0, common_1.Module)({
|
|
30
|
-
imports: [auth_module_1.AuthModule, tenant_module_1.TenantModule],
|
|
37
|
+
imports: [auth_module_1.AuthModule, tenant_module_1.TenantModule, notification_module_1.NotificationModule, system_property_module_1.SystemPropertyModule],
|
|
31
38
|
controllers: [...es6_classes_1.es6Classes.controllers],
|
|
32
39
|
providers: [...es6_classes_1.es6Classes.services],
|
|
33
40
|
exports: [...es6_classes_1.es6Classes.services],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.module.js","sourceRoot":"","sources":["../../src/admin/admin.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,qDAAiD;AACjD,2DAAuD;AACvD,+CAA2C;
|
|
1
|
+
{"version":3,"file":"admin.module.js","sourceRoot":"","sources":["../../src/admin/admin.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAuD;AACvD,qDAAiD;AACjD,2DAAuD;AACvD,+CAA2C;AAE3C,6EAAyE;AACzE,6EAAwE;AAGxE,MAAM,CAAC,kBAAkB,CAAC,GAAG,wBAAU,CAAC,QAAQ,CAAC;AAkB1C,IAAM,WAAW,mBAAjB,MAAM,WAAW;IACtB,MAAM,CAAC,QAAQ,CAAC,UAA8B,EAAE;QAC9C,OAAO;YACL,MAAM,EAAE,aAAW;YACnB,OAAO,EAAE;gBACP,wBAAU,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAC5B,4BAAY,CAAC,QAAQ,CAAC,OAAO,CAAC;gBAC9B,wCAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC;gBACpC,6CAAoB,CAAC,QAAQ,CAAC,OAAO,CAAC;aACvC;YACD,WAAW,EAAE,CAAC,GAAG,wBAAU,CAAC,WAAW,CAAC;YACxC,SAAS,EAAE,CAAC,GAAG,wBAAU,CAAC,QAAQ,CAAC;YACnC,OAAO,EAAE,CAAC,GAAG,wBAAU,CAAC,QAAQ,CAAC;SAClC,CAAC;IACJ,CAAC;CACF,CAAA;AAfY,kCAAW;sBAAX,WAAW;IANvB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,wBAAU,EAAE,4BAAY,EAAE,wCAAkB,EAAE,6CAAoB,CAAC;QAC7E,WAAW,EAAE,CAAC,GAAG,wBAAU,CAAC,WAAW,CAAC;QACxC,SAAS,EAAE,CAAC,GAAG,wBAAU,CAAC,QAAQ,CAAC;QACnC,OAAO,EAAE,CAAC,GAAG,wBAAU,CAAC,QAAQ,CAAC;KAClC,CAAC;GACW,WAAW,CAevB"}
|
|
@@ -61,7 +61,7 @@ __decorate([
|
|
|
61
61
|
exports.AdminScheduledTaskController = AdminScheduledTaskController = __decorate([
|
|
62
62
|
(0, swagger_1.ApiTags)('Admin - Scheduled Tasks'),
|
|
63
63
|
(0, swagger_1.ApiBearerAuth)(),
|
|
64
|
-
(0, common_1.Controller)('admin/scheduled-tasks'),
|
|
64
|
+
(0, common_1.Controller)('api/admin/scheduled-tasks'),
|
|
65
65
|
__metadata("design:paramtypes", [admin_access_service_1.AdminAccessService,
|
|
66
66
|
sql_service_1.SqlService])
|
|
67
67
|
], AdminScheduledTaskController);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.scheduled.task.controller.js","sourceRoot":"","sources":["../../../src/admin/controllers/admin.scheduled.task.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,6CAAuE;AACvE,mEAA+D;AAC/D,2EAAsE;AACtE,8FAAwF;AACxF,8FAAwF;AACxF,2EAAqE;AACrE,6EAAuE;AAKhE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YACmB,kBAAsC,EACtC,UAAsB;QADtB,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAOE,AAAN,KAAK,CAAC,GAAG,CAAS,GAAwB;QACxC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,EAAE,CAAC;QACxE,OAAO,IAAI,0DAA0B,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3D,CAAC;IAOK,AAAN,KAAK,CAAC,IAAI,CAAS,GAAyB;QAC1C,MAAM,IAAI,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,CAAC;QACtD,OAAO,IAAI,0DAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtE,CAAC;CACF,CAAA;AAzBY,oEAA4B;AAWjC;IALL,IAAA,aAAI,GAAE;IACN,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,uBAAuB;QAChC,WAAW,EAAE,oDAAoD;KAClE,CAAC;IACS,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,4CAAmB;;uDAGzC;AAOK;IALL,IAAA,aAAI,EAAC,MAAM,CAAC;IACZ,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,0CAA0C;QACnD,WAAW,EAAE,mDAAmD;KACjE,CAAC;IACU,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,8CAAoB;;wDAG3C;uCAxBU,4BAA4B;IAHxC,IAAA,iBAAO,EAAC,yBAAyB,CAAC;IAClC,IAAA,uBAAa,GAAE;IACf,IAAA,mBAAU,EAAC,
|
|
1
|
+
{"version":3,"file":"admin.scheduled.task.controller.js","sourceRoot":"","sources":["../../../src/admin/controllers/admin.scheduled.task.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,6CAAuE;AACvE,mEAA+D;AAC/D,2EAAsE;AACtE,8FAAwF;AACxF,8FAAwF;AACxF,2EAAqE;AACrE,6EAAuE;AAKhE,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IACvC,YACmB,kBAAsC,EACtC,UAAsB;QADtB,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,eAAU,GAAV,UAAU,CAAY;IACtC,CAAC;IAOE,AAAN,KAAK,CAAC,GAAG,CAAS,GAAwB;QACxC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,sBAAsB,EAAE,CAAC;QACxE,OAAO,IAAI,0DAA0B,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3D,CAAC;IAOK,AAAN,KAAK,CAAC,IAAI,CAAS,GAAyB;QAC1C,MAAM,IAAI,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,CAAC;QACtD,OAAO,IAAI,0DAA0B,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtE,CAAC;CACF,CAAA;AAzBY,oEAA4B;AAWjC;IALL,IAAA,aAAI,GAAE;IACN,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,uBAAuB;QAChC,WAAW,EAAE,oDAAoD;KAClE,CAAC;IACS,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,4CAAmB;;uDAGzC;AAOK;IALL,IAAA,aAAI,EAAC,MAAM,CAAC;IACZ,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,0CAA0C;QACnD,WAAW,EAAE,mDAAmD;KACjE,CAAC;IACU,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,8CAAoB;;wDAG3C;uCAxBU,4BAA4B;IAHxC,IAAA,iBAAO,EAAC,yBAAyB,CAAC;IAClC,IAAA,uBAAa,GAAE;IACf,IAAA,mBAAU,EAAC,2BAA2B,CAAC;qCAGC,yCAAkB;QAC1B,wBAAU;GAH9B,4BAA4B,CAyBxC"}
|
|
@@ -2,10 +2,14 @@ import { SqlService } from '../../common/services/sql.service';
|
|
|
2
2
|
import { AdminAccessService } from '../services/admin.access.service';
|
|
3
3
|
import { AddTenantDto } from '../dtos/add.tenant.dto';
|
|
4
4
|
import { TenantListDto } from '../dtos/tenant.list.dto';
|
|
5
|
+
import { EmailNotificationService } from '../../notification/services/email.notification.service';
|
|
6
|
+
import { SystemPropertyService } from '../../common/services/system.property.service';
|
|
5
7
|
export declare class AdminTenantController {
|
|
6
8
|
private readonly adminAccessService;
|
|
7
9
|
private readonly sqlService;
|
|
8
|
-
|
|
10
|
+
private readonly emailNotificationService;
|
|
11
|
+
private readonly systemPropertyService;
|
|
12
|
+
constructor(adminAccessService: AdminAccessService, sqlService: SqlService, emailNotificationService: EmailNotificationService, systemPropertyService: SystemPropertyService);
|
|
9
13
|
onboard(dto: AddTenantDto): Promise<import("../..").TenantEntity>;
|
|
10
14
|
list(dto: TenantListDto): Promise<{
|
|
11
15
|
records: import("../..").SqlRow[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.tenant.controller.d.ts","sourceRoot":"","sources":["../../../src/admin/controllers/admin.tenant.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"admin.tenant.controller.d.ts","sourceRoot":"","sources":["../../../src/admin/controllers/admin.tenant.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAEtF,qBAGa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,wBAAwB;IACzC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;gBAHrB,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,UAAU,EACtB,wBAAwB,EAAE,wBAAwB,EAClD,qBAAqB,EAAE,qBAAqB;IAQzD,OAAO,CAAS,GAAG,EAAE,YAAY;IAejC,IAAI,CAAS,GAAG,EAAE,aAAa;;;;;;;CAItC"}
|
|
@@ -21,14 +21,18 @@ const tenant_data_processor_1 = require("../libraries/tenant.data.processor");
|
|
|
21
21
|
const tenant_list_processor_1 = require("../libraries/tenant.list.processor");
|
|
22
22
|
const add_tenant_dto_1 = require("../dtos/add.tenant.dto");
|
|
23
23
|
const tenant_list_dto_1 = require("../dtos/tenant.list.dto");
|
|
24
|
+
const email_notification_service_1 = require("../../notification/services/email.notification.service");
|
|
25
|
+
const system_property_service_1 = require("../../common/services/system.property.service");
|
|
24
26
|
let AdminTenantController = class AdminTenantController {
|
|
25
|
-
constructor(adminAccessService, sqlService) {
|
|
27
|
+
constructor(adminAccessService, sqlService, emailNotificationService, systemPropertyService) {
|
|
26
28
|
this.adminAccessService = adminAccessService;
|
|
27
29
|
this.sqlService = sqlService;
|
|
30
|
+
this.emailNotificationService = emailNotificationService;
|
|
31
|
+
this.systemPropertyService = systemPropertyService;
|
|
28
32
|
}
|
|
29
33
|
async onboard(dto) {
|
|
30
34
|
const { user } = await this.adminAccessService.validateSuperAdmin();
|
|
31
|
-
return new tenant_data_processor_1.TenantDataProcessor(user).process(dto);
|
|
35
|
+
return new tenant_data_processor_1.TenantDataProcessor(user, this.emailNotificationService, this.systemPropertyService).process(dto);
|
|
32
36
|
}
|
|
33
37
|
async list(dto) {
|
|
34
38
|
await this.adminAccessService.validateAdmin();
|
|
@@ -61,8 +65,10 @@ __decorate([
|
|
|
61
65
|
exports.AdminTenantController = AdminTenantController = __decorate([
|
|
62
66
|
(0, swagger_1.ApiTags)('Admin - Tenants'),
|
|
63
67
|
(0, swagger_1.ApiBearerAuth)(),
|
|
64
|
-
(0, common_1.Controller)('admin/tenants'),
|
|
68
|
+
(0, common_1.Controller)('api/admin/tenants'),
|
|
65
69
|
__metadata("design:paramtypes", [admin_access_service_1.AdminAccessService,
|
|
66
|
-
sql_service_1.SqlService
|
|
70
|
+
sql_service_1.SqlService,
|
|
71
|
+
email_notification_service_1.EmailNotificationService,
|
|
72
|
+
system_property_service_1.SystemPropertyService])
|
|
67
73
|
], AdminTenantController);
|
|
68
74
|
//# sourceMappingURL=admin.tenant.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.tenant.controller.js","sourceRoot":"","sources":["../../../src/admin/controllers/admin.tenant.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,6CAAuE;AACvE,mEAA+D;AAC/D,2EAAsE;AACtE,8EAAyE;AACzE,8EAAyE;AACzE,2DAAsD;AACtD,6DAAwD;
|
|
1
|
+
{"version":3,"file":"admin.tenant.controller.js","sourceRoot":"","sources":["../../../src/admin/controllers/admin.tenant.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,6CAAuE;AACvE,mEAA+D;AAC/D,2EAAsE;AACtE,8EAAyE;AACzE,8EAAyE;AACzE,2DAAsD;AACtD,6DAAwD;AACxD,uGAAkG;AAClG,2FAAsF;AAK/E,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,YACmB,kBAAsC,EACtC,UAAsB,EACtB,wBAAkD,EAClD,qBAA4C;QAH5C,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,eAAU,GAAV,UAAU,CAAY;QACtB,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,0BAAqB,GAArB,qBAAqB,CAAuB;IAC5D,CAAC;IAOE,AAAN,KAAK,CAAC,OAAO,CAAS,GAAiB;QACrC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,CAAC;QAEpE,OAAO,IAAI,2CAAmB,CAC5B,IAAI,EACJ,IAAI,CAAC,wBAAwB,EAC7B,IAAI,CAAC,qBAAqB,CAC3B,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;IAOK,AAAN,KAAK,CAAC,IAAI,CAAS,GAAkB;QACnC,MAAM,IAAI,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC;QAC9C,OAAO,IAAI,2CAAmB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC/D,CAAC;CACF,CAAA;AAhCY,sDAAqB;AAa1B;IALL,IAAA,aAAI,GAAE;IACN,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,yCAAyC;QAClD,WAAW,EAAE,uCAAuC;KACrD,CAAC;IACa,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,6BAAY;;oDAQtC;AAOK;IALL,IAAA,aAAI,EAAC,MAAM,CAAC;IACZ,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,kCAAkC;QAC3C,WAAW,EAAE,0CAA0C;KACxD,CAAC;IACU,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,+BAAa;;iDAGpC;gCA/BU,qBAAqB;IAHjC,IAAA,iBAAO,EAAC,iBAAiB,CAAC;IAC1B,IAAA,uBAAa,GAAE;IACf,IAAA,mBAAU,EAAC,mBAAmB,CAAC;qCAGS,yCAAkB;QAC1B,wBAAU;QACI,qDAAwB;QAC3B,+CAAqB;GALpD,qBAAqB,CAgCjC"}
|
|
@@ -3,10 +3,14 @@ import { AdminAccessService } from '../services/admin.access.service';
|
|
|
3
3
|
import { AddClientUserDto } from '../dtos/add.client.user.dto';
|
|
4
4
|
import { AddBulkUsersDto } from '../dtos/add.bulk.users.dto';
|
|
5
5
|
import { AddAdminUserDto } from '../dtos/add.admin.user.dto';
|
|
6
|
+
import { EmailNotificationService } from '../../notification/services/email.notification.service';
|
|
7
|
+
import { SystemPropertyService } from '../../common/services/system.property.service';
|
|
6
8
|
export declare class AdminUserController {
|
|
7
9
|
private readonly adminAccessService;
|
|
8
10
|
private readonly tenantService;
|
|
9
|
-
|
|
11
|
+
private readonly emailNotificationService;
|
|
12
|
+
private readonly systemPropertyService;
|
|
13
|
+
constructor(adminAccessService: AdminAccessService, tenantService: TenantService, emailNotificationService: EmailNotificationService, systemPropertyService: SystemPropertyService);
|
|
10
14
|
addClientUser(dto: AddClientUserDto): Promise<import("../..").UserEntity>;
|
|
11
15
|
addClientUsersBulk(dto: AddBulkUsersDto): Promise<import("../types/admin.types").BulkUserResult>;
|
|
12
16
|
addAdminUser(dto: AddAdminUserDto): Promise<import("../..").AdminUserEntity>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.user.controller.d.ts","sourceRoot":"","sources":["../../../src/admin/controllers/admin.user.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAItE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"admin.user.controller.d.ts","sourceRoot":"","sources":["../../../src/admin/controllers/admin.user.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAItE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,wDAAwD,CAAC;AAClG,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAEtF,qBAGa,mBAAmB;IAE5B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,wBAAwB;IACzC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;gBAHrB,kBAAkB,EAAE,kBAAkB,EACtC,aAAa,EAAE,aAAa,EAC5B,wBAAwB,EAAE,wBAAwB,EAClD,qBAAqB,EAAE,qBAAqB;IAQzD,aAAa,CAAS,GAAG,EAAE,gBAAgB;IAc3C,kBAAkB,CAAS,GAAG,EAAE,eAAe;IAU/C,YAAY,CAAS,GAAG,EAAE,eAAe;CAIhD"}
|
|
@@ -23,14 +23,18 @@ const admin_user_data_processor_1 = require("../libraries/admin.user.data.proces
|
|
|
23
23
|
const add_client_user_dto_1 = require("../dtos/add.client.user.dto");
|
|
24
24
|
const add_bulk_users_dto_1 = require("../dtos/add.bulk.users.dto");
|
|
25
25
|
const add_admin_user_dto_1 = require("../dtos/add.admin.user.dto");
|
|
26
|
+
const email_notification_service_1 = require("../../notification/services/email.notification.service");
|
|
27
|
+
const system_property_service_1 = require("../../common/services/system.property.service");
|
|
26
28
|
let AdminUserController = class AdminUserController {
|
|
27
|
-
constructor(adminAccessService, tenantService) {
|
|
29
|
+
constructor(adminAccessService, tenantService, emailNotificationService, systemPropertyService) {
|
|
28
30
|
this.adminAccessService = adminAccessService;
|
|
29
31
|
this.tenantService = tenantService;
|
|
32
|
+
this.emailNotificationService = emailNotificationService;
|
|
33
|
+
this.systemPropertyService = systemPropertyService;
|
|
30
34
|
}
|
|
31
35
|
async addClientUser(dto) {
|
|
32
36
|
await this.adminAccessService.validateSuperAdmin();
|
|
33
|
-
return new client_user_data_processor_1.ClientUserDataProcessor(this.tenantService).process(dto);
|
|
37
|
+
return new client_user_data_processor_1.ClientUserDataProcessor(this.tenantService, this.emailNotificationService, this.systemPropertyService).process(dto);
|
|
34
38
|
}
|
|
35
39
|
async addClientUsersBulk(dto) {
|
|
36
40
|
await this.adminAccessService.validateSuperAdmin();
|
|
@@ -78,8 +82,10 @@ __decorate([
|
|
|
78
82
|
exports.AdminUserController = AdminUserController = __decorate([
|
|
79
83
|
(0, swagger_1.ApiTags)('Admin - Users'),
|
|
80
84
|
(0, swagger_1.ApiBearerAuth)(),
|
|
81
|
-
(0, common_1.Controller)('admin/users'),
|
|
85
|
+
(0, common_1.Controller)('api/admin/users'),
|
|
82
86
|
__metadata("design:paramtypes", [admin_access_service_1.AdminAccessService,
|
|
83
|
-
tenant_service_1.TenantService
|
|
87
|
+
tenant_service_1.TenantService,
|
|
88
|
+
email_notification_service_1.EmailNotificationService,
|
|
89
|
+
system_property_service_1.SystemPropertyService])
|
|
84
90
|
], AdminUserController);
|
|
85
91
|
//# sourceMappingURL=admin.user.controller.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.user.controller.js","sourceRoot":"","sources":["../../../src/admin/controllers/admin.user.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,6CAAuE;AACvE,yEAAqE;AACrE,2EAAsE;AACtE,wFAAkF;AAClF,oFAA8E;AAC9E,sFAAgF;AAChF,qEAA+D;AAC/D,mEAA6D;AAC7D,mEAA6D;
|
|
1
|
+
{"version":3,"file":"admin.user.controller.js","sourceRoot":"","sources":["../../../src/admin/controllers/admin.user.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAwD;AACxD,6CAAuE;AACvE,yEAAqE;AACrE,2EAAsE;AACtE,wFAAkF;AAClF,oFAA8E;AAC9E,sFAAgF;AAChF,qEAA+D;AAC/D,mEAA6D;AAC7D,mEAA6D;AAC7D,uGAAkG;AAClG,2FAAsF;AAK/E,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAC9B,YACmB,kBAAsC,EACtC,aAA4B,EAC5B,wBAAkD,EAClD,qBAA4C;QAH5C,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,kBAAa,GAAb,aAAa,CAAe;QAC5B,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,0BAAqB,GAArB,qBAAqB,CAAuB;IAC5D,CAAC;IAOE,AAAN,KAAK,CAAC,aAAa,CAAS,GAAqB;QAC/C,MAAM,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,CAAC;QACnD,OAAO,IAAI,oDAAuB,CAChC,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,wBAAwB,EAC7B,IAAI,CAAC,qBAAqB,CAC3B,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;IAOK,AAAN,KAAK,CAAC,kBAAkB,CAAS,GAAoB;QACnD,MAAM,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,CAAC;QACnD,OAAO,IAAI,gDAAqB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;IAOK,AAAN,KAAK,CAAC,YAAY,CAAS,GAAoB;QAC7C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,aAAa,EAAE,CAAC;QAC/D,OAAO,IAAI,kDAAsB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC;CACF,CAAA;AAzCY,kDAAmB;AAaxB;IALL,IAAA,aAAI,EAAC,SAAS,CAAC;IACf,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,gDAAgD;QACzD,WAAW,EAAE,uCAAuC;KACrD,CAAC;IACmB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,sCAAgB;;wDAOhD;AAOK;IALL,IAAA,aAAI,EAAC,cAAc,CAAC;IACpB,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,8CAA8C;QACvD,WAAW,EAAE,uCAAuC;KACrD,CAAC;IACwB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,oCAAe;;6DAGpD;AAOK;IALL,IAAA,aAAI,EAAC,QAAQ,CAAC;IACd,IAAA,sBAAY,EAAC;QACZ,OAAO,EAAE,iCAAiC;QAC1C,WAAW,EAAE,0CAA0C;KACxD,CAAC;IACkB,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,oCAAe;;uDAG9C;8BAxCU,mBAAmB;IAH/B,IAAA,iBAAO,EAAC,eAAe,CAAC;IACxB,IAAA,uBAAa,GAAE;IACf,IAAA,mBAAU,EAAC,iBAAiB,CAAC;qCAGW,yCAAkB;QACvB,8BAAa;QACF,qDAAwB;QAC3B,+CAAqB;GALpD,mBAAmB,CAyC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.user.data.processor.d.ts","sourceRoot":"","sources":["../../../src/admin/libraries/admin.user.data.processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"admin.user.data.processor.d.ts","sourceRoot":"","sources":["../../../src/admin/libraries/admin.user.data.processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAGxE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAI7D,qBAAa,sBAAuB,SAAQ,mBAAmB;IAGjD,OAAO,CAAC,QAAQ,CAAC,KAAK;IAFlC,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC;gBAEN,KAAK,EAAE,eAAe;IAI7C,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;YAMnD,QAAQ;YAQR,MAAM;YAiBN,oBAAoB;YAQpB,uBAAuB;YASvB,iBAAiB;YAiBjB,eAAe;IAc7B,OAAO,CAAC,YAAY;CAIrB"}
|
|
@@ -6,6 +6,7 @@ const common_data_processor_1 = require("../../common/libraries/common.data.proc
|
|
|
6
6
|
const admin_user_entity_1 = require("../../auth/entities/admin.user.entity");
|
|
7
7
|
const system_admin_role_entity_1 = require("../../auth/entities/system.admin.role.entity");
|
|
8
8
|
const system_admin_user_role_entity_1 = require("../../auth/entities/system.admin.user.role.entity");
|
|
9
|
+
const auth_utilities_1 = require("../../auth/utilities/auth.utilities");
|
|
9
10
|
class AdminUserDataProcessor extends common_data_processor_1.CommonDataProcessor {
|
|
10
11
|
constructor(actor) {
|
|
11
12
|
super();
|
|
@@ -28,7 +29,7 @@ class AdminUserDataProcessor extends common_data_processor_1.CommonDataProcessor
|
|
|
28
29
|
name: body.name,
|
|
29
30
|
email: body.email,
|
|
30
31
|
username: body.username,
|
|
31
|
-
password: body.password,
|
|
32
|
+
password: await auth_utilities_1.AuthUtility.hashPassword(body.password),
|
|
32
33
|
attributes: body.attributes ?? {},
|
|
33
34
|
});
|
|
34
35
|
await adminUser.save();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin.user.data.processor.js","sourceRoot":"","sources":["../../../src/admin/libraries/admin.user.data.processor.ts"],"names":[],"mappings":";;;AAAA,qCAA6B;AAC7B,wFAAmF;AACnF,6EAAwE;AACxE,2FAAqF;AACrF,qGAA8F;
|
|
1
|
+
{"version":3,"file":"admin.user.data.processor.js","sourceRoot":"","sources":["../../../src/admin/libraries/admin.user.data.processor.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulk.user.data.processor.d.ts","sourceRoot":"","sources":["../../../src/admin/libraries/bulk.user.data.processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"bulk.user.data.processor.d.ts","sourceRoot":"","sources":["../../../src/admin/libraries/bulk.user.data.processor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAQ3D,qBAAa,qBAAsB,SAAQ,iBAAiB;IAG9C,OAAO,CAAC,QAAQ,CAAC,aAAa;IAF1C,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC;gBAEN,aAAa,EAAE,aAAa;IAInD,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;YAMlD,QAAQ;YAWR,MAAM;IA4BpB,OAAO,CAAC,mBAAmB;YAiBb,eAAe;CAa9B"}
|
|
@@ -5,6 +5,7 @@ const typeorm_1 = require("typeorm");
|
|
|
5
5
|
const user_data_processor_1 = require("./user.data.processor");
|
|
6
6
|
const user_entity_1 = require("../../auth/entities/user.entity");
|
|
7
7
|
const user_type_enum_1 = require("../../auth/enums/user.type.enum");
|
|
8
|
+
const auth_utilities_1 = require("../../auth/utilities/auth.utilities");
|
|
8
9
|
class BulkUserDataProcessor extends user_data_processor_1.UserDataProcessor {
|
|
9
10
|
constructor(tenantService) {
|
|
10
11
|
super();
|
|
@@ -25,18 +26,18 @@ class BulkUserDataProcessor extends user_data_processor_1.UserDataProcessor {
|
|
|
25
26
|
}
|
|
26
27
|
async create() {
|
|
27
28
|
const body = this.payload;
|
|
28
|
-
const entities = body.users.map((user) => user_entity_1.UserEntity.create({
|
|
29
|
+
const entities = await Promise.all(body.users.map(async (user) => user_entity_1.UserEntity.create({
|
|
29
30
|
user_type: user_type_enum_1.UserType.TENANT_USER,
|
|
30
31
|
tenant_id: body.tenant_id,
|
|
31
32
|
full_name: user.full_name,
|
|
32
33
|
email: user.email,
|
|
33
|
-
password: user.password,
|
|
34
|
+
password: await auth_utilities_1.AuthUtility.hashPassword(user.password),
|
|
34
35
|
country: user.country,
|
|
35
36
|
contact_code: user.contact_code,
|
|
36
37
|
contact: user.contact,
|
|
37
38
|
active: user.active ?? true,
|
|
38
39
|
attributes: user.attributes ?? {},
|
|
39
|
-
}));
|
|
40
|
+
})));
|
|
40
41
|
await user_entity_1.UserEntity.save(entities);
|
|
41
42
|
return {
|
|
42
43
|
created: entities.length,
|