@solidstarters/solid-core 1.2.201 → 1.2.203
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/dist/config/cache.options.d.ts +1 -1
- package/dist/config/cache.options.d.ts.map +1 -1
- package/dist/config/cache.options.js +2 -2
- package/dist/config/cache.options.js.map +1 -1
- package/dist/config/iam.config.d.ts +4 -0
- package/dist/config/iam.config.d.ts.map +1 -1
- package/dist/config/iam.config.js +2 -0
- package/dist/config/iam.config.js.map +1 -1
- package/dist/controllers/model-metadata.controller.d.ts +25 -0
- package/dist/controllers/model-metadata.controller.d.ts.map +1 -1
- package/dist/controllers/model-metadata.controller.js +23 -0
- package/dist/controllers/model-metadata.controller.js.map +1 -1
- package/dist/controllers/setting.controller.d.ts +1 -2
- package/dist/controllers/setting.controller.d.ts.map +1 -1
- package/dist/controllers/setting.controller.js +21 -42
- package/dist/controllers/setting.controller.js.map +1 -1
- package/dist/decorators/sms-provider.decorator.d.ts +3 -0
- package/dist/decorators/sms-provider.decorator.d.ts.map +1 -0
- package/dist/decorators/sms-provider.decorator.js +11 -0
- package/dist/decorators/sms-provider.decorator.js.map +1 -0
- package/dist/dtos/create-role-metadata.dto.d.ts.map +1 -1
- package/dist/dtos/create-role-metadata.dto.js +1 -0
- package/dist/dtos/create-role-metadata.dto.js.map +1 -1
- package/dist/dtos/navigation.dto.d.ts +6 -0
- package/dist/dtos/navigation.dto.d.ts.map +1 -0
- package/dist/dtos/navigation.dto.js +33 -0
- package/dist/dtos/navigation.dto.js.map +1 -0
- package/dist/dtos/sign-in.dto.js +3 -3
- package/dist/dtos/sign-in.dto.js.map +1 -1
- package/dist/entities/common.entity.js +5 -4
- package/dist/entities/common.entity.js.map +1 -1
- package/dist/entities/field-metadata.entity.d.ts.map +1 -1
- package/dist/entities/field-metadata.entity.js +2 -1
- package/dist/entities/field-metadata.entity.js.map +1 -1
- package/dist/entities/legacy-common.entity.d.ts.map +1 -1
- package/dist/entities/legacy-common.entity.js +5 -4
- package/dist/entities/legacy-common.entity.js.map +1 -1
- package/dist/entities/model-metadata.entity.d.ts.map +1 -1
- package/dist/entities/model-metadata.entity.js +5 -1
- package/dist/entities/model-metadata.entity.js.map +1 -1
- package/dist/factories/mail.factory.d.ts.map +1 -1
- package/dist/factories/mail.factory.js.map +1 -1
- package/dist/factories/sms.factory.d.ts +14 -0
- package/dist/factories/sms.factory.d.ts.map +1 -0
- package/dist/factories/sms.factory.js +53 -0
- package/dist/factories/sms.factory.js.map +1 -0
- package/dist/helpers/date.helper.d.ts.map +1 -1
- package/dist/helpers/date.helper.js +13 -4
- package/dist/helpers/date.helper.js.map +1 -1
- package/dist/helpers/field-crud-managers/MediaFieldCrudManager.d.ts +3 -0
- package/dist/helpers/field-crud-managers/MediaFieldCrudManager.d.ts.map +1 -1
- package/dist/helpers/field-crud-managers/MediaFieldCrudManager.js +99 -0
- package/dist/helpers/field-crud-managers/MediaFieldCrudManager.js.map +1 -1
- package/dist/helpers/image-encoding.helper.d.ts +10 -0
- package/dist/helpers/image-encoding.helper.d.ts.map +1 -0
- package/dist/helpers/image-encoding.helper.js +44 -0
- package/dist/helpers/image-encoding.helper.js.map +1 -0
- package/dist/helpers/module.helper.d.ts.map +1 -1
- package/dist/helpers/module.helper.js +2 -0
- package/dist/helpers/module.helper.js.map +1 -1
- package/dist/helpers/solid-microservice-adapter.service.d.ts +31 -0
- package/dist/helpers/solid-microservice-adapter.service.d.ts.map +1 -0
- package/dist/helpers/solid-microservice-adapter.service.js +53 -0
- package/dist/helpers/solid-microservice-adapter.service.js.map +1 -0
- package/dist/helpers/solid-registry.d.ts +3 -0
- package/dist/helpers/solid-registry.d.ts.map +1 -1
- package/dist/helpers/solid-registry.js +7 -0
- package/dist/helpers/solid-registry.js.map +1 -1
- package/dist/index.d.ts +11 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/dist/jobs/database/{sms-publisher-database.service.d.ts → msg91-sms-publisher-database.service.d.ts} +2 -2
- package/dist/jobs/database/msg91-sms-publisher-database.service.d.ts.map +1 -0
- package/dist/jobs/database/{sms-publisher-database.service.js → msg91-sms-publisher-database.service.js} +8 -8
- package/dist/jobs/database/msg91-sms-publisher-database.service.js.map +1 -0
- package/dist/jobs/database/{sms-queue-database-options.d.ts → msg91-sms-queue-database-options.d.ts} +1 -1
- package/dist/jobs/database/msg91-sms-queue-database-options.d.ts.map +1 -0
- package/dist/jobs/database/{sms-queue-database-options.js → msg91-sms-queue-database-options.js} +1 -1
- package/dist/jobs/database/msg91-sms-queue-database-options.js.map +1 -0
- package/dist/jobs/database/{sms-subscriber-database.service.d.ts → msg91-sms-subscriber-database.service.d.ts} +5 -5
- package/dist/jobs/database/msg91-sms-subscriber-database.service.d.ts.map +1 -0
- package/dist/jobs/database/{sms-subscriber-database.service.js → msg91-sms-subscriber-database.service.js} +14 -12
- package/dist/jobs/database/msg91-sms-subscriber-database.service.js.map +1 -0
- package/dist/jobs/database/otp-subscriber-database.service.d.ts +4 -4
- package/dist/jobs/database/otp-subscriber-database.service.d.ts.map +1 -1
- package/dist/jobs/database/otp-subscriber-database.service.js +6 -4
- package/dist/jobs/database/otp-subscriber-database.service.js.map +1 -1
- package/dist/jobs/database/twilio-sms-subscriber-database.service.d.ts +3 -3
- package/dist/jobs/database/twilio-sms-subscriber-database.service.d.ts.map +1 -1
- package/dist/jobs/database/twilio-sms-subscriber-database.service.js +6 -4
- package/dist/jobs/database/twilio-sms-subscriber-database.service.js.map +1 -1
- package/dist/jobs/{sms-publisher.service.d.ts → msg91-otp-publisher.service.d.ts} +2 -2
- package/dist/jobs/msg91-otp-publisher.service.d.ts.map +1 -0
- package/dist/jobs/{sms-publisher.service.js → msg91-otp-publisher.service.js} +8 -8
- package/dist/jobs/msg91-otp-publisher.service.js.map +1 -0
- package/dist/jobs/{sms-queue-options.d.ts → msg91-otp-queue-options.d.ts} +1 -1
- package/dist/jobs/msg91-otp-queue-options.d.ts.map +1 -0
- package/dist/jobs/{otp-queue-options.js → msg91-otp-queue-options.js} +1 -1
- package/dist/jobs/msg91-otp-queue-options.js.map +1 -0
- package/dist/jobs/{sms-subscriber.service.d.ts → msg91-otp-subscriber.service.d.ts} +6 -6
- package/dist/jobs/msg91-otp-subscriber.service.d.ts.map +1 -0
- package/dist/jobs/{otp-subscriber.service.js → msg91-otp-subscriber.service.js} +14 -12
- package/dist/jobs/msg91-otp-subscriber.service.js.map +1 -0
- package/dist/jobs/{otp-publisher.service.d.ts → msg91-sms-publisher.service.d.ts} +2 -2
- package/dist/jobs/msg91-sms-publisher.service.d.ts.map +1 -0
- package/dist/jobs/{otp-publisher.service.js → msg91-sms-publisher.service.js} +8 -8
- package/dist/jobs/msg91-sms-publisher.service.js.map +1 -0
- package/dist/jobs/{otp-queue-options.d.ts → msg91-sms-queue-options.d.ts} +1 -1
- package/dist/jobs/msg91-sms-queue-options.d.ts.map +1 -0
- package/dist/jobs/{sms-queue-options.js → msg91-sms-queue-options.js} +1 -1
- package/dist/jobs/msg91-sms-queue-options.js.map +1 -0
- package/dist/jobs/{otp-subscriber.service.d.ts → msg91-sms-subscriber.service.d.ts} +7 -7
- package/dist/jobs/msg91-sms-subscriber.service.d.ts.map +1 -0
- package/dist/jobs/{sms-subscriber.service.js → msg91-sms-subscriber.service.js} +14 -12
- package/dist/jobs/msg91-sms-subscriber.service.js.map +1 -0
- package/dist/jobs/twilio-sms-subscriber.service.d.ts +3 -3
- package/dist/jobs/twilio-sms-subscriber.service.d.ts.map +1 -1
- package/dist/jobs/twilio-sms-subscriber.service.js +6 -4
- package/dist/jobs/twilio-sms-subscriber.service.js.map +1 -1
- package/dist/mappers/list-of-values-mapper.d.ts.map +1 -1
- package/dist/mappers/list-of-values-mapper.js +1 -1
- package/dist/mappers/list-of-values-mapper.js.map +1 -1
- package/dist/repository/security-rule.repository.d.ts.map +1 -1
- package/dist/repository/security-rule.repository.js +7 -2
- package/dist/repository/security-rule.repository.js.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.js +24 -2
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +71 -25
- package/dist/seeders/user-seeder.service.d.ts.map +1 -1
- package/dist/seeders/user-seeder.service.js +5 -4
- package/dist/seeders/user-seeder.service.js.map +1 -1
- package/dist/services/authentication.service.d.ts +6 -3
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +53 -18
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/computed-fields/entity/alpha-num-external-id-computed-field-provider.d.ts.map +1 -1
- package/dist/services/computed-fields/entity/alpha-num-external-id-computed-field-provider.js.map +1 -1
- package/dist/services/crud.service.d.ts +1 -2
- package/dist/services/crud.service.d.ts.map +1 -1
- package/dist/services/crud.service.js +6 -1
- package/dist/services/crud.service.js.map +1 -1
- package/dist/services/excel.service.d.ts +1 -0
- package/dist/services/excel.service.d.ts.map +1 -1
- package/dist/services/excel.service.js +4 -0
- package/dist/services/excel.service.js.map +1 -1
- package/dist/services/model-metadata.service.d.ts +28 -1
- package/dist/services/model-metadata.service.d.ts.map +1 -1
- package/dist/services/model-metadata.service.js +109 -2
- package/dist/services/model-metadata.service.js.map +1 -1
- package/dist/services/setting.service.d.ts.map +1 -1
- package/dist/services/setting.service.js +3 -45
- package/dist/services/setting.service.js.map +1 -1
- package/dist/services/sms/Msg91BaseSMSService.js +6 -6
- package/dist/services/sms/Msg91BaseSMSService.js.map +1 -1
- package/dist/services/sms/Msg91OTPService.d.ts.map +1 -1
- package/dist/services/sms/Msg91OTPService.js +3 -1
- package/dist/services/sms/Msg91OTPService.js.map +1 -1
- package/dist/services/sms/Msg91SMSService.d.ts.map +1 -1
- package/dist/services/sms/Msg91SMSService.js +3 -1
- package/dist/services/sms/Msg91SMSService.js.map +1 -1
- package/dist/services/sms/TwilioSMSService.d.ts.map +1 -1
- package/dist/services/sms/TwilioSMSService.js +2 -0
- package/dist/services/sms/TwilioSMSService.js.map +1 -1
- package/dist/services/solid-introspect.service.d.ts +1 -0
- package/dist/services/solid-introspect.service.d.ts.map +1 -1
- package/dist/services/solid-introspect.service.js +14 -0
- package/dist/services/solid-introspect.service.js.map +1 -1
- package/dist/services/user.service.d.ts +8 -1
- package/dist/services/user.service.d.ts.map +1 -1
- package/dist/services/user.service.js +15 -4
- package/dist/services/user.service.js.map +1 -1
- package/dist/solid-core-cli.module.js +1 -1
- package/dist/solid-core-cli.module.js.map +1 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +29 -13
- package/dist/solid-core.module.js.map +1 -1
- package/dist/subscribers/scheduled-job.subscriber.d.ts.map +1 -1
- package/dist/subscribers/scheduled-job.subscriber.js +1 -1
- package/dist/subscribers/scheduled-job.subscriber.js.map +1 -1
- package/dist/transformers/typeorm/local-date-time-transformer.d.ts +2 -2
- package/dist/transformers/typeorm/local-date-time-transformer.d.ts.map +1 -1
- package/dist/transformers/typeorm/local-date-time-transformer.js +28 -6
- package/dist/transformers/typeorm/local-date-time-transformer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/config/cache.options.ts +6 -3
- package/src/config/iam.config.ts +2 -1
- package/src/controllers/model-metadata.controller.ts +21 -1
- package/src/controllers/setting.controller.ts +32 -36
- package/src/decorators/sms-provider.decorator.ts +7 -0
- package/src/dtos/create-role-metadata.dto.ts +3 -0
- package/src/dtos/navigation.dto.ts +14 -0
- package/src/dtos/sign-in.dto.ts +3 -3
- package/src/entities/common.entity.ts +7 -7
- package/src/entities/field-metadata.entity.ts +1 -1
- package/src/entities/legacy-common.entity.ts +6 -5
- package/src/entities/model-metadata.entity.ts +1 -1
- package/src/factories/mail.factory.ts +0 -1
- package/src/factories/sms.factory.ts +43 -0
- package/src/helpers/date.helper.ts +38 -9
- package/src/helpers/field-crud-managers/MediaFieldCrudManager.ts +138 -4
- package/src/helpers/image-encoding.helper.ts +71 -0
- package/src/helpers/module.helper.ts +3 -0
- package/src/helpers/solid-microservice-adapter.service.ts +68 -0
- package/src/helpers/solid-registry.ts +9 -0
- package/src/index.ts +11 -6
- package/src/jobs/database/{sms-publisher-database.service.ts → msg91-sms-publisher-database.service.ts} +2 -2
- package/src/jobs/database/{sms-subscriber-database.service.ts → msg91-sms-subscriber-database.service.ts} +9 -4
- package/src/jobs/database/otp-subscriber-database.service.ts +8 -2
- package/src/jobs/database/twilio-sms-subscriber-database.service.ts +5 -2
- package/src/jobs/{otp-publisher.service.ts → msg91-otp-publisher.service.ts} +2 -2
- package/src/jobs/{otp-subscriber.service.ts → msg91-otp-subscriber.service.ts} +10 -4
- package/src/jobs/{sms-publisher.service.ts → msg91-sms-publisher.service.ts} +2 -2
- package/src/jobs/{sms-subscriber.service.ts → msg91-sms-subscriber.service.ts} +9 -4
- package/src/jobs/twilio-sms-subscriber.service.ts +6 -2
- package/src/mappers/list-of-values-mapper.ts +2 -1
- package/src/repository/security-rule.repository.ts +7 -2
- package/src/seeders/module-metadata-seeder.service.ts +33 -6
- package/src/seeders/seed-data/email-templates/email-on-signup.handlebars.html +155 -0
- package/src/seeders/seed-data/sms-templates/text-on-signup.handlebars.txt +10 -0
- package/src/seeders/seed-data/solid-core-metadata.json +72 -26
- package/src/seeders/user-seeder.service.ts +5 -4
- package/src/services/1.js +6 -0
- package/src/services/authentication.service.ts +80 -15
- package/src/services/computed-fields/entity/alpha-num-external-id-computed-field-provider.ts +1 -2
- package/src/services/crud.service.ts +23 -19
- package/src/services/excel.service.ts +6 -0
- package/src/services/model-metadata.service.ts +151 -0
- package/src/services/setting.service.ts +12 -52
- package/src/services/sms/Msg91BaseSMSService.ts +6 -6
- package/src/services/sms/Msg91OTPService.ts +3 -2
- package/src/services/sms/Msg91SMSService.ts +3 -1
- package/src/services/sms/TwilioSMSService.ts +3 -3
- package/src/services/solid-introspect.service.ts +22 -0
- package/src/services/user.service.ts +19 -0
- package/src/solid-core-cli.module.ts +2 -2
- package/src/solid-core.module.ts +33 -13
- package/src/subscribers/scheduled-job.subscriber.ts +9 -2
- package/src/transformers/typeorm/local-date-time-transformer.ts +38 -13
- package/dist/jobs/database/sms-publisher-database.service.d.ts.map +0 -1
- package/dist/jobs/database/sms-publisher-database.service.js.map +0 -1
- package/dist/jobs/database/sms-queue-database-options.d.ts.map +0 -1
- package/dist/jobs/database/sms-queue-database-options.js.map +0 -1
- package/dist/jobs/database/sms-subscriber-database.service.d.ts.map +0 -1
- package/dist/jobs/database/sms-subscriber-database.service.js.map +0 -1
- package/dist/jobs/otp-publisher.service.d.ts.map +0 -1
- package/dist/jobs/otp-publisher.service.js.map +0 -1
- package/dist/jobs/otp-queue-options.d.ts.map +0 -1
- package/dist/jobs/otp-queue-options.js.map +0 -1
- package/dist/jobs/otp-subscriber.service.d.ts.map +0 -1
- package/dist/jobs/otp-subscriber.service.js.map +0 -1
- package/dist/jobs/sms-publisher.service.d.ts.map +0 -1
- package/dist/jobs/sms-publisher.service.js.map +0 -1
- package/dist/jobs/sms-queue-options.d.ts.map +0 -1
- package/dist/jobs/sms-queue-options.js.map +0 -1
- package/dist/jobs/sms-subscriber.service.d.ts.map +0 -1
- package/dist/jobs/sms-subscriber.service.js.map +0 -1
- /package/src/jobs/database/{sms-queue-database-options.ts → msg91-sms-queue-database-options.ts} +0 -0
- /package/src/jobs/{otp-queue-options.ts → msg91-otp-queue-options.ts} +0 -0
- /package/src/jobs/{sms-queue-options.ts → msg91-sms-queue-options.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BadRequestException,
|
|
1
|
+
import { BadRequestException, NotFoundException } from "@nestjs/common";
|
|
2
2
|
import { ConfigService } from "@nestjs/config";
|
|
3
3
|
import { DiscoveryService, ModuleRef } from "@nestjs/core";
|
|
4
4
|
import { isArray } from "class-validator";
|
|
5
|
-
import { CommonEntity, SolidBaseRepository, User } from "src";
|
|
5
|
+
import { CommonEntity, FileService, SolidBaseRepository, User } from "src";
|
|
6
6
|
import { ERROR_MESSAGES } from "src/constants/error-messages";
|
|
7
7
|
import { SUCCESS_MESSAGES } from "src/constants/success-messages";
|
|
8
8
|
import { EntityManager, FindOptionsWhere, In, IsNull, Not, QueryFailedError, SelectQueryBuilder } from "typeorm";
|
|
@@ -34,7 +34,6 @@ import { ShortTextFieldCrudManager } from "../helpers/field-crud-managers/ShortT
|
|
|
34
34
|
import { UUIDFieldCrudManager } from "../helpers/field-crud-managers/UUIDFieldCrudManager";
|
|
35
35
|
import { FieldCrudManager, MediaWithFullUrl } from "../interfaces";
|
|
36
36
|
import { CrudHelperService, FilterCombinator, UserIdFields } from "./crud-helper.service";
|
|
37
|
-
import { FileService } from "./file.service";
|
|
38
37
|
import { HashingService } from "./hashing.service";
|
|
39
38
|
import { getMediaStorageProvider } from "./mediaStorageProviders";
|
|
40
39
|
import { ModelMetadataService } from "./model-metadata.service";
|
|
@@ -45,19 +44,19 @@ import { BasicGroupFilterDto } from "src/dtos/basic-group-filters.dto";
|
|
|
45
44
|
export class CRUDService<T extends CommonEntity> { // Add two generic value i.e Person,CreatePersonDto, so we get the proper types in our service
|
|
46
45
|
|
|
47
46
|
constructor(
|
|
48
|
-
readonly modelMetadataService: ModelMetadataService,
|
|
49
|
-
readonly moduleMetadataService: ModuleMetadataService,
|
|
50
|
-
readonly configService: ConfigService,
|
|
51
|
-
readonly fileService: FileService,
|
|
52
|
-
readonly discoveryService: DiscoveryService,
|
|
53
|
-
readonly crudHelperService: CrudHelperService,
|
|
47
|
+
readonly modelMetadataService: ModelMetadataService, // go away
|
|
48
|
+
readonly moduleMetadataService: ModuleMetadataService, // go away
|
|
49
|
+
readonly configService: ConfigService, // we don't use it - go away
|
|
50
|
+
readonly fileService: FileService, // we don't use it - go away
|
|
51
|
+
readonly discoveryService: DiscoveryService, // go away
|
|
52
|
+
readonly crudHelperService: CrudHelperService, // go away
|
|
54
53
|
readonly entityManager: EntityManager,
|
|
55
54
|
readonly repo: SolidBaseRepository<T>,
|
|
56
55
|
readonly modelName: string,
|
|
57
56
|
readonly moduleName: string,
|
|
58
57
|
readonly moduleRef: ModuleRef,
|
|
59
|
-
readonly defaultEntityManager
|
|
60
|
-
|
|
58
|
+
readonly defaultEntityManager?: EntityManager
|
|
59
|
+
|
|
61
60
|
//We can just have the Model Entity here
|
|
62
61
|
) { }
|
|
63
62
|
|
|
@@ -340,7 +339,12 @@ export class CRUDService<T extends CommonEntity> { // Add two generic value i.e
|
|
|
340
339
|
// Use the EntityController to extract uploaded content & pass to the entity service.
|
|
341
340
|
// If embedded media, then the media uri will saved in the entity table, else the uri will be saved in the media table
|
|
342
341
|
// Plan the media table schema e.g id, uri, storageProvider, entity_id, entity_name, createdAt, updatedAt
|
|
343
|
-
const options = {
|
|
342
|
+
const options = {
|
|
343
|
+
...commonOptions,
|
|
344
|
+
mediaMaxSizeKb: fieldMetadata.mediaMaxSizeKb,
|
|
345
|
+
mediaTypes: fieldMetadata.mediaTypes,
|
|
346
|
+
type: fieldMetadata.type as unknown as SolidMediaType
|
|
347
|
+
};
|
|
344
348
|
return new MediaFieldCrudManager(options);
|
|
345
349
|
}
|
|
346
350
|
case SolidFieldType.relation: {
|
|
@@ -435,11 +439,11 @@ export class CRUDService<T extends CommonEntity> { // Add two generic value i.e
|
|
|
435
439
|
}
|
|
436
440
|
|
|
437
441
|
private isSkipComputation(isPartialUpdate: boolean, computedFieldMetadata: FieldMetadata) {
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
442
|
+
if (isPartialUpdate) return true; // If it is a partial update, then skip computation
|
|
443
|
+
if (computedFieldMetadata.computedFieldTriggerConfig && computedFieldMetadata.computedFieldTriggerConfig.length > 0) {
|
|
444
|
+
return true; // computedFieldTriggerConfig is a new field introduced as part of the IEntityComputedFieldProvider new interface, so this computation will be skiipped in crud service & will be called in the subscriber instead
|
|
445
|
+
}
|
|
446
|
+
return false; // If it is not a partial update, then do not skip computation
|
|
443
447
|
}
|
|
444
448
|
|
|
445
449
|
async find(basicFilterDto: BasicFilterDto, solidRequestContext: any = {}) {
|
|
@@ -705,7 +709,7 @@ export class CRUDService<T extends CommonEntity> { // Add two generic value i.e
|
|
|
705
709
|
return mediaDetails as MediaWithFullUrl[];
|
|
706
710
|
}
|
|
707
711
|
|
|
708
|
-
async findOne(id: number, query: any={}, solidRequestContext: any = {}) {
|
|
712
|
+
async findOne(id: number, query: any = {}, solidRequestContext: any = {}) {
|
|
709
713
|
const { populate = [], fields = [], populateMedia = [] } = query;
|
|
710
714
|
|
|
711
715
|
// const normalizedFields = this.crudHelperService.normalize(fields);
|
|
@@ -1065,7 +1069,7 @@ export class CRUDService<T extends CommonEntity> { // Add two generic value i.e
|
|
|
1065
1069
|
return updatedEntity
|
|
1066
1070
|
}
|
|
1067
1071
|
|
|
1068
|
-
private getDefaultEntityManager(){
|
|
1072
|
+
private getDefaultEntityManager() {
|
|
1069
1073
|
return this.defaultEntityManager ?? this.entityManager;
|
|
1070
1074
|
}
|
|
1071
1075
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Injectable, Logger } from '@nestjs/common';
|
|
2
2
|
import * as ExcelJS from 'exceljs';
|
|
3
3
|
import { ERROR_MESSAGES } from 'src/constants/error-messages';
|
|
4
|
+
import { parseFlexibleDate } from 'src/helpers/date.helper';
|
|
4
5
|
import { PassThrough, Readable } from 'stream';
|
|
5
6
|
|
|
6
7
|
export interface ExcelReadOptions {
|
|
@@ -302,4 +303,9 @@ export class ExcelService {
|
|
|
302
303
|
|
|
303
304
|
return { headers, rows };
|
|
304
305
|
}
|
|
306
|
+
|
|
307
|
+
public parseAndValidateDate(value: string): Date | null {
|
|
308
|
+
return parseFlexibleDate(value);
|
|
309
|
+
}
|
|
310
|
+
|
|
305
311
|
}
|
|
@@ -30,6 +30,9 @@ import { CrudHelperService } from './crud-helper.service';
|
|
|
30
30
|
import { FieldMetadataService } from './field-metadata.service';
|
|
31
31
|
import { MediaStorageProviderMetadataService } from './media-storage-provider-metadata.service';
|
|
32
32
|
import { RoleMetadataService } from './role-metadata.service';
|
|
33
|
+
import { NavigationDto } from 'src/dtos/navigation.dto';
|
|
34
|
+
import { SolidIntrospectService } from './solid-introspect.service';
|
|
35
|
+
import { CRUDService } from './crud.service';
|
|
33
36
|
|
|
34
37
|
@Injectable()
|
|
35
38
|
export class ModelMetadataService {
|
|
@@ -50,6 +53,8 @@ export class ModelMetadataService {
|
|
|
50
53
|
private readonly fieldMetadataService: FieldMetadataService,
|
|
51
54
|
private readonly roleService: RoleMetadataService,
|
|
52
55
|
private readonly moduleMetadataHelperService: ModuleMetadataHelperService,
|
|
56
|
+
readonly introspectService: SolidIntrospectService,
|
|
57
|
+
|
|
53
58
|
// No longer used.
|
|
54
59
|
// private readonly generateCodePublihser: GenerateCodePublisherDatabase,
|
|
55
60
|
) { }
|
|
@@ -1291,4 +1296,150 @@ export class ModelMetadataService {
|
|
|
1291
1296
|
});
|
|
1292
1297
|
}
|
|
1293
1298
|
|
|
1299
|
+
async navigation(navigationDto: NavigationDto) {
|
|
1300
|
+
const { recordId, modelName, ...basicFilterDto } = navigationDto;
|
|
1301
|
+
|
|
1302
|
+
const modelServiceInstanceWrapper =
|
|
1303
|
+
this.introspectService.getProvider(`${classify(modelName)}Service`);
|
|
1304
|
+
|
|
1305
|
+
if (!modelServiceInstanceWrapper) {
|
|
1306
|
+
throw new BadRequestException(
|
|
1307
|
+
`Invalid model name (${modelName}) specified in Navigation.`,
|
|
1308
|
+
);
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
const modelService: CRUDService<any> = modelServiceInstanceWrapper.instance;
|
|
1312
|
+
|
|
1313
|
+
const recs = await modelService.find(basicFilterDto);
|
|
1314
|
+
|
|
1315
|
+
// navigation only works for paginated results
|
|
1316
|
+
if (!('records' in recs) || !('currentPage' in recs.meta)) {
|
|
1317
|
+
return {
|
|
1318
|
+
prev: null,
|
|
1319
|
+
next: null,
|
|
1320
|
+
meta: null,
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
const { records, meta } = recs;
|
|
1325
|
+
|
|
1326
|
+
// --------------------
|
|
1327
|
+
// Find record index in page
|
|
1328
|
+
// --------------------
|
|
1329
|
+
const index = records.findIndex(r => String(r.id) === String(recordId));
|
|
1330
|
+
|
|
1331
|
+
if (index === -1) {
|
|
1332
|
+
throw new BadRequestException(`Record not found in current page`);
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
// --------------------
|
|
1336
|
+
// Pagination calculations
|
|
1337
|
+
// --------------------
|
|
1338
|
+
const limit = meta.perPage;
|
|
1339
|
+
const currentOffset = (meta.currentPage - 1) * meta.perPage;
|
|
1340
|
+
const currentIndexGlobal = currentOffset + index + 1;
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
let prev: { record: any; offset: number; limit: number } | null = null;
|
|
1344
|
+
let next: { record: any; offset: number; limit: number } | null = null;
|
|
1345
|
+
|
|
1346
|
+
// --------------------
|
|
1347
|
+
// PREV
|
|
1348
|
+
// --------------------
|
|
1349
|
+
if (index > 0) {
|
|
1350
|
+
prev = {
|
|
1351
|
+
record: records[index - 1],
|
|
1352
|
+
offset: currentOffset,
|
|
1353
|
+
limit,
|
|
1354
|
+
};
|
|
1355
|
+
} else if (meta.prevPage !== null) {
|
|
1356
|
+
const prevOffset = (meta.prevPage - 1) * meta.perPage;
|
|
1357
|
+
|
|
1358
|
+
const prevPage = await modelService.find({
|
|
1359
|
+
...basicFilterDto,
|
|
1360
|
+
offset: prevOffset,
|
|
1361
|
+
limit,
|
|
1362
|
+
});
|
|
1363
|
+
|
|
1364
|
+
if ('records' in prevPage) {
|
|
1365
|
+
const record = prevPage.records.at(-1) ?? null;
|
|
1366
|
+
if (record) {
|
|
1367
|
+
prev = {
|
|
1368
|
+
record,
|
|
1369
|
+
offset: prevOffset,
|
|
1370
|
+
limit,
|
|
1371
|
+
};
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
// --------------------
|
|
1377
|
+
// NEXT
|
|
1378
|
+
// --------------------
|
|
1379
|
+
if (index < records.length - 1) {
|
|
1380
|
+
next = {
|
|
1381
|
+
record: records[index + 1],
|
|
1382
|
+
offset: currentOffset,
|
|
1383
|
+
limit,
|
|
1384
|
+
};
|
|
1385
|
+
} else if (meta.nextPage !== null) {
|
|
1386
|
+
const nextOffset = (meta.nextPage - 1) * meta.perPage;
|
|
1387
|
+
|
|
1388
|
+
const nextPage = await modelService.find({
|
|
1389
|
+
...basicFilterDto,
|
|
1390
|
+
offset: nextOffset,
|
|
1391
|
+
limit,
|
|
1392
|
+
});
|
|
1393
|
+
|
|
1394
|
+
if ('records' in nextPage) {
|
|
1395
|
+
const record = nextPage.records[0] ?? null;
|
|
1396
|
+
if (record) {
|
|
1397
|
+
next = {
|
|
1398
|
+
record,
|
|
1399
|
+
offset: nextOffset,
|
|
1400
|
+
limit,
|
|
1401
|
+
};
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
// --------------------
|
|
1407
|
+
// RESPONSE
|
|
1408
|
+
// --------------------
|
|
1409
|
+
return {
|
|
1410
|
+
prev: prev
|
|
1411
|
+
? {
|
|
1412
|
+
recordId: prev.record.id,
|
|
1413
|
+
offset: prev.offset,
|
|
1414
|
+
limit: prev.limit,
|
|
1415
|
+
}
|
|
1416
|
+
: null,
|
|
1417
|
+
|
|
1418
|
+
next: next
|
|
1419
|
+
? {
|
|
1420
|
+
recordId: next.record.id,
|
|
1421
|
+
offset: next.offset,
|
|
1422
|
+
limit: next.limit,
|
|
1423
|
+
}
|
|
1424
|
+
: null,
|
|
1425
|
+
meta: {
|
|
1426
|
+
totalRecords: meta.totalRecords,
|
|
1427
|
+
perPage: meta.perPage,
|
|
1428
|
+
currentPage: meta.currentPage,
|
|
1429
|
+
totalPages: meta.totalPages,
|
|
1430
|
+
|
|
1431
|
+
currentIndexInPage: index,
|
|
1432
|
+
currentIndexGlobal,
|
|
1433
|
+
|
|
1434
|
+
hasPrev: !!prev,
|
|
1435
|
+
hasNext: !!next,
|
|
1436
|
+
|
|
1437
|
+
prevPage: meta.prevPage,
|
|
1438
|
+
nextPage: meta.nextPage,
|
|
1439
|
+
},
|
|
1440
|
+
|
|
1441
|
+
};
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
|
|
1294
1445
|
}
|
|
@@ -46,49 +46,7 @@ export class SettingService extends CRUDService<Setting> {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
async seedDefaultSettings(): Promise<void> {
|
|
49
|
-
const settingsSeederData =
|
|
50
|
-
passwordlessRegistrationValidateWhat: this.iamConfiguration.passwordlessRegistrationValidateWhat,
|
|
51
|
-
allowPublicRegistration: this.iamConfiguration.allowPublicRegistration,
|
|
52
|
-
passwordBasedAuth: this.iamConfiguration.passwordBasedAuth,
|
|
53
|
-
passwordLessAuth: this.iamConfiguration.passwordLessAuth,
|
|
54
|
-
activateUserOnRegistration: this.iamConfiguration.activateUserOnRegistration,
|
|
55
|
-
iamGoogleOAuthEnabled: false,
|
|
56
|
-
authPagesLayout: "center",
|
|
57
|
-
authPagesTheme: "light",
|
|
58
|
-
appLogo: null,
|
|
59
|
-
companylogo: null,
|
|
60
|
-
favicon: null,
|
|
61
|
-
appLogoPosition: "in_form_view",
|
|
62
|
-
showAuthContent: false,
|
|
63
|
-
appTitle: process.env.SOLID_APP_NAME || "Solid App",
|
|
64
|
-
appSubtitle: process.env.SOLID_APP_SUBTITLE || "Lorem Ipsum",
|
|
65
|
-
appDescription: process.env.SOLID_APP_DESCRIPTION || "lorem ipsum",
|
|
66
|
-
showLegalLinks: false,
|
|
67
|
-
appTnc: null,
|
|
68
|
-
appPrivacyPolicy: null,
|
|
69
|
-
defaultRole: this.iamConfiguration.defaultRole,
|
|
70
|
-
shouldQueueEmails: this.commonConfiguration.shouldQueueEmails,
|
|
71
|
-
shouldQueueSms: this.commonConfiguration.shouldQueueSms,
|
|
72
|
-
enableDarkMode: true,
|
|
73
|
-
copyright: null,
|
|
74
|
-
enableUsername: true,
|
|
75
|
-
enabledNotification: true,
|
|
76
|
-
contactSupportEmail: null,
|
|
77
|
-
contactSupportDisplayName: null,
|
|
78
|
-
contactSupportIcon: null,
|
|
79
|
-
authScreenRightBackgroundImage: null,
|
|
80
|
-
authScreenLeftBackgroundImage: null,
|
|
81
|
-
authScreenCenterBackgroundImage: null,
|
|
82
|
-
authenticationPasswordRegex: this.iamConfiguration.PASSWORD_REGEX,
|
|
83
|
-
authenticationPasswordRegexErrorMessage: this.iamConfiguration.PASSWORD_REGEX_ERROR_MESSAGE,
|
|
84
|
-
authenticationPasswordComplexityDescription: this.iamConfiguration.PASSWORD_COMPLEXITY_DESC,
|
|
85
|
-
solidXGenAiCodeBuilderConfig: JSON.stringify({
|
|
86
|
-
defaultProvider: "",
|
|
87
|
-
availableProviders: []
|
|
88
|
-
}),
|
|
89
|
-
showNameFieldsForRegistration: this.iamConfiguration.showNameFieldsForRegistration,
|
|
90
|
-
forceChangePasswordOnFirstLogin: this.iamConfiguration.forceChangePasswordOnFirstLogin
|
|
91
|
-
};
|
|
49
|
+
const settingsSeederData = this.getDefaultSettings();
|
|
92
50
|
|
|
93
51
|
const existingSettings = await this.repo.find();
|
|
94
52
|
const existingKeys = new Set(existingSettings.map(s => s.key));
|
|
@@ -178,11 +136,12 @@ export class SettingService extends CRUDService<Setting> {
|
|
|
178
136
|
appLogo: null,
|
|
179
137
|
companylogo: null,
|
|
180
138
|
favicon: null,
|
|
181
|
-
|
|
139
|
+
// in_form_view | in_image_view
|
|
140
|
+
appLogoPosition: "in_form_view",
|
|
182
141
|
showAuthContent: false,
|
|
183
142
|
appTitle: process.env.SOLID_APP_NAME || "Solid App",
|
|
184
|
-
appSubtitle:
|
|
185
|
-
appDescription:
|
|
143
|
+
appSubtitle: process.env.SOLID_APP_SUBTITLE || "",
|
|
144
|
+
appDescription: process.env.SOLID_APP_DESCRIPTION || "",
|
|
186
145
|
showLegalLinks: false,
|
|
187
146
|
appTnc: null,
|
|
188
147
|
appPrivacyPolicy: null,
|
|
@@ -212,6 +171,10 @@ export class SettingService extends CRUDService<Setting> {
|
|
|
212
171
|
};
|
|
213
172
|
}
|
|
214
173
|
|
|
174
|
+
// private async getSettingsFromRepo(): Promise<Setting[]> {
|
|
175
|
+
// const cachedSettings = await this.cacheManager.get('cached-system-settings');
|
|
176
|
+
// }
|
|
177
|
+
|
|
215
178
|
async getConfigValue(settingKey: string) {
|
|
216
179
|
try {
|
|
217
180
|
const settingsArray: Setting[] = await this.repo.find();
|
|
@@ -242,10 +205,7 @@ export class SettingService extends CRUDService<Setting> {
|
|
|
242
205
|
}
|
|
243
206
|
}
|
|
244
207
|
|
|
245
|
-
async updateSettings(
|
|
246
|
-
settings: CreateSettingDto[] = [],
|
|
247
|
-
uploadedFiles: Array<Express.Multer.File> = []
|
|
248
|
-
): Promise<Setting[]> {
|
|
208
|
+
async updateSettings(settings: CreateSettingDto[] = [], uploadedFiles: Array<Express.Multer.File> = []): Promise<Setting[]> {
|
|
249
209
|
const activeUser = this.requestContextService.getActiveUser();
|
|
250
210
|
const userId = activeUser?.sub;
|
|
251
211
|
|
|
@@ -381,8 +341,8 @@ export class SettingService extends CRUDService<Setting> {
|
|
|
381
341
|
|
|
382
342
|
const { showHeader, inListView } = getMcpUrlDto;
|
|
383
343
|
|
|
384
|
-
if(process.env.MCP_ENABLED === 'false') {
|
|
385
|
-
|
|
344
|
+
if (process.env.MCP_ENABLED === 'false') {
|
|
345
|
+
throw new ForbiddenException(ERROR_MESSAGES.FORBIDDEN);
|
|
386
346
|
}
|
|
387
347
|
|
|
388
348
|
if (solidRequestContext.activeUser) {
|
|
@@ -22,8 +22,8 @@ export abstract class Msg91BaseSMSService implements ISMS {
|
|
|
22
22
|
|
|
23
23
|
async sendSMSUsingTemplate(to: string, templateName: string, templateParams: any, shouldQueueSms = false): Promise<any> {
|
|
24
24
|
// Load template and evaluate it.
|
|
25
|
-
const
|
|
26
|
-
if (!
|
|
25
|
+
const smsTemplate = await this.smsTemplateService.findOneByName(templateName);
|
|
26
|
+
if (!smsTemplate) {
|
|
27
27
|
throw new Error(`Invalid template name ${templateName}`);
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -33,12 +33,12 @@ export abstract class Msg91BaseSMSService implements ISMS {
|
|
|
33
33
|
|
|
34
34
|
// The below code is only for reference, msh91 maintains the SMS templates in their database, and we need to only specify the templateId.
|
|
35
35
|
// The below was designed assuming that there are certain sms gateways who do not work this way.
|
|
36
|
-
if (
|
|
37
|
-
const bodyTemplate = Handlebars.compile(
|
|
36
|
+
if (smsTemplate.body) {
|
|
37
|
+
const bodyTemplate = Handlebars.compile(smsTemplate.body);
|
|
38
38
|
body = bodyTemplate(templateParams);
|
|
39
39
|
}
|
|
40
|
-
if (
|
|
41
|
-
templateId =
|
|
40
|
+
if (smsTemplate.smsProviderTemplateId) {
|
|
41
|
+
templateId = smsTemplate.smsProviderTemplateId;
|
|
42
42
|
}
|
|
43
43
|
if (!body && !templateId) {
|
|
44
44
|
throw new Error(`Invalid template, neither body nor templateId specified on template with name ${templateName}`);
|
|
@@ -7,6 +7,7 @@ import { SmsTemplateService } from "../sms-template.service";
|
|
|
7
7
|
import { Msg91BaseSMSService } from "./Msg91BaseSMSService";
|
|
8
8
|
import { ISMS } from "../../interfaces";
|
|
9
9
|
import { PublisherFactory } from "../queues/publisher-factory.service";
|
|
10
|
+
import { SmsProvider } from "src/decorators/sms-provider.decorator";
|
|
10
11
|
|
|
11
12
|
interface OtpParams {
|
|
12
13
|
otp: string,
|
|
@@ -16,16 +17,16 @@ interface OtpParams {
|
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
@Injectable()
|
|
20
|
+
@SmsProvider()
|
|
19
21
|
export class Msg91OTPService extends Msg91BaseSMSService implements ISMS {
|
|
20
22
|
constructor(
|
|
21
23
|
@Inject(commonConfig.KEY)
|
|
22
24
|
commonConfiguration: ConfigType<typeof commonConfig>,
|
|
23
|
-
// smsPublisher: OTPQueuePublisher,
|
|
24
25
|
publisherFactory: PublisherFactory<any>,
|
|
25
26
|
smsTemplateService: SmsTemplateService,
|
|
26
27
|
private readonly httpService: HttpService,
|
|
27
28
|
) {
|
|
28
|
-
super(commonConfiguration, '
|
|
29
|
+
super(commonConfiguration, 'Msg91OTPQueuePublisher', publisherFactory, smsTemplateService);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
async sendSMSSynchronously(message: QueueMessage<any>): Promise<any> {
|
|
@@ -7,8 +7,10 @@ import { SmsTemplateService } from "../sms-template.service";
|
|
|
7
7
|
import { Msg91BaseSMSService } from "./Msg91BaseSMSService";
|
|
8
8
|
import { ISMS } from "../../interfaces";
|
|
9
9
|
import { PublisherFactory } from "../queues/publisher-factory.service";
|
|
10
|
+
import { SmsProvider } from "src/decorators/sms-provider.decorator";
|
|
10
11
|
|
|
11
12
|
@Injectable()
|
|
13
|
+
@SmsProvider()
|
|
12
14
|
export class Msg91SMSService extends Msg91BaseSMSService implements ISMS {
|
|
13
15
|
constructor(
|
|
14
16
|
@Inject(commonConfig.KEY)
|
|
@@ -18,7 +20,7 @@ export class Msg91SMSService extends Msg91BaseSMSService implements ISMS {
|
|
|
18
20
|
smsTemplateService: SmsTemplateService,
|
|
19
21
|
private readonly httpService: HttpService,
|
|
20
22
|
) {
|
|
21
|
-
super(commonConfiguration, '
|
|
23
|
+
super(commonConfiguration, 'Msg91SmsQueuePublisher', publisherFactory, smsTemplateService)
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
async sendSMSSynchronously(message: QueueMessage<any>): Promise<any> {
|
|
@@ -7,9 +7,11 @@ import { ISMS } from "../../interfaces";
|
|
|
7
7
|
import { PublisherFactory } from "../queues/publisher-factory.service";
|
|
8
8
|
import twilio from 'twilio';
|
|
9
9
|
import { QueueMessage } from "src/interfaces/mq";
|
|
10
|
+
import { SmsProvider } from "src/decorators/sms-provider.decorator";
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
@Injectable()
|
|
14
|
+
@SmsProvider()
|
|
13
15
|
export class TwilioSMSService implements ISMS {
|
|
14
16
|
private readonly logger = new Logger(TwilioSMSService.name);
|
|
15
17
|
|
|
@@ -18,9 +20,7 @@ export class TwilioSMSService implements ISMS {
|
|
|
18
20
|
private commonConfiguration: ConfigType<typeof commonConfig>,
|
|
19
21
|
private publisherFactory: PublisherFactory<any>,
|
|
20
22
|
private smsTemplateService: SmsTemplateService,
|
|
21
|
-
) {
|
|
22
|
-
// super(commonConfiguration, 'OTPQueuePublisher', publisherFactory, smsTemplateService);
|
|
23
|
-
}
|
|
23
|
+
) { }
|
|
24
24
|
|
|
25
25
|
async sendSMS(to: string, body: string, shouldQueueSms: boolean): Promise<any> {
|
|
26
26
|
const accountSid = this.commonConfiguration.twilio.accountSid;
|
|
@@ -20,6 +20,7 @@ import { CreatedByUpdatedBySubscriber } from 'src/subscribers/created-by-updated
|
|
|
20
20
|
import { SoftDeleteAwareEventSubscriber } from 'src/subscribers/soft-delete-aware-event.subscriber';
|
|
21
21
|
import { DataSource } from 'typeorm';
|
|
22
22
|
import { CRUDService } from './crud.service';
|
|
23
|
+
import { IS_SMS_PROVIDER } from 'src/decorators/sms-provider.decorator';
|
|
23
24
|
|
|
24
25
|
export const coreSubscriberClasses = [
|
|
25
26
|
AuditSubscriber,
|
|
@@ -153,6 +154,15 @@ export class SolidIntrospectService implements OnApplicationBootstrap {
|
|
|
153
154
|
this.solidRegistry.registerWhatsappProvider(whatsappProvider);
|
|
154
155
|
});
|
|
155
156
|
|
|
157
|
+
// Register all IWhatsappTransport implementations
|
|
158
|
+
const smsProviders = this.discoveryService
|
|
159
|
+
.getProviders()
|
|
160
|
+
.filter((provider) => this.isSmsProvider(provider));
|
|
161
|
+
|
|
162
|
+
smsProviders.forEach((smsProvider) => {
|
|
163
|
+
this.solidRegistry.registerSmsProvider(smsProvider);
|
|
164
|
+
});
|
|
165
|
+
|
|
156
166
|
// Register all ISecurityRuleConfigProvider implementations
|
|
157
167
|
const securityRuleConfigProviders = this.discoveryService
|
|
158
168
|
.getProviders()
|
|
@@ -352,6 +362,18 @@ export class SolidIntrospectService implements OnApplicationBootstrap {
|
|
|
352
362
|
return !!isWhatsappProvider;
|
|
353
363
|
}
|
|
354
364
|
|
|
365
|
+
private isSmsProvider(provider: InstanceWrapper) {
|
|
366
|
+
const { instance } = provider;
|
|
367
|
+
if (!instance) return false;
|
|
368
|
+
|
|
369
|
+
const isSmsProvider = this.reflector.get<boolean>(
|
|
370
|
+
IS_SMS_PROVIDER,
|
|
371
|
+
instance.constructor,
|
|
372
|
+
);
|
|
373
|
+
|
|
374
|
+
return !!isSmsProvider;
|
|
375
|
+
}
|
|
376
|
+
|
|
355
377
|
private isSecurityRuleConfigProvider(provider: InstanceWrapper) {
|
|
356
378
|
const { instance } = provider;
|
|
357
379
|
if (!instance) return false;
|
|
@@ -18,6 +18,7 @@ import { iamConfig } from 'src/config/iam.config';
|
|
|
18
18
|
import { ERROR_MESSAGES } from 'src/constants/error-messages';
|
|
19
19
|
import { UserRepository } from 'src/repository/user.repository';
|
|
20
20
|
import { RoleMetadataRepository } from 'src/repository/role-metadata.repository';
|
|
21
|
+
import { HashingService } from './hashing.service';
|
|
21
22
|
|
|
22
23
|
@Injectable()
|
|
23
24
|
export class UserService extends CRUDService<User> {
|
|
@@ -29,6 +30,8 @@ export class UserService extends CRUDService<User> {
|
|
|
29
30
|
readonly fileService: FileService,
|
|
30
31
|
readonly discoveryService: DiscoveryService,
|
|
31
32
|
readonly crudHelperService: CrudHelperService,
|
|
33
|
+
readonly hashingService: HashingService,
|
|
34
|
+
|
|
32
35
|
@InjectEntityManager()
|
|
33
36
|
readonly entityManager: EntityManager,
|
|
34
37
|
// @InjectRepository(User, 'default')
|
|
@@ -283,4 +286,20 @@ export class UserService extends CRUDService<User> {
|
|
|
283
286
|
}
|
|
284
287
|
}
|
|
285
288
|
|
|
289
|
+
async hashPassword(password: string): Promise<{
|
|
290
|
+
password: string;
|
|
291
|
+
passwordScheme: string;
|
|
292
|
+
passwordSchemeVersion: number;
|
|
293
|
+
}> {
|
|
294
|
+
const hashedPassword = await this.hashingService.hash(password);
|
|
295
|
+
|
|
296
|
+
return {
|
|
297
|
+
password: hashedPassword,
|
|
298
|
+
passwordScheme: this.hashingService.name(),
|
|
299
|
+
passwordSchemeVersion: this.hashingService.currentVersion(),
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
|
|
286
304
|
}
|
|
305
|
+
|
|
@@ -5,7 +5,7 @@ import { WinstonLoggerConfig } from './winston.logger';
|
|
|
5
5
|
import { WinstonModule } from 'nest-winston';
|
|
6
6
|
import { CacheModule } from '@nestjs/cache-manager';
|
|
7
7
|
import { EventEmitterModule } from '@nestjs/event-emitter';
|
|
8
|
-
import {
|
|
8
|
+
import { CacheManagerOptions } from './config/cache.options';
|
|
9
9
|
import { ConfigModule } from '@nestjs/config';
|
|
10
10
|
import Joi from '@hapi/joi';
|
|
11
11
|
|
|
@@ -31,7 +31,7 @@ import Joi from '@hapi/joi';
|
|
|
31
31
|
}),
|
|
32
32
|
|
|
33
33
|
SolidCoreCliDBModule,
|
|
34
|
-
CacheModule.registerAsync(
|
|
34
|
+
CacheModule.registerAsync(CacheManagerOptions),
|
|
35
35
|
EventEmitterModule.forRoot(),
|
|
36
36
|
SolidCoreModule, // Import main module without exposing forRoot()
|
|
37
37
|
],
|