@memberjunction/server 1.2.0 → 1.2.1

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.
@@ -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: 4/25/2024, 7:44:21 AM
5
+ * GENERATED: 4/30/2024, 12:16:26 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 } 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 } from '@memberjunction/core-entities';
24
24
 
25
25
 
26
26
  //****************************************************************************
@@ -2976,6 +2976,12 @@ export class Entity_ {
2976
2976
  @Field(() => [mj_core_schema_server_object_types.UserViewCategory_])
2977
2977
  UserViewCategoriesArray: mj_core_schema_server_object_types.UserViewCategory_[]; // Link to UserViewCategories
2978
2978
 
2979
+ @Field(() => [mj_core_schema_server_object_types.EntitySetting_])
2980
+ EntitySettingsArray: mj_core_schema_server_object_types.EntitySetting_[]; // Link to EntitySettings
2981
+
2982
+ @Field(() => [mj_core_schema_server_object_types.DuplicateRun_])
2983
+ DuplicateRunsArray: mj_core_schema_server_object_types.DuplicateRun_[]; // Link to DuplicateRuns
2984
+
2979
2985
  }
2980
2986
 
2981
2987
  //****************************************************************************
@@ -3496,6 +3502,22 @@ export class EntityResolverBase extends ResolverBase {
3496
3502
  const result = this.ArrayMapFieldNamesToCodeNames('User View Categories', await dataSource.query(sSQL));
3497
3503
  return result;
3498
3504
  }
3505
+
3506
+ @FieldResolver(() => [mj_core_schema_server_object_types.EntitySetting_])
3507
+ async EntitySettingsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3508
+ this.CheckUserReadPermissions('Entity Settings', userPayload);
3509
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwEntitySettings] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Settings', userPayload, EntityPermissionType.Read, 'AND');
3510
+ const result = this.ArrayMapFieldNamesToCodeNames('Entity Settings', await dataSource.query(sSQL));
3511
+ return result;
3512
+ }
3513
+
3514
+ @FieldResolver(() => [mj_core_schema_server_object_types.DuplicateRun_])
3515
+ async DuplicateRunsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3516
+ this.CheckUserReadPermissions('Duplicate Runs', userPayload);
3517
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDuplicateRuns] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Duplicate Runs', userPayload, EntityPermissionType.Read, 'AND');
3518
+ const result = this.ArrayMapFieldNamesToCodeNames('Duplicate Runs', await dataSource.query(sSQL));
3519
+ return result;
3520
+ }
3499
3521
 
3500
3522
  @Mutation(() => Entity_)
3501
3523
  async CreateEntity(
@@ -3732,6 +3754,9 @@ export class User_ {
3732
3754
  @Field(() => [mj_core_schema_server_object_types.QueryCategory_])
3733
3755
  QueryCategoriesArray: mj_core_schema_server_object_types.QueryCategory_[]; // Link to QueryCategories
3734
3756
 
3757
+ @Field(() => [mj_core_schema_server_object_types.DuplicateRun_])
3758
+ DuplicateRunsArray: mj_core_schema_server_object_types.DuplicateRun_[]; // Link to DuplicateRuns
3759
+
3735
3760
  }
3736
3761
 
3737
3762
  //****************************************************************************
@@ -4051,6 +4076,14 @@ export class UserResolverBase extends ResolverBase {
4051
4076
  const result = this.ArrayMapFieldNamesToCodeNames('Query Categories', await dataSource.query(sSQL));
4052
4077
  return result;
4053
4078
  }
4079
+
4080
+ @FieldResolver(() => [mj_core_schema_server_object_types.DuplicateRun_])
4081
+ async DuplicateRunsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
4082
+ this.CheckUserReadPermissions('Duplicate Runs', userPayload);
4083
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDuplicateRuns] WHERE [StartedByUserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Duplicate Runs', userPayload, EntityPermissionType.Read, 'AND');
4084
+ const result = this.ArrayMapFieldNamesToCodeNames('Duplicate Runs', await dataSource.query(sSQL));
4085
+ return result;
4086
+ }
4054
4087
 
4055
4088
  @Mutation(() => User_)
4056
4089
  async CreateUser(
@@ -6892,6 +6925,9 @@ export class List_ {
6892
6925
  @Field(() => [mj_core_schema_server_object_types.ListDetail_])
6893
6926
  ListDetailsArray: mj_core_schema_server_object_types.ListDetail_[]; // Link to ListDetails
6894
6927
 
6928
+ @Field(() => [mj_core_schema_server_object_types.DuplicateRun_])
6929
+ DuplicateRunsArray: mj_core_schema_server_object_types.DuplicateRun_[]; // Link to DuplicateRuns
6930
+
6895
6931
  }
6896
6932
 
6897
6933
  //****************************************************************************
@@ -7005,6 +7041,14 @@ export class ListResolver extends ResolverBase {
7005
7041
  const result = this.ArrayMapFieldNamesToCodeNames('List Details', await dataSource.query(sSQL));
7006
7042
  return result;
7007
7043
  }
7044
+
7045
+ @FieldResolver(() => [mj_core_schema_server_object_types.DuplicateRun_])
7046
+ async DuplicateRunsArray(@Root() list_: List_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
7047
+ this.CheckUserReadPermissions('Duplicate Runs', userPayload);
7048
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDuplicateRuns] WHERE [SourceListID]=${list_.ID} ` + this.getRowLevelSecurityWhereClause('Duplicate Runs', userPayload, EntityPermissionType.Read, 'AND');
7049
+ const result = this.ArrayMapFieldNamesToCodeNames('Duplicate Runs', await dataSource.query(sSQL));
7050
+ return result;
7051
+ }
7008
7052
 
7009
7053
  @Mutation(() => List_)
7010
7054
  async CreateList(
@@ -9330,6 +9374,9 @@ export class AIModel_ {
9330
9374
  @Field(() => [mj_core_schema_server_object_types.VectorIndex_])
9331
9375
  VectorIndexesArray: mj_core_schema_server_object_types.VectorIndex_[]; // Link to VectorIndexes
9332
9376
 
9377
+ @Field(() => [mj_core_schema_server_object_types.EntityDocument_])
9378
+ EntityDocumentsArray: mj_core_schema_server_object_types.EntityDocument_[]; // Link to EntityDocuments
9379
+
9333
9380
  }
9334
9381
 
9335
9382
  //****************************************************************************
@@ -9459,6 +9506,14 @@ export class AIModelResolver extends ResolverBase {
9459
9506
  const result = this.ArrayMapFieldNamesToCodeNames('Vector Indexes', await dataSource.query(sSQL));
9460
9507
  return result;
9461
9508
  }
9509
+
9510
+ @FieldResolver(() => [mj_core_schema_server_object_types.EntityDocument_])
9511
+ async EntityDocumentsArray(@Root() aimodel_: AIModel_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
9512
+ this.CheckUserReadPermissions('Entity Documents', userPayload);
9513
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwEntityDocuments] WHERE [AIModelID]=${aimodel_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Documents', userPayload, EntityPermissionType.Read, 'AND');
9514
+ const result = this.ArrayMapFieldNamesToCodeNames('Entity Documents', await dataSource.query(sSQL));
9515
+ return result;
9516
+ }
9462
9517
 
9463
9518
  @Mutation(() => AIModel_)
9464
9519
  async UpdateAIModel(
@@ -14003,6 +14058,9 @@ export class RecordMergeLog_ {
14003
14058
  @Field(() => [mj_core_schema_server_object_types.RecordMergeDeletionLog_])
14004
14059
  RecordMergeDeletionLogsArray: mj_core_schema_server_object_types.RecordMergeDeletionLog_[]; // Link to RecordMergeDeletionLogs
14005
14060
 
14061
+ @Field(() => [mj_core_schema_server_object_types.DuplicateRunDetailMatch_])
14062
+ DuplicateRunDetailMatchesArray: mj_core_schema_server_object_types.DuplicateRunDetailMatch_[]; // Link to DuplicateRunDetailMatches
14063
+
14006
14064
  }
14007
14065
 
14008
14066
  //****************************************************************************
@@ -14140,6 +14198,14 @@ export class RecordMergeLogResolver extends ResolverBase {
14140
14198
  const result = this.ArrayMapFieldNamesToCodeNames('Record Merge Deletion Logs', await dataSource.query(sSQL));
14141
14199
  return result;
14142
14200
  }
14201
+
14202
+ @FieldResolver(() => [mj_core_schema_server_object_types.DuplicateRunDetailMatch_])
14203
+ async DuplicateRunDetailMatchesArray(@Root() recordmergelog_: RecordMergeLog_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
14204
+ this.CheckUserReadPermissions('Duplicate Run Detail Matches', userPayload);
14205
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDuplicateRunDetailMatches] WHERE [RecordMergeLogID]=${recordmergelog_.ID} ` + this.getRowLevelSecurityWhereClause('Duplicate Run Detail Matches', userPayload, EntityPermissionType.Read, 'AND');
14206
+ const result = this.ArrayMapFieldNamesToCodeNames('Duplicate Run Detail Matches', await dataSource.query(sSQL));
14207
+ return result;
14208
+ }
14143
14209
 
14144
14210
  @Mutation(() => RecordMergeLog_)
14145
14211
  async CreateRecordMergeLog(
@@ -16354,6 +16420,18 @@ export class EntityDocument_ {
16354
16420
  @Field({nullable: true})
16355
16421
  Template?: string;
16356
16422
 
16423
+ @Field(() => Int)
16424
+ VectorDatabaseID: number;
16425
+
16426
+ @Field(() => Int)
16427
+ AIModelID: number;
16428
+
16429
+ @Field(() => Float, {description: 'Value between 0 and 1 that determines what is considered a potential matching record. Value must be <= AbsoluteMatchThreshold. This is primarily used for duplicate detection but can be used for other applications as well where matching is relevant.'})
16430
+ PotentialMatchThreshold: number;
16431
+
16432
+ @Field(() => Float, {description: 'Value between 0 and 1 that determines what is considered an absolute matching record. Value must be >= PotentialMatchThreshold. This is primarily used for duplicate detection but can be used for other applications as well where matching is relevant.'})
16433
+ AbsoluteMatchThreshold: number;
16434
+
16357
16435
  @Field()
16358
16436
  @MaxLength(8)
16359
16437
  CreatedAt: Date;
@@ -16362,12 +16440,6 @@ export class EntityDocument_ {
16362
16440
  @MaxLength(8)
16363
16441
  UpdatedAt: Date;
16364
16442
 
16365
- @Field(() => Int)
16366
- VectorDatabaseID: number;
16367
-
16368
- @Field(() => Int)
16369
- AIModelID: number;
16370
-
16371
16443
  @Field()
16372
16444
  @MaxLength(510)
16373
16445
  Entity: string;
@@ -16379,6 +16451,9 @@ export class EntityDocument_ {
16379
16451
  @Field(() => [mj_core_schema_server_object_types.EntityDocumentRun_])
16380
16452
  EntityDocumentRunsArray: mj_core_schema_server_object_types.EntityDocumentRun_[]; // Link to EntityDocumentRuns
16381
16453
 
16454
+ @Field(() => [mj_core_schema_server_object_types.EntityDocumentSetting_])
16455
+ EntityDocumentSettingsArray: mj_core_schema_server_object_types.EntityDocumentSetting_[]; // Link to EntityDocumentSettings
16456
+
16382
16457
  }
16383
16458
 
16384
16459
  //****************************************************************************
@@ -16406,6 +16481,12 @@ export class CreateEntityDocumentInput {
16406
16481
 
16407
16482
  @Field(() => Int)
16408
16483
  AIModelID: number;
16484
+
16485
+ @Field(() => Float)
16486
+ PotentialMatchThreshold: number;
16487
+
16488
+ @Field(() => Float)
16489
+ AbsoluteMatchThreshold: number;
16409
16490
  }
16410
16491
 
16411
16492
 
@@ -16437,6 +16518,12 @@ export class UpdateEntityDocumentInput {
16437
16518
 
16438
16519
  @Field(() => Int)
16439
16520
  AIModelID: number;
16521
+
16522
+ @Field(() => Float)
16523
+ PotentialMatchThreshold: number;
16524
+
16525
+ @Field(() => Float)
16526
+ AbsoluteMatchThreshold: number;
16440
16527
  }
16441
16528
 
16442
16529
  //****************************************************************************
@@ -16498,6 +16585,14 @@ export class EntityDocumentResolver extends ResolverBase {
16498
16585
  const result = this.ArrayMapFieldNamesToCodeNames('Entity Document Runs', await dataSource.query(sSQL));
16499
16586
  return result;
16500
16587
  }
16588
+
16589
+ @FieldResolver(() => [mj_core_schema_server_object_types.EntityDocumentSetting_])
16590
+ async EntityDocumentSettingsArray(@Root() entitydocument_: EntityDocument_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16591
+ this.CheckUserReadPermissions('Entity Document Settings', userPayload);
16592
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwEntityDocumentSettings] WHERE [EntityDocumentID]=${entitydocument_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Document Settings', userPayload, EntityPermissionType.Read, 'AND');
16593
+ const result = this.ArrayMapFieldNamesToCodeNames('Entity Document Settings', await dataSource.query(sSQL));
16594
+ return result;
16595
+ }
16501
16596
 
16502
16597
  @Mutation(() => EntityDocument_)
16503
16598
  async CreateEntityDocument(
@@ -18877,4 +18972,1116 @@ export class VersionInstallationResolver extends ResolverBase {
18877
18972
  const i = input, d = dataSource; // prevent error
18878
18973
  }
18879
18974
 
18975
+ }
18976
+
18977
+ //****************************************************************************
18978
+ // ENTITY CLASS for Duplicate Run Detail Matches
18979
+ //****************************************************************************
18980
+ @ObjectType()
18981
+ export class DuplicateRunDetailMatch_ {
18982
+ @Field(() => Int)
18983
+ ID: number;
18984
+
18985
+ @Field(() => Int)
18986
+ DuplicateRunDetailID: number;
18987
+
18988
+ @Field()
18989
+ @MaxLength(1000)
18990
+ MatchRecordID: string;
18991
+
18992
+ @Field(() => Float, {description: 'Value between 0 and 1 designating the computed probability of a match'})
18993
+ MatchProbability: number;
18994
+
18995
+ @Field()
18996
+ @MaxLength(8)
18997
+ MatchedAt: Date;
18998
+
18999
+ @Field()
19000
+ @MaxLength(40)
19001
+ Action: string;
19002
+
19003
+ @Field()
19004
+ @MaxLength(40)
19005
+ ApprovalStatus: string;
19006
+
19007
+ @Field()
19008
+ @MaxLength(40)
19009
+ MergeStatus: string;
19010
+
19011
+ @Field()
19012
+ @MaxLength(8)
19013
+ MergedAt: Date;
19014
+
19015
+ @Field(() => Int, {nullable: true})
19016
+ RecordMergeLogID?: number;
19017
+
19018
+ @Field()
19019
+ @MaxLength(8)
19020
+ CreatedAt: Date;
19021
+
19022
+ @Field()
19023
+ @MaxLength(8)
19024
+ UpdatedAt: Date;
19025
+
19026
+ }
19027
+
19028
+ //****************************************************************************
19029
+ // INPUT TYPE for Duplicate Run Detail Matches
19030
+ //****************************************************************************
19031
+ @InputType()
19032
+ export class CreateDuplicateRunDetailMatchInput {
19033
+ @Field(() => Int)
19034
+ DuplicateRunDetailID: number;
19035
+
19036
+ @Field()
19037
+ MatchRecordID: string;
19038
+
19039
+ @Field(() => Float)
19040
+ MatchProbability: number;
19041
+
19042
+ @Field()
19043
+ MatchedAt: Date;
19044
+
19045
+ @Field()
19046
+ Action: string;
19047
+
19048
+ @Field()
19049
+ ApprovalStatus: string;
19050
+
19051
+ @Field()
19052
+ MergeStatus: string;
19053
+
19054
+ @Field()
19055
+ MergedAt: Date;
19056
+
19057
+ @Field(() => Int, { nullable: true })
19058
+ RecordMergeLogID: number;
19059
+ }
19060
+
19061
+
19062
+ //****************************************************************************
19063
+ // INPUT TYPE for Duplicate Run Detail Matches
19064
+ //****************************************************************************
19065
+ @InputType()
19066
+ export class UpdateDuplicateRunDetailMatchInput {
19067
+ @Field(() => Int)
19068
+ ID: number;
19069
+
19070
+ @Field(() => Int)
19071
+ DuplicateRunDetailID: number;
19072
+
19073
+ @Field()
19074
+ MatchRecordID: string;
19075
+
19076
+ @Field(() => Float)
19077
+ MatchProbability: number;
19078
+
19079
+ @Field()
19080
+ MatchedAt: Date;
19081
+
19082
+ @Field()
19083
+ Action: string;
19084
+
19085
+ @Field()
19086
+ ApprovalStatus: string;
19087
+
19088
+ @Field()
19089
+ MergeStatus: string;
19090
+
19091
+ @Field()
19092
+ MergedAt: Date;
19093
+
19094
+ @Field(() => Int, { nullable: true })
19095
+ RecordMergeLogID: number;
19096
+ }
19097
+
19098
+ //****************************************************************************
19099
+ // RESOLVER for Duplicate Run Detail Matches
19100
+ //****************************************************************************
19101
+ @ObjectType()
19102
+ export class RunDuplicateRunDetailMatchViewResult {
19103
+ @Field(() => [DuplicateRunDetailMatch_])
19104
+ Results: DuplicateRunDetailMatch_[];
19105
+
19106
+ @Field(() => Int, {nullable: true})
19107
+ UserViewRunID?: number;
19108
+
19109
+ @Field(() => Int, {nullable: true})
19110
+ RowCount: number;
19111
+
19112
+ @Field(() => Int, {nullable: true})
19113
+ TotalRowCount: number;
19114
+
19115
+ @Field(() => Int, {nullable: true})
19116
+ ExecutionTime: number;
19117
+
19118
+ @Field({nullable: true})
19119
+ ErrorMessage?: string;
19120
+
19121
+ @Field(() => Boolean, {nullable: false})
19122
+ Success: boolean;
19123
+ }
19124
+
19125
+ @Resolver(DuplicateRunDetailMatch_)
19126
+ export class DuplicateRunDetailMatchResolver extends ResolverBase {
19127
+ @Query(() => RunDuplicateRunDetailMatchViewResult)
19128
+ async RunDuplicateRunDetailMatchViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19129
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
19130
+ }
19131
+
19132
+ @Query(() => RunDuplicateRunDetailMatchViewResult)
19133
+ async RunDuplicateRunDetailMatchViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19134
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
19135
+ }
19136
+
19137
+ @Query(() => RunDuplicateRunDetailMatchViewResult)
19138
+ async RunDuplicateRunDetailMatchDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19139
+ input.EntityName = 'Duplicate Run Detail Matches';
19140
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
19141
+ }
19142
+ @Query(() => DuplicateRunDetailMatch_, { nullable: true })
19143
+ async DuplicateRunDetailMatch(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<DuplicateRunDetailMatch_ | null> {
19144
+ this.CheckUserReadPermissions('Duplicate Run Detail Matches', userPayload);
19145
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDuplicateRunDetailMatches] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Duplicate Run Detail Matches', userPayload, EntityPermissionType.Read, 'AND');
19146
+ const result = this.MapFieldNamesToCodeNames('Duplicate Run Detail Matches', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
19147
+ return result;
19148
+ }
19149
+
19150
+ @Mutation(() => DuplicateRunDetailMatch_)
19151
+ async CreateDuplicateRunDetailMatch(
19152
+ @Arg('input', () => CreateDuplicateRunDetailMatchInput) input: CreateDuplicateRunDetailMatchInput,
19153
+ @Ctx() { dataSource, userPayload }: AppContext,
19154
+ @PubSub() pubSub: PubSubEngine
19155
+ ) {
19156
+ if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
19157
+ const entityObject = <DuplicateRunDetailMatchEntity>await new Metadata().GetEntityObject('Duplicate Run Detail Matches', this.GetUserFromPayload(userPayload));
19158
+ await entityObject.NewRecord();
19159
+ entityObject.SetMany(input);
19160
+ if (await entityObject.Save()) {
19161
+ // save worked, fire the AfterCreate event and then return all the data
19162
+ await this.AfterCreate(dataSource, input); // fire event
19163
+ return entityObject.GetAll();
19164
+ }
19165
+ else
19166
+ // save failed, return null
19167
+ return null;
19168
+ }
19169
+ else
19170
+ return null;
19171
+ }
19172
+
19173
+ // Before/After CREATE Event Hooks for Sub-Classes to Override
19174
+ protected async BeforeCreate(dataSource: DataSource, input: CreateDuplicateRunDetailMatchInput): Promise<boolean> {
19175
+ return true;
19176
+ }
19177
+ protected async AfterCreate(dataSource: DataSource, input: CreateDuplicateRunDetailMatchInput) {
19178
+ }
19179
+
19180
+ @Mutation(() => DuplicateRunDetailMatch_)
19181
+ async UpdateDuplicateRunDetailMatch(
19182
+ @Arg('input', () => UpdateDuplicateRunDetailMatchInput) input: UpdateDuplicateRunDetailMatchInput,
19183
+ @Ctx() { dataSource, userPayload }: AppContext,
19184
+ @PubSub() pubSub: PubSubEngine
19185
+ ) {
19186
+ if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
19187
+ const entityObject = <DuplicateRunDetailMatchEntity>await new Metadata().GetEntityObject('Duplicate Run Detail Matches', this.GetUserFromPayload(userPayload));
19188
+ entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Duplicate Run Detail Matches
19189
+
19190
+ if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
19191
+ // save worked, fire afterevent and return all the data
19192
+ await this.AfterUpdate(dataSource, input); // fire event
19193
+ return entityObject.GetAll();
19194
+ }
19195
+ else
19196
+ return null; // save failed, return null
19197
+ }
19198
+ else
19199
+ return null;
19200
+ }
19201
+
19202
+ // Before/After UPDATE Event Hooks for Sub-Classes to Override
19203
+ protected async BeforeUpdate(dataSource: DataSource, input: UpdateDuplicateRunDetailMatchInput): Promise<boolean> {
19204
+ const i = input, d = dataSource; // prevent error
19205
+ return true;
19206
+ }
19207
+ protected async AfterUpdate(dataSource: DataSource, input: UpdateDuplicateRunDetailMatchInput) {
19208
+ const i = input, d = dataSource; // prevent error
19209
+ }
19210
+
19211
+ }
19212
+
19213
+ //****************************************************************************
19214
+ // ENTITY CLASS for Entity Document Settings
19215
+ //****************************************************************************
19216
+ @ObjectType()
19217
+ export class EntityDocumentSetting_ {
19218
+ @Field(() => Int)
19219
+ ID: number;
19220
+
19221
+ @Field(() => Int)
19222
+ EntityDocumentID: number;
19223
+
19224
+ @Field()
19225
+ @MaxLength(200)
19226
+ Name: string;
19227
+
19228
+ @Field()
19229
+ Value: string;
19230
+
19231
+ @Field({nullable: true})
19232
+ Comments?: string;
19233
+
19234
+ @Field()
19235
+ @MaxLength(8)
19236
+ CreatedAt: Date;
19237
+
19238
+ @Field()
19239
+ @MaxLength(8)
19240
+ UpdatedAt: Date;
19241
+
19242
+ @Field()
19243
+ @MaxLength(500)
19244
+ EntityDocument: string;
19245
+
19246
+ }
19247
+
19248
+ //****************************************************************************
19249
+ // INPUT TYPE for Entity Document Settings
19250
+ //****************************************************************************
19251
+ @InputType()
19252
+ export class CreateEntityDocumentSettingInput {
19253
+ @Field(() => Int)
19254
+ EntityDocumentID: number;
19255
+
19256
+ @Field()
19257
+ Name: string;
19258
+
19259
+ @Field()
19260
+ Value: string;
19261
+
19262
+ @Field({ nullable: true })
19263
+ Comments: string;
19264
+ }
19265
+
19266
+
19267
+ //****************************************************************************
19268
+ // INPUT TYPE for Entity Document Settings
19269
+ //****************************************************************************
19270
+ @InputType()
19271
+ export class UpdateEntityDocumentSettingInput {
19272
+ @Field(() => Int)
19273
+ ID: number;
19274
+
19275
+ @Field(() => Int)
19276
+ EntityDocumentID: number;
19277
+
19278
+ @Field()
19279
+ Name: string;
19280
+
19281
+ @Field()
19282
+ Value: string;
19283
+
19284
+ @Field({ nullable: true })
19285
+ Comments: string;
19286
+ }
19287
+
19288
+ //****************************************************************************
19289
+ // RESOLVER for Entity Document Settings
19290
+ //****************************************************************************
19291
+ @ObjectType()
19292
+ export class RunEntityDocumentSettingViewResult {
19293
+ @Field(() => [EntityDocumentSetting_])
19294
+ Results: EntityDocumentSetting_[];
19295
+
19296
+ @Field(() => Int, {nullable: true})
19297
+ UserViewRunID?: number;
19298
+
19299
+ @Field(() => Int, {nullable: true})
19300
+ RowCount: number;
19301
+
19302
+ @Field(() => Int, {nullable: true})
19303
+ TotalRowCount: number;
19304
+
19305
+ @Field(() => Int, {nullable: true})
19306
+ ExecutionTime: number;
19307
+
19308
+ @Field({nullable: true})
19309
+ ErrorMessage?: string;
19310
+
19311
+ @Field(() => Boolean, {nullable: false})
19312
+ Success: boolean;
19313
+ }
19314
+
19315
+ @Resolver(EntityDocumentSetting_)
19316
+ export class EntityDocumentSettingResolver extends ResolverBase {
19317
+ @Query(() => RunEntityDocumentSettingViewResult)
19318
+ async RunEntityDocumentSettingViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19319
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
19320
+ }
19321
+
19322
+ @Query(() => RunEntityDocumentSettingViewResult)
19323
+ async RunEntityDocumentSettingViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19324
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
19325
+ }
19326
+
19327
+ @Query(() => RunEntityDocumentSettingViewResult)
19328
+ async RunEntityDocumentSettingDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19329
+ input.EntityName = 'Entity Document Settings';
19330
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
19331
+ }
19332
+ @Query(() => EntityDocumentSetting_, { nullable: true })
19333
+ async EntityDocumentSetting(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityDocumentSetting_ | null> {
19334
+ this.CheckUserReadPermissions('Entity Document Settings', userPayload);
19335
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwEntityDocumentSettings] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Document Settings', userPayload, EntityPermissionType.Read, 'AND');
19336
+ const result = this.MapFieldNamesToCodeNames('Entity Document Settings', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
19337
+ return result;
19338
+ }
19339
+
19340
+ @Mutation(() => EntityDocumentSetting_)
19341
+ async CreateEntityDocumentSetting(
19342
+ @Arg('input', () => CreateEntityDocumentSettingInput) input: CreateEntityDocumentSettingInput,
19343
+ @Ctx() { dataSource, userPayload }: AppContext,
19344
+ @PubSub() pubSub: PubSubEngine
19345
+ ) {
19346
+ if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
19347
+ const entityObject = <EntityDocumentSettingEntity>await new Metadata().GetEntityObject('Entity Document Settings', this.GetUserFromPayload(userPayload));
19348
+ await entityObject.NewRecord();
19349
+ entityObject.SetMany(input);
19350
+ if (await entityObject.Save()) {
19351
+ // save worked, fire the AfterCreate event and then return all the data
19352
+ await this.AfterCreate(dataSource, input); // fire event
19353
+ return entityObject.GetAll();
19354
+ }
19355
+ else
19356
+ // save failed, return null
19357
+ return null;
19358
+ }
19359
+ else
19360
+ return null;
19361
+ }
19362
+
19363
+ // Before/After CREATE Event Hooks for Sub-Classes to Override
19364
+ protected async BeforeCreate(dataSource: DataSource, input: CreateEntityDocumentSettingInput): Promise<boolean> {
19365
+ return true;
19366
+ }
19367
+ protected async AfterCreate(dataSource: DataSource, input: CreateEntityDocumentSettingInput) {
19368
+ }
19369
+
19370
+ @Mutation(() => EntityDocumentSetting_)
19371
+ async UpdateEntityDocumentSetting(
19372
+ @Arg('input', () => UpdateEntityDocumentSettingInput) input: UpdateEntityDocumentSettingInput,
19373
+ @Ctx() { dataSource, userPayload }: AppContext,
19374
+ @PubSub() pubSub: PubSubEngine
19375
+ ) {
19376
+ if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
19377
+ const entityObject = <EntityDocumentSettingEntity>await new Metadata().GetEntityObject('Entity Document Settings', this.GetUserFromPayload(userPayload));
19378
+ entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Entity Document Settings
19379
+
19380
+ if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
19381
+ // save worked, fire afterevent and return all the data
19382
+ await this.AfterUpdate(dataSource, input); // fire event
19383
+ return entityObject.GetAll();
19384
+ }
19385
+ else
19386
+ return null; // save failed, return null
19387
+ }
19388
+ else
19389
+ return null;
19390
+ }
19391
+
19392
+ // Before/After UPDATE Event Hooks for Sub-Classes to Override
19393
+ protected async BeforeUpdate(dataSource: DataSource, input: UpdateEntityDocumentSettingInput): Promise<boolean> {
19394
+ const i = input, d = dataSource; // prevent error
19395
+ return true;
19396
+ }
19397
+ protected async AfterUpdate(dataSource: DataSource, input: UpdateEntityDocumentSettingInput) {
19398
+ const i = input, d = dataSource; // prevent error
19399
+ }
19400
+
19401
+ }
19402
+
19403
+ //****************************************************************************
19404
+ // ENTITY CLASS for Entity Settings
19405
+ //****************************************************************************
19406
+ @ObjectType()
19407
+ export class EntitySetting_ {
19408
+ @Field(() => Int)
19409
+ ID: number;
19410
+
19411
+ @Field(() => Int)
19412
+ EntityID: number;
19413
+
19414
+ @Field()
19415
+ @MaxLength(200)
19416
+ Name: string;
19417
+
19418
+ @Field()
19419
+ Value: string;
19420
+
19421
+ @Field({nullable: true})
19422
+ Comments?: string;
19423
+
19424
+ @Field()
19425
+ @MaxLength(8)
19426
+ CreatedAt: Date;
19427
+
19428
+ @Field()
19429
+ @MaxLength(8)
19430
+ UpdatedAt: Date;
19431
+
19432
+ @Field()
19433
+ @MaxLength(510)
19434
+ Entity: string;
19435
+
19436
+ }
19437
+
19438
+ //****************************************************************************
19439
+ // INPUT TYPE for Entity Settings
19440
+ //****************************************************************************
19441
+ @InputType()
19442
+ export class CreateEntitySettingInput {
19443
+ @Field(() => Int)
19444
+ EntityID: number;
19445
+
19446
+ @Field()
19447
+ Name: string;
19448
+
19449
+ @Field()
19450
+ Value: string;
19451
+
19452
+ @Field({ nullable: true })
19453
+ Comments: string;
19454
+ }
19455
+
19456
+
19457
+ //****************************************************************************
19458
+ // INPUT TYPE for Entity Settings
19459
+ //****************************************************************************
19460
+ @InputType()
19461
+ export class UpdateEntitySettingInput {
19462
+ @Field(() => Int)
19463
+ ID: number;
19464
+
19465
+ @Field(() => Int)
19466
+ EntityID: number;
19467
+
19468
+ @Field()
19469
+ Name: string;
19470
+
19471
+ @Field()
19472
+ Value: string;
19473
+
19474
+ @Field({ nullable: true })
19475
+ Comments: string;
19476
+ }
19477
+
19478
+ //****************************************************************************
19479
+ // RESOLVER for Entity Settings
19480
+ //****************************************************************************
19481
+ @ObjectType()
19482
+ export class RunEntitySettingViewResult {
19483
+ @Field(() => [EntitySetting_])
19484
+ Results: EntitySetting_[];
19485
+
19486
+ @Field(() => Int, {nullable: true})
19487
+ UserViewRunID?: number;
19488
+
19489
+ @Field(() => Int, {nullable: true})
19490
+ RowCount: number;
19491
+
19492
+ @Field(() => Int, {nullable: true})
19493
+ TotalRowCount: number;
19494
+
19495
+ @Field(() => Int, {nullable: true})
19496
+ ExecutionTime: number;
19497
+
19498
+ @Field({nullable: true})
19499
+ ErrorMessage?: string;
19500
+
19501
+ @Field(() => Boolean, {nullable: false})
19502
+ Success: boolean;
19503
+ }
19504
+
19505
+ @Resolver(EntitySetting_)
19506
+ export class EntitySettingResolver extends ResolverBase {
19507
+ @Query(() => RunEntitySettingViewResult)
19508
+ async RunEntitySettingViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19509
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
19510
+ }
19511
+
19512
+ @Query(() => RunEntitySettingViewResult)
19513
+ async RunEntitySettingViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19514
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
19515
+ }
19516
+
19517
+ @Query(() => RunEntitySettingViewResult)
19518
+ async RunEntitySettingDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19519
+ input.EntityName = 'Entity Settings';
19520
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
19521
+ }
19522
+ @Query(() => EntitySetting_, { nullable: true })
19523
+ async EntitySetting(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntitySetting_ | null> {
19524
+ this.CheckUserReadPermissions('Entity Settings', userPayload);
19525
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwEntitySettings] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Settings', userPayload, EntityPermissionType.Read, 'AND');
19526
+ const result = this.MapFieldNamesToCodeNames('Entity Settings', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
19527
+ return result;
19528
+ }
19529
+
19530
+ @Mutation(() => EntitySetting_)
19531
+ async CreateEntitySetting(
19532
+ @Arg('input', () => CreateEntitySettingInput) input: CreateEntitySettingInput,
19533
+ @Ctx() { dataSource, userPayload }: AppContext,
19534
+ @PubSub() pubSub: PubSubEngine
19535
+ ) {
19536
+ if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
19537
+ const entityObject = <EntitySettingEntity>await new Metadata().GetEntityObject('Entity Settings', this.GetUserFromPayload(userPayload));
19538
+ await entityObject.NewRecord();
19539
+ entityObject.SetMany(input);
19540
+ if (await entityObject.Save()) {
19541
+ // save worked, fire the AfterCreate event and then return all the data
19542
+ await this.AfterCreate(dataSource, input); // fire event
19543
+ return entityObject.GetAll();
19544
+ }
19545
+ else
19546
+ // save failed, return null
19547
+ return null;
19548
+ }
19549
+ else
19550
+ return null;
19551
+ }
19552
+
19553
+ // Before/After CREATE Event Hooks for Sub-Classes to Override
19554
+ protected async BeforeCreate(dataSource: DataSource, input: CreateEntitySettingInput): Promise<boolean> {
19555
+ return true;
19556
+ }
19557
+ protected async AfterCreate(dataSource: DataSource, input: CreateEntitySettingInput) {
19558
+ }
19559
+
19560
+ @Mutation(() => EntitySetting_)
19561
+ async UpdateEntitySetting(
19562
+ @Arg('input', () => UpdateEntitySettingInput) input: UpdateEntitySettingInput,
19563
+ @Ctx() { dataSource, userPayload }: AppContext,
19564
+ @PubSub() pubSub: PubSubEngine
19565
+ ) {
19566
+ if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
19567
+ const entityObject = <EntitySettingEntity>await new Metadata().GetEntityObject('Entity Settings', this.GetUserFromPayload(userPayload));
19568
+ entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Entity Settings
19569
+
19570
+ if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
19571
+ // save worked, fire afterevent and return all the data
19572
+ await this.AfterUpdate(dataSource, input); // fire event
19573
+ return entityObject.GetAll();
19574
+ }
19575
+ else
19576
+ return null; // save failed, return null
19577
+ }
19578
+ else
19579
+ return null;
19580
+ }
19581
+
19582
+ // Before/After UPDATE Event Hooks for Sub-Classes to Override
19583
+ protected async BeforeUpdate(dataSource: DataSource, input: UpdateEntitySettingInput): Promise<boolean> {
19584
+ const i = input, d = dataSource; // prevent error
19585
+ return true;
19586
+ }
19587
+ protected async AfterUpdate(dataSource: DataSource, input: UpdateEntitySettingInput) {
19588
+ const i = input, d = dataSource; // prevent error
19589
+ }
19590
+
19591
+ }
19592
+
19593
+ //****************************************************************************
19594
+ // ENTITY CLASS for Duplicate Runs
19595
+ //****************************************************************************
19596
+ @ObjectType()
19597
+ export class DuplicateRun_ {
19598
+ @Field(() => Int)
19599
+ ID: number;
19600
+
19601
+ @Field(() => Int)
19602
+ EntityID: number;
19603
+
19604
+ @Field(() => Int)
19605
+ StartedByUserID: number;
19606
+
19607
+ @Field()
19608
+ @MaxLength(8)
19609
+ StartedAt: Date;
19610
+
19611
+ @Field({nullable: true})
19612
+ @MaxLength(8)
19613
+ EndedAt?: Date;
19614
+
19615
+ @Field()
19616
+ @MaxLength(40)
19617
+ ApprovalStatus: string;
19618
+
19619
+ @Field({nullable: true})
19620
+ ApprovalComments?: string;
19621
+
19622
+ @Field(() => Int, {nullable: true})
19623
+ ApprovedByUserID?: number;
19624
+
19625
+ @Field()
19626
+ @MaxLength(40)
19627
+ ProcessingStatus: string;
19628
+
19629
+ @Field({nullable: true})
19630
+ ProcessingErrorMessage?: string;
19631
+
19632
+ @Field(() => Int)
19633
+ SourceListID: number;
19634
+
19635
+ @Field()
19636
+ @MaxLength(8)
19637
+ CreatedAt: Date;
19638
+
19639
+ @Field()
19640
+ @MaxLength(8)
19641
+ UpdatedAt: Date;
19642
+
19643
+ @Field()
19644
+ @MaxLength(510)
19645
+ Entity: string;
19646
+
19647
+ @Field()
19648
+ @MaxLength(200)
19649
+ StartedByUser: string;
19650
+
19651
+ @Field({nullable: true})
19652
+ @MaxLength(200)
19653
+ ApprovedByUser?: string;
19654
+
19655
+ @Field()
19656
+ @MaxLength(200)
19657
+ SourceList: string;
19658
+
19659
+ @Field(() => [mj_core_schema_server_object_types.DuplicateRunDetail_])
19660
+ DuplicateRunDetailsArray: mj_core_schema_server_object_types.DuplicateRunDetail_[]; // Link to DuplicateRunDetails
19661
+
19662
+ }
19663
+
19664
+ //****************************************************************************
19665
+ // INPUT TYPE for Duplicate Runs
19666
+ //****************************************************************************
19667
+ @InputType()
19668
+ export class CreateDuplicateRunInput {
19669
+ @Field(() => Int)
19670
+ EntityID: number;
19671
+
19672
+ @Field(() => Int)
19673
+ StartedByUserID: number;
19674
+
19675
+ @Field()
19676
+ StartedAt: Date;
19677
+
19678
+ @Field({ nullable: true })
19679
+ EndedAt: Date;
19680
+
19681
+ @Field()
19682
+ ApprovalStatus: string;
19683
+
19684
+ @Field({ nullable: true })
19685
+ ApprovalComments: string;
19686
+
19687
+ @Field(() => Int, { nullable: true })
19688
+ ApprovedByUserID: number;
19689
+
19690
+ @Field()
19691
+ ProcessingStatus: string;
19692
+
19693
+ @Field({ nullable: true })
19694
+ ProcessingErrorMessage: string;
19695
+
19696
+ @Field(() => Int)
19697
+ SourceListID: number;
19698
+ }
19699
+
19700
+
19701
+ //****************************************************************************
19702
+ // INPUT TYPE for Duplicate Runs
19703
+ //****************************************************************************
19704
+ @InputType()
19705
+ export class UpdateDuplicateRunInput {
19706
+ @Field(() => Int)
19707
+ ID: number;
19708
+
19709
+ @Field(() => Int)
19710
+ EntityID: number;
19711
+
19712
+ @Field(() => Int)
19713
+ StartedByUserID: number;
19714
+
19715
+ @Field()
19716
+ StartedAt: Date;
19717
+
19718
+ @Field({ nullable: true })
19719
+ EndedAt: Date;
19720
+
19721
+ @Field()
19722
+ ApprovalStatus: string;
19723
+
19724
+ @Field({ nullable: true })
19725
+ ApprovalComments: string;
19726
+
19727
+ @Field(() => Int, { nullable: true })
19728
+ ApprovedByUserID: number;
19729
+
19730
+ @Field()
19731
+ ProcessingStatus: string;
19732
+
19733
+ @Field({ nullable: true })
19734
+ ProcessingErrorMessage: string;
19735
+
19736
+ @Field(() => Int)
19737
+ SourceListID: number;
19738
+ }
19739
+
19740
+ //****************************************************************************
19741
+ // RESOLVER for Duplicate Runs
19742
+ //****************************************************************************
19743
+ @ObjectType()
19744
+ export class RunDuplicateRunViewResult {
19745
+ @Field(() => [DuplicateRun_])
19746
+ Results: DuplicateRun_[];
19747
+
19748
+ @Field(() => Int, {nullable: true})
19749
+ UserViewRunID?: number;
19750
+
19751
+ @Field(() => Int, {nullable: true})
19752
+ RowCount: number;
19753
+
19754
+ @Field(() => Int, {nullable: true})
19755
+ TotalRowCount: number;
19756
+
19757
+ @Field(() => Int, {nullable: true})
19758
+ ExecutionTime: number;
19759
+
19760
+ @Field({nullable: true})
19761
+ ErrorMessage?: string;
19762
+
19763
+ @Field(() => Boolean, {nullable: false})
19764
+ Success: boolean;
19765
+ }
19766
+
19767
+ @Resolver(DuplicateRun_)
19768
+ export class DuplicateRunResolver extends ResolverBase {
19769
+ @Query(() => RunDuplicateRunViewResult)
19770
+ async RunDuplicateRunViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19771
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
19772
+ }
19773
+
19774
+ @Query(() => RunDuplicateRunViewResult)
19775
+ async RunDuplicateRunViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19776
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
19777
+ }
19778
+
19779
+ @Query(() => RunDuplicateRunViewResult)
19780
+ async RunDuplicateRunDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19781
+ input.EntityName = 'Duplicate Runs';
19782
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
19783
+ }
19784
+ @Query(() => DuplicateRun_, { nullable: true })
19785
+ async DuplicateRun(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<DuplicateRun_ | null> {
19786
+ this.CheckUserReadPermissions('Duplicate Runs', userPayload);
19787
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDuplicateRuns] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Duplicate Runs', userPayload, EntityPermissionType.Read, 'AND');
19788
+ const result = this.MapFieldNamesToCodeNames('Duplicate Runs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
19789
+ return result;
19790
+ }
19791
+
19792
+ @FieldResolver(() => [mj_core_schema_server_object_types.DuplicateRunDetail_])
19793
+ async DuplicateRunDetailsArray(@Root() duplicaterun_: DuplicateRun_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19794
+ this.CheckUserReadPermissions('Duplicate Run Details', userPayload);
19795
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDuplicateRunDetails] WHERE [DuplicateRunID]=${duplicaterun_.ID} ` + this.getRowLevelSecurityWhereClause('Duplicate Run Details', userPayload, EntityPermissionType.Read, 'AND');
19796
+ const result = this.ArrayMapFieldNamesToCodeNames('Duplicate Run Details', await dataSource.query(sSQL));
19797
+ return result;
19798
+ }
19799
+
19800
+ @Mutation(() => DuplicateRun_)
19801
+ async CreateDuplicateRun(
19802
+ @Arg('input', () => CreateDuplicateRunInput) input: CreateDuplicateRunInput,
19803
+ @Ctx() { dataSource, userPayload }: AppContext,
19804
+ @PubSub() pubSub: PubSubEngine
19805
+ ) {
19806
+ if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
19807
+ const entityObject = <DuplicateRunEntity>await new Metadata().GetEntityObject('Duplicate Runs', this.GetUserFromPayload(userPayload));
19808
+ await entityObject.NewRecord();
19809
+ entityObject.SetMany(input);
19810
+ if (await entityObject.Save()) {
19811
+ // save worked, fire the AfterCreate event and then return all the data
19812
+ await this.AfterCreate(dataSource, input); // fire event
19813
+ return entityObject.GetAll();
19814
+ }
19815
+ else
19816
+ // save failed, return null
19817
+ return null;
19818
+ }
19819
+ else
19820
+ return null;
19821
+ }
19822
+
19823
+ // Before/After CREATE Event Hooks for Sub-Classes to Override
19824
+ protected async BeforeCreate(dataSource: DataSource, input: CreateDuplicateRunInput): Promise<boolean> {
19825
+ return true;
19826
+ }
19827
+ protected async AfterCreate(dataSource: DataSource, input: CreateDuplicateRunInput) {
19828
+ }
19829
+
19830
+ @Mutation(() => DuplicateRun_)
19831
+ async UpdateDuplicateRun(
19832
+ @Arg('input', () => UpdateDuplicateRunInput) input: UpdateDuplicateRunInput,
19833
+ @Ctx() { dataSource, userPayload }: AppContext,
19834
+ @PubSub() pubSub: PubSubEngine
19835
+ ) {
19836
+ if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
19837
+ const entityObject = <DuplicateRunEntity>await new Metadata().GetEntityObject('Duplicate Runs', this.GetUserFromPayload(userPayload));
19838
+ entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Duplicate Runs
19839
+
19840
+ if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
19841
+ // save worked, fire afterevent and return all the data
19842
+ await this.AfterUpdate(dataSource, input); // fire event
19843
+ return entityObject.GetAll();
19844
+ }
19845
+ else
19846
+ return null; // save failed, return null
19847
+ }
19848
+ else
19849
+ return null;
19850
+ }
19851
+
19852
+ // Before/After UPDATE Event Hooks for Sub-Classes to Override
19853
+ protected async BeforeUpdate(dataSource: DataSource, input: UpdateDuplicateRunInput): Promise<boolean> {
19854
+ const i = input, d = dataSource; // prevent error
19855
+ return true;
19856
+ }
19857
+ protected async AfterUpdate(dataSource: DataSource, input: UpdateDuplicateRunInput) {
19858
+ const i = input, d = dataSource; // prevent error
19859
+ }
19860
+
19861
+ }
19862
+
19863
+ //****************************************************************************
19864
+ // ENTITY CLASS for Duplicate Run Details
19865
+ //****************************************************************************
19866
+ @ObjectType()
19867
+ export class DuplicateRunDetail_ {
19868
+ @Field(() => Int)
19869
+ ID: number;
19870
+
19871
+ @Field(() => Int)
19872
+ DuplicateRunID: number;
19873
+
19874
+ @Field()
19875
+ @MaxLength(1000)
19876
+ RecordID: string;
19877
+
19878
+ @Field()
19879
+ @MaxLength(40)
19880
+ MatchStatus: string;
19881
+
19882
+ @Field({nullable: true, description: 'If MatchStatus=Skipped, this field can be used to store the reason why the record was skipped'})
19883
+ SkippedReason?: string;
19884
+
19885
+ @Field({nullable: true, description: 'If MatchStatus=\'Error\' this field can be used to track the error from that phase of the process for logging/diagnostics.'})
19886
+ MatchErrorMessage?: string;
19887
+
19888
+ @Field()
19889
+ @MaxLength(40)
19890
+ MergeStatus: string;
19891
+
19892
+ @Field({nullable: true})
19893
+ MergeErrorMessage?: string;
19894
+
19895
+ @Field()
19896
+ @MaxLength(8)
19897
+ CreatedAt: Date;
19898
+
19899
+ @Field()
19900
+ @MaxLength(8)
19901
+ UpdatedAt: Date;
19902
+
19903
+ @Field(() => [mj_core_schema_server_object_types.DuplicateRunDetailMatch_])
19904
+ DuplicateRunDetailMatchesArray: mj_core_schema_server_object_types.DuplicateRunDetailMatch_[]; // Link to DuplicateRunDetailMatches
19905
+
19906
+ }
19907
+
19908
+ //****************************************************************************
19909
+ // INPUT TYPE for Duplicate Run Details
19910
+ //****************************************************************************
19911
+ @InputType()
19912
+ export class CreateDuplicateRunDetailInput {
19913
+ @Field(() => Int)
19914
+ DuplicateRunID: number;
19915
+
19916
+ @Field()
19917
+ RecordID: string;
19918
+
19919
+ @Field()
19920
+ MatchStatus: string;
19921
+
19922
+ @Field({ nullable: true })
19923
+ SkippedReason: string;
19924
+
19925
+ @Field({ nullable: true })
19926
+ MatchErrorMessage: string;
19927
+
19928
+ @Field()
19929
+ MergeStatus: string;
19930
+
19931
+ @Field({ nullable: true })
19932
+ MergeErrorMessage: string;
19933
+ }
19934
+
19935
+
19936
+ //****************************************************************************
19937
+ // INPUT TYPE for Duplicate Run Details
19938
+ //****************************************************************************
19939
+ @InputType()
19940
+ export class UpdateDuplicateRunDetailInput {
19941
+ @Field(() => Int)
19942
+ ID: number;
19943
+
19944
+ @Field(() => Int)
19945
+ DuplicateRunID: number;
19946
+
19947
+ @Field()
19948
+ RecordID: string;
19949
+
19950
+ @Field()
19951
+ MatchStatus: string;
19952
+
19953
+ @Field({ nullable: true })
19954
+ SkippedReason: string;
19955
+
19956
+ @Field({ nullable: true })
19957
+ MatchErrorMessage: string;
19958
+
19959
+ @Field()
19960
+ MergeStatus: string;
19961
+
19962
+ @Field({ nullable: true })
19963
+ MergeErrorMessage: string;
19964
+ }
19965
+
19966
+ //****************************************************************************
19967
+ // RESOLVER for Duplicate Run Details
19968
+ //****************************************************************************
19969
+ @ObjectType()
19970
+ export class RunDuplicateRunDetailViewResult {
19971
+ @Field(() => [DuplicateRunDetail_])
19972
+ Results: DuplicateRunDetail_[];
19973
+
19974
+ @Field(() => Int, {nullable: true})
19975
+ UserViewRunID?: number;
19976
+
19977
+ @Field(() => Int, {nullable: true})
19978
+ RowCount: number;
19979
+
19980
+ @Field(() => Int, {nullable: true})
19981
+ TotalRowCount: number;
19982
+
19983
+ @Field(() => Int, {nullable: true})
19984
+ ExecutionTime: number;
19985
+
19986
+ @Field({nullable: true})
19987
+ ErrorMessage?: string;
19988
+
19989
+ @Field(() => Boolean, {nullable: false})
19990
+ Success: boolean;
19991
+ }
19992
+
19993
+ @Resolver(DuplicateRunDetail_)
19994
+ export class DuplicateRunDetailResolver extends ResolverBase {
19995
+ @Query(() => RunDuplicateRunDetailViewResult)
19996
+ async RunDuplicateRunDetailViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
19997
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
19998
+ }
19999
+
20000
+ @Query(() => RunDuplicateRunDetailViewResult)
20001
+ async RunDuplicateRunDetailViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
20002
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
20003
+ }
20004
+
20005
+ @Query(() => RunDuplicateRunDetailViewResult)
20006
+ async RunDuplicateRunDetailDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
20007
+ input.EntityName = 'Duplicate Run Details';
20008
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
20009
+ }
20010
+ @Query(() => DuplicateRunDetail_, { nullable: true })
20011
+ async DuplicateRunDetail(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<DuplicateRunDetail_ | null> {
20012
+ this.CheckUserReadPermissions('Duplicate Run Details', userPayload);
20013
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDuplicateRunDetails] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Duplicate Run Details', userPayload, EntityPermissionType.Read, 'AND');
20014
+ const result = this.MapFieldNamesToCodeNames('Duplicate Run Details', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
20015
+ return result;
20016
+ }
20017
+
20018
+ @FieldResolver(() => [mj_core_schema_server_object_types.DuplicateRunDetailMatch_])
20019
+ async DuplicateRunDetailMatchesArray(@Root() duplicaterundetail_: DuplicateRunDetail_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
20020
+ this.CheckUserReadPermissions('Duplicate Run Detail Matches', userPayload);
20021
+ const sSQL = `SELECT * FROM [${Metadata.Provider.ConfigData.MJCoreSchemaName}].[vwDuplicateRunDetailMatches] WHERE [DuplicateRunDetailID]=${duplicaterundetail_.ID} ` + this.getRowLevelSecurityWhereClause('Duplicate Run Detail Matches', userPayload, EntityPermissionType.Read, 'AND');
20022
+ const result = this.ArrayMapFieldNamesToCodeNames('Duplicate Run Detail Matches', await dataSource.query(sSQL));
20023
+ return result;
20024
+ }
20025
+
20026
+ @Mutation(() => DuplicateRunDetail_)
20027
+ async CreateDuplicateRunDetail(
20028
+ @Arg('input', () => CreateDuplicateRunDetailInput) input: CreateDuplicateRunDetailInput,
20029
+ @Ctx() { dataSource, userPayload }: AppContext,
20030
+ @PubSub() pubSub: PubSubEngine
20031
+ ) {
20032
+ if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
20033
+ const entityObject = <DuplicateRunDetailEntity>await new Metadata().GetEntityObject('Duplicate Run Details', this.GetUserFromPayload(userPayload));
20034
+ await entityObject.NewRecord();
20035
+ entityObject.SetMany(input);
20036
+ if (await entityObject.Save()) {
20037
+ // save worked, fire the AfterCreate event and then return all the data
20038
+ await this.AfterCreate(dataSource, input); // fire event
20039
+ return entityObject.GetAll();
20040
+ }
20041
+ else
20042
+ // save failed, return null
20043
+ return null;
20044
+ }
20045
+ else
20046
+ return null;
20047
+ }
20048
+
20049
+ // Before/After CREATE Event Hooks for Sub-Classes to Override
20050
+ protected async BeforeCreate(dataSource: DataSource, input: CreateDuplicateRunDetailInput): Promise<boolean> {
20051
+ return true;
20052
+ }
20053
+ protected async AfterCreate(dataSource: DataSource, input: CreateDuplicateRunDetailInput) {
20054
+ }
20055
+
20056
+ @Mutation(() => DuplicateRunDetail_)
20057
+ async UpdateDuplicateRunDetail(
20058
+ @Arg('input', () => UpdateDuplicateRunDetailInput) input: UpdateDuplicateRunDetailInput,
20059
+ @Ctx() { dataSource, userPayload }: AppContext,
20060
+ @PubSub() pubSub: PubSubEngine
20061
+ ) {
20062
+ if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
20063
+ const entityObject = <DuplicateRunDetailEntity>await new Metadata().GetEntityObject('Duplicate Run Details', this.GetUserFromPayload(userPayload));
20064
+ entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Duplicate Run Details
20065
+
20066
+ if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
20067
+ // save worked, fire afterevent and return all the data
20068
+ await this.AfterUpdate(dataSource, input); // fire event
20069
+ return entityObject.GetAll();
20070
+ }
20071
+ else
20072
+ return null; // save failed, return null
20073
+ }
20074
+ else
20075
+ return null;
20076
+ }
20077
+
20078
+ // Before/After UPDATE Event Hooks for Sub-Classes to Override
20079
+ protected async BeforeUpdate(dataSource: DataSource, input: UpdateDuplicateRunDetailInput): Promise<boolean> {
20080
+ const i = input, d = dataSource; // prevent error
20081
+ return true;
20082
+ }
20083
+ protected async AfterUpdate(dataSource: DataSource, input: UpdateDuplicateRunDetailInput) {
20084
+ const i = input, d = dataSource; // prevent error
20085
+ }
20086
+
18880
20087
  }