@solidxai/core 0.1.4 → 0.1.5-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +8 -0
- package/dist/constants/error-messages.d.ts +1 -0
- package/dist/constants/error-messages.d.ts.map +1 -1
- package/dist/constants/error-messages.js +1 -0
- package/dist/constants/error-messages.js.map +1 -1
- package/dist/constants.d.ts +3 -3
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +12 -12
- package/dist/constants.js.map +1 -1
- package/dist/controllers/otp-authentication.controller.d.ts +1 -4
- package/dist/controllers/otp-authentication.controller.d.ts.map +1 -1
- package/dist/controllers/otp-authentication.controller.js +1 -1
- package/dist/controllers/role-metadata.controller.d.ts +1 -0
- package/dist/controllers/role-metadata.controller.d.ts.map +1 -1
- package/dist/controllers/role-metadata.controller.js +15 -0
- package/dist/controllers/role-metadata.controller.js.map +1 -1
- package/dist/dtos/create-email-template.dto.d.ts.map +1 -1
- package/dist/dtos/create-email-template.dto.js.map +1 -1
- package/dist/dtos/create-list-of-values.dto.d.ts.map +1 -1
- package/dist/dtos/create-list-of-values.dto.js.map +1 -1
- package/dist/dtos/create-menu-item-metadata.dto.d.ts.map +1 -1
- package/dist/dtos/create-menu-item-metadata.dto.js.map +1 -1
- package/dist/dtos/create-role-metadata.dto.d.ts.map +1 -1
- package/dist/dtos/create-role-metadata.dto.js.map +1 -1
- package/dist/dtos/create-scheduled-job.dto.d.ts.map +1 -1
- package/dist/dtos/create-scheduled-job.dto.js.map +1 -1
- package/dist/dtos/create-security-rule.dto.d.ts.map +1 -1
- package/dist/dtos/create-security-rule.dto.js.map +1 -1
- package/dist/dtos/create-sms-template.dto.d.ts.map +1 -1
- package/dist/dtos/create-sms-template.dto.js.map +1 -1
- package/dist/dtos/create-view-metadata.dto.d.ts.map +1 -1
- package/dist/dtos/create-view-metadata.dto.js.map +1 -1
- package/dist/dtos/otp-sign-in.dto.d.ts +1 -1
- package/dist/dtos/otp-sign-in.dto.d.ts.map +1 -1
- package/dist/dtos/otp-sign-in.dto.js +2 -2
- package/dist/dtos/otp-sign-in.dto.js.map +1 -1
- package/dist/dtos/otp-sign-up.dto.d.ts +2 -2
- package/dist/dtos/otp-sign-up.dto.d.ts.map +1 -1
- package/dist/dtos/otp-sign-up.dto.js +2 -2
- package/dist/dtos/otp-sign-up.dto.js.map +1 -1
- package/dist/dtos/resolve-s3-url.dto.d.ts +2 -5
- package/dist/dtos/resolve-s3-url.dto.d.ts.map +1 -1
- package/dist/dtos/resolve-s3-url.dto.js +1 -13
- package/dist/dtos/resolve-s3-url.dto.js.map +1 -1
- package/dist/dtos/sign-up.dto.d.ts.map +1 -1
- package/dist/dtos/sign-up.dto.js.map +1 -1
- package/dist/dtos/update-email-template.dto.d.ts.map +1 -1
- package/dist/dtos/update-email-template.dto.js.map +1 -1
- package/dist/dtos/update-list-of-values.dto.d.ts.map +1 -1
- package/dist/dtos/update-list-of-values.dto.js.map +1 -1
- package/dist/dtos/update-menu-item-metadata.dto.d.ts.map +1 -1
- package/dist/dtos/update-menu-item-metadata.dto.js.map +1 -1
- package/dist/dtos/update-scheduled-job.dto.d.ts.map +1 -1
- package/dist/dtos/update-scheduled-job.dto.js.map +1 -1
- package/dist/dtos/update-security-rule.dto.d.ts.map +1 -1
- package/dist/dtos/update-security-rule.dto.js.map +1 -1
- package/dist/dtos/update-sms-template.dto.d.ts.map +1 -1
- package/dist/dtos/update-sms-template.dto.js.map +1 -1
- package/dist/dtos/update-view-metadata.dto.d.ts.map +1 -1
- package/dist/dtos/update-view-metadata.dto.js.map +1 -1
- package/dist/entities/user.entity.d.ts +1 -0
- package/dist/entities/user.entity.d.ts.map +1 -1
- package/dist/entities/user.entity.js +6 -1
- package/dist/entities/user.entity.js.map +1 -1
- package/dist/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.d.ts +2 -0
- package/dist/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.d.ts.map +1 -1
- package/dist/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.js +33 -23
- package/dist/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.js.map +1 -1
- package/dist/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.d.ts +3 -0
- package/dist/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.d.ts.map +1 -1
- package/dist/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.js +36 -23
- package/dist/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.js.map +1 -1
- package/dist/helpers/security.helper.js +1 -0
- package/dist/helpers/security.helper.js.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/repository/solid-base.repository.d.ts +10 -1
- package/dist/repository/solid-base.repository.d.ts.map +1 -1
- package/dist/repository/solid-base.repository.js +109 -0
- package/dist/repository/solid-base.repository.js.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.d.ts +2 -0
- package/dist/seeders/module-metadata-seeder.service.d.ts.map +1 -1
- package/dist/seeders/module-metadata-seeder.service.js +141 -71
- package/dist/seeders/module-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/permission-metadata-seeder.service.d.ts +1 -1
- package/dist/seeders/permission-metadata-seeder.service.d.ts.map +1 -1
- package/dist/seeders/permission-metadata-seeder.service.js +1 -1
- package/dist/seeders/permission-metadata-seeder.service.js.map +1 -1
- package/dist/seeders/seed-data/solid-core-metadata.json +12 -25
- package/dist/services/authentication.service.d.ts +22 -8
- package/dist/services/authentication.service.d.ts.map +1 -1
- package/dist/services/authentication.service.js +228 -214
- package/dist/services/authentication.service.js.map +1 -1
- package/dist/services/crud-helper.service.d.ts +4 -0
- package/dist/services/crud-helper.service.d.ts.map +1 -1
- package/dist/services/crud-helper.service.js +66 -32
- package/dist/services/crud-helper.service.js.map +1 -1
- package/dist/services/crud.service.d.ts.map +1 -1
- package/dist/services/crud.service.js +7 -4
- package/dist/services/crud.service.js.map +1 -1
- package/dist/services/field-metadata.service.d.ts.map +1 -1
- package/dist/services/field-metadata.service.js.map +1 -1
- package/dist/services/file/disk-file.service.d.ts +0 -2
- package/dist/services/file/disk-file.service.d.ts.map +1 -1
- package/dist/services/file/disk-file.service.js +7 -16
- package/dist/services/file/disk-file.service.js.map +1 -1
- package/dist/services/file/index.d.ts +1 -0
- package/dist/services/file/index.d.ts.map +1 -1
- package/dist/services/file/index.js +1 -0
- package/dist/services/file/index.js.map +1 -1
- package/dist/services/file/storage-path-builder.d.ts +17 -0
- package/dist/services/file/storage-path-builder.d.ts.map +1 -0
- package/dist/{seeders/sms-template-seeder.service.js → services/file/storage-path-builder.js} +45 -35
- package/dist/services/file/storage-path-builder.js.map +1 -0
- package/dist/services/media.service.d.ts +1 -1
- package/dist/services/media.service.d.ts.map +1 -1
- package/dist/services/media.service.js +45 -6
- package/dist/services/media.service.js.map +1 -1
- package/dist/services/mediaStorageProviders/file-s3-storage-provider.js.map +1 -1
- package/dist/services/mediaStorageProviders/file-storage-provider.d.ts.map +1 -1
- package/dist/services/mediaStorageProviders/file-storage-provider.js +46 -7
- package/dist/services/mediaStorageProviders/file-storage-provider.js.map +1 -1
- package/dist/services/module-metadata.service.d.ts +4 -6
- package/dist/services/module-metadata.service.d.ts.map +1 -1
- package/dist/services/module-metadata.service.js +16 -14
- package/dist/services/module-metadata.service.js.map +1 -1
- package/dist/services/setting.service.d.ts +3 -2
- package/dist/services/setting.service.d.ts.map +1 -1
- package/dist/services/setting.service.js +7 -4
- package/dist/services/setting.service.js.map +1 -1
- package/dist/services/settings/default-settings-provider.service.d.ts +24 -2
- package/dist/services/settings/default-settings-provider.service.d.ts.map +1 -1
- package/dist/services/settings/default-settings-provider.service.js +8 -6
- package/dist/services/settings/default-settings-provider.service.js.map +1 -1
- package/dist/solid-core.module.d.ts +3 -1
- package/dist/solid-core.module.d.ts.map +1 -1
- package/dist/solid-core.module.js +45 -9
- package/dist/solid-core.module.js.map +1 -1
- package/dist/testing/adapters/ui/playwright-adapter.d.ts.map +1 -1
- package/dist/testing/adapters/ui/playwright-adapter.js +35 -2
- package/dist/testing/adapters/ui/playwright-adapter.js.map +1 -1
- package/package.json +8 -2
- package/src/constants/error-messages.ts +1 -0
- package/src/constants.ts +3 -3
- package/src/controllers/role-metadata.controller.ts +26 -18
- package/src/dtos/create-email-template.dto.ts +7 -0
- package/src/dtos/create-list-of-values.dto.ts +7 -0
- package/src/dtos/create-menu-item-metadata.dto.ts +12 -1
- package/src/dtos/create-role-metadata.dto.ts +9 -0
- package/src/dtos/create-scheduled-job.dto.ts +14 -0
- package/src/dtos/create-security-rule.dto.ts +6 -0
- package/src/dtos/create-sms-template.dto.ts +6 -0
- package/src/dtos/create-view-metadata.dto.ts +11 -0
- package/src/dtos/otp-sign-in.dto.ts +3 -3
- package/src/dtos/otp-sign-up.dto.ts +3 -3
- package/src/dtos/resolve-s3-url.dto.ts +2 -12
- package/src/dtos/sign-up.dto.ts +0 -2
- package/src/dtos/update-email-template.dto.ts +6 -0
- package/src/dtos/update-list-of-values.dto.ts +8 -0
- package/src/dtos/update-menu-item-metadata.dto.ts +12 -0
- package/src/dtos/update-scheduled-job.dto.ts +15 -0
- package/src/dtos/update-security-rule.dto.ts +7 -0
- package/src/dtos/update-sms-template.dto.ts +32 -32
- package/src/dtos/update-view-metadata.dto.ts +12 -0
- package/src/entities/user.entity.ts +3 -0
- package/src/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.ts +43 -32
- package/src/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.ts +45 -33
- package/src/helpers/security.helper.ts +1 -1
- package/src/index.ts +0 -4
- package/src/repository/solid-base.repository.ts +172 -1
- package/src/seeders/module-metadata-seeder.service.ts +188 -126
- package/src/seeders/permission-metadata-seeder.service.ts +1 -4
- package/src/seeders/seed-data/solid-core-metadata.json +12 -25
- package/src/services/authentication.service.ts +268 -266
- package/src/services/crud-helper.service.ts +79 -36
- package/src/services/crud.service.ts +9 -4
- package/src/services/field-metadata.service.ts +0 -71
- package/src/services/file/disk-file.service.ts +8 -18
- package/src/services/file/index.ts +1 -0
- package/src/services/file/storage-path-builder.ts +56 -0
- package/src/services/media.service.ts +13 -7
- package/src/services/mediaStorageProviders/file-s3-storage-provider.ts +1 -1
- package/src/services/mediaStorageProviders/file-storage-provider.ts +13 -8
- package/src/services/module-metadata.service.ts +18 -15
- package/src/services/setting.service.ts +5 -3
- package/src/services/settings/default-settings-provider.service.ts +5 -3
- package/src/solid-core.module.ts +16 -12
- package/src/testing/adapters/ui/playwright-adapter.ts +1 -1
- package/dist/passport-strategies/local.strategy.d.ts +0 -15
- package/dist/passport-strategies/local.strategy.d.ts.map +0 -1
- package/dist/passport-strategies/local.strategy.js +0 -44
- package/dist/passport-strategies/local.strategy.js.map +0 -1
- package/dist/seeders/email-template-seeder.service.d.ts +0 -10
- package/dist/seeders/email-template-seeder.service.d.ts.map +0 -1
- package/dist/seeders/email-template-seeder.service.js +0 -84
- package/dist/seeders/email-template-seeder.service.js.map +0 -1
- package/dist/seeders/sms-template-seeder.service.d.ts +0 -10
- package/dist/seeders/sms-template-seeder.service.d.ts.map +0 -1
- package/dist/seeders/sms-template-seeder.service.js.map +0 -1
- package/dist/seeders/user-seeder.service.d.ts +0 -10
- package/dist/seeders/user-seeder.service.d.ts.map +0 -1
- package/dist/seeders/user-seeder.service.js +0 -44
- package/dist/seeders/user-seeder.service.js.map +0 -1
- package/src/passport-strategies/local.strategy.ts +0 -28
- package/src/seeders/email-template-seeder.service.ts +0 -49
- package/src/seeders/sms-template-seeder.service.ts +0 -50
- package/src/seeders/user-seeder.service.ts +0 -33
|
@@ -14,22 +14,10 @@ const openapi = require("@nestjs/swagger");
|
|
|
14
14
|
const class_validator_1 = require("class-validator");
|
|
15
15
|
class ResolveS3UrlDto {
|
|
16
16
|
static _OPENAPI_METADATA_FACTORY() {
|
|
17
|
-
return {
|
|
17
|
+
return { s3Key: { required: true, type: () => String }, bucketName: { required: false, type: () => String }, mediaStorageProviderUserKey: { required: false, type: () => String }, isPrivate: { required: true, type: () => String } };
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
exports.ResolveS3UrlDto = ResolveS3UrlDto;
|
|
21
|
-
__decorate([
|
|
22
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
23
|
-
__metadata("design:type", String)
|
|
24
|
-
], ResolveS3UrlDto.prototype, "modelName", void 0);
|
|
25
|
-
__decorate([
|
|
26
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
27
|
-
__metadata("design:type", String)
|
|
28
|
-
], ResolveS3UrlDto.prototype, "fieldName", void 0);
|
|
29
|
-
__decorate([
|
|
30
|
-
(0, class_validator_1.IsNotEmpty)(),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], ResolveS3UrlDto.prototype, "fileType", void 0);
|
|
33
21
|
__decorate([
|
|
34
22
|
(0, class_validator_1.IsNotEmpty)(),
|
|
35
23
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-s3-url.dto.js","sourceRoot":"","sources":["../../src/dtos/resolve-s3-url.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAA6E;AAE7E,MAAa,eAAe;;;;
|
|
1
|
+
{"version":3,"file":"resolve-s3-url.dto.js","sourceRoot":"","sources":["../../src/dtos/resolve-s3-url.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAA6E;AAE7E,MAAa,eAAe;;;;CAY3B;AAZD,0CAYC;AAVG;IADC,IAAA,4BAAU,GAAE;;8CACC;AAGd;IADC,IAAA,4BAAU,GAAE;;mDACO;AAGpB;IADC,IAAA,4BAAU,GAAE;;oEACwB;AAGrC;IADC,IAAA,4BAAU,GAAE;;kDACK","sourcesContent":["import { IsEmail, IsNotEmpty, IsOptional, MinLength } from 'class-validator';\n\nexport class ResolveS3UrlDto {\n @IsNotEmpty()\n s3Key: string;\n\n @IsOptional()\n bucketName?: string;\n\n @IsOptional()\n mediaStorageProviderUserKey?: string;\n\n @IsNotEmpty()\n isPrivate: string;\n}\n\n\n\n\n\n\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/sign-up.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,SAAS;IAIlB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,QAAQ,EAAE,MAAM,CAAC;IAIjB,KAAK,EAAE,MAAM,CAAC;IAGd,QAAQ,EAAE,MAAM,CAAC;IAIjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAKhB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"sign-up.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/sign-up.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,SAAS;IAIlB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAGlB,QAAQ,EAAE,MAAM,CAAC;IAIjB,KAAK,EAAE,MAAM,CAAC;IAGd,QAAQ,EAAE,MAAM,CAAC;IAIjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAKhB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-up.dto.js","sourceRoot":"","sources":["../../src/dtos/sign-up.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yDAAyC;AACzC,qDAAgG;AAEhG,MAAa,SAAS;;;;
|
|
1
|
+
{"version":3,"file":"sign-up.dto.js","sourceRoot":"","sources":["../../src/dtos/sign-up.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,yDAAyC;AACzC,qDAAgG;AAEhG,MAAa,SAAS;;;;CAwBrB;AAxBD,8BAwBC;AApBG;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;2CACK;AAGlB;IADC,IAAA,4BAAU,GAAE;;2CACI;AAIjB;IAFC,IAAA,yBAAO,GAAE;IACT,IAAA,4BAAU,GAAE;;wCACC;AAGd;IADC,IAAA,4BAAU,GAAE;;2CACI;AAIjB;IAFC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;;yCACG;AAKhB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;IACT,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;wCACF","sourcesContent":["import { Type } from 'class-transformer';\nimport { IsArray, IsEmail, IsNotEmpty, IsOptional, IsString, MinLength } from 'class-validator';\n\nexport class SignUpDto {\n\n @IsString()\n @IsOptional()\n fullName?: string;\n\n @IsNotEmpty()\n username: string;\n\n @IsEmail()\n @IsNotEmpty()\n email: string;\n\n @IsOptional()\n password: string;\n\n @IsString()\n @IsOptional()\n mobile?: string;\n\n @IsOptional()\n @IsArray()\n @Type(() => String)\n roles?: string[];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-email-template.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-email-template.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;;AAMrE,qBAAa,sBAAuB,SAAQ,2BAAmC;IAM3E,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"update-email-template.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-email-template.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;;AAMrE,qBAAa,sBAAuB,SAAQ,2BAAmC;IAM3E,IAAI,EAAE,MAAM,CAAC;IAMb,WAAW,EAAE,MAAM,CAAC;IAMpB,IAAI,EAAE,MAAM,CAAC;IAKb,IAAI,EAAE,MAAM,CAAC;IAMb,OAAO,EAAE,MAAM,CAAC;IAKhB,WAAW,EAAE,MAAM,CAAC;IAKpB,MAAM,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-email-template.dto.js","sourceRoot":"","sources":["../../src/dtos/update-email-template.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA2D;AAC3D,2EAAqE;AACrE,qDAA2C;AAC3C,qDAA0C;AAC1C,qDAA6C;AAC7C,qDAAwD;AAExD,MAAa,sBAAuB,SAAQ,IAAA,qBAAW,EAAC,kDAAsB,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"update-email-template.dto.js","sourceRoot":"","sources":["../../src/dtos/update-email-template.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA2D;AAC3D,2EAAqE;AACrE,qDAA2C;AAC3C,qDAA0C;AAC1C,qDAA6C;AAC7C,qDAAwD;AAExD,MAAa,sBAAuB,SAAQ,IAAA,qBAAW,EAAC,kDAAsB,CAAC;;;;CAwC9E;AAxCD,wDAwCC;AAlCG;IALC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,EAAC,kBAAkB,CAAC;IAC3B,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;oDACD;AAMb;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;2DACM;AAMpB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;oDACD;AAKb;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;oDACD;AAMb;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;uDACE;AAKhB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;2DACM;AAKpB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;IACX,IAAA,qBAAW,GAAE;;sDACE;AAClB,CAAC,CAAC,CAAC","sourcesContent":["import { PartialType, ApiProperty } from '@nestjs/swagger';\nimport { CreateEmailTemplateDto } from './create-email-template.dto';\nimport { IsString } from 'class-validator';\nimport { Matches } from 'class-validator';\nimport { IsOptional } from 'class-validator';\nimport { IsNotEmpty, IsBoolean } from 'class-validator';\n\nexport class UpdateEmailTemplateDto extends PartialType(CreateEmailTemplateDto) {\n @IsNotEmpty()\n @IsOptional()\n @Matches(/[a-z]+(-[a-z]+)*/)\n @IsString()\n @ApiProperty()\n name: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n displayName: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n body: string;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n type: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n subject: string;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n description: string;\n\n @IsOptional()\n @IsBoolean()\n @ApiProperty()\n active: boolean;\n} { }\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-list-of-values.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-list-of-values.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"update-list-of-values.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-list-of-values.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;IAMX,IAAI,EAAE,MAAM,CAAC;IAMb,KAAK,EAAE,MAAM,CAAC;IAMd,OAAO,EAAE,MAAM,CAAC;IAMhB,WAAW,EAAE,MAAM,CAAC;IAKpB,OAAO,EAAE,OAAO,CAAC;IAKjB,QAAQ,EAAE,MAAM,CAAC;IAKjB,QAAQ,EAAE,MAAM,CAAC;IAKjB,aAAa,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-list-of-values.dto.js","sourceRoot":"","sources":["../../src/dtos/update-list-of-values.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAAqF;AACrF,6CAA8C;AAE9C,MAAa,qBAAqB;;;;
|
|
1
|
+
{"version":3,"file":"update-list-of-values.dto.js","sourceRoot":"","sources":["../../src/dtos/update-list-of-values.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAAqF;AACrF,6CAA8C;AAE9C,MAAa,qBAAqB;;;;CAgDjC;AAhDD,sDAgDC;AA7CG;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;;iDACG;AAMX;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;mDACD;AAMb;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;oDACA;AAMd;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;sDACE;AAMhB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;0DACM;AAKpB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;IACX,IAAA,qBAAW,GAAE;;sDACG;AAKjB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;uDACG;AAKjB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;uDACG;AAKjB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;4DACQ","sourcesContent":["import { IsInt, IsOptional, IsString, IsNotEmpty, IsBoolean } from 'class-validator';\nimport { ApiProperty } from '@nestjs/swagger';\n\nexport class UpdateListOfValuesDto {\n @IsOptional()\n @IsInt()\n id: number;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n type: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n value: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n display: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n description: string;\n\n @IsOptional()\n @IsBoolean()\n @ApiProperty()\n default: boolean;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n sequence: number;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n moduleId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n moduleUserKey: string;\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-menu-item-metadata.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-menu-item-metadata.dto.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,qBAAa,yBAAyB;IAGlC,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"update-menu-item-metadata.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-menu-item-metadata.dto.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E,qBAAa,yBAAyB;IAGlC,EAAE,EAAE,MAAM,CAAC;IAOX,IAAI,EAAE,MAAM,CAAC;IAMb,WAAW,EAAE,MAAM,CAAC;IAKpB,QAAQ,EAAE,MAAM,CAAC;IAKjB,aAAa,EAAE,MAAM,CAAC;IAKtB,gBAAgB,EAAE,MAAM,CAAC;IAKzB,qBAAqB,EAAE,MAAM,CAAC;IAK9B,QAAQ,EAAE,MAAM,CAAC;IAKjB,aAAa,EAAE,MAAM,CAAC;IAQtB,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAK/B,QAAQ,EAAE,MAAM,EAAE,CAAC;IAKnB,YAAY,EAAE,MAAM,CAAC;IAKrB,cAAc,EAAE,MAAM,CAAC;IAKvB,QAAQ,EAAE,MAAM,CAAC;CAEpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-menu-item-metadata.dto.js","sourceRoot":"","sources":["../../src/dtos/update-menu-item-metadata.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAsH;AACtH,yDAAoD;AACpD,0FAAiE;AACjE,6CAA8C;AAC9C,yEAA0E;AAE1E,MAAa,yBAAyB;;;;
|
|
1
|
+
{"version":3,"file":"update-menu-item-metadata.dto.js","sourceRoot":"","sources":["../../src/dtos/update-menu-item-metadata.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAsH;AACtH,yDAAoD;AACpD,0FAAiE;AACjE,6CAA8C;AAC9C,yEAA0E;AAE1E,MAAa,yBAAyB;;;;CA4ErC;AA5ED,8DA4EC;AAzEG;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;;qDACG;AAOX;IALC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,EAAC,kBAAkB,CAAC;IAC3B,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;uDACD;AAMb;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;8DACM;AAKpB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;2DACG;AAKjB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;gEACQ;AAKtB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;mEACW;AAKzB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;wEACgB;AAK9B;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;2DACG;AAKjB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;gEACQ;AAQtB;IANC,IAAA,6BAAS,EAAC,2BAAgB,CAAC;IAC3B,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;IACb,IAAA,yBAAO,GAAE;IACT,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,gDAAqB,CAAC;;wDACH;AAK/B;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;IACT,IAAA,qBAAW,GAAE;;2DACK;AAKnB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;+DACO;AAKrB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;iEACS;AAKvB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;2DACG","sourcesContent":["import { IsInt, IsOptional, IsString, Matches, IsNotEmpty, ValidateNested, IsArray, IsNumber } from 'class-validator';\nimport { Transform, Type } from 'class-transformer';\nimport arrayTransformer from '../transformers/array-transformer';\nimport { ApiProperty } from '@nestjs/swagger';\nimport { UpdateRoleMetadataDto } from 'src/dtos/update-role-metadata.dto';\n\nexport class UpdateMenuItemMetadataDto {\n @IsOptional()\n @IsInt()\n id: number;\n\n @IsNotEmpty()\n @IsOptional()\n @Matches(/[a-z]+(-[a-z]+)*/)\n @IsString()\n @ApiProperty()\n name: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n displayName: string;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n moduleId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n moduleUserKey: string;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n parentMenuItemId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n parentMenuItemUserKey: string;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n actionId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n actionUserKey: string;\n\n @Transform(arrayTransformer)\n @IsOptional()\n @ApiProperty()\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => UpdateRoleMetadataDto)\n roles: UpdateRoleMetadataDto[];\n\n @IsOptional()\n @IsArray()\n @ApiProperty()\n rolesIds: number[];\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n rolesCommand: string;\n\n @IsOptional()\n @IsNumber()\n @ApiProperty()\n sequenceNumber: number;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n iconName: string;\n\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-scheduled-job.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-scheduled-job.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"update-scheduled-job.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-scheduled-job.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;IAMX,YAAY,EAAE,MAAM,CAAC;IAMrB,QAAQ,EAAE,OAAO,CAAC;IAMlB,SAAS,EAAE,MAAM,CAAC;IAKlB,SAAS,EAAE,IAAI,CAAC;IAKhB,OAAO,EAAE,IAAI,CAAC;IAKd,SAAS,EAAE,IAAI,CAAC;IAKhB,OAAO,EAAE,IAAI,CAAC;IAKd,UAAU,EAAE,MAAM,CAAC;IAKnB,SAAS,EAAE,IAAI,CAAC;IAKhB,SAAS,EAAE,IAAI,CAAC;IAKhB,SAAS,EAAE,MAAM,CAAC;IAMlB,GAAG,EAAE,MAAM,CAAC;IAKZ,cAAc,EAAE,MAAM,CAAC;IAKvB,QAAQ,EAAE,MAAM,CAAC;IAKjB,aAAa,EAAE,MAAM,CAAC;CACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-scheduled-job.dto.js","sourceRoot":"","sources":["../../src/dtos/update-scheduled-job.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAA6F;AAC7F,6CAA8C;AAE9C,MAAa,qBAAqB;;;;
|
|
1
|
+
{"version":3,"file":"update-scheduled-job.dto.js","sourceRoot":"","sources":["../../src/dtos/update-scheduled-job.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAA6F;AAC7F,6CAA8C;AAE9C,MAAa,qBAAqB;;;;CAmFjC;AAnFD,sDAmFC;AAhFG;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;;iDACG;AAMX;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;2DACO;AAMrB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;IACX,IAAA,qBAAW,GAAE;;uDACI;AAMlB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;wDACI;AA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\nimport { ApiProperty } from '@nestjs/swagger';\n\nexport class UpdateScheduledJobDto {\n @IsOptional()\n @IsInt()\n id: number;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n scheduleName: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsBoolean()\n @ApiProperty()\n isActive: boolean;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n frequency: string;\n\n @IsOptional()\n @IsDate()\n @ApiProperty()\n startTime: Date;\n\n @IsOptional()\n @IsDate()\n @ApiProperty()\n endTime: Date;\n\n @IsOptional()\n @IsDate()\n @ApiProperty()\n startDate: Date;\n\n @IsOptional()\n @IsDate()\n @ApiProperty()\n endDate: Date;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n dayOfMonth: number;\n\n @IsOptional()\n @IsDate()\n @ApiProperty()\n lastRunAt: Date;\n\n @IsOptional()\n @IsDate()\n @ApiProperty()\n nextRunAt: Date;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n dayOfWeek: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n job: string;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n cronExpression: string;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n moduleId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n moduleUserKey: string;\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-security-rule.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-security-rule.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"update-security-rule.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-security-rule.dto.ts"],"names":[],"mappings":"AAGA,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;IAMX,IAAI,EAAE,MAAM,CAAC;IAMb,WAAW,EAAE,MAAM,CAAC;IAKpB,MAAM,EAAE,MAAM,CAAC;IAKf,WAAW,EAAE,MAAM,CAAC;IAKpB,eAAe,EAAE,MAAM,CAAC;IAKxB,oBAAoB,EAAE,MAAM,CAAC;IAM7B,kBAAkB,EAAE,GAAG,CAAC;IAKxB,0BAA0B,EAAE,MAAM,CAAC;CACtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-security-rule.dto.js","sourceRoot":"","sources":["../../src/dtos/update-security-rule.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAAkF;AAClF,6CAA8C;AAE9C,MAAa,qBAAqB;;;;
|
|
1
|
+
{"version":3,"file":"update-security-rule.dto.js","sourceRoot":"","sources":["../../src/dtos/update-security-rule.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAAkF;AAClF,6CAA8C;AAE9C,MAAa,qBAAqB;;;;CA+CjC;AA/CD,sDA+CC;AA5CG;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;;iDACG;AAMX;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;mDACD;AAMb;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;0DACM;AAKpB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;qDACC;AAKf;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;0DACM;AAKpB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;8DACU;AAKxB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;mEACe;AAM7B;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;;iEACU;AAKxB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;yEACqB","sourcesContent":["import { IsInt, IsOptional, IsString, IsNotEmpty, IsJSON } from 'class-validator';\nimport { ApiProperty } from '@nestjs/swagger';\n\nexport class UpdateSecurityRuleDto {\n @IsOptional()\n @IsInt()\n id: number;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n name: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n description: string;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n roleId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n roleUserKey: string;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n modelMetadataId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n modelMetadataUserKey: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsJSON()\n @ApiProperty()\n securityRuleConfig: any;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n securityRuleConfigProvider: string;\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-sms-template.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-sms-template.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;;AAIjE,qBAAa,oBAAqB,SAAQ,yBAAiC;
|
|
1
|
+
{"version":3,"file":"update-sms-template.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-sms-template.dto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;;AAIjE,qBAAa,oBAAqB,SAAQ,yBAAiC;IAIvE,IAAI,EAAE,MAAM,CAAC;IAOb,IAAI,EAAE,MAAM,CAAC;IAKb,qBAAqB,EAAE,MAAM,CAAC;IAM9B,WAAW,EAAE,MAAM,CAAC;IAKpB,IAAI,EAAE,MAAM,CAAC;IAKb,WAAW,EAAE,MAAM,CAAC;IAKpB,MAAM,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-sms-template.dto.js","sourceRoot":"","sources":["../../src/dtos/update-sms-template.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA2D;AAC3D,uEAAiE;AACjE,qDAA2C;AAC3C,qDAA6E;AAE7E,MAAa,oBAAqB,SAAQ,IAAA,qBAAW,EAAC,8CAAoB,CAAC;;;;CAsC1E;AAtCD,oDAsCC;
|
|
1
|
+
{"version":3,"file":"update-sms-template.dto.js","sourceRoot":"","sources":["../../src/dtos/update-sms-template.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,6CAA2D;AAC3D,uEAAiE;AACjE,qDAA2C;AAC3C,qDAA6E;AAE7E,MAAa,oBAAqB,SAAQ,IAAA,qBAAW,EAAC,8CAAoB,CAAC;;;;CAsC1E;AAtCD,oDAsCC;AAlCG;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;kDACD;AAOb;IALC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,EAAC,kBAAkB,CAAC;IAC3B,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;kDACD;AAKb;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;mEACgB;AAM9B;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;yDACM;AAKpB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;kDACD;AAKb;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;yDACM;AAKpB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;IACX,IAAA,qBAAW,GAAE;;oDACE;AAClB,CAAC,CAAC,CAAC","sourcesContent":["import { PartialType, ApiProperty } from '@nestjs/swagger';\nimport { CreateSmsTemplateDto } from './create-sms-template.dto';\nimport { IsString } from 'class-validator';\nimport { IsOptional, Matches, IsNotEmpty, IsBoolean } from 'class-validator';\n\nexport class UpdateSmsTemplateDto extends PartialType(CreateSmsTemplateDto) {\n @IsOptional()\n @IsString()\n @ApiProperty()\n type: string;\n\n @IsNotEmpty()\n @IsOptional()\n @Matches(/[a-z]+(-[a-z]+)*/)\n @IsString()\n @ApiProperty()\n name: string;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n smsProviderTemplateId: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n displayName: string;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n body: string;\n\n @IsOptional()\n @IsString()\n @ApiProperty()\n description: string;\n\n @IsOptional()\n @IsBoolean()\n @ApiProperty()\n active: boolean;\n} { }\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-view-metadata.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-view-metadata.dto.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAEnF,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"update-view-metadata.dto.d.ts","sourceRoot":"","sources":["../../src/dtos/update-view-metadata.dto.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wCAAwC,CAAC;AAEnF,qBAAa,qBAAqB;IAG9B,EAAE,EAAE,MAAM,CAAC;IAOX,IAAI,EAAE,MAAM,CAAC;IAMb,WAAW,EAAE,MAAM,CAAC;IAMpB,IAAI,EAAE,MAAM,CAAC;IAMb,OAAO,EAAE,GAAG,CAAC;IAMb,MAAM,EAAE,GAAG,CAAC;IAKZ,QAAQ,EAAE,MAAM,CAAC;IAKjB,aAAa,EAAE,MAAM,CAAC;IAKtB,OAAO,EAAE,MAAM,CAAC;IAKhB,YAAY,EAAE,MAAM,CAAC;IAOrB,gBAAgB,EAAE,yBAAyB,EAAE,CAAC;IAK9C,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAK9B,uBAAuB,EAAE,MAAM,CAAC;CACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-view-metadata.dto.js","sourceRoot":"","sources":["../../src/dtos/update-view-metadata.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAAoH;AACpH,6CAA8C;AAC9C,yDAAyC;AACzC,mFAAmF;AAEnF,MAAa,qBAAqB;;;;
|
|
1
|
+
{"version":3,"file":"update-view-metadata.dto.js","sourceRoot":"","sources":["../../src/dtos/update-view-metadata.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,qDAAoH;AACpH,6CAA8C;AAC9C,yDAAyC;AACzC,mFAAmF;AAEnF,MAAa,qBAAqB;;;;CAwEjC;AAxED,sDAwEC;AArEG;IAFC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;;iDACG;AAOX;IALC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,EAAC,kBAAkB,CAAC;IAC3B,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;mDACD;AAMb;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;0DACM;AAMpB;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,GAAE;;mDACD;AAMb;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;;sDACD;AAMb;IAJC,IAAA,4BAAU,GAAE;IACZ,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,GAAE;IACR,IAAA,qBAAW,GAAE;;qDACF;AAKZ;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;uDACG;AAKjB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;4DACQ;AAKtB;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,uBAAK,GAAE;IACP,IAAA,qBAAW,GAAE;;sDACE;AAKhB;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;2DACO;AAOrB;IALC,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;IACb,IAAA,yBAAO,GAAE;IACT,IAAA,gCAAc,EAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC9B,IAAA,wBAAI,EAAC,GAAG,EAAE,CAAC,yDAAyB,CAAC;;+DACQ;AAK9C;IAHC,IAAA,4BAAU,GAAE;IACZ,IAAA,yBAAO,GAAE;IACT,IAAA,qBAAW,GAAE;;kEACgB;AAK9B;IAHC,IAAA,0BAAQ,GAAE;IACV,IAAA,4BAAU,GAAE;IACZ,IAAA,qBAAW,GAAE;;sEACkB","sourcesContent":["import { IsInt, IsOptional, IsString, Matches, IsNotEmpty, IsJSON, ValidateNested, IsArray } from 'class-validator';\nimport { ApiProperty } from '@nestjs/swagger';\nimport { Type } from 'class-transformer';\nimport { UpdateUserViewMetadataDto } from 'src/dtos/update-user-view-metadata.dto';\n\nexport class UpdateViewMetadataDto {\n @IsOptional()\n @IsInt()\n id: number;\n\n @IsNotEmpty()\n @IsOptional()\n @Matches(/[a-z]+(-[a-z]+)*/)\n @IsString()\n @ApiProperty()\n name: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n displayName: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsString()\n @ApiProperty()\n type: string;\n\n @IsNotEmpty()\n @IsOptional()\n @IsJSON()\n @ApiProperty()\n context: any;\n\n @IsNotEmpty()\n @IsOptional()\n @IsJSON()\n @ApiProperty()\n layout: any;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n moduleId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n moduleUserKey: string;\n\n @IsOptional()\n @IsInt()\n @ApiProperty()\n modelId: number;\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n modelUserKey: string;\n\n @IsOptional()\n @ApiProperty()\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => UpdateUserViewMetadataDto)\n userViewMetadata: UpdateUserViewMetadataDto[];\n\n @IsOptional()\n @IsArray()\n @ApiProperty()\n userViewMetadataIds: number[];\n\n @IsString()\n @IsOptional()\n @ApiProperty()\n userViewMetadataCommand: string;\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.entity.d.ts","sourceRoot":"","sources":["../../src/entities/user.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAEzD,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AAGzE,qBAGa,IAAK,SAAQ,YAAY;IAGlC,QAAQ,EAAE,MAAM,CAAC;IAIjB,QAAQ,EAAE,MAAM,CAAC;IAIjB,KAAK,EAAE,MAAM,CAAC;IAId,MAAM,EAAE,MAAM,CAAC;IAGf,QAAQ,EAAE,MAAM,CAAC;IAGjB,mBAAmB,EAAE,OAAO,CAAQ;IAGpC,i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
24
|
this.active = true;
|
|
25
|
+
this.failedLoginAttempts = 0;
|
|
25
26
|
}
|
|
26
27
|
static _OPENAPI_METADATA_FACTORY() {
|
|
27
|
-
return { fullName: { required: true, type: () => String }, username: { required: true, type: () => String }, email: { required: true, type: () => String }, mobile: { required: true, type: () => String }, password: { required: true, type: () => String }, forcePasswordChange: { required: true, type: () => Boolean, default: true }, lastLoginProvider: { required: true, type: () => String, default: "local" }, accessCode: { required: true, type: () => String }, googleAccessToken: { required: true, type: () => String }, googleId: { required: true, type: () => String }, googleProfilePicture: { required: true, type: () => String }, active: { required: true, type: () => Boolean, default: true }, forgotPasswordConfirmedAt: { required: true, type: () => Date }, verificationTokenOnForgotPassword: { required: true, type: () => String }, verificationTokenOnForgotPasswordExpiresAt: { required: true, type: () => Date }, emailVerifiedOnRegistrationAt: { required: true, type: () => Date }, emailVerificationTokenOnRegistration: { required: true, type: () => String }, emailVerificationTokenOnRegistrationExpiresAt: { required: true, type: () => Date }, mobileVerifiedOnRegistrationAt: { required: true, type: () => Date }, mobileVerificationTokenOnRegistration: { required: true, type: () => String }, mobileVerificationTokenOnRegistrationExpiresAt: { required: true, type: () => Date }, emailVerifiedOnLoginAt: { required: true, type: () => Date }, emailVerificationTokenOnLogin: { required: true, type: () => String }, emailVerificationTokenOnLoginExpiresAt: { required: true, type: () => Date }, mobileVerifiedOnLoginAt: { required: true, type: () => Date }, mobileVerificationTokenOnLogin: { required: true, type: () => String }, mobileVerificationTokenOnLoginExpiresAt: { required: true, type: () => Date }, customPayload: { required: true, type: () => String }, roles: { required: true, type: () => [require("./role-metadata.entity").RoleMetadata] }, userViewMetadata: { required: true, type: () => [require("./user-view-metadata.entity").UserViewMetadata] }, passwordScheme: { required: true, type: () => String }, passwordSchemeVersion: { required: true, type: () => Number }, rehashedAt: { required: true, type: () => Date }, _media: { required: true, type: () => Object } };
|
|
28
|
+
return { fullName: { required: true, type: () => String }, username: { required: true, type: () => String }, email: { required: true, type: () => String }, mobile: { required: true, type: () => String }, password: { required: true, type: () => String }, forcePasswordChange: { required: true, type: () => Boolean, default: true }, lastLoginProvider: { required: true, type: () => String, default: "local" }, accessCode: { required: true, type: () => String }, googleAccessToken: { required: true, type: () => String }, googleId: { required: true, type: () => String }, googleProfilePicture: { required: true, type: () => String }, active: { required: true, type: () => Boolean, default: true }, forgotPasswordConfirmedAt: { required: true, type: () => Date }, verificationTokenOnForgotPassword: { required: true, type: () => String }, verificationTokenOnForgotPasswordExpiresAt: { required: true, type: () => Date }, emailVerifiedOnRegistrationAt: { required: true, type: () => Date }, emailVerificationTokenOnRegistration: { required: true, type: () => String }, emailVerificationTokenOnRegistrationExpiresAt: { required: true, type: () => Date }, mobileVerifiedOnRegistrationAt: { required: true, type: () => Date }, mobileVerificationTokenOnRegistration: { required: true, type: () => String }, mobileVerificationTokenOnRegistrationExpiresAt: { required: true, type: () => Date }, emailVerifiedOnLoginAt: { required: true, type: () => Date }, emailVerificationTokenOnLogin: { required: true, type: () => String }, emailVerificationTokenOnLoginExpiresAt: { required: true, type: () => Date }, mobileVerifiedOnLoginAt: { required: true, type: () => Date }, mobileVerificationTokenOnLogin: { required: true, type: () => String }, mobileVerificationTokenOnLoginExpiresAt: { required: true, type: () => Date }, customPayload: { required: true, type: () => String }, roles: { required: true, type: () => [require("./role-metadata.entity").RoleMetadata] }, userViewMetadata: { required: true, type: () => [require("./user-view-metadata.entity").UserViewMetadata] }, passwordScheme: { required: true, type: () => String }, passwordSchemeVersion: { required: true, type: () => Number }, rehashedAt: { required: true, type: () => Date }, failedLoginAttempts: { required: true, type: () => Number, default: 0 }, _media: { required: true, type: () => Object } };
|
|
28
29
|
}
|
|
29
30
|
};
|
|
30
31
|
exports.User = User;
|
|
@@ -170,6 +171,10 @@ __decorate([
|
|
|
170
171
|
(0, typeorm_1.Column)({ nullable: true }),
|
|
171
172
|
__metadata("design:type", Date)
|
|
172
173
|
], User.prototype, "rehashedAt", void 0);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, typeorm_1.Column)({ type: "int", default: 0 }),
|
|
176
|
+
__metadata("design:type", Number)
|
|
177
|
+
], User.prototype, "failedLoginAttempts", void 0);
|
|
173
178
|
__decorate([
|
|
174
179
|
(0, class_transformer_1.Expose)(),
|
|
175
180
|
__metadata("design:type", Object)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../src/entities/user.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAAyD;AACzD,qCAAoG;AACpG,iEAAiE;AACjE,2EAAyE;AACzE,yDAAoD;AAK7C,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,4BAAY;IAA/B;;QAqBH,wBAAmB,GAAY,IAAI,CAAC;QAGpC,sBAAiB,GAAW,OAAO,CAAC;QAepC,WAAM,GAAY,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"user.entity.js","sourceRoot":"","sources":["../../src/entities/user.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAAyD;AACzD,qCAAoG;AACpG,iEAAiE;AACjE,2EAAyE;AACzE,yDAAoD;AAK7C,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,4BAAY;IAA/B;;QAqBH,wBAAmB,GAAY,IAAI,CAAC;QAGpC,sBAAiB,GAAW,OAAO,CAAC;QAepC,WAAM,GAAY,IAAI,CAAC;QAmEvB,wBAAmB,GAAW,CAAC,CAAC;KAGnC;;2UAxFkC,IAAI,wWAkBjB,IAAI;;CAsEzB,CAAA;AA7GY,oBAAI;AAGb;IAFC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,0BAAM,GAAE;;sCACQ;AAIjB;IAHC,IAAA,eAAK,EAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACvB,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAC3B,IAAA,0BAAM,GAAE;;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"src/entities/common.entity\"\nimport { Entity, Column, Index, JoinTable, ManyToMany, OneToMany, TableInheritance } from \"typeorm\";\nimport { RoleMetadata } from 'src/entities/role-metadata.entity';\nimport { UserViewMetadata } from 'src/entities/user-view-metadata.entity'\nimport { Exclude, Expose } from \"class-transformer\";\n\n@Entity(\"ss_user\")\n@TableInheritance({ column: { type: \"varchar\", name: \"type\", default: \"User\" } })\n@Exclude()\nexport class User extends CommonEntity {\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n fullName: string; \n @Index({ unique: true })\n @Column({ type: \"varchar\" })\n @Expose()\n username: string;\n // @Index({ unique: true })\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n email: string;\n // @Index({ unique: true })\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n mobile: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n password: string;\n @Column({ nullable: true, default: true })\n @Expose()\n forcePasswordChange: boolean = true;\n @Column({ type: \"varchar\", default: \"local\" })\n // don't send to client\n lastLoginProvider: string = \"local\";\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client (test)\n accessCode: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n googleAccessToken: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n googleId: string;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n googleProfilePicture: string;\n @Column({ default: true })\n @Expose()\n active: boolean = true;\n @Column({ nullable: true })\n // don't send to client\n forgotPasswordConfirmedAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n verificationTokenOnForgotPassword: string;\n @Column({ nullable: true })\n // don't send to client\n verificationTokenOnForgotPasswordExpiresAt: Date;\n @Column({ nullable: true })\n // don't send to client\n emailVerifiedOnRegistrationAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n emailVerificationTokenOnRegistration: string;\n @Column({ nullable: true })\n // don't send to client\n emailVerificationTokenOnRegistrationExpiresAt: Date;\n @Column({ nullable: true })\n // don't send to client\n mobileVerifiedOnRegistrationAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n mobileVerificationTokenOnRegistration: string;\n @Column({ nullable: true })\n // don't send to client\n mobileVerificationTokenOnRegistrationExpiresAt: Date;\n @Column({ nullable: true })\n // don't send to client\n emailVerifiedOnLoginAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n emailVerificationTokenOnLogin: string;\n @Column({ nullable: true })\n // don't send to client\n emailVerificationTokenOnLoginExpiresAt: Date;\n @Column({ nullable: true })\n // don't send to client\n mobileVerifiedOnLoginAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n // don't send to client\n mobileVerificationTokenOnLogin: string;\n @Column({ nullable: true })\n // don't send to client\n mobileVerificationTokenOnLoginExpiresAt: Date;\n @Column({ type: \"varchar\", nullable: true })\n @Expose()\n customPayload: string;\n @ManyToMany(() => RoleMetadata, roleMetadata => roleMetadata.users, { cascade: true })\n @JoinTable()\n @Expose()\n roles: RoleMetadata[];\n @OneToMany(() => UserViewMetadata, userViewMetadata => userViewMetadata.user, { cascade: true })\n // don't send to client\n userViewMetadata: UserViewMetadata[];\n // dont send to client\n @Column({ type: \"varchar\", default: \"bcrypt\" })\n passwordScheme: string;\n // dont send to client\n @Column({ type: \"int\", default: 1 })\n passwordSchemeVersion: number;\n // dont send to client\n @Column({ nullable: true })\n rehashedAt: Date;\n // dont send to client\n @Column({ type: \"int\", default: 0 })\n failedLoginAttempts: number = 0;\n @Expose()\n _media: any;\n}"]}
|
|
@@ -8,6 +8,8 @@ export interface ManyToManyRelationFieldOptions {
|
|
|
8
8
|
entityManager: EntityManager;
|
|
9
9
|
fieldName: string;
|
|
10
10
|
relationCoModelFieldName?: string;
|
|
11
|
+
isUpdate?: boolean;
|
|
12
|
+
entityId?: number;
|
|
11
13
|
}
|
|
12
14
|
export declare class ManyToManyRelationFieldCrudManager implements FieldCrudManager {
|
|
13
15
|
private readonly options;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManyToManyRelationFieldCrudManager.d.ts","sourceRoot":"","sources":["../../../src/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAM,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,8BAA8B;IAE3C,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACrC,2BAA2B,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACvD,iBAAiB,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC7C,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ManyToManyRelationFieldCrudManager.d.ts","sourceRoot":"","sources":["../../../src/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAM,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,8BAA8B;IAE3C,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACrC,2BAA2B,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACvD,iBAAiB,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC7C,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,aAAa,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAKD,qBAAa,kCAAmC,YAAW,gBAAgB;IAO3D,OAAO,CAAC,QAAQ,CAAC,OAAO;IANpC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuD;IAE9E,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,gBAAgB,CAAS;gBAEJ,OAAO,EAAE,8BAA8B;IAapE,QAAQ,CAAC,GAAG,EAAE,GAAG;IAIjB,OAAO,CAAC,gBAAgB;IAwBlB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;YAgBlC,kBAAkB;IA4BhC,OAAO,CAAC,wBAAwB;YAIlB,sBAAsB;YAWtB,sBAAsB;YAqBtB,yBAAyB;YAczB,yBAAyB;YASzB,yBAAyB;YAgBzB,yBAAyB;IASvC,OAAO,CAAC,yBAAyB;CAWpC"}
|
|
@@ -51,7 +51,13 @@ class ManyToManyRelationFieldCrudManager {
|
|
|
51
51
|
const currentEntityRepository = this.options.entityManager.getRepository(currentEntityName);
|
|
52
52
|
const relatedEntityName = (0, strings_1.classify)(this.options.relationCoModelSingularName);
|
|
53
53
|
const relatedEntityRepository = this.options.entityManager.getRepository(relatedEntityName);
|
|
54
|
-
|
|
54
|
+
const result = await this.transformByCommand(dto, relatedEntityRepository, currentEntityRepository);
|
|
55
|
+
if (result !== undefined) {
|
|
56
|
+
dto[this.valueFieldName] = result;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
delete dto[this.valueFieldName];
|
|
60
|
+
}
|
|
55
61
|
return dto;
|
|
56
62
|
}
|
|
57
63
|
async transformByCommand(dto, relatedEntityRepository, currentEntityRepository) {
|
|
@@ -68,11 +74,11 @@ class ManyToManyRelationFieldCrudManager {
|
|
|
68
74
|
case create_field_metadata_dto_1.RelationFieldsCommand.clear:
|
|
69
75
|
return this.transformForCommandClear();
|
|
70
76
|
case create_field_metadata_dto_1.RelationFieldsCommand.set:
|
|
71
|
-
return await this.transformForCommandSet(ids, relatedEntityRepository
|
|
77
|
+
return await this.transformForCommandSet(ids, relatedEntityRepository);
|
|
72
78
|
case create_field_metadata_dto_1.RelationFieldsCommand.link:
|
|
73
|
-
return await this.tranformForCommandLink(ids, relatedEntityRepository
|
|
79
|
+
return await this.tranformForCommandLink(ids, relatedEntityRepository);
|
|
74
80
|
case create_field_metadata_dto_1.RelationFieldsCommand.unlink:
|
|
75
|
-
return await this.transformForCommandUnLink(ids
|
|
81
|
+
return await this.transformForCommandUnLink(ids);
|
|
76
82
|
default:
|
|
77
83
|
this.logger.log(`Invalid command ${command}`);
|
|
78
84
|
return null;
|
|
@@ -81,38 +87,42 @@ class ManyToManyRelationFieldCrudManager {
|
|
|
81
87
|
transformForCommandClear() {
|
|
82
88
|
return [];
|
|
83
89
|
}
|
|
84
|
-
async transformForCommandSet(ids, relatedEntityRepository
|
|
90
|
+
async transformForCommandSet(ids, relatedEntityRepository) {
|
|
85
91
|
const loadedEntities = await relatedEntityRepository.find({
|
|
86
92
|
where: { id: (0, typeorm_1.In)(ids) }
|
|
87
93
|
});
|
|
88
94
|
if (loadedEntities.length !== ids.length) {
|
|
89
|
-
throw new Error('Invalid entity ids provided for
|
|
95
|
+
throw new Error('Invalid entity ids provided for set');
|
|
90
96
|
}
|
|
91
97
|
return loadedEntities;
|
|
92
98
|
}
|
|
93
|
-
async tranformForCommandLink(ids, relatedEntityRepository
|
|
94
|
-
|
|
95
|
-
|
|
99
|
+
async tranformForCommandLink(ids, relatedEntityRepository) {
|
|
100
|
+
if (!this.options.isUpdate) {
|
|
101
|
+
throw new Error('Link command is only supported for update operations');
|
|
102
|
+
}
|
|
103
|
+
const count = await relatedEntityRepository.count({
|
|
96
104
|
where: { id: (0, typeorm_1.In)(ids) }
|
|
97
105
|
});
|
|
98
|
-
if (
|
|
106
|
+
if (count !== ids.length) {
|
|
99
107
|
throw new Error('Invalid entity ids provided for linking');
|
|
100
108
|
}
|
|
101
|
-
|
|
102
|
-
|
|
109
|
+
await this.options.entityManager
|
|
110
|
+
.createQueryBuilder()
|
|
111
|
+
.relation((0, strings_1.classify)(this.options.modelSingularName), this.valueFieldName)
|
|
112
|
+
.of(this.options.entityId)
|
|
113
|
+
.add(ids);
|
|
114
|
+
return undefined;
|
|
103
115
|
}
|
|
104
|
-
async transformForCommandUnLink(ids
|
|
105
|
-
if (
|
|
106
|
-
throw new Error('
|
|
116
|
+
async transformForCommandUnLink(ids) {
|
|
117
|
+
if (!this.options.isUpdate) {
|
|
118
|
+
throw new Error('Unlink command is only supported for update operations');
|
|
107
119
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
tranformedRelatedFields.push(...filteredEntities);
|
|
115
|
-
return tranformedRelatedFields;
|
|
120
|
+
await this.options.entityManager
|
|
121
|
+
.createQueryBuilder()
|
|
122
|
+
.relation((0, strings_1.classify)(this.options.modelSingularName), this.valueFieldName)
|
|
123
|
+
.of(this.options.entityId)
|
|
124
|
+
.remove(ids);
|
|
125
|
+
return undefined;
|
|
116
126
|
}
|
|
117
127
|
async transformForCommandCreate(values, relatedEntityRepository) {
|
|
118
128
|
const transformedRelatedFields = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManyToManyRelationFieldCrudManager.js","sourceRoot":"","sources":["../../../src/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.ts"],"names":[],"mappings":";;;AAAA,oEAAkE;AAClE,2CAAwC;AACxC,qDAA8D;AAC9D,oFAA2E;AAE3E,qCAA4C;AAa5C,MAAM,YAAY,GAAG,CAAC,iDAAqB,CAAC,IAAI,EAAE,iDAAqB,CAAC,MAAM,EAAE,iDAAqB,CAAC,GAAG,CAAC,CAAC;AAG3G,MAAa,kCAAkC;IAO3C,YAA6B,OAAuC;QAAvC,YAAO,GAAP,OAAO,CAAgC;QANnD,WAAM,GAAG,IAAI,eAAM,CAAC,kCAAkC,CAAC,IAAI,CAAC,CAAC;QAO1E,IAAI,CAAC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AC;gBACF,MAAM,WAAW,GAAG,uBAAuB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC3D,wBAAwB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC/C,CAAC;QACL,CAAC;QAED,OAAO,wBAAwB,CAAC;IACpC,CAAC;IAEO,KAAK,CAAC,yBAAyB,CAAC,MAAa,EAAE,uBAA4B;QAE/E,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAG5C,MAAM,uBAAuB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAA;IACf,CAAC;IAEO,yBAAyB;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IACjC,CAAC;CASJ;AAlLD,gFAkLC","sourcesContent":["import { classify } from \"@angular-devkit/core/src/utils/strings\";\nimport { Logger } from \"@nestjs/common\";\nimport { isEmpty, isEnum, isNotEmpty } from \"class-validator\";\nimport { RelationFieldsCommand } from \"src/dtos/create-field-metadata.dto\";\nimport { FieldCrudManager, ValidationError } from \"src/interfaces\";\nimport { EntityManager, In } from \"typeorm\";\n\nexport interface ManyToManyRelationFieldOptions {\n // Add options for relation field\n required: boolean | undefined | null;\n relationCoModelSingularName: string | undefined | null;\n modelSingularName: string | undefined | null;\n isInverseSide: boolean;\n entityManager: EntityManager;\n fieldName: string;\n relationCoModelFieldName?: string;\n}\n\nconst linkCommands = [RelationFieldsCommand.link, RelationFieldsCommand.unlink, RelationFieldsCommand.set];\n\n// This implementation is meant to be used for many-to-one relation field\nexport class ManyToManyRelationFieldCrudManager implements FieldCrudManager {\n private readonly logger = new Logger(ManyToManyRelationFieldCrudManager.name);\n\n private valueFieldName: string;\n private idFieldName: string;\n private commandFieldName: string;\n\n constructor(private readonly options: ManyToManyRelationFieldOptions) {\n if (!this.options.isInverseSide) {\n this.valueFieldName = `${this.options.fieldName}`;\n this.idFieldName = `${this.options.fieldName}Ids`;\n this.commandFieldName = `${this.options.fieldName}Command`;\n }\n else {\n this.valueFieldName = `${this.options.relationCoModelFieldName}`;\n this.idFieldName = `${this.options.relationCoModelFieldName}Ids`;\n this.commandFieldName = `${this.options.relationCoModelFieldName}Command`;\n }\n }\n\n validate(dto: any) {\n return this.applyValidations(dto);\n }\n\n private applyValidations(dto: any): ValidationError[] { \n const errors: ValidationError[] = [];\n\n const commandFieldName = this.commandFieldName;\n const commandValue = dto[commandFieldName];\n this.isApplyRequiredValidation() && isEmpty(commandValue) ? errors.push({ field: commandFieldName, error: 'Command field is required' }) : \"no errors\";\n if (isNotEmpty(commandValue)) {\n !isEnum(commandValue, RelationFieldsCommand)? errors.push({ field: this.options.fieldName, error: 'Command Field has invalid value' }) : \"no errors\";\n } \n \n var fieldValue = null\n if (commandValue === RelationFieldsCommand.clear) {\n return errors;\n } else if (linkCommands.includes(commandValue)) {\n fieldValue = dto[this.idFieldName];\n } \n else {\n fieldValue = dto[this.valueFieldName];\n }\n\n this.isApplyRequiredValidation() && isEmpty(fieldValue) ? errors.push({ field: this.options.fieldName, error: `Field: ${this.options.fieldName} is required` }) : \"no errors\";\n return errors;\n }\n\n async transformForCreate(dto: any): Promise<any> {\n const currentEntityName = classify(this.options.modelSingularName);\n const currentEntityRepository = this.options.entityManager.getRepository(currentEntityName);\n\n const relatedEntityName = classify(this.options.relationCoModelSingularName);\n const relatedEntityRepository = this.options.entityManager.getRepository(relatedEntityName)\n\n dto[this.valueFieldName] = await this.transformByCommand(dto, relatedEntityRepository, currentEntityRepository);\n return dto;\n }\n\n private async transformByCommand(dto: any, relatedEntityRepository: any, currentEntityRepository: any): Promise<any[]> {\n // TODO : Need to add support for the multiple commands\n const command = dto[this.commandFieldName];\n const values = dto[this.valueFieldName];\n const ids = dto[this.idFieldName];\n \n switch (command) {\n case RelationFieldsCommand.create:\n return await this.transformForCommandCreate(values, relatedEntityRepository);\n case RelationFieldsCommand.update:\n return await this.transformForCommandUpdate(values, relatedEntityRepository, dto, currentEntityRepository);\n case RelationFieldsCommand.delete:\n return await this.transformForCommandDelete(values, relatedEntityRepository);\n case RelationFieldsCommand.clear:\n return this.transformForCommandClear();\n case RelationFieldsCommand.set:\n return await this.transformForCommandSet(ids, relatedEntityRepository, dto, currentEntityRepository); \n case RelationFieldsCommand.link:\n return await this.tranformForCommandLink(ids, relatedEntityRepository, dto, currentEntityRepository);\n case RelationFieldsCommand.unlink:\n return await this.transformForCommandUnLink(ids, relatedEntityRepository, dto, currentEntityRepository);\n default:\n this.logger.log(`Invalid command ${command}`);\n return null;\n \n }\n }\n\n private transformForCommandClear() {\n return []\n }\n\n private async transformForCommandSet(ids: any[], relatedEntityRepository: any, dto: any, currentEntityRepository: any): Promise<any[]> {\n // Load the entities with the ids passed\n const loadedEntities: any[] = await relatedEntityRepository.find({\n where : {id: In(ids) } \n })\n if (loadedEntities.length !== ids.length) {\n throw new Error('Invalid entity ids provided for linking');\n }\n\n return loadedEntities;\n }\n\n private async tranformForCommandLink(ids: any, relatedEntityRepository: any, dto: any, currentEntityRepository: any) {\n const tranformedRelatedFields = [];\n // Load the entities with the ids passed\n const loadedEntities: any[] = await relatedEntityRepository.find({\n where : {id: In(ids) } \n })\n if (loadedEntities.length !== ids.length) {\n throw new Error('Invalid entity ids provided for linking');\n }\n tranformedRelatedFields.push(...loadedEntities);\n\n return tranformedRelatedFields;\n }\n\n private async transformForCommandUnLink(ids: any, relatedEntityRepository: any, dto: any, currentEntityRepository: any) {\n if (dto.id == null) {\n throw new Error('Entity id is required for unlinking');\n } \n\n const tranformedRelatedFields = [];\n const entityInstance = await currentEntityRepository.findOne({\n where: {id: dto.id},\n relations: [this.valueFieldName]\n });\n const filteredEntities = entityInstance[this.valueFieldName].filter((entity) => !ids.includes(entity.id));\n tranformedRelatedFields.push(...filteredEntities);\n\n return tranformedRelatedFields;\n }\n\n private async transformForCommandCreate(values: any[], relatedEntityRepository: any): Promise<any[]> {\n const transformedRelatedFields = [];\n for (const entity of values) {\n const transformed = relatedEntityRepository.create(entity);\n transformedRelatedFields.push(transformed);\n }\n return transformedRelatedFields;\n }\n\n private async transformForCommandUpdate(values: any[], relatedEntityRepository: any, dto: any, currentEntityRepository: any): Promise<any[]> {\n const transformedRelatedFields = [];\n for (const entity of values) {\n if (entity.id) {\n const transformed = await relatedEntityRepository.preload(entity);\n transformedRelatedFields.push(transformed);\n }\n else {\n const transformed = relatedEntityRepository.create(entity);\n transformedRelatedFields.push(transformed);\n }\n }\n\n return transformedRelatedFields;\n }\n\n private async transformForCommandDelete(values: any[], relatedEntityRepository: any): Promise<any[]> {\n // Map and get the ids from the values\n const ids = values.map((value) => value.id);\n\n // Delete the ids linked to the associated entity\n await relatedEntityRepository.delete(ids);\n return null\n }\n\n private isApplyRequiredValidation(): boolean {\n return this.options.required;\n }\n\n // TODO: We have moved this to SolidRegistry service, refactor to use that service.\n // Returns the entity target class from the entity name\n // private getEntityTarget(entityName: string): any { //TODO Can be refactored to use this function from crud helper service\n // const entityMetadatas = this.options.entityManager.connection.entityMetadatas;\n // const entityMetadata = entityMetadatas.find(em => em.name === entityName);\n // return entityMetadata.target;\n // }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ManyToManyRelationFieldCrudManager.js","sourceRoot":"","sources":["../../../src/helpers/field-crud-managers/ManyToManyRelationFieldCrudManager.ts"],"names":[],"mappings":";;;AAAA,oEAAkE;AAClE,2CAAwC;AACxC,qDAA8D;AAC9D,oFAA2E;AAE3E,qCAA4C;AAe5C,MAAM,YAAY,GAAG,CAAC,iDAAqB,CAAC,IAAI,EAAE,iDAAqB,CAAC,MAAM,EAAE,iDAAqB,CAAC,GAAG,CAAC,CAAC;AAG3G,MAAa,kCAAkC;IAO3C,YAA6B,OAAuC;QAAvC,YAAO,GAAP,OAAO,CAAgC;QANnD,WAAM,GAAG,IAAI,eAAM,CAAC,kCAAkC,CAAC,IAAI,CAAC,CAAC;QAO1E,IAAI,CAAC,IAAI,CAAC,OAAO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C,WAAW,CAAC,CAAC;YAC/C,CAAC;iBACI,CAAC;gBACF,MAAM,WAAW,GAAG,uBAAuB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC3D,wBAAwB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAC/C,CAAC;QACL,CAAC;QAED,OAAO,wBAAwB,CAAC;IACpC,CAAC;IAEO,KAAK,CAAC,yBAAyB,CAAC,MAAa,EAAE,uBAA4B;QAE/E,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAG5C,MAAM,uBAAuB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAA;IACf,CAAC;IAEO,yBAAyB;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IACjC,CAAC;CASJ;AA3LD,gFA2LC","sourcesContent":["import { classify } from \"@angular-devkit/core/src/utils/strings\";\nimport { Logger } from \"@nestjs/common\";\nimport { isEmpty, isEnum, isNotEmpty } from \"class-validator\";\nimport { RelationFieldsCommand } from \"src/dtos/create-field-metadata.dto\";\nimport { FieldCrudManager, ValidationError } from \"src/interfaces\";\nimport { EntityManager, In } from \"typeorm\";\n\nexport interface ManyToManyRelationFieldOptions {\n // Add options for relation field\n required: boolean | undefined | null;\n relationCoModelSingularName: string | undefined | null;\n modelSingularName: string | undefined | null;\n isInverseSide: boolean;\n entityManager: EntityManager;\n fieldName: string;\n relationCoModelFieldName?: string;\n isUpdate?: boolean;\n entityId?: number;\n}\n\nconst linkCommands = [RelationFieldsCommand.link, RelationFieldsCommand.unlink, RelationFieldsCommand.set];\n\n// This implementation is meant to be used for many-to-one relation field\nexport class ManyToManyRelationFieldCrudManager implements FieldCrudManager {\n private readonly logger = new Logger(ManyToManyRelationFieldCrudManager.name);\n\n private valueFieldName: string;\n private idFieldName: string;\n private commandFieldName: string;\n\n constructor(private readonly options: ManyToManyRelationFieldOptions) {\n if (!this.options.isInverseSide) {\n this.valueFieldName = `${this.options.fieldName}`;\n this.idFieldName = `${this.options.fieldName}Ids`;\n this.commandFieldName = `${this.options.fieldName}Command`;\n }\n else {\n this.valueFieldName = `${this.options.relationCoModelFieldName}`;\n this.idFieldName = `${this.options.relationCoModelFieldName}Ids`;\n this.commandFieldName = `${this.options.relationCoModelFieldName}Command`;\n }\n }\n\n validate(dto: any) {\n return this.applyValidations(dto);\n }\n\n private applyValidations(dto: any): ValidationError[] { \n const errors: ValidationError[] = [];\n\n const commandFieldName = this.commandFieldName;\n const commandValue = dto[commandFieldName];\n this.isApplyRequiredValidation() && isEmpty(commandValue) ? errors.push({ field: commandFieldName, error: 'Command field is required' }) : \"no errors\";\n if (isNotEmpty(commandValue)) {\n !isEnum(commandValue, RelationFieldsCommand)? errors.push({ field: this.options.fieldName, error: 'Command Field has invalid value' }) : \"no errors\";\n } \n \n var fieldValue = null\n if (commandValue === RelationFieldsCommand.clear) {\n return errors;\n } else if (linkCommands.includes(commandValue)) {\n fieldValue = dto[this.idFieldName];\n } \n else {\n fieldValue = dto[this.valueFieldName];\n }\n\n this.isApplyRequiredValidation() && isEmpty(fieldValue) ? errors.push({ field: this.options.fieldName, error: `Field: ${this.options.fieldName} is required` }) : \"no errors\";\n return errors;\n }\n\n async transformForCreate(dto: any): Promise<any> {\n const currentEntityName = classify(this.options.modelSingularName);\n const currentEntityRepository = this.options.entityManager.getRepository(currentEntityName);\n\n const relatedEntityName = classify(this.options.relationCoModelSingularName);\n const relatedEntityRepository = this.options.entityManager.getRepository(relatedEntityName)\n\n const result = await this.transformByCommand(dto, relatedEntityRepository, currentEntityRepository);\n if (result !== undefined) {\n dto[this.valueFieldName] = result;\n } else {\n delete dto[this.valueFieldName];\n }\n return dto;\n }\n\n private async transformByCommand(dto: any, relatedEntityRepository: any, currentEntityRepository: any): Promise<any[] | undefined> {\n // TODO : Need to add support for the multiple commands\n const command = dto[this.commandFieldName];\n const values = dto[this.valueFieldName];\n const ids = dto[this.idFieldName];\n\n switch (command) {\n case RelationFieldsCommand.create:\n return await this.transformForCommandCreate(values, relatedEntityRepository);\n case RelationFieldsCommand.update:\n return await this.transformForCommandUpdate(values, relatedEntityRepository, dto, currentEntityRepository);\n case RelationFieldsCommand.delete:\n return await this.transformForCommandDelete(values, relatedEntityRepository);\n case RelationFieldsCommand.clear:\n return this.transformForCommandClear();\n case RelationFieldsCommand.set:\n return await this.transformForCommandSet(ids, relatedEntityRepository);\n case RelationFieldsCommand.link:\n return await this.tranformForCommandLink(ids, relatedEntityRepository);\n case RelationFieldsCommand.unlink:\n return await this.transformForCommandUnLink(ids);\n default:\n this.logger.log(`Invalid command ${command}`);\n return null;\n\n }\n }\n\n private transformForCommandClear() {\n return []\n }\n\n private async transformForCommandSet(ids: any[], relatedEntityRepository: any): Promise<any[]> {\n const loadedEntities: any[] = await relatedEntityRepository.find({\n where : {id: In(ids) }\n })\n if (loadedEntities.length !== ids.length) {\n throw new Error('Invalid entity ids provided for set');\n }\n\n return loadedEntities;\n }\n\n private async tranformForCommandLink(ids: any[], relatedEntityRepository: any): Promise<undefined> {\n if (!this.options.isUpdate) {\n throw new Error('Link command is only supported for update operations');\n }\n\n const count: number = await relatedEntityRepository.count({\n where: { id: In(ids) }\n });\n if (count !== ids.length) {\n throw new Error('Invalid entity ids provided for linking');\n }\n\n await this.options.entityManager\n .createQueryBuilder()\n .relation(classify(this.options.modelSingularName), this.valueFieldName)\n .of(this.options.entityId)\n .add(ids);\n\n return undefined;\n }\n\n private async transformForCommandUnLink(ids: any[]): Promise<undefined> {\n if (!this.options.isUpdate) {\n throw new Error('Unlink command is only supported for update operations');\n }\n\n await this.options.entityManager\n .createQueryBuilder()\n .relation(classify(this.options.modelSingularName), this.valueFieldName)\n .of(this.options.entityId)\n .remove(ids);\n\n return undefined;\n }\n\n private async transformForCommandCreate(values: any[], relatedEntityRepository: any): Promise<any[]> {\n const transformedRelatedFields = [];\n for (const entity of values) {\n const transformed = relatedEntityRepository.create(entity);\n transformedRelatedFields.push(transformed);\n }\n return transformedRelatedFields;\n }\n\n private async transformForCommandUpdate(values: any[], relatedEntityRepository: any, dto: any, currentEntityRepository: any): Promise<any[]> {\n const transformedRelatedFields = [];\n for (const entity of values) {\n if (entity.id) {\n const transformed = await relatedEntityRepository.preload(entity);\n transformedRelatedFields.push(transformed);\n }\n else {\n const transformed = relatedEntityRepository.create(entity);\n transformedRelatedFields.push(transformed);\n }\n }\n\n return transformedRelatedFields;\n }\n\n private async transformForCommandDelete(values: any[], relatedEntityRepository: any): Promise<any[]> {\n // Map and get the ids from the values\n const ids = values.map((value) => value.id);\n\n // Delete the ids linked to the associated entity\n await relatedEntityRepository.delete(ids);\n return null\n }\n\n private isApplyRequiredValidation(): boolean {\n return this.options.required;\n }\n\n // TODO: We have moved this to SolidRegistry service, refactor to use that service.\n // Returns the entity target class from the entity name\n // private getEntityTarget(entityName: string): any { //TODO Can be refactored to use this function from crud helper service\n // const entityMetadatas = this.options.entityManager.connection.entityMetadatas;\n // const entityMetadata = entityMetadatas.find(em => em.name === entityName);\n // return entityMetadata.target;\n // }\n}\n"]}
|
|
@@ -7,9 +7,12 @@ export interface OneToManyRelationFieldOptions {
|
|
|
7
7
|
modelSingularName: string | undefined | null;
|
|
8
8
|
inverseFieldName: string | undefined | null;
|
|
9
9
|
entityManager: EntityManager | undefined | null;
|
|
10
|
+
isUpdate?: boolean;
|
|
11
|
+
entityId?: number;
|
|
10
12
|
}
|
|
11
13
|
export declare class OneToManyRelationFieldCrudManager implements FieldCrudManager {
|
|
12
14
|
private readonly options;
|
|
15
|
+
private readonly logger;
|
|
13
16
|
private readonly valueFieldName;
|
|
14
17
|
private readonly idFieldName;
|
|
15
18
|
private readonly commandFieldName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OneToManyRelationFieldCrudManager.d.ts","sourceRoot":"","sources":["../../../src/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAM,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,6BAA6B;IAE1C,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACrC,2BAA2B,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACvD,+BAA+B,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC3D,iBAAiB,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC7C,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC5C,aAAa,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"OneToManyRelationFieldCrudManager.d.ts","sourceRoot":"","sources":["../../../src/helpers/field-crud-managers/OneToManyRelationFieldCrudManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAE,aAAa,EAAM,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,6BAA6B;IAE1C,QAAQ,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IACrC,2BAA2B,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACvD,+BAA+B,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC3D,iBAAiB,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC7C,gBAAgB,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC5C,aAAa,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI,CAAC;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAKD,qBAAa,iCAAkC,YAAW,gBAAgB;IAO1D,OAAO,CAAC,Q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