@memberjunction/server 1.5.2 → 1.6.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.
Files changed (39) hide show
  1. package/CHANGELOG.json +333 -1
  2. package/CHANGELOG.md +71 -2
  3. package/dist/apolloServer/index.d.ts.map +1 -1
  4. package/dist/context.d.ts.map +1 -1
  5. package/dist/entitySubclasses/EntityBehavior.server.js +1 -1
  6. package/dist/entitySubclasses/EntityBehavior.server.js.map +1 -1
  7. package/dist/entitySubclasses/userViewEntity.server.js +2 -2
  8. package/dist/entitySubclasses/userViewEntity.server.js.map +1 -1
  9. package/dist/generated/generated.d.ts +557 -43
  10. package/dist/generated/generated.d.ts.map +1 -1
  11. package/dist/generated/generated.js +2992 -241
  12. package/dist/generated/generated.js.map +1 -1
  13. package/dist/generic/ResolverBase.d.ts.map +1 -1
  14. package/dist/generic/ResolverBase.js +16 -6
  15. package/dist/generic/ResolverBase.js.map +1 -1
  16. package/dist/resolvers/AskSkipResolver.d.ts.map +1 -1
  17. package/dist/resolvers/AskSkipResolver.js +52 -13
  18. package/dist/resolvers/AskSkipResolver.js.map +1 -1
  19. package/dist/resolvers/EntityCommunicationsResolver.d.ts +49 -0
  20. package/dist/resolvers/EntityCommunicationsResolver.d.ts.map +1 -0
  21. package/dist/resolvers/EntityCommunicationsResolver.js +228 -0
  22. package/dist/resolvers/EntityCommunicationsResolver.js.map +1 -0
  23. package/dist/resolvers/EntityRecordNameResolver.d.ts.map +1 -1
  24. package/dist/resolvers/EntityRecordNameResolver.js.map +1 -1
  25. package/dist/resolvers/UserFavoriteResolver.d.ts +1 -0
  26. package/dist/resolvers/UserFavoriteResolver.d.ts.map +1 -1
  27. package/dist/resolvers/UserFavoriteResolver.js +57 -0
  28. package/dist/resolvers/UserFavoriteResolver.js.map +1 -1
  29. package/package.json +36 -43
  30. package/src/entitySubclasses/EntityBehavior.server.ts +1 -1
  31. package/src/entitySubclasses/userViewEntity.server.ts +2 -2
  32. package/src/generated/generated.ts +2146 -205
  33. package/src/generic/ResolverBase.ts +18 -8
  34. package/src/resolvers/AskSkipResolver.ts +55 -16
  35. package/src/resolvers/EntityCommunicationsResolver.ts +194 -0
  36. package/src/resolvers/EntityRecordNameResolver.ts +1 -38
  37. package/src/resolvers/UserFavoriteResolver.ts +64 -3
  38. package/.eslintignore +0 -5
  39. package/.eslintrc +0 -24
@@ -2,7 +2,7 @@
2
2
  * ALL ENTITIES - TypeGraphQL Type Class Definition - AUTO GENERATED FILE
3
3
  * Generated Entities and Resolvers for Server
4
4
  *
5
- * GENERATED: 6/6/2024, 4:59:51 PM
5
+ * GENERATED: 6/10/2024, 3:22:34 PM
6
6
  *
7
7
  * >>> DO NOT MODIFY THIS FILE!!!!!!!!!!!!
8
8
  * >>> YOUR CHANGES WILL BE OVERWRITTEN
@@ -20,7 +20,7 @@ import { mj_core_schema } from '../config';
20
20
 
21
21
  import * as mj_core_schema_server_object_types from '@memberjunction/server'
22
22
 
23
- import { CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity, DataContextItemEntity, DataContextEntity, UserViewCategoryEntity, DashboardCategoryEntity, ReportCategoryEntity, FileStorageProviderEntity, FileEntity, FileCategoryEntity, FileEntityRecordLinkEntity, VersionInstallationEntity, DuplicateRunDetailMatchEntity, EntityDocumentSettingEntity, EntitySettingEntity, DuplicateRunEntity, DuplicateRunDetailEntity, EntityBehaviorEntity, EntityBehaviorTypeEntity, ApplicationSettingEntity, ActionCategoryEntity, EntityActionEntity, EntityActionInvocationEntity, ActionAuthorizationEntity, EntityActionInvocationTypeEntity, ActionEntity, EntityActionFilterEntity, ActionFilterEntity, ActionContextTypeEntity, ActionResultCodeEntity, ActionContextEntity, ActionExecutionLogEntity, ActionParamEntity, ActionLibraryEntity, LibraryEntity, ListCategoryEntity, CommunicationTemplateEntity, CommunicationProviderEntity, CommunicationRunEntity, CommunicationProviderMessageTypeEntity, CommunicationLogEntity, CommunicationBaseMessageTypeEntity } from '@memberjunction/core-entities';
23
+ import { CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity, DataContextItemEntity, DataContextEntity, UserViewCategoryEntity, DashboardCategoryEntity, ReportCategoryEntity, FileStorageProviderEntity, FileEntity, FileCategoryEntity, FileEntityRecordLinkEntity, VersionInstallationEntity, DuplicateRunDetailMatchEntity, EntityDocumentSettingEntity, EntitySettingEntity, DuplicateRunEntity, DuplicateRunDetailEntity, EntityBehaviorEntity, EntityBehaviorTypeEntity, ApplicationSettingEntity, ActionCategoryEntity, EntityActionEntity, EntityActionInvocationEntity, ActionAuthorizationEntity, EntityActionInvocationTypeEntity, ActionEntity, EntityActionFilterEntity, ActionFilterEntity, ActionContextTypeEntity, ActionResultCodeEntity, ActionContextEntity, ActionExecutionLogEntity, ActionParamEntity, ActionLibraryEntity, LibraryEntity, ListCategoryEntity, CommunicationProviderEntity, CommunicationRunEntity, CommunicationProviderMessageTypeEntity, CommunicationLogEntity, CommunicationBaseMessageTypeEntity, TemplateEntity, TemplateCategoryEntity, TemplateContentEntity, TemplateParamEntity, TemplateContentTypeEntity, RecommendationEntity, RecommendationProviderEntity, RecommendationRunEntity, RecommendationItemEntity, EntityCommunicationMessageTypeEntity, EntityCommunicationFieldEntity } from '@memberjunction/core-entities';
24
24
 
25
25
 
26
26
  //****************************************************************************
@@ -2464,6 +2464,10 @@ export class Entity_ {
2464
2464
  @MaxLength(8)
2465
2465
  UpdatedAt: Date;
2466
2466
 
2467
+ @Field({nullable: true, description: 'Used to specify a field within the entity that in turn contains the field name that will be used for record-level communication preferences. For example in a hypothetical entity called Contacts, say there is a field called PreferredComm and that field had possible values of Email1, SMS, and Phone, and those value in turn corresponded to field names in the entity. Each record in the Contacts entity could have a specific preference for which field would be used for communication. The MJ Communication Framework will use this information when available, as a priority ahead of the data in the Entity Communication Fields entity which is entity-level and not record-level.'})
2468
+ @MaxLength(510)
2469
+ PreferredCommunicationField?: string;
2470
+
2467
2471
  @Field({nullable: true})
2468
2472
  CodeName?: string;
2469
2473
 
@@ -2581,6 +2585,18 @@ export class Entity_ {
2581
2585
  @Field(() => [mj_core_schema_server_object_types.EntityAction_])
2582
2586
  EntityActionsArray: mj_core_schema_server_object_types.EntityAction_[]; // Link to EntityActions
2583
2587
 
2588
+ @Field(() => [mj_core_schema_server_object_types.TemplateParam_])
2589
+ TemplateParamsArray: mj_core_schema_server_object_types.TemplateParam_[]; // Link to TemplateParams
2590
+
2591
+ @Field(() => [mj_core_schema_server_object_types.Recommendation_])
2592
+ RecommendationsArray: mj_core_schema_server_object_types.Recommendation_[]; // Link to Recommendations
2593
+
2594
+ @Field(() => [mj_core_schema_server_object_types.RecommendationItem_])
2595
+ RecommendationItemsArray: mj_core_schema_server_object_types.RecommendationItem_[]; // Link to RecommendationItems
2596
+
2597
+ @Field(() => [mj_core_schema_server_object_types.EntityCommunicationMessageType_])
2598
+ EntityCommunicationMessageTypesArray: mj_core_schema_server_object_types.EntityCommunicationMessageType_[]; // Link to EntityCommunicationMessageTypes
2599
+
2584
2600
  }
2585
2601
 
2586
2602
  //****************************************************************************
@@ -2701,6 +2717,9 @@ export class CreateEntityInput {
2701
2717
 
2702
2718
  @Field({ nullable: true })
2703
2719
  EntityObjectSubclassImport?: string;
2720
+
2721
+ @Field({ nullable: true })
2722
+ PreferredCommunicationField?: string;
2704
2723
  }
2705
2724
 
2706
2725
 
@@ -2823,6 +2842,9 @@ export class UpdateEntityInput {
2823
2842
  @Field({ nullable: true })
2824
2843
  EntityObjectSubclassImport?: string;
2825
2844
 
2845
+ @Field({ nullable: true })
2846
+ PreferredCommunicationField?: string;
2847
+
2826
2848
  @Field(() => [KeyValuePairInput], { nullable: true })
2827
2849
  OldValues___?: KeyValuePairInput[];
2828
2850
  }
@@ -3142,6 +3164,38 @@ export class EntityResolverBase extends ResolverBase {
3142
3164
  const result = this.ArrayMapFieldNamesToCodeNames('Entity Actions', await dataSource.query(sSQL));
3143
3165
  return result;
3144
3166
  }
3167
+
3168
+ @FieldResolver(() => [mj_core_schema_server_object_types.TemplateParam_])
3169
+ async TemplateParamsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3170
+ this.CheckUserReadPermissions('Template Params', userPayload);
3171
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplateParams] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Template Params', userPayload, EntityPermissionType.Read, 'AND');
3172
+ const result = this.ArrayMapFieldNamesToCodeNames('Template Params', await dataSource.query(sSQL));
3173
+ return result;
3174
+ }
3175
+
3176
+ @FieldResolver(() => [mj_core_schema_server_object_types.Recommendation_])
3177
+ async RecommendationsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3178
+ this.CheckUserReadPermissions('Recommendations', userPayload);
3179
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecommendations] WHERE [SourceEntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Recommendations', userPayload, EntityPermissionType.Read, 'AND');
3180
+ const result = this.ArrayMapFieldNamesToCodeNames('Recommendations', await dataSource.query(sSQL));
3181
+ return result;
3182
+ }
3183
+
3184
+ @FieldResolver(() => [mj_core_schema_server_object_types.RecommendationItem_])
3185
+ async RecommendationItemsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3186
+ this.CheckUserReadPermissions('Recommendation Items', userPayload);
3187
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecommendationItems] WHERE [DestinationEntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Recommendation Items', userPayload, EntityPermissionType.Read, 'AND');
3188
+ const result = this.ArrayMapFieldNamesToCodeNames('Recommendation Items', await dataSource.query(sSQL));
3189
+ return result;
3190
+ }
3191
+
3192
+ @FieldResolver(() => [mj_core_schema_server_object_types.EntityCommunicationMessageType_])
3193
+ async EntityCommunicationMessageTypesArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3194
+ this.CheckUserReadPermissions('Entity Communication Message Types', userPayload);
3195
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwEntityCommunicationMessageTypes] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Communication Message Types', userPayload, EntityPermissionType.Read, 'AND');
3196
+ const result = this.ArrayMapFieldNamesToCodeNames('Entity Communication Message Types', await dataSource.query(sSQL));
3197
+ return result;
3198
+ }
3145
3199
 
3146
3200
  @Mutation(() => Entity_)
3147
3201
  async CreateEntity(
@@ -3327,6 +3381,15 @@ export class User_ {
3327
3381
  @Field(() => [mj_core_schema_server_object_types.CommunicationRun_])
3328
3382
  CommunicationRunsArray: mj_core_schema_server_object_types.CommunicationRun_[]; // Link to CommunicationRuns
3329
3383
 
3384
+ @Field(() => [mj_core_schema_server_object_types.Template_])
3385
+ TemplatesArray: mj_core_schema_server_object_types.Template_[]; // Link to Templates
3386
+
3387
+ @Field(() => [mj_core_schema_server_object_types.TemplateCategory_])
3388
+ TemplateCategoriesArray: mj_core_schema_server_object_types.TemplateCategory_[]; // Link to TemplateCategories
3389
+
3390
+ @Field(() => [mj_core_schema_server_object_types.RecommendationRun_])
3391
+ RecommendationRunsArray: mj_core_schema_server_object_types.RecommendationRun_[]; // Link to RecommendationRuns
3392
+
3330
3393
  }
3331
3394
 
3332
3395
  //****************************************************************************
@@ -3681,6 +3744,30 @@ export class UserResolverBase extends ResolverBase {
3681
3744
  const result = this.ArrayMapFieldNamesToCodeNames('Communication Runs', await dataSource.query(sSQL));
3682
3745
  return result;
3683
3746
  }
3747
+
3748
+ @FieldResolver(() => [mj_core_schema_server_object_types.Template_])
3749
+ async TemplatesArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3750
+ this.CheckUserReadPermissions('Templates', userPayload);
3751
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplates] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Templates', userPayload, EntityPermissionType.Read, 'AND');
3752
+ const result = this.ArrayMapFieldNamesToCodeNames('Templates', await dataSource.query(sSQL));
3753
+ return result;
3754
+ }
3755
+
3756
+ @FieldResolver(() => [mj_core_schema_server_object_types.TemplateCategory_])
3757
+ async TemplateCategoriesArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3758
+ this.CheckUserReadPermissions('Template Categories', userPayload);
3759
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplateCategories] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Template Categories', userPayload, EntityPermissionType.Read, 'AND');
3760
+ const result = this.ArrayMapFieldNamesToCodeNames('Template Categories', await dataSource.query(sSQL));
3761
+ return result;
3762
+ }
3763
+
3764
+ @FieldResolver(() => [mj_core_schema_server_object_types.RecommendationRun_])
3765
+ async RecommendationRunsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3766
+ this.CheckUserReadPermissions('Recommendation Runs', userPayload);
3767
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecommendationRuns] WHERE [RunByUserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Recommendation Runs', userPayload, EntityPermissionType.Read, 'AND');
3768
+ const result = this.ArrayMapFieldNamesToCodeNames('Recommendation Runs', await dataSource.query(sSQL));
3769
+ return result;
3770
+ }
3684
3771
 
3685
3772
  @Mutation(() => User_)
3686
3773
  async CreateUser(
@@ -8084,6 +8171,40 @@ export class AIModel_ {
8084
8171
 
8085
8172
  }
8086
8173
 
8174
+ //****************************************************************************
8175
+ // INPUT TYPE for AI Models
8176
+ //****************************************************************************
8177
+ @InputType()
8178
+ export class CreateAIModelInput {
8179
+ @Field()
8180
+ Name: string;
8181
+
8182
+ @Field({ nullable: true })
8183
+ Vendor?: string;
8184
+
8185
+ @Field(() => Int)
8186
+ AIModelTypeID: number;
8187
+
8188
+ @Field(() => Boolean)
8189
+ IsActive: boolean;
8190
+
8191
+ @Field({ nullable: true })
8192
+ Description?: string;
8193
+
8194
+ @Field({ nullable: true })
8195
+ DriverClass?: string;
8196
+
8197
+ @Field({ nullable: true })
8198
+ DriverImportPath?: string;
8199
+
8200
+ @Field({ nullable: true })
8201
+ APIName?: string;
8202
+
8203
+ @Field(() => Int, { nullable: true })
8204
+ PowerRank?: number;
8205
+ }
8206
+
8207
+
8087
8208
  //****************************************************************************
8088
8209
  // INPUT TYPE for AI Models
8089
8210
  //****************************************************************************
@@ -8223,6 +8344,15 @@ export class AIModelResolver extends ResolverBase {
8223
8344
  return result;
8224
8345
  }
8225
8346
 
8347
+ @Mutation(() => AIModel_)
8348
+ async CreateAIModel(
8349
+ @Arg('input', () => CreateAIModelInput) input: CreateAIModelInput,
8350
+ @Ctx() { dataSource, userPayload }: AppContext,
8351
+ @PubSub() pubSub: PubSubEngine
8352
+ ) {
8353
+ return this.CreateRecord('AI Models', input, dataSource, userPayload, pubSub)
8354
+ }
8355
+
8226
8356
  @Mutation(() => AIModel_)
8227
8357
  async UpdateAIModel(
8228
8358
  @Arg('input', () => UpdateAIModelInput) input: UpdateAIModelInput,
@@ -8232,6 +8362,12 @@ export class AIModelResolver extends ResolverBase {
8232
8362
  return this.UpdateRecord('AI Models', input, dataSource, userPayload, pubSub);
8233
8363
  }
8234
8364
 
8365
+ @Mutation(() => AIModel_)
8366
+ async DeleteAIModel(@Arg('ID', () => Int) ID: number, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
8367
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
8368
+ return this.DeleteRecord('AI Models', key, options, dataSource, userPayload, pubSub);
8369
+ }
8370
+
8235
8371
  }
8236
8372
 
8237
8373
  //****************************************************************************
@@ -8278,6 +8414,28 @@ export class AIAction_ {
8278
8414
 
8279
8415
  }
8280
8416
 
8417
+ //****************************************************************************
8418
+ // INPUT TYPE for AI Actions
8419
+ //****************************************************************************
8420
+ @InputType()
8421
+ export class CreateAIActionInput {
8422
+ @Field()
8423
+ Name: string;
8424
+
8425
+ @Field({ nullable: true })
8426
+ Description?: string;
8427
+
8428
+ @Field(() => Int, { nullable: true })
8429
+ DefaultModelID?: number;
8430
+
8431
+ @Field({ nullable: true })
8432
+ DefaultPrompt?: string;
8433
+
8434
+ @Field(() => Boolean)
8435
+ IsActive: boolean;
8436
+ }
8437
+
8438
+
8281
8439
  //****************************************************************************
8282
8440
  // INPUT TYPE for AI Actions
8283
8441
  //****************************************************************************
@@ -8381,6 +8539,15 @@ export class AIActionResolver extends ResolverBase {
8381
8539
  return result;
8382
8540
  }
8383
8541
 
8542
+ @Mutation(() => AIAction_)
8543
+ async CreateAIAction(
8544
+ @Arg('input', () => CreateAIActionInput) input: CreateAIActionInput,
8545
+ @Ctx() { dataSource, userPayload }: AppContext,
8546
+ @PubSub() pubSub: PubSubEngine
8547
+ ) {
8548
+ return this.CreateRecord('AI Actions', input, dataSource, userPayload, pubSub)
8549
+ }
8550
+
8384
8551
  @Mutation(() => AIAction_)
8385
8552
  async UpdateAIAction(
8386
8553
  @Arg('input', () => UpdateAIActionInput) input: UpdateAIActionInput,
@@ -8433,6 +8600,22 @@ export class AIModelAction_ {
8433
8600
 
8434
8601
  }
8435
8602
 
8603
+ //****************************************************************************
8604
+ // INPUT TYPE for AI Model Actions
8605
+ //****************************************************************************
8606
+ @InputType()
8607
+ export class CreateAIModelActionInput {
8608
+ @Field(() => Int)
8609
+ AIModelID: number;
8610
+
8611
+ @Field(() => Int)
8612
+ AIActionID: number;
8613
+
8614
+ @Field(() => Boolean)
8615
+ IsActive: boolean;
8616
+ }
8617
+
8618
+
8436
8619
  //****************************************************************************
8437
8620
  // INPUT TYPE for AI Model Actions
8438
8621
  //****************************************************************************
@@ -8514,6 +8697,15 @@ export class AIModelActionResolver extends ResolverBase {
8514
8697
  return result;
8515
8698
  }
8516
8699
 
8700
+ @Mutation(() => AIModelAction_)
8701
+ async CreateAIModelAction(
8702
+ @Arg('input', () => CreateAIModelActionInput) input: CreateAIModelActionInput,
8703
+ @Ctx() { dataSource, userPayload }: AppContext,
8704
+ @PubSub() pubSub: PubSubEngine
8705
+ ) {
8706
+ return this.CreateRecord('AI Model Actions', input, dataSource, userPayload, pubSub)
8707
+ }
8708
+
8517
8709
  @Mutation(() => AIModelAction_)
8518
8710
  async UpdateAIModelAction(
8519
8711
  @Arg('input', () => UpdateAIModelActionInput) input: UpdateAIModelActionInput,
@@ -8597,6 +8789,49 @@ export class EntityAIAction_ {
8597
8789
 
8598
8790
  }
8599
8791
 
8792
+ //****************************************************************************
8793
+ // INPUT TYPE for Entity AI Actions
8794
+ //****************************************************************************
8795
+ @InputType()
8796
+ export class CreateEntityAIActionInput {
8797
+ @Field(() => Int)
8798
+ EntityID: number;
8799
+
8800
+ @Field(() => Int)
8801
+ AIActionID: number;
8802
+
8803
+ @Field(() => Int, { nullable: true })
8804
+ AIModelID?: number;
8805
+
8806
+ @Field()
8807
+ Name: string;
8808
+
8809
+ @Field({ nullable: true })
8810
+ Prompt?: string;
8811
+
8812
+ @Field()
8813
+ TriggerEvent: string;
8814
+
8815
+ @Field()
8816
+ UserMessage: string;
8817
+
8818
+ @Field()
8819
+ OutputType: string;
8820
+
8821
+ @Field({ nullable: true })
8822
+ OutputField?: string;
8823
+
8824
+ @Field(() => Boolean)
8825
+ SkipIfOutputFieldNotEmpty: boolean;
8826
+
8827
+ @Field(() => Int, { nullable: true })
8828
+ OutputEntityID?: number;
8829
+
8830
+ @Field({ nullable: true })
8831
+ Comments?: string;
8832
+ }
8833
+
8834
+
8600
8835
  //****************************************************************************
8601
8836
  // INPUT TYPE for Entity AI Actions
8602
8837
  //****************************************************************************
@@ -8705,6 +8940,15 @@ export class EntityAIActionResolver extends ResolverBase {
8705
8940
  return result;
8706
8941
  }
8707
8942
 
8943
+ @Mutation(() => EntityAIAction_)
8944
+ async CreateEntityAIAction(
8945
+ @Arg('input', () => CreateEntityAIActionInput) input: CreateEntityAIActionInput,
8946
+ @Ctx() { dataSource, userPayload }: AppContext,
8947
+ @PubSub() pubSub: PubSubEngine
8948
+ ) {
8949
+ return this.CreateRecord('Entity AI Actions', input, dataSource, userPayload, pubSub)
8950
+ }
8951
+
8708
8952
  @Mutation(() => EntityAIAction_)
8709
8953
  async UpdateEntityAIAction(
8710
8954
  @Arg('input', () => UpdateEntityAIActionInput) input: UpdateEntityAIActionInput,
@@ -8742,6 +8986,19 @@ export class AIModelType_ {
8742
8986
 
8743
8987
  }
8744
8988
 
8989
+ //****************************************************************************
8990
+ // INPUT TYPE for AI Model Types
8991
+ //****************************************************************************
8992
+ @InputType()
8993
+ export class CreateAIModelTypeInput {
8994
+ @Field()
8995
+ Name: string;
8996
+
8997
+ @Field({ nullable: true })
8998
+ Description?: string;
8999
+ }
9000
+
9001
+
8745
9002
  //****************************************************************************
8746
9003
  // INPUT TYPE for AI Model Types
8747
9004
  //****************************************************************************
@@ -8828,6 +9085,15 @@ export class AIModelTypeResolver extends ResolverBase {
8828
9085
  return result;
8829
9086
  }
8830
9087
 
9088
+ @Mutation(() => AIModelType_)
9089
+ async CreateAIModelType(
9090
+ @Arg('input', () => CreateAIModelTypeInput) input: CreateAIModelTypeInput,
9091
+ @Ctx() { dataSource, userPayload }: AppContext,
9092
+ @PubSub() pubSub: PubSubEngine
9093
+ ) {
9094
+ return this.CreateRecord('AI Model Types', input, dataSource, userPayload, pubSub)
9095
+ }
9096
+
8831
9097
  @Mutation(() => AIModelType_)
8832
9098
  async UpdateAIModelType(
8833
9099
  @Arg('input', () => UpdateAIModelTypeInput) input: UpdateAIModelTypeInput,
@@ -8837,6 +9103,12 @@ export class AIModelTypeResolver extends ResolverBase {
8837
9103
  return this.UpdateRecord('AI Model Types', input, dataSource, userPayload, pubSub);
8838
9104
  }
8839
9105
 
9106
+ @Mutation(() => AIModelType_)
9107
+ async DeleteAIModelType(@Arg('ID', () => Int) ID: number, @Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9108
+ const key = new CompositeKey([{FieldName: 'ID', Value: ID}]);
9109
+ return this.DeleteRecord('AI Model Types', key, options, dataSource, userPayload, pubSub);
9110
+ }
9111
+
8840
9112
  }
8841
9113
 
8842
9114
  //****************************************************************************
@@ -20117,10 +20389,10 @@ export class ListCategoryResolver extends ResolverBase {
20117
20389
  }
20118
20390
 
20119
20391
  //****************************************************************************
20120
- // ENTITY CLASS for Communication Templates
20392
+ // ENTITY CLASS for Communication Providers
20121
20393
  //****************************************************************************
20122
- @ObjectType({ description: 'Reusable templates for communication.' })
20123
- export class CommunicationTemplate_ {
20394
+ @ObjectType({ description: 'All supported communication providers.' })
20395
+ export class CommunicationProvider_ {
20124
20396
  @Field(() => Int)
20125
20397
  ID: number;
20126
20398
 
@@ -20128,14 +20400,18 @@ export class CommunicationTemplate_ {
20128
20400
  @MaxLength(510)
20129
20401
  Name: string;
20130
20402
 
20131
- @Field()
20132
- Content: string;
20403
+ @Field({nullable: true})
20404
+ Description?: string;
20133
20405
 
20134
- @Field(() => Int, {nullable: true})
20135
- ParentID?: number;
20406
+ @Field({description: 'The status of the communication provider (Disabled or Active).'})
20407
+ @MaxLength(40)
20408
+ Status: string;
20136
20409
 
20137
- @Field({nullable: true})
20138
- Comments?: string;
20410
+ @Field(() => Boolean, {description: 'Indicates if the provider supports sending messages.'})
20411
+ SupportsSending: boolean;
20412
+
20413
+ @Field(() => Boolean, {description: 'Indicates if the provider supports receiving messages.'})
20414
+ SupportsReceiving: boolean;
20139
20415
 
20140
20416
  @Field()
20141
20417
  @MaxLength(8)
@@ -20144,236 +20420,71 @@ export class CommunicationTemplate_ {
20144
20420
  @Field()
20145
20421
  @MaxLength(8)
20146
20422
  UpdatedAt: Date;
20147
-
20148
- @Field({nullable: true})
20149
- @MaxLength(510)
20150
- Parent?: string;
20151
20423
 
20152
- @Field(() => [mj_core_schema_server_object_types.CommunicationTemplate_])
20153
- CommunicationTemplatesArray: mj_core_schema_server_object_types.CommunicationTemplate_[]; // Link to CommunicationTemplates
20424
+ @Field(() => [mj_core_schema_server_object_types.CommunicationProviderMessageType_])
20425
+ CommunicationProviderMessageTypesArray: mj_core_schema_server_object_types.CommunicationProviderMessageType_[]; // Link to CommunicationProviderMessageTypes
20426
+
20427
+ @Field(() => [mj_core_schema_server_object_types.CommunicationLog_])
20428
+ CommunicationLogsArray: mj_core_schema_server_object_types.CommunicationLog_[]; // Link to CommunicationLogs
20154
20429
 
20155
20430
  }
20156
20431
 
20157
20432
  //****************************************************************************
20158
- // INPUT TYPE for Communication Templates
20433
+ // INPUT TYPE for Communication Providers
20159
20434
  //****************************************************************************
20160
20435
  @InputType()
20161
- export class CreateCommunicationTemplateInput {
20436
+ export class CreateCommunicationProviderInput {
20162
20437
  @Field()
20163
20438
  Name: string;
20164
20439
 
20440
+ @Field({ nullable: true })
20441
+ Description?: string;
20442
+
20165
20443
  @Field()
20166
- Content: string;
20444
+ Status: string;
20167
20445
 
20168
- @Field(() => Int, { nullable: true })
20169
- ParentID?: number;
20446
+ @Field(() => Boolean)
20447
+ SupportsSending: boolean;
20170
20448
 
20171
- @Field({ nullable: true })
20172
- Comments?: string;
20449
+ @Field(() => Boolean)
20450
+ SupportsReceiving: boolean;
20173
20451
  }
20174
20452
 
20175
20453
 
20176
20454
  //****************************************************************************
20177
- // INPUT TYPE for Communication Templates
20455
+ // INPUT TYPE for Communication Providers
20178
20456
  //****************************************************************************
20179
20457
  @InputType()
20180
- export class UpdateCommunicationTemplateInput {
20458
+ export class UpdateCommunicationProviderInput {
20181
20459
  @Field(() => Int)
20182
20460
  ID: number;
20183
20461
 
20184
20462
  @Field()
20185
20463
  Name: string;
20186
20464
 
20465
+ @Field({ nullable: true })
20466
+ Description?: string;
20467
+
20187
20468
  @Field()
20188
- Content: string;
20469
+ Status: string;
20189
20470
 
20190
- @Field(() => Int, { nullable: true })
20191
- ParentID?: number;
20471
+ @Field(() => Boolean)
20472
+ SupportsSending: boolean;
20192
20473
 
20193
- @Field({ nullable: true })
20194
- Comments?: string;
20474
+ @Field(() => Boolean)
20475
+ SupportsReceiving: boolean;
20195
20476
 
20196
20477
  @Field(() => [KeyValuePairInput], { nullable: true })
20197
20478
  OldValues___?: KeyValuePairInput[];
20198
20479
  }
20199
20480
 
20200
20481
  //****************************************************************************
20201
- // RESOLVER for Communication Templates
20482
+ // RESOLVER for Communication Providers
20202
20483
  //****************************************************************************
20203
20484
  @ObjectType()
20204
- export class RunCommunicationTemplateViewResult {
20205
- @Field(() => [CommunicationTemplate_])
20206
- Results: CommunicationTemplate_[];
20207
-
20208
- @Field(() => Int, {nullable: true})
20209
- UserViewRunID?: number;
20210
-
20211
- @Field(() => Int, {nullable: true})
20212
- RowCount: number;
20213
-
20214
- @Field(() => Int, {nullable: true})
20215
- TotalRowCount: number;
20216
-
20217
- @Field(() => Int, {nullable: true})
20218
- ExecutionTime: number;
20219
-
20220
- @Field({nullable: true})
20221
- ErrorMessage?: string;
20222
-
20223
- @Field(() => Boolean, {nullable: false})
20224
- Success: boolean;
20225
- }
20226
-
20227
- @Resolver(CommunicationTemplate_)
20228
- export class CommunicationTemplateResolver extends ResolverBase {
20229
- @Query(() => RunCommunicationTemplateViewResult)
20230
- async RunCommunicationTemplateViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
20231
- return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
20232
- }
20233
-
20234
- @Query(() => RunCommunicationTemplateViewResult)
20235
- async RunCommunicationTemplateViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
20236
- return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
20237
- }
20238
-
20239
- @Query(() => RunCommunicationTemplateViewResult)
20240
- async RunCommunicationTemplateDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
20241
- input.EntityName = 'Communication Templates';
20242
- return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
20243
- }
20244
- @Query(() => CommunicationTemplate_, { nullable: true })
20245
- async CommunicationTemplate(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<CommunicationTemplate_ | null> {
20246
- this.CheckUserReadPermissions('Communication Templates', userPayload);
20247
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCommunicationTemplates] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Communication Templates', userPayload, EntityPermissionType.Read, 'AND');
20248
- const result = this.MapFieldNamesToCodeNames('Communication Templates', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
20249
- return result;
20250
- }
20251
-
20252
- @FieldResolver(() => [mj_core_schema_server_object_types.CommunicationTemplate_])
20253
- async CommunicationTemplatesArray(@Root() communicationtemplate_: CommunicationTemplate_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
20254
- this.CheckUserReadPermissions('Communication Templates', userPayload);
20255
- const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwCommunicationTemplates] WHERE [ParentID]=${communicationtemplate_.ID} ` + this.getRowLevelSecurityWhereClause('Communication Templates', userPayload, EntityPermissionType.Read, 'AND');
20256
- const result = this.ArrayMapFieldNamesToCodeNames('Communication Templates', await dataSource.query(sSQL));
20257
- return result;
20258
- }
20259
-
20260
- @Mutation(() => CommunicationTemplate_)
20261
- async CreateCommunicationTemplate(
20262
- @Arg('input', () => CreateCommunicationTemplateInput) input: CreateCommunicationTemplateInput,
20263
- @Ctx() { dataSource, userPayload }: AppContext,
20264
- @PubSub() pubSub: PubSubEngine
20265
- ) {
20266
- return this.CreateRecord('Communication Templates', input, dataSource, userPayload, pubSub)
20267
- }
20268
-
20269
- @Mutation(() => CommunicationTemplate_)
20270
- async UpdateCommunicationTemplate(
20271
- @Arg('input', () => UpdateCommunicationTemplateInput) input: UpdateCommunicationTemplateInput,
20272
- @Ctx() { dataSource, userPayload }: AppContext,
20273
- @PubSub() pubSub: PubSubEngine
20274
- ) {
20275
- return this.UpdateRecord('Communication Templates', input, dataSource, userPayload, pubSub);
20276
- }
20277
-
20278
- }
20279
-
20280
- //****************************************************************************
20281
- // ENTITY CLASS for Communication Providers
20282
- //****************************************************************************
20283
- @ObjectType({ description: 'All supported communication providers.' })
20284
- export class CommunicationProvider_ {
20285
- @Field(() => Int)
20286
- ID: number;
20287
-
20288
- @Field()
20289
- @MaxLength(510)
20290
- Name: string;
20291
-
20292
- @Field({nullable: true})
20293
- Description?: string;
20294
-
20295
- @Field({description: 'The status of the communication provider (Disabled or Active).'})
20296
- @MaxLength(40)
20297
- Status: string;
20298
-
20299
- @Field(() => Boolean, {description: 'Indicates if the provider supports sending messages.'})
20300
- SupportsSending: boolean;
20301
-
20302
- @Field(() => Boolean, {description: 'Indicates if the provider supports receiving messages.'})
20303
- SupportsReceiving: boolean;
20304
-
20305
- @Field()
20306
- @MaxLength(8)
20307
- CreatedAt: Date;
20308
-
20309
- @Field()
20310
- @MaxLength(8)
20311
- UpdatedAt: Date;
20312
-
20313
- @Field(() => [mj_core_schema_server_object_types.CommunicationProviderMessageType_])
20314
- CommunicationProviderMessageTypesArray: mj_core_schema_server_object_types.CommunicationProviderMessageType_[]; // Link to CommunicationProviderMessageTypes
20315
-
20316
- @Field(() => [mj_core_schema_server_object_types.CommunicationLog_])
20317
- CommunicationLogsArray: mj_core_schema_server_object_types.CommunicationLog_[]; // Link to CommunicationLogs
20318
-
20319
- }
20320
-
20321
- //****************************************************************************
20322
- // INPUT TYPE for Communication Providers
20323
- //****************************************************************************
20324
- @InputType()
20325
- export class CreateCommunicationProviderInput {
20326
- @Field()
20327
- Name: string;
20328
-
20329
- @Field({ nullable: true })
20330
- Description?: string;
20331
-
20332
- @Field()
20333
- Status: string;
20334
-
20335
- @Field(() => Boolean)
20336
- SupportsSending: boolean;
20337
-
20338
- @Field(() => Boolean)
20339
- SupportsReceiving: boolean;
20340
- }
20341
-
20342
-
20343
- //****************************************************************************
20344
- // INPUT TYPE for Communication Providers
20345
- //****************************************************************************
20346
- @InputType()
20347
- export class UpdateCommunicationProviderInput {
20348
- @Field(() => Int)
20349
- ID: number;
20350
-
20351
- @Field()
20352
- Name: string;
20353
-
20354
- @Field({ nullable: true })
20355
- Description?: string;
20356
-
20357
- @Field()
20358
- Status: string;
20359
-
20360
- @Field(() => Boolean)
20361
- SupportsSending: boolean;
20362
-
20363
- @Field(() => Boolean)
20364
- SupportsReceiving: boolean;
20365
-
20366
- @Field(() => [KeyValuePairInput], { nullable: true })
20367
- OldValues___?: KeyValuePairInput[];
20368
- }
20369
-
20370
- //****************************************************************************
20371
- // RESOLVER for Communication Providers
20372
- //****************************************************************************
20373
- @ObjectType()
20374
- export class RunCommunicationProviderViewResult {
20375
- @Field(() => [CommunicationProvider_])
20376
- Results: CommunicationProvider_[];
20485
+ export class RunCommunicationProviderViewResult {
20486
+ @Field(() => [CommunicationProvider_])
20487
+ Results: CommunicationProvider_[];
20377
20488
 
20378
20489
  @Field(() => Int, {nullable: true})
20379
20490
  UserViewRunID?: number;
@@ -20474,6 +20585,14 @@ export class CommunicationRun_ {
20474
20585
  @MaxLength(40)
20475
20586
  Status: string;
20476
20587
 
20588
+ @Field({nullable: true})
20589
+ @MaxLength(8)
20590
+ StartedAt?: Date;
20591
+
20592
+ @Field({nullable: true})
20593
+ @MaxLength(8)
20594
+ EndedAt?: Date;
20595
+
20477
20596
  @Field({nullable: true})
20478
20597
  Comments?: string;
20479
20598
 
@@ -20511,6 +20630,12 @@ export class CreateCommunicationRunInput {
20511
20630
  @Field()
20512
20631
  Status: string;
20513
20632
 
20633
+ @Field({ nullable: true })
20634
+ StartedAt?: Date;
20635
+
20636
+ @Field({ nullable: true })
20637
+ EndedAt?: Date;
20638
+
20514
20639
  @Field({ nullable: true })
20515
20640
  Comments?: string;
20516
20641
 
@@ -20536,6 +20661,12 @@ export class UpdateCommunicationRunInput {
20536
20661
  @Field()
20537
20662
  Status: string;
20538
20663
 
20664
+ @Field({ nullable: true })
20665
+ StartedAt?: Date;
20666
+
20667
+ @Field({ nullable: true })
20668
+ EndedAt?: Date;
20669
+
20539
20670
  @Field({ nullable: true })
20540
20671
  Comments?: string;
20541
20672
 
@@ -21028,6 +21159,9 @@ export class CommunicationBaseMessageType_ {
21028
21159
  @Field(() => [mj_core_schema_server_object_types.CommunicationProviderMessageType_])
21029
21160
  CommunicationProviderMessageTypesArray: mj_core_schema_server_object_types.CommunicationProviderMessageType_[]; // Link to CommunicationProviderMessageTypes
21030
21161
 
21162
+ @Field(() => [mj_core_schema_server_object_types.EntityCommunicationMessageType_])
21163
+ EntityCommunicationMessageTypesArray: mj_core_schema_server_object_types.EntityCommunicationMessageType_[]; // Link to EntityCommunicationMessageTypes
21164
+
21031
21165
  }
21032
21166
 
21033
21167
  //****************************************************************************
@@ -21138,6 +21272,14 @@ export class CommunicationBaseMessageTypeResolver extends ResolverBase {
21138
21272
  const result = this.ArrayMapFieldNamesToCodeNames('Communication Provider Message Types', await dataSource.query(sSQL));
21139
21273
  return result;
21140
21274
  }
21275
+
21276
+ @FieldResolver(() => [mj_core_schema_server_object_types.EntityCommunicationMessageType_])
21277
+ async EntityCommunicationMessageTypesArray(@Root() communicationbasemessagetype_: CommunicationBaseMessageType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21278
+ this.CheckUserReadPermissions('Entity Communication Message Types', userPayload);
21279
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwEntityCommunicationMessageTypes] WHERE [BaseMessageTypeID]=${communicationbasemessagetype_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Communication Message Types', userPayload, EntityPermissionType.Read, 'AND');
21280
+ const result = this.ArrayMapFieldNamesToCodeNames('Entity Communication Message Types', await dataSource.query(sSQL));
21281
+ return result;
21282
+ }
21141
21283
 
21142
21284
  @Mutation(() => CommunicationBaseMessageType_)
21143
21285
  async CreateCommunicationBaseMessageType(
@@ -21157,4 +21299,1803 @@ export class CommunicationBaseMessageTypeResolver extends ResolverBase {
21157
21299
  return this.UpdateRecord('Communication Base Message Types', input, dataSource, userPayload, pubSub);
21158
21300
  }
21159
21301
 
21302
+ }
21303
+
21304
+ //****************************************************************************
21305
+ // ENTITY CLASS for Templates
21306
+ //****************************************************************************
21307
+ @ObjectType({ description: 'Templates are used for dynamic expansion of a static template with data from a given context. Templates can be used to create documents, messages and anything else that requires dynamic document creation merging together static text, data and lightweight logic' })
21308
+ export class Template_ {
21309
+ @Field(() => Int)
21310
+ ID: number;
21311
+
21312
+ @Field({description: 'Name of the template'})
21313
+ @MaxLength(510)
21314
+ Name: string;
21315
+
21316
+ @Field({nullable: true, description: 'Description of the template'})
21317
+ Description?: string;
21318
+
21319
+ @Field({nullable: true, description: 'This prompt will be used by the AI to generate template content as requested by the user.'})
21320
+ UserPrompt?: string;
21321
+
21322
+ @Field(() => Int, {nullable: true, description: 'Optional, Category that this template is part of'})
21323
+ CategoryID?: number;
21324
+
21325
+ @Field(() => Int)
21326
+ UserID: number;
21327
+
21328
+ @Field({nullable: true, description: 'Optional, if provided, this template will not be available for use until the specified date. Requires IsActive to be set to 1'})
21329
+ @MaxLength(8)
21330
+ ActiveAt?: Date;
21331
+
21332
+ @Field({nullable: true, description: 'Optional, if provided, this template will not be available for use after the specified date. If IsActive=0, this has no effect.'})
21333
+ @MaxLength(8)
21334
+ DisabledAt?: Date;
21335
+
21336
+ @Field(() => Boolean, {description: 'If set to 0, the template will be disabled regardless of the values in ActiveAt/DisabledAt. '})
21337
+ IsActive: boolean;
21338
+
21339
+ @Field()
21340
+ @MaxLength(8)
21341
+ CreatedAt: Date;
21342
+
21343
+ @Field()
21344
+ @MaxLength(8)
21345
+ UpdatedAt: Date;
21346
+
21347
+ @Field({nullable: true})
21348
+ @MaxLength(510)
21349
+ Category?: string;
21350
+
21351
+ @Field()
21352
+ @MaxLength(200)
21353
+ User: string;
21354
+
21355
+ @Field(() => [mj_core_schema_server_object_types.TemplateParam_])
21356
+ TemplateParamsArray: mj_core_schema_server_object_types.TemplateParam_[]; // Link to TemplateParams
21357
+
21358
+ @Field(() => [mj_core_schema_server_object_types.TemplateContent_])
21359
+ TemplateContentsArray: mj_core_schema_server_object_types.TemplateContent_[]; // Link to TemplateContents
21360
+
21361
+ }
21362
+
21363
+ //****************************************************************************
21364
+ // INPUT TYPE for Templates
21365
+ //****************************************************************************
21366
+ @InputType()
21367
+ export class CreateTemplateInput {
21368
+ @Field()
21369
+ Name: string;
21370
+
21371
+ @Field({ nullable: true })
21372
+ Description?: string;
21373
+
21374
+ @Field({ nullable: true })
21375
+ UserPrompt?: string;
21376
+
21377
+ @Field(() => Int, { nullable: true })
21378
+ CategoryID?: number;
21379
+
21380
+ @Field(() => Int)
21381
+ UserID: number;
21382
+
21383
+ @Field({ nullable: true })
21384
+ ActiveAt?: Date;
21385
+
21386
+ @Field({ nullable: true })
21387
+ DisabledAt?: Date;
21388
+
21389
+ @Field(() => Boolean)
21390
+ IsActive: boolean;
21391
+ }
21392
+
21393
+
21394
+ //****************************************************************************
21395
+ // INPUT TYPE for Templates
21396
+ //****************************************************************************
21397
+ @InputType()
21398
+ export class UpdateTemplateInput {
21399
+ @Field(() => Int)
21400
+ ID: number;
21401
+
21402
+ @Field()
21403
+ Name: string;
21404
+
21405
+ @Field({ nullable: true })
21406
+ Description?: string;
21407
+
21408
+ @Field({ nullable: true })
21409
+ UserPrompt?: string;
21410
+
21411
+ @Field(() => Int, { nullable: true })
21412
+ CategoryID?: number;
21413
+
21414
+ @Field(() => Int)
21415
+ UserID: number;
21416
+
21417
+ @Field({ nullable: true })
21418
+ ActiveAt?: Date;
21419
+
21420
+ @Field({ nullable: true })
21421
+ DisabledAt?: Date;
21422
+
21423
+ @Field(() => Boolean)
21424
+ IsActive: boolean;
21425
+
21426
+ @Field(() => [KeyValuePairInput], { nullable: true })
21427
+ OldValues___?: KeyValuePairInput[];
21428
+ }
21429
+
21430
+ //****************************************************************************
21431
+ // RESOLVER for Templates
21432
+ //****************************************************************************
21433
+ @ObjectType()
21434
+ export class RunTemplateViewResult {
21435
+ @Field(() => [Template_])
21436
+ Results: Template_[];
21437
+
21438
+ @Field(() => Int, {nullable: true})
21439
+ UserViewRunID?: number;
21440
+
21441
+ @Field(() => Int, {nullable: true})
21442
+ RowCount: number;
21443
+
21444
+ @Field(() => Int, {nullable: true})
21445
+ TotalRowCount: number;
21446
+
21447
+ @Field(() => Int, {nullable: true})
21448
+ ExecutionTime: number;
21449
+
21450
+ @Field({nullable: true})
21451
+ ErrorMessage?: string;
21452
+
21453
+ @Field(() => Boolean, {nullable: false})
21454
+ Success: boolean;
21455
+ }
21456
+
21457
+ @Resolver(Template_)
21458
+ export class TemplateResolver extends ResolverBase {
21459
+ @Query(() => RunTemplateViewResult)
21460
+ async RunTemplateViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21461
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
21462
+ }
21463
+
21464
+ @Query(() => RunTemplateViewResult)
21465
+ async RunTemplateViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21466
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
21467
+ }
21468
+
21469
+ @Query(() => RunTemplateViewResult)
21470
+ async RunTemplateDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21471
+ input.EntityName = 'Templates';
21472
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
21473
+ }
21474
+ @Query(() => Template_, { nullable: true })
21475
+ async Template(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Template_ | null> {
21476
+ this.CheckUserReadPermissions('Templates', userPayload);
21477
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplates] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Templates', userPayload, EntityPermissionType.Read, 'AND');
21478
+ const result = this.MapFieldNamesToCodeNames('Templates', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
21479
+ return result;
21480
+ }
21481
+
21482
+ @FieldResolver(() => [mj_core_schema_server_object_types.TemplateParam_])
21483
+ async TemplateParamsArray(@Root() template_: Template_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21484
+ this.CheckUserReadPermissions('Template Params', userPayload);
21485
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplateParams] WHERE [TemplateID]=${template_.ID} ` + this.getRowLevelSecurityWhereClause('Template Params', userPayload, EntityPermissionType.Read, 'AND');
21486
+ const result = this.ArrayMapFieldNamesToCodeNames('Template Params', await dataSource.query(sSQL));
21487
+ return result;
21488
+ }
21489
+
21490
+ @FieldResolver(() => [mj_core_schema_server_object_types.TemplateContent_])
21491
+ async TemplateContentsArray(@Root() template_: Template_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21492
+ this.CheckUserReadPermissions('Template Contents', userPayload);
21493
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplateContents] WHERE [TemplateID]=${template_.ID} ` + this.getRowLevelSecurityWhereClause('Template Contents', userPayload, EntityPermissionType.Read, 'AND');
21494
+ const result = this.ArrayMapFieldNamesToCodeNames('Template Contents', await dataSource.query(sSQL));
21495
+ return result;
21496
+ }
21497
+
21498
+ @Mutation(() => Template_)
21499
+ async CreateTemplate(
21500
+ @Arg('input', () => CreateTemplateInput) input: CreateTemplateInput,
21501
+ @Ctx() { dataSource, userPayload }: AppContext,
21502
+ @PubSub() pubSub: PubSubEngine
21503
+ ) {
21504
+ return this.CreateRecord('Templates', input, dataSource, userPayload, pubSub)
21505
+ }
21506
+
21507
+ @Mutation(() => Template_)
21508
+ async UpdateTemplate(
21509
+ @Arg('input', () => UpdateTemplateInput) input: UpdateTemplateInput,
21510
+ @Ctx() { dataSource, userPayload }: AppContext,
21511
+ @PubSub() pubSub: PubSubEngine
21512
+ ) {
21513
+ return this.UpdateRecord('Templates', input, dataSource, userPayload, pubSub);
21514
+ }
21515
+
21516
+ }
21517
+
21518
+ //****************************************************************************
21519
+ // ENTITY CLASS for Template Categories
21520
+ //****************************************************************************
21521
+ @ObjectType({ description: 'Template categories for organizing templates' })
21522
+ export class TemplateCategory_ {
21523
+ @Field(() => Int)
21524
+ ID: number;
21525
+
21526
+ @Field({description: 'Name of the template category'})
21527
+ @MaxLength(510)
21528
+ Name: string;
21529
+
21530
+ @Field({nullable: true, description: 'Description of the template category'})
21531
+ Description?: string;
21532
+
21533
+ @Field(() => Int, {nullable: true})
21534
+ ParentID?: number;
21535
+
21536
+ @Field(() => Int)
21537
+ UserID: number;
21538
+
21539
+ @Field()
21540
+ @MaxLength(8)
21541
+ CreatedAt: Date;
21542
+
21543
+ @Field()
21544
+ @MaxLength(8)
21545
+ UpdatedAt: Date;
21546
+
21547
+ @Field({nullable: true})
21548
+ @MaxLength(510)
21549
+ Parent?: string;
21550
+
21551
+ @Field()
21552
+ @MaxLength(200)
21553
+ User: string;
21554
+
21555
+ @Field(() => [mj_core_schema_server_object_types.Template_])
21556
+ TemplatesArray: mj_core_schema_server_object_types.Template_[]; // Link to Templates
21557
+
21558
+ @Field(() => [mj_core_schema_server_object_types.TemplateCategory_])
21559
+ TemplateCategoriesArray: mj_core_schema_server_object_types.TemplateCategory_[]; // Link to TemplateCategories
21560
+
21561
+ }
21562
+
21563
+ //****************************************************************************
21564
+ // INPUT TYPE for Template Categories
21565
+ //****************************************************************************
21566
+ @InputType()
21567
+ export class CreateTemplateCategoryInput {
21568
+ @Field()
21569
+ Name: string;
21570
+
21571
+ @Field({ nullable: true })
21572
+ Description?: string;
21573
+
21574
+ @Field(() => Int, { nullable: true })
21575
+ ParentID?: number;
21576
+
21577
+ @Field(() => Int)
21578
+ UserID: number;
21579
+ }
21580
+
21581
+
21582
+ //****************************************************************************
21583
+ // INPUT TYPE for Template Categories
21584
+ //****************************************************************************
21585
+ @InputType()
21586
+ export class UpdateTemplateCategoryInput {
21587
+ @Field(() => Int)
21588
+ ID: number;
21589
+
21590
+ @Field()
21591
+ Name: string;
21592
+
21593
+ @Field({ nullable: true })
21594
+ Description?: string;
21595
+
21596
+ @Field(() => Int, { nullable: true })
21597
+ ParentID?: number;
21598
+
21599
+ @Field(() => Int)
21600
+ UserID: number;
21601
+
21602
+ @Field(() => [KeyValuePairInput], { nullable: true })
21603
+ OldValues___?: KeyValuePairInput[];
21604
+ }
21605
+
21606
+ //****************************************************************************
21607
+ // RESOLVER for Template Categories
21608
+ //****************************************************************************
21609
+ @ObjectType()
21610
+ export class RunTemplateCategoryViewResult {
21611
+ @Field(() => [TemplateCategory_])
21612
+ Results: TemplateCategory_[];
21613
+
21614
+ @Field(() => Int, {nullable: true})
21615
+ UserViewRunID?: number;
21616
+
21617
+ @Field(() => Int, {nullable: true})
21618
+ RowCount: number;
21619
+
21620
+ @Field(() => Int, {nullable: true})
21621
+ TotalRowCount: number;
21622
+
21623
+ @Field(() => Int, {nullable: true})
21624
+ ExecutionTime: number;
21625
+
21626
+ @Field({nullable: true})
21627
+ ErrorMessage?: string;
21628
+
21629
+ @Field(() => Boolean, {nullable: false})
21630
+ Success: boolean;
21631
+ }
21632
+
21633
+ @Resolver(TemplateCategory_)
21634
+ export class TemplateCategoryResolver extends ResolverBase {
21635
+ @Query(() => RunTemplateCategoryViewResult)
21636
+ async RunTemplateCategoryViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21637
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
21638
+ }
21639
+
21640
+ @Query(() => RunTemplateCategoryViewResult)
21641
+ async RunTemplateCategoryViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21642
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
21643
+ }
21644
+
21645
+ @Query(() => RunTemplateCategoryViewResult)
21646
+ async RunTemplateCategoryDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21647
+ input.EntityName = 'Template Categories';
21648
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
21649
+ }
21650
+ @Query(() => TemplateCategory_, { nullable: true })
21651
+ async TemplateCategory(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<TemplateCategory_ | null> {
21652
+ this.CheckUserReadPermissions('Template Categories', userPayload);
21653
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplateCategories] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Template Categories', userPayload, EntityPermissionType.Read, 'AND');
21654
+ const result = this.MapFieldNamesToCodeNames('Template Categories', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
21655
+ return result;
21656
+ }
21657
+
21658
+ @FieldResolver(() => [mj_core_schema_server_object_types.Template_])
21659
+ async TemplatesArray(@Root() templatecategory_: TemplateCategory_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21660
+ this.CheckUserReadPermissions('Templates', userPayload);
21661
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplates] WHERE [CategoryID]=${templatecategory_.ID} ` + this.getRowLevelSecurityWhereClause('Templates', userPayload, EntityPermissionType.Read, 'AND');
21662
+ const result = this.ArrayMapFieldNamesToCodeNames('Templates', await dataSource.query(sSQL));
21663
+ return result;
21664
+ }
21665
+
21666
+ @FieldResolver(() => [mj_core_schema_server_object_types.TemplateCategory_])
21667
+ async TemplateCategoriesArray(@Root() templatecategory_: TemplateCategory_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21668
+ this.CheckUserReadPermissions('Template Categories', userPayload);
21669
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplateCategories] WHERE [ParentID]=${templatecategory_.ID} ` + this.getRowLevelSecurityWhereClause('Template Categories', userPayload, EntityPermissionType.Read, 'AND');
21670
+ const result = this.ArrayMapFieldNamesToCodeNames('Template Categories', await dataSource.query(sSQL));
21671
+ return result;
21672
+ }
21673
+
21674
+ @Mutation(() => TemplateCategory_)
21675
+ async CreateTemplateCategory(
21676
+ @Arg('input', () => CreateTemplateCategoryInput) input: CreateTemplateCategoryInput,
21677
+ @Ctx() { dataSource, userPayload }: AppContext,
21678
+ @PubSub() pubSub: PubSubEngine
21679
+ ) {
21680
+ return this.CreateRecord('Template Categories', input, dataSource, userPayload, pubSub)
21681
+ }
21682
+
21683
+ @Mutation(() => TemplateCategory_)
21684
+ async UpdateTemplateCategory(
21685
+ @Arg('input', () => UpdateTemplateCategoryInput) input: UpdateTemplateCategoryInput,
21686
+ @Ctx() { dataSource, userPayload }: AppContext,
21687
+ @PubSub() pubSub: PubSubEngine
21688
+ ) {
21689
+ return this.UpdateRecord('Template Categories', input, dataSource, userPayload, pubSub);
21690
+ }
21691
+
21692
+ }
21693
+
21694
+ //****************************************************************************
21695
+ // ENTITY CLASS for Template Contents
21696
+ //****************************************************************************
21697
+ @ObjectType({ description: 'Template content for different versions of a template for purposes like HTML/Text/etc' })
21698
+ export class TemplateContent_ {
21699
+ @Field(() => Int)
21700
+ ID: number;
21701
+
21702
+ @Field(() => Int)
21703
+ TemplateID: number;
21704
+
21705
+ @Field(() => Int)
21706
+ TypeID: number;
21707
+
21708
+ @Field({nullable: true, description: 'The actual text content for the template'})
21709
+ TemplateText?: string;
21710
+
21711
+ @Field(() => Int, {description: 'Priority of the content version, higher priority versions will be used ahead of lower priority versions for a given Type'})
21712
+ Priority: number;
21713
+
21714
+ @Field(() => Boolean, {description: 'Indicates whether the content is active or not. Use this to disable a particular Template Content item without having to remove it'})
21715
+ IsActive: boolean;
21716
+
21717
+ @Field()
21718
+ @MaxLength(8)
21719
+ CreatedAt: Date;
21720
+
21721
+ @Field()
21722
+ @MaxLength(8)
21723
+ UpdatedAt: Date;
21724
+
21725
+ @Field()
21726
+ @MaxLength(510)
21727
+ Template: string;
21728
+
21729
+ @Field()
21730
+ @MaxLength(510)
21731
+ Type: string;
21732
+
21733
+ }
21734
+
21735
+ //****************************************************************************
21736
+ // INPUT TYPE for Template Contents
21737
+ //****************************************************************************
21738
+ @InputType()
21739
+ export class CreateTemplateContentInput {
21740
+ @Field(() => Int)
21741
+ TemplateID: number;
21742
+
21743
+ @Field(() => Int)
21744
+ TypeID: number;
21745
+
21746
+ @Field({ nullable: true })
21747
+ TemplateText?: string;
21748
+
21749
+ @Field(() => Int)
21750
+ Priority: number;
21751
+
21752
+ @Field(() => Boolean)
21753
+ IsActive: boolean;
21754
+ }
21755
+
21756
+
21757
+ //****************************************************************************
21758
+ // INPUT TYPE for Template Contents
21759
+ //****************************************************************************
21760
+ @InputType()
21761
+ export class UpdateTemplateContentInput {
21762
+ @Field(() => Int)
21763
+ ID: number;
21764
+
21765
+ @Field(() => Int)
21766
+ TemplateID: number;
21767
+
21768
+ @Field(() => Int)
21769
+ TypeID: number;
21770
+
21771
+ @Field({ nullable: true })
21772
+ TemplateText?: string;
21773
+
21774
+ @Field(() => Int)
21775
+ Priority: number;
21776
+
21777
+ @Field(() => Boolean)
21778
+ IsActive: boolean;
21779
+
21780
+ @Field(() => [KeyValuePairInput], { nullable: true })
21781
+ OldValues___?: KeyValuePairInput[];
21782
+ }
21783
+
21784
+ //****************************************************************************
21785
+ // RESOLVER for Template Contents
21786
+ //****************************************************************************
21787
+ @ObjectType()
21788
+ export class RunTemplateContentViewResult {
21789
+ @Field(() => [TemplateContent_])
21790
+ Results: TemplateContent_[];
21791
+
21792
+ @Field(() => Int, {nullable: true})
21793
+ UserViewRunID?: number;
21794
+
21795
+ @Field(() => Int, {nullable: true})
21796
+ RowCount: number;
21797
+
21798
+ @Field(() => Int, {nullable: true})
21799
+ TotalRowCount: number;
21800
+
21801
+ @Field(() => Int, {nullable: true})
21802
+ ExecutionTime: number;
21803
+
21804
+ @Field({nullable: true})
21805
+ ErrorMessage?: string;
21806
+
21807
+ @Field(() => Boolean, {nullable: false})
21808
+ Success: boolean;
21809
+ }
21810
+
21811
+ @Resolver(TemplateContent_)
21812
+ export class TemplateContentResolver extends ResolverBase {
21813
+ @Query(() => RunTemplateContentViewResult)
21814
+ async RunTemplateContentViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21815
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
21816
+ }
21817
+
21818
+ @Query(() => RunTemplateContentViewResult)
21819
+ async RunTemplateContentViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21820
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
21821
+ }
21822
+
21823
+ @Query(() => RunTemplateContentViewResult)
21824
+ async RunTemplateContentDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
21825
+ input.EntityName = 'Template Contents';
21826
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
21827
+ }
21828
+ @Query(() => TemplateContent_, { nullable: true })
21829
+ async TemplateContent(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<TemplateContent_ | null> {
21830
+ this.CheckUserReadPermissions('Template Contents', userPayload);
21831
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplateContents] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Template Contents', userPayload, EntityPermissionType.Read, 'AND');
21832
+ const result = this.MapFieldNamesToCodeNames('Template Contents', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
21833
+ return result;
21834
+ }
21835
+
21836
+ @Mutation(() => TemplateContent_)
21837
+ async CreateTemplateContent(
21838
+ @Arg('input', () => CreateTemplateContentInput) input: CreateTemplateContentInput,
21839
+ @Ctx() { dataSource, userPayload }: AppContext,
21840
+ @PubSub() pubSub: PubSubEngine
21841
+ ) {
21842
+ return this.CreateRecord('Template Contents', input, dataSource, userPayload, pubSub)
21843
+ }
21844
+
21845
+ @Mutation(() => TemplateContent_)
21846
+ async UpdateTemplateContent(
21847
+ @Arg('input', () => UpdateTemplateContentInput) input: UpdateTemplateContentInput,
21848
+ @Ctx() { dataSource, userPayload }: AppContext,
21849
+ @PubSub() pubSub: PubSubEngine
21850
+ ) {
21851
+ return this.UpdateRecord('Template Contents', input, dataSource, userPayload, pubSub);
21852
+ }
21853
+
21854
+ }
21855
+
21856
+ //****************************************************************************
21857
+ // ENTITY CLASS for Template Params
21858
+ //****************************************************************************
21859
+ @ObjectType({ description: 'Parameters allowed for use inside the template' })
21860
+ export class TemplateParam_ {
21861
+ @Field(() => Int)
21862
+ ID: number;
21863
+
21864
+ @Field(() => Int, {description: 'ID of the template this parameter belongs to'})
21865
+ TemplateID: number;
21866
+
21867
+ @Field({description: 'Name of the parameter'})
21868
+ @MaxLength(510)
21869
+ Name: string;
21870
+
21871
+ @Field({nullable: true, description: 'Description of the parameter'})
21872
+ Description?: string;
21873
+
21874
+ @Field({description: 'Type of the parameter'})
21875
+ @MaxLength(40)
21876
+ Type: string;
21877
+
21878
+ @Field({nullable: true, description: 'Default value of the parameter'})
21879
+ DefaultValue?: string;
21880
+
21881
+ @Field(() => Boolean)
21882
+ IsRequired: boolean;
21883
+
21884
+ @Field(() => Int, {nullable: true, description: 'Entity ID, used only when Type is Record'})
21885
+ EntityID?: number;
21886
+
21887
+ @Field({nullable: true, description: 'Record ID, used only when Type is Record'})
21888
+ @MaxLength(4000)
21889
+ RecordID?: string;
21890
+
21891
+ @Field()
21892
+ @MaxLength(8)
21893
+ CreatedAt: Date;
21894
+
21895
+ @Field()
21896
+ @MaxLength(8)
21897
+ UpdatedAt: Date;
21898
+
21899
+ @Field()
21900
+ @MaxLength(510)
21901
+ Template: string;
21902
+
21903
+ @Field({nullable: true})
21904
+ @MaxLength(510)
21905
+ Entity?: string;
21906
+
21907
+ }
21908
+
21909
+ //****************************************************************************
21910
+ // INPUT TYPE for Template Params
21911
+ //****************************************************************************
21912
+ @InputType()
21913
+ export class CreateTemplateParamInput {
21914
+ @Field(() => Int)
21915
+ TemplateID: number;
21916
+
21917
+ @Field()
21918
+ Name: string;
21919
+
21920
+ @Field({ nullable: true })
21921
+ Description?: string;
21922
+
21923
+ @Field()
21924
+ Type: string;
21925
+
21926
+ @Field({ nullable: true })
21927
+ DefaultValue?: string;
21928
+
21929
+ @Field(() => Boolean)
21930
+ IsRequired: boolean;
21931
+
21932
+ @Field(() => Int, { nullable: true })
21933
+ EntityID?: number;
21934
+
21935
+ @Field({ nullable: true })
21936
+ RecordID?: string;
21937
+ }
21938
+
21939
+
21940
+ //****************************************************************************
21941
+ // INPUT TYPE for Template Params
21942
+ //****************************************************************************
21943
+ @InputType()
21944
+ export class UpdateTemplateParamInput {
21945
+ @Field(() => Int)
21946
+ ID: number;
21947
+
21948
+ @Field(() => Int)
21949
+ TemplateID: number;
21950
+
21951
+ @Field()
21952
+ Name: string;
21953
+
21954
+ @Field({ nullable: true })
21955
+ Description?: string;
21956
+
21957
+ @Field()
21958
+ Type: string;
21959
+
21960
+ @Field({ nullable: true })
21961
+ DefaultValue?: string;
21962
+
21963
+ @Field(() => Boolean)
21964
+ IsRequired: boolean;
21965
+
21966
+ @Field(() => Int, { nullable: true })
21967
+ EntityID?: number;
21968
+
21969
+ @Field({ nullable: true })
21970
+ RecordID?: string;
21971
+
21972
+ @Field(() => [KeyValuePairInput], { nullable: true })
21973
+ OldValues___?: KeyValuePairInput[];
21974
+ }
21975
+
21976
+ //****************************************************************************
21977
+ // RESOLVER for Template Params
21978
+ //****************************************************************************
21979
+ @ObjectType()
21980
+ export class RunTemplateParamViewResult {
21981
+ @Field(() => [TemplateParam_])
21982
+ Results: TemplateParam_[];
21983
+
21984
+ @Field(() => Int, {nullable: true})
21985
+ UserViewRunID?: number;
21986
+
21987
+ @Field(() => Int, {nullable: true})
21988
+ RowCount: number;
21989
+
21990
+ @Field(() => Int, {nullable: true})
21991
+ TotalRowCount: number;
21992
+
21993
+ @Field(() => Int, {nullable: true})
21994
+ ExecutionTime: number;
21995
+
21996
+ @Field({nullable: true})
21997
+ ErrorMessage?: string;
21998
+
21999
+ @Field(() => Boolean, {nullable: false})
22000
+ Success: boolean;
22001
+ }
22002
+
22003
+ @Resolver(TemplateParam_)
22004
+ export class TemplateParamResolver extends ResolverBase {
22005
+ @Query(() => RunTemplateParamViewResult)
22006
+ async RunTemplateParamViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22007
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
22008
+ }
22009
+
22010
+ @Query(() => RunTemplateParamViewResult)
22011
+ async RunTemplateParamViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22012
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
22013
+ }
22014
+
22015
+ @Query(() => RunTemplateParamViewResult)
22016
+ async RunTemplateParamDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22017
+ input.EntityName = 'Template Params';
22018
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
22019
+ }
22020
+ @Query(() => TemplateParam_, { nullable: true })
22021
+ async TemplateParam(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<TemplateParam_ | null> {
22022
+ this.CheckUserReadPermissions('Template Params', userPayload);
22023
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplateParams] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Template Params', userPayload, EntityPermissionType.Read, 'AND');
22024
+ const result = this.MapFieldNamesToCodeNames('Template Params', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
22025
+ return result;
22026
+ }
22027
+
22028
+ @Mutation(() => TemplateParam_)
22029
+ async CreateTemplateParam(
22030
+ @Arg('input', () => CreateTemplateParamInput) input: CreateTemplateParamInput,
22031
+ @Ctx() { dataSource, userPayload }: AppContext,
22032
+ @PubSub() pubSub: PubSubEngine
22033
+ ) {
22034
+ return this.CreateRecord('Template Params', input, dataSource, userPayload, pubSub)
22035
+ }
22036
+
22037
+ @Mutation(() => TemplateParam_)
22038
+ async UpdateTemplateParam(
22039
+ @Arg('input', () => UpdateTemplateParamInput) input: UpdateTemplateParamInput,
22040
+ @Ctx() { dataSource, userPayload }: AppContext,
22041
+ @PubSub() pubSub: PubSubEngine
22042
+ ) {
22043
+ return this.UpdateRecord('Template Params', input, dataSource, userPayload, pubSub);
22044
+ }
22045
+
22046
+ }
22047
+
22048
+ //****************************************************************************
22049
+ // ENTITY CLASS for Template Content Types
22050
+ //****************************************************************************
22051
+ @ObjectType({ description: 'Template content types for categorizing content within templates' })
22052
+ export class TemplateContentType_ {
22053
+ @Field(() => Int)
22054
+ ID: number;
22055
+
22056
+ @Field({description: 'Name of the template content type'})
22057
+ @MaxLength(510)
22058
+ Name: string;
22059
+
22060
+ @Field({nullable: true, description: 'Description of the template content type'})
22061
+ Description?: string;
22062
+
22063
+ @Field()
22064
+ @MaxLength(8)
22065
+ CreatedAt: Date;
22066
+
22067
+ @Field()
22068
+ @MaxLength(8)
22069
+ UpdatedAt: Date;
22070
+
22071
+ @Field(() => [mj_core_schema_server_object_types.TemplateContent_])
22072
+ TemplateContentsArray: mj_core_schema_server_object_types.TemplateContent_[]; // Link to TemplateContents
22073
+
22074
+ }
22075
+
22076
+ //****************************************************************************
22077
+ // INPUT TYPE for Template Content Types
22078
+ //****************************************************************************
22079
+ @InputType()
22080
+ export class CreateTemplateContentTypeInput {
22081
+ @Field()
22082
+ Name: string;
22083
+
22084
+ @Field({ nullable: true })
22085
+ Description?: string;
22086
+ }
22087
+
22088
+
22089
+ //****************************************************************************
22090
+ // INPUT TYPE for Template Content Types
22091
+ //****************************************************************************
22092
+ @InputType()
22093
+ export class UpdateTemplateContentTypeInput {
22094
+ @Field(() => Int)
22095
+ ID: number;
22096
+
22097
+ @Field()
22098
+ Name: string;
22099
+
22100
+ @Field({ nullable: true })
22101
+ Description?: string;
22102
+
22103
+ @Field(() => [KeyValuePairInput], { nullable: true })
22104
+ OldValues___?: KeyValuePairInput[];
22105
+ }
22106
+
22107
+ //****************************************************************************
22108
+ // RESOLVER for Template Content Types
22109
+ //****************************************************************************
22110
+ @ObjectType()
22111
+ export class RunTemplateContentTypeViewResult {
22112
+ @Field(() => [TemplateContentType_])
22113
+ Results: TemplateContentType_[];
22114
+
22115
+ @Field(() => Int, {nullable: true})
22116
+ UserViewRunID?: number;
22117
+
22118
+ @Field(() => Int, {nullable: true})
22119
+ RowCount: number;
22120
+
22121
+ @Field(() => Int, {nullable: true})
22122
+ TotalRowCount: number;
22123
+
22124
+ @Field(() => Int, {nullable: true})
22125
+ ExecutionTime: number;
22126
+
22127
+ @Field({nullable: true})
22128
+ ErrorMessage?: string;
22129
+
22130
+ @Field(() => Boolean, {nullable: false})
22131
+ Success: boolean;
22132
+ }
22133
+
22134
+ @Resolver(TemplateContentType_)
22135
+ export class TemplateContentTypeResolver extends ResolverBase {
22136
+ @Query(() => RunTemplateContentTypeViewResult)
22137
+ async RunTemplateContentTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22138
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
22139
+ }
22140
+
22141
+ @Query(() => RunTemplateContentTypeViewResult)
22142
+ async RunTemplateContentTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22143
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
22144
+ }
22145
+
22146
+ @Query(() => RunTemplateContentTypeViewResult)
22147
+ async RunTemplateContentTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22148
+ input.EntityName = 'Template Content Types';
22149
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
22150
+ }
22151
+ @Query(() => TemplateContentType_, { nullable: true })
22152
+ async TemplateContentType(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<TemplateContentType_ | null> {
22153
+ this.CheckUserReadPermissions('Template Content Types', userPayload);
22154
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplateContentTypes] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Template Content Types', userPayload, EntityPermissionType.Read, 'AND');
22155
+ const result = this.MapFieldNamesToCodeNames('Template Content Types', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
22156
+ return result;
22157
+ }
22158
+
22159
+ @FieldResolver(() => [mj_core_schema_server_object_types.TemplateContent_])
22160
+ async TemplateContentsArray(@Root() templatecontenttype_: TemplateContentType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22161
+ this.CheckUserReadPermissions('Template Contents', userPayload);
22162
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwTemplateContents] WHERE [TypeID]=${templatecontenttype_.ID} ` + this.getRowLevelSecurityWhereClause('Template Contents', userPayload, EntityPermissionType.Read, 'AND');
22163
+ const result = this.ArrayMapFieldNamesToCodeNames('Template Contents', await dataSource.query(sSQL));
22164
+ return result;
22165
+ }
22166
+
22167
+ @Mutation(() => TemplateContentType_)
22168
+ async CreateTemplateContentType(
22169
+ @Arg('input', () => CreateTemplateContentTypeInput) input: CreateTemplateContentTypeInput,
22170
+ @Ctx() { dataSource, userPayload }: AppContext,
22171
+ @PubSub() pubSub: PubSubEngine
22172
+ ) {
22173
+ return this.CreateRecord('Template Content Types', input, dataSource, userPayload, pubSub)
22174
+ }
22175
+
22176
+ @Mutation(() => TemplateContentType_)
22177
+ async UpdateTemplateContentType(
22178
+ @Arg('input', () => UpdateTemplateContentTypeInput) input: UpdateTemplateContentTypeInput,
22179
+ @Ctx() { dataSource, userPayload }: AppContext,
22180
+ @PubSub() pubSub: PubSubEngine
22181
+ ) {
22182
+ return this.UpdateRecord('Template Content Types', input, dataSource, userPayload, pubSub);
22183
+ }
22184
+
22185
+ }
22186
+
22187
+ //****************************************************************************
22188
+ // ENTITY CLASS for Recommendations
22189
+ //****************************************************************************
22190
+ @ObjectType({ description: 'Recommendation headers that store the left side of the recommendation which we track in the SourceEntityID/SourceEntityRecordID' })
22191
+ export class Recommendation_ {
22192
+ @Field(() => Int)
22193
+ ID: number;
22194
+
22195
+ @Field(() => Int)
22196
+ RecommendationRunID: number;
22197
+
22198
+ @Field(() => Int)
22199
+ SourceEntityID: number;
22200
+
22201
+ @Field({description: 'The record ID of the source entity'})
22202
+ SourceEntityRecordID: string;
22203
+
22204
+ @Field({nullable: true})
22205
+ @MaxLength(8)
22206
+ CreatedAt?: Date;
22207
+
22208
+ @Field({nullable: true})
22209
+ @MaxLength(8)
22210
+ UpdatedAt?: Date;
22211
+
22212
+ @Field()
22213
+ @MaxLength(510)
22214
+ SourceEntity: string;
22215
+
22216
+ @Field(() => [mj_core_schema_server_object_types.RecommendationItem_])
22217
+ RecommendationItemsArray: mj_core_schema_server_object_types.RecommendationItem_[]; // Link to RecommendationItems
22218
+
22219
+ }
22220
+
22221
+ //****************************************************************************
22222
+ // INPUT TYPE for Recommendations
22223
+ //****************************************************************************
22224
+ @InputType()
22225
+ export class CreateRecommendationInput {
22226
+ @Field(() => Int)
22227
+ RecommendationRunID: number;
22228
+
22229
+ @Field(() => Int)
22230
+ SourceEntityID: number;
22231
+
22232
+ @Field()
22233
+ SourceEntityRecordID: string;
22234
+ }
22235
+
22236
+
22237
+ //****************************************************************************
22238
+ // INPUT TYPE for Recommendations
22239
+ //****************************************************************************
22240
+ @InputType()
22241
+ export class UpdateRecommendationInput {
22242
+ @Field(() => Int)
22243
+ ID: number;
22244
+
22245
+ @Field(() => Int)
22246
+ RecommendationRunID: number;
22247
+
22248
+ @Field(() => Int)
22249
+ SourceEntityID: number;
22250
+
22251
+ @Field()
22252
+ SourceEntityRecordID: string;
22253
+
22254
+ @Field(() => [KeyValuePairInput], { nullable: true })
22255
+ OldValues___?: KeyValuePairInput[];
22256
+ }
22257
+
22258
+ //****************************************************************************
22259
+ // RESOLVER for Recommendations
22260
+ //****************************************************************************
22261
+ @ObjectType()
22262
+ export class RunRecommendationViewResult {
22263
+ @Field(() => [Recommendation_])
22264
+ Results: Recommendation_[];
22265
+
22266
+ @Field(() => Int, {nullable: true})
22267
+ UserViewRunID?: number;
22268
+
22269
+ @Field(() => Int, {nullable: true})
22270
+ RowCount: number;
22271
+
22272
+ @Field(() => Int, {nullable: true})
22273
+ TotalRowCount: number;
22274
+
22275
+ @Field(() => Int, {nullable: true})
22276
+ ExecutionTime: number;
22277
+
22278
+ @Field({nullable: true})
22279
+ ErrorMessage?: string;
22280
+
22281
+ @Field(() => Boolean, {nullable: false})
22282
+ Success: boolean;
22283
+ }
22284
+
22285
+ @Resolver(Recommendation_)
22286
+ export class RecommendationResolver extends ResolverBase {
22287
+ @Query(() => RunRecommendationViewResult)
22288
+ async RunRecommendationViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22289
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
22290
+ }
22291
+
22292
+ @Query(() => RunRecommendationViewResult)
22293
+ async RunRecommendationViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22294
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
22295
+ }
22296
+
22297
+ @Query(() => RunRecommendationViewResult)
22298
+ async RunRecommendationDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22299
+ input.EntityName = 'Recommendations';
22300
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
22301
+ }
22302
+ @Query(() => Recommendation_, { nullable: true })
22303
+ async Recommendation(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Recommendation_ | null> {
22304
+ this.CheckUserReadPermissions('Recommendations', userPayload);
22305
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecommendations] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Recommendations', userPayload, EntityPermissionType.Read, 'AND');
22306
+ const result = this.MapFieldNamesToCodeNames('Recommendations', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
22307
+ return result;
22308
+ }
22309
+
22310
+ @FieldResolver(() => [mj_core_schema_server_object_types.RecommendationItem_])
22311
+ async RecommendationItemsArray(@Root() recommendation_: Recommendation_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22312
+ this.CheckUserReadPermissions('Recommendation Items', userPayload);
22313
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecommendationItems] WHERE [RecommendationID]=${recommendation_.ID} ` + this.getRowLevelSecurityWhereClause('Recommendation Items', userPayload, EntityPermissionType.Read, 'AND');
22314
+ const result = this.ArrayMapFieldNamesToCodeNames('Recommendation Items', await dataSource.query(sSQL));
22315
+ return result;
22316
+ }
22317
+
22318
+ @Mutation(() => Recommendation_)
22319
+ async CreateRecommendation(
22320
+ @Arg('input', () => CreateRecommendationInput) input: CreateRecommendationInput,
22321
+ @Ctx() { dataSource, userPayload }: AppContext,
22322
+ @PubSub() pubSub: PubSubEngine
22323
+ ) {
22324
+ return this.CreateRecord('Recommendations', input, dataSource, userPayload, pubSub)
22325
+ }
22326
+
22327
+ @Mutation(() => Recommendation_)
22328
+ async UpdateRecommendation(
22329
+ @Arg('input', () => UpdateRecommendationInput) input: UpdateRecommendationInput,
22330
+ @Ctx() { dataSource, userPayload }: AppContext,
22331
+ @PubSub() pubSub: PubSubEngine
22332
+ ) {
22333
+ return this.UpdateRecord('Recommendations', input, dataSource, userPayload, pubSub);
22334
+ }
22335
+
22336
+ }
22337
+
22338
+ //****************************************************************************
22339
+ // ENTITY CLASS for Recommendation Providers
22340
+ //****************************************************************************
22341
+ @ObjectType({ description: 'Recommendation providers details' })
22342
+ export class RecommendationProvider_ {
22343
+ @Field(() => Int)
22344
+ ID: number;
22345
+
22346
+ @Field()
22347
+ @MaxLength(510)
22348
+ Name: string;
22349
+
22350
+ @Field({nullable: true})
22351
+ Description?: string;
22352
+
22353
+ @Field({nullable: true})
22354
+ @MaxLength(8)
22355
+ CreatedAt?: Date;
22356
+
22357
+ @Field({nullable: true})
22358
+ @MaxLength(8)
22359
+ UpdatedAt?: Date;
22360
+
22361
+ @Field(() => [mj_core_schema_server_object_types.RecommendationRun_])
22362
+ RecommendationRunsArray: mj_core_schema_server_object_types.RecommendationRun_[]; // Link to RecommendationRuns
22363
+
22364
+ }
22365
+
22366
+ //****************************************************************************
22367
+ // INPUT TYPE for Recommendation Providers
22368
+ //****************************************************************************
22369
+ @InputType()
22370
+ export class CreateRecommendationProviderInput {
22371
+ @Field()
22372
+ Name: string;
22373
+
22374
+ @Field({ nullable: true })
22375
+ Description?: string;
22376
+ }
22377
+
22378
+
22379
+ //****************************************************************************
22380
+ // INPUT TYPE for Recommendation Providers
22381
+ //****************************************************************************
22382
+ @InputType()
22383
+ export class UpdateRecommendationProviderInput {
22384
+ @Field(() => Int)
22385
+ ID: number;
22386
+
22387
+ @Field()
22388
+ Name: string;
22389
+
22390
+ @Field({ nullable: true })
22391
+ Description?: string;
22392
+
22393
+ @Field(() => [KeyValuePairInput], { nullable: true })
22394
+ OldValues___?: KeyValuePairInput[];
22395
+ }
22396
+
22397
+ //****************************************************************************
22398
+ // RESOLVER for Recommendation Providers
22399
+ //****************************************************************************
22400
+ @ObjectType()
22401
+ export class RunRecommendationProviderViewResult {
22402
+ @Field(() => [RecommendationProvider_])
22403
+ Results: RecommendationProvider_[];
22404
+
22405
+ @Field(() => Int, {nullable: true})
22406
+ UserViewRunID?: number;
22407
+
22408
+ @Field(() => Int, {nullable: true})
22409
+ RowCount: number;
22410
+
22411
+ @Field(() => Int, {nullable: true})
22412
+ TotalRowCount: number;
22413
+
22414
+ @Field(() => Int, {nullable: true})
22415
+ ExecutionTime: number;
22416
+
22417
+ @Field({nullable: true})
22418
+ ErrorMessage?: string;
22419
+
22420
+ @Field(() => Boolean, {nullable: false})
22421
+ Success: boolean;
22422
+ }
22423
+
22424
+ @Resolver(RecommendationProvider_)
22425
+ export class RecommendationProviderResolver extends ResolverBase {
22426
+ @Query(() => RunRecommendationProviderViewResult)
22427
+ async RunRecommendationProviderViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22428
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
22429
+ }
22430
+
22431
+ @Query(() => RunRecommendationProviderViewResult)
22432
+ async RunRecommendationProviderViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22433
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
22434
+ }
22435
+
22436
+ @Query(() => RunRecommendationProviderViewResult)
22437
+ async RunRecommendationProviderDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22438
+ input.EntityName = 'Recommendation Providers';
22439
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
22440
+ }
22441
+ @Query(() => RecommendationProvider_, { nullable: true })
22442
+ async RecommendationProvider(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<RecommendationProvider_ | null> {
22443
+ this.CheckUserReadPermissions('Recommendation Providers', userPayload);
22444
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecommendationProviders] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Recommendation Providers', userPayload, EntityPermissionType.Read, 'AND');
22445
+ const result = this.MapFieldNamesToCodeNames('Recommendation Providers', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
22446
+ return result;
22447
+ }
22448
+
22449
+ @FieldResolver(() => [mj_core_schema_server_object_types.RecommendationRun_])
22450
+ async RecommendationRunsArray(@Root() recommendationprovider_: RecommendationProvider_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22451
+ this.CheckUserReadPermissions('Recommendation Runs', userPayload);
22452
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecommendationRuns] WHERE [RecommendationProviderID]=${recommendationprovider_.ID} ` + this.getRowLevelSecurityWhereClause('Recommendation Runs', userPayload, EntityPermissionType.Read, 'AND');
22453
+ const result = this.ArrayMapFieldNamesToCodeNames('Recommendation Runs', await dataSource.query(sSQL));
22454
+ return result;
22455
+ }
22456
+
22457
+ @Mutation(() => RecommendationProvider_)
22458
+ async CreateRecommendationProvider(
22459
+ @Arg('input', () => CreateRecommendationProviderInput) input: CreateRecommendationProviderInput,
22460
+ @Ctx() { dataSource, userPayload }: AppContext,
22461
+ @PubSub() pubSub: PubSubEngine
22462
+ ) {
22463
+ return this.CreateRecord('Recommendation Providers', input, dataSource, userPayload, pubSub)
22464
+ }
22465
+
22466
+ @Mutation(() => RecommendationProvider_)
22467
+ async UpdateRecommendationProvider(
22468
+ @Arg('input', () => UpdateRecommendationProviderInput) input: UpdateRecommendationProviderInput,
22469
+ @Ctx() { dataSource, userPayload }: AppContext,
22470
+ @PubSub() pubSub: PubSubEngine
22471
+ ) {
22472
+ return this.UpdateRecord('Recommendation Providers', input, dataSource, userPayload, pubSub);
22473
+ }
22474
+
22475
+ }
22476
+
22477
+ //****************************************************************************
22478
+ // ENTITY CLASS for Recommendation Runs
22479
+ //****************************************************************************
22480
+ @ObjectType({ description: 'Recommendation runs log each time a provider is requested to provide recommendations' })
22481
+ export class RecommendationRun_ {
22482
+ @Field(() => Int)
22483
+ ID: number;
22484
+
22485
+ @Field(() => Int)
22486
+ RecommendationProviderID: number;
22487
+
22488
+ @Field({description: 'The start date of the recommendation run'})
22489
+ @MaxLength(8)
22490
+ StartDate: Date;
22491
+
22492
+ @Field({nullable: true, description: 'The end date of the recommendation run'})
22493
+ @MaxLength(8)
22494
+ EndDate?: Date;
22495
+
22496
+ @Field({description: 'The status of the recommendation run'})
22497
+ @MaxLength(100)
22498
+ Status: string;
22499
+
22500
+ @Field({nullable: true})
22501
+ Description?: string;
22502
+
22503
+ @Field(() => Int)
22504
+ RunByUserID: number;
22505
+
22506
+ @Field({nullable: true})
22507
+ @MaxLength(8)
22508
+ CreatedAt?: Date;
22509
+
22510
+ @Field({nullable: true})
22511
+ @MaxLength(8)
22512
+ UpdatedAt?: Date;
22513
+
22514
+ @Field()
22515
+ @MaxLength(510)
22516
+ RecommendationProvider: string;
22517
+
22518
+ @Field()
22519
+ @MaxLength(200)
22520
+ RunByUser: string;
22521
+
22522
+ @Field(() => [mj_core_schema_server_object_types.Recommendation_])
22523
+ RecommendationsArray: mj_core_schema_server_object_types.Recommendation_[]; // Link to Recommendations
22524
+
22525
+ }
22526
+
22527
+ //****************************************************************************
22528
+ // INPUT TYPE for Recommendation Runs
22529
+ //****************************************************************************
22530
+ @InputType()
22531
+ export class CreateRecommendationRunInput {
22532
+ @Field(() => Int)
22533
+ RecommendationProviderID: number;
22534
+
22535
+ @Field()
22536
+ StartDate: Date;
22537
+
22538
+ @Field({ nullable: true })
22539
+ EndDate?: Date;
22540
+
22541
+ @Field()
22542
+ Status: string;
22543
+
22544
+ @Field({ nullable: true })
22545
+ Description?: string;
22546
+
22547
+ @Field(() => Int)
22548
+ RunByUserID: number;
22549
+ }
22550
+
22551
+
22552
+ //****************************************************************************
22553
+ // INPUT TYPE for Recommendation Runs
22554
+ //****************************************************************************
22555
+ @InputType()
22556
+ export class UpdateRecommendationRunInput {
22557
+ @Field(() => Int)
22558
+ ID: number;
22559
+
22560
+ @Field(() => Int)
22561
+ RecommendationProviderID: number;
22562
+
22563
+ @Field()
22564
+ StartDate: Date;
22565
+
22566
+ @Field({ nullable: true })
22567
+ EndDate?: Date;
22568
+
22569
+ @Field()
22570
+ Status: string;
22571
+
22572
+ @Field({ nullable: true })
22573
+ Description?: string;
22574
+
22575
+ @Field(() => Int)
22576
+ RunByUserID: number;
22577
+
22578
+ @Field(() => [KeyValuePairInput], { nullable: true })
22579
+ OldValues___?: KeyValuePairInput[];
22580
+ }
22581
+
22582
+ //****************************************************************************
22583
+ // RESOLVER for Recommendation Runs
22584
+ //****************************************************************************
22585
+ @ObjectType()
22586
+ export class RunRecommendationRunViewResult {
22587
+ @Field(() => [RecommendationRun_])
22588
+ Results: RecommendationRun_[];
22589
+
22590
+ @Field(() => Int, {nullable: true})
22591
+ UserViewRunID?: number;
22592
+
22593
+ @Field(() => Int, {nullable: true})
22594
+ RowCount: number;
22595
+
22596
+ @Field(() => Int, {nullable: true})
22597
+ TotalRowCount: number;
22598
+
22599
+ @Field(() => Int, {nullable: true})
22600
+ ExecutionTime: number;
22601
+
22602
+ @Field({nullable: true})
22603
+ ErrorMessage?: string;
22604
+
22605
+ @Field(() => Boolean, {nullable: false})
22606
+ Success: boolean;
22607
+ }
22608
+
22609
+ @Resolver(RecommendationRun_)
22610
+ export class RecommendationRunResolver extends ResolverBase {
22611
+ @Query(() => RunRecommendationRunViewResult)
22612
+ async RunRecommendationRunViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22613
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
22614
+ }
22615
+
22616
+ @Query(() => RunRecommendationRunViewResult)
22617
+ async RunRecommendationRunViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22618
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
22619
+ }
22620
+
22621
+ @Query(() => RunRecommendationRunViewResult)
22622
+ async RunRecommendationRunDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22623
+ input.EntityName = 'Recommendation Runs';
22624
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
22625
+ }
22626
+ @Query(() => RecommendationRun_, { nullable: true })
22627
+ async RecommendationRun(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<RecommendationRun_ | null> {
22628
+ this.CheckUserReadPermissions('Recommendation Runs', userPayload);
22629
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecommendationRuns] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Recommendation Runs', userPayload, EntityPermissionType.Read, 'AND');
22630
+ const result = this.MapFieldNamesToCodeNames('Recommendation Runs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
22631
+ return result;
22632
+ }
22633
+
22634
+ @FieldResolver(() => [mj_core_schema_server_object_types.Recommendation_])
22635
+ async RecommendationsArray(@Root() recommendationrun_: RecommendationRun_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22636
+ this.CheckUserReadPermissions('Recommendations', userPayload);
22637
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecommendations] WHERE [RecommendationRunID]=${recommendationrun_.ID} ` + this.getRowLevelSecurityWhereClause('Recommendations', userPayload, EntityPermissionType.Read, 'AND');
22638
+ const result = this.ArrayMapFieldNamesToCodeNames('Recommendations', await dataSource.query(sSQL));
22639
+ return result;
22640
+ }
22641
+
22642
+ @Mutation(() => RecommendationRun_)
22643
+ async CreateRecommendationRun(
22644
+ @Arg('input', () => CreateRecommendationRunInput) input: CreateRecommendationRunInput,
22645
+ @Ctx() { dataSource, userPayload }: AppContext,
22646
+ @PubSub() pubSub: PubSubEngine
22647
+ ) {
22648
+ return this.CreateRecord('Recommendation Runs', input, dataSource, userPayload, pubSub)
22649
+ }
22650
+
22651
+ @Mutation(() => RecommendationRun_)
22652
+ async UpdateRecommendationRun(
22653
+ @Arg('input', () => UpdateRecommendationRunInput) input: UpdateRecommendationRunInput,
22654
+ @Ctx() { dataSource, userPayload }: AppContext,
22655
+ @PubSub() pubSub: PubSubEngine
22656
+ ) {
22657
+ return this.UpdateRecord('Recommendation Runs', input, dataSource, userPayload, pubSub);
22658
+ }
22659
+
22660
+ }
22661
+
22662
+ //****************************************************************************
22663
+ // ENTITY CLASS for Recommendation Items
22664
+ //****************************************************************************
22665
+ @ObjectType({ description: 'Table to store individual recommendation items that are the right side of the recommendation which we track in the DestinationEntityID/DestinationEntityRecordID' })
22666
+ export class RecommendationItem_ {
22667
+ @Field(() => Int)
22668
+ ID: number;
22669
+
22670
+ @Field(() => Int)
22671
+ RecommendationID: number;
22672
+
22673
+ @Field(() => Int, {description: 'The ID of the destination entity'})
22674
+ DestinationEntityID: number;
22675
+
22676
+ @Field({description: 'The record ID of the destination entity'})
22677
+ DestinationEntityRecordID: string;
22678
+
22679
+ @Field(() => Float, {nullable: true, description: 'A value between 0 and 1 indicating the probability of the match, higher numbers indicating a more certain match/recommendation.'})
22680
+ MatchProbability?: number;
22681
+
22682
+ @Field({nullable: true})
22683
+ @MaxLength(8)
22684
+ CreatedAt?: Date;
22685
+
22686
+ @Field({nullable: true})
22687
+ @MaxLength(8)
22688
+ UpdatedAt?: Date;
22689
+
22690
+ @Field()
22691
+ @MaxLength(510)
22692
+ DestinationEntity: string;
22693
+
22694
+ }
22695
+
22696
+ //****************************************************************************
22697
+ // INPUT TYPE for Recommendation Items
22698
+ //****************************************************************************
22699
+ @InputType()
22700
+ export class CreateRecommendationItemInput {
22701
+ @Field(() => Int)
22702
+ RecommendationID: number;
22703
+
22704
+ @Field(() => Int)
22705
+ DestinationEntityID: number;
22706
+
22707
+ @Field()
22708
+ DestinationEntityRecordID: string;
22709
+
22710
+ @Field(() => Float, { nullable: true })
22711
+ MatchProbability?: number;
22712
+ }
22713
+
22714
+
22715
+ //****************************************************************************
22716
+ // INPUT TYPE for Recommendation Items
22717
+ //****************************************************************************
22718
+ @InputType()
22719
+ export class UpdateRecommendationItemInput {
22720
+ @Field(() => Int)
22721
+ ID: number;
22722
+
22723
+ @Field(() => Int)
22724
+ RecommendationID: number;
22725
+
22726
+ @Field(() => Int)
22727
+ DestinationEntityID: number;
22728
+
22729
+ @Field()
22730
+ DestinationEntityRecordID: string;
22731
+
22732
+ @Field(() => Float, { nullable: true })
22733
+ MatchProbability?: number;
22734
+
22735
+ @Field(() => [KeyValuePairInput], { nullable: true })
22736
+ OldValues___?: KeyValuePairInput[];
22737
+ }
22738
+
22739
+ //****************************************************************************
22740
+ // RESOLVER for Recommendation Items
22741
+ //****************************************************************************
22742
+ @ObjectType()
22743
+ export class RunRecommendationItemViewResult {
22744
+ @Field(() => [RecommendationItem_])
22745
+ Results: RecommendationItem_[];
22746
+
22747
+ @Field(() => Int, {nullable: true})
22748
+ UserViewRunID?: number;
22749
+
22750
+ @Field(() => Int, {nullable: true})
22751
+ RowCount: number;
22752
+
22753
+ @Field(() => Int, {nullable: true})
22754
+ TotalRowCount: number;
22755
+
22756
+ @Field(() => Int, {nullable: true})
22757
+ ExecutionTime: number;
22758
+
22759
+ @Field({nullable: true})
22760
+ ErrorMessage?: string;
22761
+
22762
+ @Field(() => Boolean, {nullable: false})
22763
+ Success: boolean;
22764
+ }
22765
+
22766
+ @Resolver(RecommendationItem_)
22767
+ export class RecommendationItemResolver extends ResolverBase {
22768
+ @Query(() => RunRecommendationItemViewResult)
22769
+ async RunRecommendationItemViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22770
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
22771
+ }
22772
+
22773
+ @Query(() => RunRecommendationItemViewResult)
22774
+ async RunRecommendationItemViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22775
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
22776
+ }
22777
+
22778
+ @Query(() => RunRecommendationItemViewResult)
22779
+ async RunRecommendationItemDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22780
+ input.EntityName = 'Recommendation Items';
22781
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
22782
+ }
22783
+ @Query(() => RecommendationItem_, { nullable: true })
22784
+ async RecommendationItem(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<RecommendationItem_ | null> {
22785
+ this.CheckUserReadPermissions('Recommendation Items', userPayload);
22786
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwRecommendationItems] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Recommendation Items', userPayload, EntityPermissionType.Read, 'AND');
22787
+ const result = this.MapFieldNamesToCodeNames('Recommendation Items', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
22788
+ return result;
22789
+ }
22790
+
22791
+ @Mutation(() => RecommendationItem_)
22792
+ async CreateRecommendationItem(
22793
+ @Arg('input', () => CreateRecommendationItemInput) input: CreateRecommendationItemInput,
22794
+ @Ctx() { dataSource, userPayload }: AppContext,
22795
+ @PubSub() pubSub: PubSubEngine
22796
+ ) {
22797
+ return this.CreateRecord('Recommendation Items', input, dataSource, userPayload, pubSub)
22798
+ }
22799
+
22800
+ @Mutation(() => RecommendationItem_)
22801
+ async UpdateRecommendationItem(
22802
+ @Arg('input', () => UpdateRecommendationItemInput) input: UpdateRecommendationItemInput,
22803
+ @Ctx() { dataSource, userPayload }: AppContext,
22804
+ @PubSub() pubSub: PubSubEngine
22805
+ ) {
22806
+ return this.UpdateRecord('Recommendation Items', input, dataSource, userPayload, pubSub);
22807
+ }
22808
+
22809
+ }
22810
+
22811
+ //****************************************************************************
22812
+ // ENTITY CLASS for Entity Communication Message Types
22813
+ //****************************************************************************
22814
+ @ObjectType({ description: 'Mapping between entities and communication base message types' })
22815
+ export class EntityCommunicationMessageType_ {
22816
+ @Field(() => Int)
22817
+ ID: number;
22818
+
22819
+ @Field(() => Int, {description: 'ID of the entity'})
22820
+ EntityID: number;
22821
+
22822
+ @Field(() => Int, {description: 'ID of the communication base message type'})
22823
+ BaseMessageTypeID: number;
22824
+
22825
+ @Field(() => Boolean, {description: 'Indicates whether the message type is active'})
22826
+ IsActive: boolean;
22827
+
22828
+ @Field()
22829
+ @MaxLength(8)
22830
+ CreatedAt: Date;
22831
+
22832
+ @Field()
22833
+ @MaxLength(8)
22834
+ UpdatedAt: Date;
22835
+
22836
+ @Field()
22837
+ @MaxLength(510)
22838
+ Entity: string;
22839
+
22840
+ @Field()
22841
+ @MaxLength(200)
22842
+ BaseMessageType: string;
22843
+
22844
+ @Field(() => [mj_core_schema_server_object_types.EntityCommunicationField_])
22845
+ EntityCommunicationFieldsArray: mj_core_schema_server_object_types.EntityCommunicationField_[]; // Link to EntityCommunicationFields
22846
+
22847
+ }
22848
+
22849
+ //****************************************************************************
22850
+ // INPUT TYPE for Entity Communication Message Types
22851
+ //****************************************************************************
22852
+ @InputType()
22853
+ export class CreateEntityCommunicationMessageTypeInput {
22854
+ @Field(() => Int)
22855
+ EntityID: number;
22856
+
22857
+ @Field(() => Int)
22858
+ BaseMessageTypeID: number;
22859
+
22860
+ @Field(() => Boolean)
22861
+ IsActive: boolean;
22862
+ }
22863
+
22864
+
22865
+ //****************************************************************************
22866
+ // INPUT TYPE for Entity Communication Message Types
22867
+ //****************************************************************************
22868
+ @InputType()
22869
+ export class UpdateEntityCommunicationMessageTypeInput {
22870
+ @Field(() => Int)
22871
+ ID: number;
22872
+
22873
+ @Field(() => Int)
22874
+ EntityID: number;
22875
+
22876
+ @Field(() => Int)
22877
+ BaseMessageTypeID: number;
22878
+
22879
+ @Field(() => Boolean)
22880
+ IsActive: boolean;
22881
+
22882
+ @Field(() => [KeyValuePairInput], { nullable: true })
22883
+ OldValues___?: KeyValuePairInput[];
22884
+ }
22885
+
22886
+ //****************************************************************************
22887
+ // RESOLVER for Entity Communication Message Types
22888
+ //****************************************************************************
22889
+ @ObjectType()
22890
+ export class RunEntityCommunicationMessageTypeViewResult {
22891
+ @Field(() => [EntityCommunicationMessageType_])
22892
+ Results: EntityCommunicationMessageType_[];
22893
+
22894
+ @Field(() => Int, {nullable: true})
22895
+ UserViewRunID?: number;
22896
+
22897
+ @Field(() => Int, {nullable: true})
22898
+ RowCount: number;
22899
+
22900
+ @Field(() => Int, {nullable: true})
22901
+ TotalRowCount: number;
22902
+
22903
+ @Field(() => Int, {nullable: true})
22904
+ ExecutionTime: number;
22905
+
22906
+ @Field({nullable: true})
22907
+ ErrorMessage?: string;
22908
+
22909
+ @Field(() => Boolean, {nullable: false})
22910
+ Success: boolean;
22911
+ }
22912
+
22913
+ @Resolver(EntityCommunicationMessageType_)
22914
+ export class EntityCommunicationMessageTypeResolver extends ResolverBase {
22915
+ @Query(() => RunEntityCommunicationMessageTypeViewResult)
22916
+ async RunEntityCommunicationMessageTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22917
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
22918
+ }
22919
+
22920
+ @Query(() => RunEntityCommunicationMessageTypeViewResult)
22921
+ async RunEntityCommunicationMessageTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22922
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
22923
+ }
22924
+
22925
+ @Query(() => RunEntityCommunicationMessageTypeViewResult)
22926
+ async RunEntityCommunicationMessageTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22927
+ input.EntityName = 'Entity Communication Message Types';
22928
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
22929
+ }
22930
+ @Query(() => EntityCommunicationMessageType_, { nullable: true })
22931
+ async EntityCommunicationMessageType(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityCommunicationMessageType_ | null> {
22932
+ this.CheckUserReadPermissions('Entity Communication Message Types', userPayload);
22933
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwEntityCommunicationMessageTypes] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Communication Message Types', userPayload, EntityPermissionType.Read, 'AND');
22934
+ const result = this.MapFieldNamesToCodeNames('Entity Communication Message Types', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
22935
+ return result;
22936
+ }
22937
+
22938
+ @FieldResolver(() => [mj_core_schema_server_object_types.EntityCommunicationField_])
22939
+ async EntityCommunicationFieldsArray(@Root() entitycommunicationmessagetype_: EntityCommunicationMessageType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
22940
+ this.CheckUserReadPermissions('Entity Communication Fields', userPayload);
22941
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwEntityCommunicationFields] WHERE [EntityCommunicationMessageTypeID]=${entitycommunicationmessagetype_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Communication Fields', userPayload, EntityPermissionType.Read, 'AND');
22942
+ const result = this.ArrayMapFieldNamesToCodeNames('Entity Communication Fields', await dataSource.query(sSQL));
22943
+ return result;
22944
+ }
22945
+
22946
+ @Mutation(() => EntityCommunicationMessageType_)
22947
+ async CreateEntityCommunicationMessageType(
22948
+ @Arg('input', () => CreateEntityCommunicationMessageTypeInput) input: CreateEntityCommunicationMessageTypeInput,
22949
+ @Ctx() { dataSource, userPayload }: AppContext,
22950
+ @PubSub() pubSub: PubSubEngine
22951
+ ) {
22952
+ return this.CreateRecord('Entity Communication Message Types', input, dataSource, userPayload, pubSub)
22953
+ }
22954
+
22955
+ @Mutation(() => EntityCommunicationMessageType_)
22956
+ async UpdateEntityCommunicationMessageType(
22957
+ @Arg('input', () => UpdateEntityCommunicationMessageTypeInput) input: UpdateEntityCommunicationMessageTypeInput,
22958
+ @Ctx() { dataSource, userPayload }: AppContext,
22959
+ @PubSub() pubSub: PubSubEngine
22960
+ ) {
22961
+ return this.UpdateRecord('Entity Communication Message Types', input, dataSource, userPayload, pubSub);
22962
+ }
22963
+
22964
+ }
22965
+
22966
+ //****************************************************************************
22967
+ // ENTITY CLASS for Entity Communication Fields
22968
+ //****************************************************************************
22969
+ @ObjectType({ description: 'Mapping between entity fields and communication base message types with priority' })
22970
+ export class EntityCommunicationField_ {
22971
+ @Field(() => Int)
22972
+ ID: number;
22973
+
22974
+ @Field(() => Int, {description: 'ID of the entity communication message type'})
22975
+ EntityCommunicationMessageTypeID: number;
22976
+
22977
+ @Field({description: 'Name of the field in the entity that maps to the communication base message type'})
22978
+ @MaxLength(1000)
22979
+ FieldName: string;
22980
+
22981
+ @Field(() => Int, {description: 'Priority of the field for the communication base message type'})
22982
+ Priority: number;
22983
+
22984
+ @Field()
22985
+ @MaxLength(8)
22986
+ CreatedAt: Date;
22987
+
22988
+ @Field()
22989
+ @MaxLength(8)
22990
+ UpdatedAt: Date;
22991
+
22992
+ }
22993
+
22994
+ //****************************************************************************
22995
+ // INPUT TYPE for Entity Communication Fields
22996
+ //****************************************************************************
22997
+ @InputType()
22998
+ export class CreateEntityCommunicationFieldInput {
22999
+ @Field(() => Int)
23000
+ EntityCommunicationMessageTypeID: number;
23001
+
23002
+ @Field()
23003
+ FieldName: string;
23004
+
23005
+ @Field(() => Int)
23006
+ Priority: number;
23007
+ }
23008
+
23009
+
23010
+ //****************************************************************************
23011
+ // INPUT TYPE for Entity Communication Fields
23012
+ //****************************************************************************
23013
+ @InputType()
23014
+ export class UpdateEntityCommunicationFieldInput {
23015
+ @Field(() => Int)
23016
+ ID: number;
23017
+
23018
+ @Field(() => Int)
23019
+ EntityCommunicationMessageTypeID: number;
23020
+
23021
+ @Field()
23022
+ FieldName: string;
23023
+
23024
+ @Field(() => Int)
23025
+ Priority: number;
23026
+
23027
+ @Field(() => [KeyValuePairInput], { nullable: true })
23028
+ OldValues___?: KeyValuePairInput[];
23029
+ }
23030
+
23031
+ //****************************************************************************
23032
+ // RESOLVER for Entity Communication Fields
23033
+ //****************************************************************************
23034
+ @ObjectType()
23035
+ export class RunEntityCommunicationFieldViewResult {
23036
+ @Field(() => [EntityCommunicationField_])
23037
+ Results: EntityCommunicationField_[];
23038
+
23039
+ @Field(() => Int, {nullable: true})
23040
+ UserViewRunID?: number;
23041
+
23042
+ @Field(() => Int, {nullable: true})
23043
+ RowCount: number;
23044
+
23045
+ @Field(() => Int, {nullable: true})
23046
+ TotalRowCount: number;
23047
+
23048
+ @Field(() => Int, {nullable: true})
23049
+ ExecutionTime: number;
23050
+
23051
+ @Field({nullable: true})
23052
+ ErrorMessage?: string;
23053
+
23054
+ @Field(() => Boolean, {nullable: false})
23055
+ Success: boolean;
23056
+ }
23057
+
23058
+ @Resolver(EntityCommunicationField_)
23059
+ export class EntityCommunicationFieldResolver extends ResolverBase {
23060
+ @Query(() => RunEntityCommunicationFieldViewResult)
23061
+ async RunEntityCommunicationFieldViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
23062
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
23063
+ }
23064
+
23065
+ @Query(() => RunEntityCommunicationFieldViewResult)
23066
+ async RunEntityCommunicationFieldViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
23067
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
23068
+ }
23069
+
23070
+ @Query(() => RunEntityCommunicationFieldViewResult)
23071
+ async RunEntityCommunicationFieldDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
23072
+ input.EntityName = 'Entity Communication Fields';
23073
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
23074
+ }
23075
+ @Query(() => EntityCommunicationField_, { nullable: true })
23076
+ async EntityCommunicationField(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityCommunicationField_ | null> {
23077
+ this.CheckUserReadPermissions('Entity Communication Fields', userPayload);
23078
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwEntityCommunicationFields] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Communication Fields', userPayload, EntityPermissionType.Read, 'AND');
23079
+ const result = this.MapFieldNamesToCodeNames('Entity Communication Fields', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
23080
+ return result;
23081
+ }
23082
+
23083
+ @Mutation(() => EntityCommunicationField_)
23084
+ async CreateEntityCommunicationField(
23085
+ @Arg('input', () => CreateEntityCommunicationFieldInput) input: CreateEntityCommunicationFieldInput,
23086
+ @Ctx() { dataSource, userPayload }: AppContext,
23087
+ @PubSub() pubSub: PubSubEngine
23088
+ ) {
23089
+ return this.CreateRecord('Entity Communication Fields', input, dataSource, userPayload, pubSub)
23090
+ }
23091
+
23092
+ @Mutation(() => EntityCommunicationField_)
23093
+ async UpdateEntityCommunicationField(
23094
+ @Arg('input', () => UpdateEntityCommunicationFieldInput) input: UpdateEntityCommunicationFieldInput,
23095
+ @Ctx() { dataSource, userPayload }: AppContext,
23096
+ @PubSub() pubSub: PubSubEngine
23097
+ ) {
23098
+ return this.UpdateRecord('Entity Communication Fields', input, dataSource, userPayload, pubSub);
23099
+ }
23100
+
21160
23101
  }