@memberjunction/server 0.9.181 → 0.9.183

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: 2/14/2024, 10:23:29 AM
5
+ * GENERATED: 2/20/2024, 5:28:54 PM
6
6
  *
7
7
  * >>> DO NOT MODIFY THIS FILE!!!!!!!!!!!!
8
8
  * >>> YOUR CHANGES WILL BE OVERWRITTEN
@@ -17,7 +17,7 @@ import { AppContext } from '@memberjunction/server';
17
17
  import { MaxLength } from 'class-validator';
18
18
  import { DataSource } from 'typeorm';
19
19
 
20
- 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, ResourceFolderEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity, DataContextItemEntity, DataContextEntity } from '@memberjunction/core-entities';
20
+ 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 } from '@memberjunction/core-entities';
21
21
 
22
22
 
23
23
  //****************************************************************************
@@ -3582,9 +3582,6 @@ export class User_ {
3582
3582
  @Field(() => [Conversation_])
3583
3583
  ConversationsArray: Conversation_[]; // Link to Conversations
3584
3584
 
3585
- @Field(() => [ResourceFolder_])
3586
- ResourceFoldersArray: ResourceFolder_[]; // Link to ResourceFolders
3587
-
3588
3585
  @Field(() => [RecordMergeLog_])
3589
3586
  RecordMergeLogsArray: RecordMergeLog_[]; // Link to RecordMergeLogs
3590
3587
 
@@ -3863,14 +3860,6 @@ export class UserResolverBase extends ResolverBase {
3863
3860
  return result;
3864
3861
  }
3865
3862
 
3866
- @FieldResolver(() => [ResourceFolder_])
3867
- async ResourceFoldersArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3868
- this.CheckUserReadPermissions('Resource Folders', userPayload);
3869
- const sSQL = `SELECT * FROM [admin].[vwResourceFolders] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
3870
- const result = this.ArrayMapFieldNamesToCodeNames('Resource Folders', await dataSource.query(sSQL));
3871
- return result;
3872
- }
3873
-
3874
3863
  @FieldResolver(() => [RecordMergeLog_])
3875
3864
  async RecordMergeLogsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
3876
3865
  this.CheckUserReadPermissions('Record Merge Logs', userPayload);
@@ -4487,6 +4476,9 @@ export class UserView_ {
4487
4476
  @Field({nullable: true})
4488
4477
  Description?: string;
4489
4478
 
4479
+ @Field(() => Int, {nullable: true})
4480
+ CategoryID?: number;
4481
+
4490
4482
  @Field(() => Boolean)
4491
4483
  IsShared: boolean;
4492
4484
 
@@ -4583,6 +4575,9 @@ export class CreateUserViewInput {
4583
4575
  @Field({ nullable: true })
4584
4576
  Description: string;
4585
4577
 
4578
+ @Field(() => Int, { nullable: true })
4579
+ CategoryID: number;
4580
+
4586
4581
  @Field(() => Boolean, )
4587
4582
  IsShared: boolean;
4588
4583
 
@@ -4641,6 +4636,9 @@ export class UpdateUserViewInput {
4641
4636
  @Field({ nullable: true })
4642
4637
  Description: string;
4643
4638
 
4639
+ @Field(() => Int, { nullable: true })
4640
+ CategoryID: number;
4641
+
4644
4642
  @Field(() => Boolean, )
4645
4643
  IsShared: boolean;
4646
4644
 
@@ -10433,12 +10431,19 @@ export class Dashboard_ {
10433
10431
  @Field({nullable: true})
10434
10432
  Description?: string;
10435
10433
 
10434
+ @Field(() => Int, {nullable: true})
10435
+ CategoryID?: number;
10436
+
10436
10437
  @Field()
10437
10438
  UIConfigDetails: string;
10438
10439
 
10439
10440
  @Field(() => Int, {nullable: true})
10440
10441
  UserID?: number;
10441
10442
 
10443
+ @Field({nullable: true})
10444
+ @MaxLength(200)
10445
+ Category?: string;
10446
+
10442
10447
  @Field({nullable: true})
10443
10448
  @MaxLength(200)
10444
10449
  User?: string;
@@ -10456,6 +10461,9 @@ export class CreateDashboardInput {
10456
10461
  @Field({ nullable: true })
10457
10462
  Description: string;
10458
10463
 
10464
+ @Field(() => Int, { nullable: true })
10465
+ CategoryID: number;
10466
+
10459
10467
  @Field()
10460
10468
  UIConfigDetails: string;
10461
10469
 
@@ -10478,6 +10486,9 @@ export class UpdateDashboardInput {
10478
10486
  @Field({ nullable: true })
10479
10487
  Description: string;
10480
10488
 
10489
+ @Field(() => Int, { nullable: true })
10490
+ CategoryID: number;
10491
+
10481
10492
  @Field()
10482
10493
  UIConfigDetails: string;
10483
10494
 
@@ -10891,6 +10902,9 @@ export class Report_ {
10891
10902
  @Field({nullable: true})
10892
10903
  Description?: string;
10893
10904
 
10905
+ @Field(() => Int, {nullable: true})
10906
+ CategoryID?: number;
10907
+
10894
10908
  @Field(() => Int)
10895
10909
  UserID: number;
10896
10910
 
@@ -10904,11 +10918,11 @@ export class Report_ {
10904
10918
  @Field(() => Int, {nullable: true})
10905
10919
  ConversationDetailID?: number;
10906
10920
 
10907
- @Field({nullable: true})
10908
- ReportSQL?: string;
10921
+ @Field(() => Int, {nullable: true})
10922
+ DataContextID?: number;
10909
10923
 
10910
10924
  @Field({nullable: true})
10911
- ReportConfiguration?: string;
10925
+ Configuration?: string;
10912
10926
 
10913
10927
  @Field(() => Int, {nullable: true})
10914
10928
  OutputTriggerTypeID?: number;
@@ -10941,6 +10955,10 @@ export class Report_ {
10941
10955
  @MaxLength(8)
10942
10956
  UpdatedAt: Date;
10943
10957
 
10958
+ @Field({nullable: true})
10959
+ @MaxLength(200)
10960
+ Category?: string;
10961
+
10944
10962
  @Field()
10945
10963
  @MaxLength(200)
10946
10964
  User: string;
@@ -10949,6 +10967,10 @@ export class Report_ {
10949
10967
  @MaxLength(200)
10950
10968
  Conversation?: string;
10951
10969
 
10970
+ @Field({nullable: true})
10971
+ @MaxLength(510)
10972
+ DataContext?: string;
10973
+
10952
10974
  @Field({nullable: true})
10953
10975
  @MaxLength(510)
10954
10976
  OutputTriggerType?: string;
@@ -10981,6 +11003,9 @@ export class CreateReportInput {
10981
11003
  @Field({ nullable: true })
10982
11004
  Description: string;
10983
11005
 
11006
+ @Field(() => Int, { nullable: true })
11007
+ CategoryID: number;
11008
+
10984
11009
  @Field(() => Int, )
10985
11010
  UserID: number;
10986
11011
 
@@ -10993,11 +11018,11 @@ export class CreateReportInput {
10993
11018
  @Field(() => Int, { nullable: true })
10994
11019
  ConversationDetailID: number;
10995
11020
 
10996
- @Field({ nullable: true })
10997
- ReportSQL: string;
11021
+ @Field(() => Int, { nullable: true })
11022
+ DataContextID: number;
10998
11023
 
10999
11024
  @Field({ nullable: true })
11000
- ReportConfiguration: string;
11025
+ Configuration: string;
11001
11026
 
11002
11027
  @Field(() => Int, { nullable: true })
11003
11028
  OutputTriggerTypeID: number;
@@ -11036,6 +11061,9 @@ export class UpdateReportInput {
11036
11061
  @Field({ nullable: true })
11037
11062
  Description: string;
11038
11063
 
11064
+ @Field(() => Int, { nullable: true })
11065
+ CategoryID: number;
11066
+
11039
11067
  @Field(() => Int, )
11040
11068
  UserID: number;
11041
11069
 
@@ -11048,11 +11076,11 @@ export class UpdateReportInput {
11048
11076
  @Field(() => Int, { nullable: true })
11049
11077
  ConversationDetailID: number;
11050
11078
 
11051
- @Field({ nullable: true })
11052
- ReportSQL: string;
11079
+ @Field(() => Int, { nullable: true })
11080
+ DataContextID: number;
11053
11081
 
11054
11082
  @Field({ nullable: true })
11055
- ReportConfiguration: string;
11083
+ Configuration: string;
11056
11084
 
11057
11085
  @Field(() => Int, { nullable: true })
11058
11086
  OutputTriggerTypeID: number;
@@ -11472,9 +11500,6 @@ export class ResourceType_ {
11472
11500
  @Field(() => [WorkspaceItem_])
11473
11501
  WorkspaceItemsArray: WorkspaceItem_[]; // Link to WorkspaceItems
11474
11502
 
11475
- @Field(() => [ResourceFolder_])
11476
- ResourceFoldersArray: ResourceFolder_[]; // Link to ResourceFolders
11477
-
11478
11503
  }
11479
11504
  //****************************************************************************
11480
11505
  // RESOLVER for Resource Types
@@ -11536,14 +11561,6 @@ export class ResourceTypeResolver extends ResolverBase {
11536
11561
  const result = this.ArrayMapFieldNamesToCodeNames('Workspace Items', await dataSource.query(sSQL));
11537
11562
  return result;
11538
11563
  }
11539
-
11540
- @FieldResolver(() => [ResourceFolder_])
11541
- async ResourceFoldersArray(@Root() resourcetype_: ResourceType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
11542
- this.CheckUserReadPermissions('Resource Folders', userPayload);
11543
- const sSQL = `SELECT * FROM [admin].[vwResourceFolders] WHERE [ResourceTypeName]=${resourcetype_.ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
11544
- const result = this.ArrayMapFieldNamesToCodeNames('Resource Folders', await dataSource.query(sSQL));
11545
- return result;
11546
- }
11547
11564
 
11548
11565
  }
11549
11566
 
@@ -13122,221 +13139,6 @@ export class UserNotificationResolver extends ResolverBase {
13122
13139
 
13123
13140
  }
13124
13141
 
13125
- //****************************************************************************
13126
- // ENTITY CLASS for Resource Folders
13127
- //****************************************************************************
13128
- @ObjectType()
13129
- export class ResourceFolder_ {
13130
- @Field(() => Int)
13131
- ID: number;
13132
-
13133
- @Field(() => Int, {nullable: true})
13134
- ParentID?: number;
13135
-
13136
- @Field()
13137
- @MaxLength(100)
13138
- Name: string;
13139
-
13140
- @Field()
13141
- @MaxLength(510)
13142
- ResourceTypeName: string;
13143
-
13144
- @Field({nullable: true})
13145
- Description?: string;
13146
-
13147
- @Field(() => Int)
13148
- UserID: number;
13149
-
13150
- @Field()
13151
- @MaxLength(8)
13152
- CreatedAt: Date;
13153
-
13154
- @Field()
13155
- @MaxLength(8)
13156
- UpdatedAt: Date;
13157
-
13158
- @Field({nullable: true})
13159
- @MaxLength(100)
13160
- Parent?: string;
13161
-
13162
- @Field()
13163
- @MaxLength(200)
13164
- User: string;
13165
-
13166
- @Field(() => [ResourceFolder_])
13167
- ResourceFoldersArray: ResourceFolder_[]; // Link to ResourceFolders
13168
-
13169
- }
13170
-
13171
- //****************************************************************************
13172
- // INPUT TYPE for Resource Folders
13173
- //****************************************************************************
13174
- @InputType()
13175
- export class CreateResourceFolderInput {
13176
- @Field(() => Int, { nullable: true })
13177
- ParentID: number;
13178
-
13179
- @Field()
13180
- Name: string;
13181
-
13182
- @Field()
13183
- ResourceTypeName: string;
13184
-
13185
- @Field({ nullable: true })
13186
- Description: string;
13187
-
13188
- @Field(() => Int, )
13189
- UserID: number;
13190
- }
13191
-
13192
-
13193
- //****************************************************************************
13194
- // INPUT TYPE for Resource Folders
13195
- //****************************************************************************
13196
- @InputType()
13197
- export class UpdateResourceFolderInput {
13198
- @Field(() => Int, )
13199
- ID: number;
13200
-
13201
- @Field(() => Int, { nullable: true })
13202
- ParentID: number;
13203
-
13204
- @Field()
13205
- Name: string;
13206
-
13207
- @Field()
13208
- ResourceTypeName: string;
13209
-
13210
- @Field({ nullable: true })
13211
- Description: string;
13212
-
13213
- @Field(() => Int, )
13214
- UserID: number;
13215
- }
13216
-
13217
- //****************************************************************************
13218
- // RESOLVER for Resource Folders
13219
- //****************************************************************************
13220
- @ObjectType()
13221
- export class RunResourceFolderViewResult {
13222
- @Field(() => [ResourceFolder_])
13223
- Results: ResourceFolder_[];
13224
-
13225
- @Field(() => Int, {nullable: true})
13226
- UserViewRunID?: number;
13227
-
13228
- @Field(() => Int, {nullable: true})
13229
- RowCount: number;
13230
-
13231
- @Field(() => Int, {nullable: true})
13232
- TotalRowCount: number;
13233
-
13234
- @Field(() => Int, {nullable: true})
13235
- ExecutionTime: number;
13236
-
13237
- @Field({nullable: true})
13238
- ErrorMessage?: string;
13239
-
13240
- @Field(() => Boolean, {nullable: false})
13241
- Success: boolean;
13242
- }
13243
-
13244
- @Resolver(ResourceFolder_)
13245
- export class ResourceFolderResolver extends ResolverBase {
13246
- @Query(() => RunResourceFolderViewResult)
13247
- async RunResourceFolderViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
13248
- return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
13249
- }
13250
-
13251
- @Query(() => RunResourceFolderViewResult)
13252
- async RunResourceFolderViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
13253
- return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
13254
- }
13255
-
13256
- @Query(() => RunResourceFolderViewResult)
13257
- async RunResourceFolderDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
13258
- input.EntityName = 'Resource Folders';
13259
- return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
13260
- }
13261
- @Query(() => ResourceFolder_, { nullable: true })
13262
- async ResourceFolder(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ResourceFolder_ | null> {
13263
- this.CheckUserReadPermissions('Resource Folders', userPayload);
13264
- const sSQL = `SELECT * FROM [admin].[vwResourceFolders] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
13265
- const result = this.MapFieldNamesToCodeNames('Resource Folders', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
13266
- return result;
13267
- }
13268
-
13269
- @FieldResolver(() => [ResourceFolder_])
13270
- async ResourceFoldersArray(@Root() resourcefolder_: ResourceFolder_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
13271
- this.CheckUserReadPermissions('Resource Folders', userPayload);
13272
- const sSQL = `SELECT * FROM [admin].[vwResourceFolders] WHERE [ParentID]=${resourcefolder_.ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
13273
- const result = this.ArrayMapFieldNamesToCodeNames('Resource Folders', await dataSource.query(sSQL));
13274
- return result;
13275
- }
13276
-
13277
- @Mutation(() => ResourceFolder_)
13278
- async CreateResourceFolder(
13279
- @Arg('input', () => CreateResourceFolderInput) input: CreateResourceFolderInput,
13280
- @Ctx() { dataSource, userPayload }: AppContext,
13281
- @PubSub() pubSub: PubSubEngine
13282
- ) {
13283
- if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
13284
- const entityObject = <ResourceFolderEntity>await new Metadata().GetEntityObject('Resource Folders', this.GetUserFromPayload(userPayload));
13285
- await entityObject.NewRecord();
13286
- entityObject.SetMany(input);
13287
- if (await entityObject.Save()) {
13288
- // save worked, fire the AfterCreate event and then return all the data
13289
- await this.AfterCreate(dataSource, input); // fire event
13290
- return entityObject.GetAll();
13291
- }
13292
- else
13293
- // save failed, return null
13294
- return null;
13295
- }
13296
- else
13297
- return null;
13298
- }
13299
-
13300
- // Before/After CREATE Event Hooks for Sub-Classes to Override
13301
- protected async BeforeCreate(dataSource: DataSource, input: CreateResourceFolderInput): Promise<boolean> {
13302
- return true;
13303
- }
13304
- protected async AfterCreate(dataSource: DataSource, input: CreateResourceFolderInput) {
13305
- }
13306
-
13307
- @Mutation(() => ResourceFolder_)
13308
- async UpdateResourceFolder(
13309
- @Arg('input', () => UpdateResourceFolderInput) input: UpdateResourceFolderInput,
13310
- @Ctx() { dataSource, userPayload }: AppContext,
13311
- @PubSub() pubSub: PubSubEngine
13312
- ) {
13313
- if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
13314
- const entityObject = <ResourceFolderEntity>await new Metadata().GetEntityObject('Resource Folders', this.GetUserFromPayload(userPayload));
13315
- entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Resource Folders
13316
-
13317
- if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
13318
- // save worked, fire afterevent and return all the data
13319
- await this.AfterUpdate(dataSource, input); // fire event
13320
- return entityObject.GetAll();
13321
- }
13322
- else
13323
- return null; // save failed, return null
13324
- }
13325
- else
13326
- return null;
13327
- }
13328
-
13329
- // Before/After UPDATE Event Hooks for Sub-Classes to Override
13330
- protected async BeforeUpdate(dataSource: DataSource, input: UpdateResourceFolderInput): Promise<boolean> {
13331
- const i = input, d = dataSource; // prevent error
13332
- return true;
13333
- }
13334
- protected async AfterUpdate(dataSource: DataSource, input: UpdateResourceFolderInput) {
13335
- const i = input, d = dataSource; // prevent error
13336
- }
13337
-
13338
- }
13339
-
13340
13142
  //****************************************************************************
13341
13143
  // ENTITY CLASS for Schema Info
13342
13144
  //****************************************************************************
@@ -16528,6 +16330,9 @@ export class DataContext_ {
16528
16330
  @Field(() => [DataContextItem_])
16529
16331
  DataContextItemsArray: DataContextItem_[]; // Link to DataContextItems
16530
16332
 
16333
+ @Field(() => [Report_])
16334
+ ReportsArray: Report_[]; // Link to Reports
16335
+
16531
16336
  }
16532
16337
 
16533
16338
  //****************************************************************************
@@ -16629,6 +16434,14 @@ export class DataContextResolver extends ResolverBase {
16629
16434
  const result = this.ArrayMapFieldNamesToCodeNames('Data Context Items', await dataSource.query(sSQL));
16630
16435
  return result;
16631
16436
  }
16437
+
16438
+ @FieldResolver(() => [Report_])
16439
+ async ReportsArray(@Root() datacontext_: DataContext_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16440
+ this.CheckUserReadPermissions('Reports', userPayload);
16441
+ const sSQL = `SELECT * FROM [admin].[vwReports] WHERE [DataContextID]=${datacontext_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
16442
+ const result = this.ArrayMapFieldNamesToCodeNames('Reports', await dataSource.query(sSQL));
16443
+ return result;
16444
+ }
16632
16445
 
16633
16446
  @Mutation(() => DataContext_)
16634
16447
  async CreateDataContext(
@@ -16691,4 +16504,616 @@ export class DataContextResolver extends ResolverBase {
16691
16504
  const i = input, d = dataSource; // prevent error
16692
16505
  }
16693
16506
 
16507
+ }
16508
+
16509
+ //****************************************************************************
16510
+ // ENTITY CLASS for User View Categories
16511
+ //****************************************************************************
16512
+ @ObjectType()
16513
+ export class UserViewCategory_ {
16514
+ @Field(() => Int)
16515
+ ID: number;
16516
+
16517
+ @Field()
16518
+ @MaxLength(200)
16519
+ Name: string;
16520
+
16521
+ @Field({nullable: true})
16522
+ Description?: string;
16523
+
16524
+ @Field(() => Int, {nullable: true})
16525
+ ParentID?: number;
16526
+
16527
+ @Field()
16528
+ @MaxLength(8)
16529
+ CreatedAt: Date;
16530
+
16531
+ @Field()
16532
+ @MaxLength(8)
16533
+ UpdatedAt: Date;
16534
+
16535
+ @Field({nullable: true})
16536
+ @MaxLength(200)
16537
+ Parent?: string;
16538
+
16539
+ @Field(() => [UserViewCategory_])
16540
+ UserViewCategoriesArray: UserViewCategory_[]; // Link to UserViewCategories
16541
+
16542
+ @Field(() => [UserView_])
16543
+ UserViewsArray: UserView_[]; // Link to UserViews
16544
+
16545
+ }
16546
+
16547
+ //****************************************************************************
16548
+ // INPUT TYPE for User View Categories
16549
+ //****************************************************************************
16550
+ @InputType()
16551
+ export class CreateUserViewCategoryInput {
16552
+ @Field()
16553
+ Name: string;
16554
+
16555
+ @Field({ nullable: true })
16556
+ Description: string;
16557
+
16558
+ @Field(() => Int, { nullable: true })
16559
+ ParentID: number;
16560
+ }
16561
+
16562
+
16563
+ //****************************************************************************
16564
+ // INPUT TYPE for User View Categories
16565
+ //****************************************************************************
16566
+ @InputType()
16567
+ export class UpdateUserViewCategoryInput {
16568
+ @Field(() => Int, )
16569
+ ID: number;
16570
+
16571
+ @Field()
16572
+ Name: string;
16573
+
16574
+ @Field({ nullable: true })
16575
+ Description: string;
16576
+
16577
+ @Field(() => Int, { nullable: true })
16578
+ ParentID: number;
16579
+ }
16580
+
16581
+ //****************************************************************************
16582
+ // RESOLVER for User View Categories
16583
+ //****************************************************************************
16584
+ @ObjectType()
16585
+ export class RunUserViewCategoryViewResult {
16586
+ @Field(() => [UserViewCategory_])
16587
+ Results: UserViewCategory_[];
16588
+
16589
+ @Field(() => Int, {nullable: true})
16590
+ UserViewRunID?: number;
16591
+
16592
+ @Field(() => Int, {nullable: true})
16593
+ RowCount: number;
16594
+
16595
+ @Field(() => Int, {nullable: true})
16596
+ TotalRowCount: number;
16597
+
16598
+ @Field(() => Int, {nullable: true})
16599
+ ExecutionTime: number;
16600
+
16601
+ @Field({nullable: true})
16602
+ ErrorMessage?: string;
16603
+
16604
+ @Field(() => Boolean, {nullable: false})
16605
+ Success: boolean;
16606
+ }
16607
+
16608
+ @Resolver(UserViewCategory_)
16609
+ export class UserViewCategoryResolver extends ResolverBase {
16610
+ @Query(() => RunUserViewCategoryViewResult)
16611
+ async RunUserViewCategoryViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16612
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
16613
+ }
16614
+
16615
+ @Query(() => RunUserViewCategoryViewResult)
16616
+ async RunUserViewCategoryViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16617
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
16618
+ }
16619
+
16620
+ @Query(() => RunUserViewCategoryViewResult)
16621
+ async RunUserViewCategoryDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16622
+ input.EntityName = 'User View Categories';
16623
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
16624
+ }
16625
+ @Query(() => UserViewCategory_, { nullable: true })
16626
+ async UserViewCategory(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<UserViewCategory_ | null> {
16627
+ this.CheckUserReadPermissions('User View Categories', userPayload);
16628
+ const sSQL = `SELECT * FROM [admin].[vwUserViewCategories] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('User View Categories', userPayload, EntityPermissionType.Read, 'AND');
16629
+ const result = this.MapFieldNamesToCodeNames('User View Categories', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
16630
+ return result;
16631
+ }
16632
+
16633
+ @FieldResolver(() => [UserViewCategory_])
16634
+ async UserViewCategoriesArray(@Root() userviewcategory_: UserViewCategory_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16635
+ this.CheckUserReadPermissions('User View Categories', userPayload);
16636
+ const sSQL = `SELECT * FROM [admin].[vwUserViewCategories] WHERE [ParentID]=${userviewcategory_.ID} ` + this.getRowLevelSecurityWhereClause('User View Categories', userPayload, EntityPermissionType.Read, 'AND');
16637
+ const result = this.ArrayMapFieldNamesToCodeNames('User View Categories', await dataSource.query(sSQL));
16638
+ return result;
16639
+ }
16640
+
16641
+ @FieldResolver(() => [UserView_])
16642
+ async UserViewsArray(@Root() userviewcategory_: UserViewCategory_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16643
+ this.CheckUserReadPermissions('User Views', userPayload);
16644
+ const sSQL = `SELECT * FROM [admin].[vwUserViews] WHERE [CategoryID]=${userviewcategory_.ID} ` + this.getRowLevelSecurityWhereClause('User Views', userPayload, EntityPermissionType.Read, 'AND');
16645
+ const result = this.ArrayMapFieldNamesToCodeNames('User Views', await dataSource.query(sSQL));
16646
+ return result;
16647
+ }
16648
+
16649
+ @Mutation(() => UserViewCategory_)
16650
+ async CreateUserViewCategory(
16651
+ @Arg('input', () => CreateUserViewCategoryInput) input: CreateUserViewCategoryInput,
16652
+ @Ctx() { dataSource, userPayload }: AppContext,
16653
+ @PubSub() pubSub: PubSubEngine
16654
+ ) {
16655
+ if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
16656
+ const entityObject = <UserViewCategoryEntity>await new Metadata().GetEntityObject('User View Categories', this.GetUserFromPayload(userPayload));
16657
+ await entityObject.NewRecord();
16658
+ entityObject.SetMany(input);
16659
+ if (await entityObject.Save()) {
16660
+ // save worked, fire the AfterCreate event and then return all the data
16661
+ await this.AfterCreate(dataSource, input); // fire event
16662
+ return entityObject.GetAll();
16663
+ }
16664
+ else
16665
+ // save failed, return null
16666
+ return null;
16667
+ }
16668
+ else
16669
+ return null;
16670
+ }
16671
+
16672
+ // Before/After CREATE Event Hooks for Sub-Classes to Override
16673
+ protected async BeforeCreate(dataSource: DataSource, input: CreateUserViewCategoryInput): Promise<boolean> {
16674
+ return true;
16675
+ }
16676
+ protected async AfterCreate(dataSource: DataSource, input: CreateUserViewCategoryInput) {
16677
+ }
16678
+
16679
+ @Mutation(() => UserViewCategory_)
16680
+ async UpdateUserViewCategory(
16681
+ @Arg('input', () => UpdateUserViewCategoryInput) input: UpdateUserViewCategoryInput,
16682
+ @Ctx() { dataSource, userPayload }: AppContext,
16683
+ @PubSub() pubSub: PubSubEngine
16684
+ ) {
16685
+ if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
16686
+ const entityObject = <UserViewCategoryEntity>await new Metadata().GetEntityObject('User View Categories', this.GetUserFromPayload(userPayload));
16687
+ entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for User View Categories
16688
+
16689
+ if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
16690
+ // save worked, fire afterevent and return all the data
16691
+ await this.AfterUpdate(dataSource, input); // fire event
16692
+ return entityObject.GetAll();
16693
+ }
16694
+ else
16695
+ return null; // save failed, return null
16696
+ }
16697
+ else
16698
+ return null;
16699
+ }
16700
+
16701
+ // Before/After UPDATE Event Hooks for Sub-Classes to Override
16702
+ protected async BeforeUpdate(dataSource: DataSource, input: UpdateUserViewCategoryInput): Promise<boolean> {
16703
+ const i = input, d = dataSource; // prevent error
16704
+ return true;
16705
+ }
16706
+ protected async AfterUpdate(dataSource: DataSource, input: UpdateUserViewCategoryInput) {
16707
+ const i = input, d = dataSource; // prevent error
16708
+ }
16709
+
16710
+ }
16711
+
16712
+ //****************************************************************************
16713
+ // ENTITY CLASS for Dashboard Categories
16714
+ //****************************************************************************
16715
+ @ObjectType()
16716
+ export class DashboardCategory_ {
16717
+ @Field(() => Int)
16718
+ ID: number;
16719
+
16720
+ @Field()
16721
+ @MaxLength(200)
16722
+ Name: string;
16723
+
16724
+ @Field({nullable: true})
16725
+ Description?: string;
16726
+
16727
+ @Field(() => Int, {nullable: true})
16728
+ ParentID?: number;
16729
+
16730
+ @Field()
16731
+ @MaxLength(8)
16732
+ CreatedAt: Date;
16733
+
16734
+ @Field()
16735
+ @MaxLength(8)
16736
+ UpdatedAt: Date;
16737
+
16738
+ @Field({nullable: true})
16739
+ @MaxLength(200)
16740
+ Parent?: string;
16741
+
16742
+ @Field(() => [Dashboard_])
16743
+ DashboardsArray: Dashboard_[]; // Link to Dashboards
16744
+
16745
+ @Field(() => [DashboardCategory_])
16746
+ DashboardCategoriesArray: DashboardCategory_[]; // Link to DashboardCategories
16747
+
16748
+ }
16749
+
16750
+ //****************************************************************************
16751
+ // INPUT TYPE for Dashboard Categories
16752
+ //****************************************************************************
16753
+ @InputType()
16754
+ export class CreateDashboardCategoryInput {
16755
+ @Field(() => Int, )
16756
+ ID: number;
16757
+
16758
+ @Field()
16759
+ Name: string;
16760
+
16761
+ @Field({ nullable: true })
16762
+ Description: string;
16763
+
16764
+ @Field(() => Int, { nullable: true })
16765
+ ParentID: number;
16766
+ }
16767
+
16768
+
16769
+ //****************************************************************************
16770
+ // INPUT TYPE for Dashboard Categories
16771
+ //****************************************************************************
16772
+ @InputType()
16773
+ export class UpdateDashboardCategoryInput {
16774
+ @Field(() => Int, )
16775
+ ID: number;
16776
+
16777
+ @Field()
16778
+ Name: string;
16779
+
16780
+ @Field({ nullable: true })
16781
+ Description: string;
16782
+
16783
+ @Field(() => Int, { nullable: true })
16784
+ ParentID: number;
16785
+ }
16786
+
16787
+ //****************************************************************************
16788
+ // RESOLVER for Dashboard Categories
16789
+ //****************************************************************************
16790
+ @ObjectType()
16791
+ export class RunDashboardCategoryViewResult {
16792
+ @Field(() => [DashboardCategory_])
16793
+ Results: DashboardCategory_[];
16794
+
16795
+ @Field(() => Int, {nullable: true})
16796
+ UserViewRunID?: number;
16797
+
16798
+ @Field(() => Int, {nullable: true})
16799
+ RowCount: number;
16800
+
16801
+ @Field(() => Int, {nullable: true})
16802
+ TotalRowCount: number;
16803
+
16804
+ @Field(() => Int, {nullable: true})
16805
+ ExecutionTime: number;
16806
+
16807
+ @Field({nullable: true})
16808
+ ErrorMessage?: string;
16809
+
16810
+ @Field(() => Boolean, {nullable: false})
16811
+ Success: boolean;
16812
+ }
16813
+
16814
+ @Resolver(DashboardCategory_)
16815
+ export class DashboardCategoryResolver extends ResolverBase {
16816
+ @Query(() => RunDashboardCategoryViewResult)
16817
+ async RunDashboardCategoryViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16818
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
16819
+ }
16820
+
16821
+ @Query(() => RunDashboardCategoryViewResult)
16822
+ async RunDashboardCategoryViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16823
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
16824
+ }
16825
+
16826
+ @Query(() => RunDashboardCategoryViewResult)
16827
+ async RunDashboardCategoryDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16828
+ input.EntityName = 'Dashboard Categories';
16829
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
16830
+ }
16831
+ @Query(() => DashboardCategory_, { nullable: true })
16832
+ async DashboardCategory(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<DashboardCategory_ | null> {
16833
+ this.CheckUserReadPermissions('Dashboard Categories', userPayload);
16834
+ const sSQL = `SELECT * FROM [admin].[vwDashboardCategories] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Dashboard Categories', userPayload, EntityPermissionType.Read, 'AND');
16835
+ const result = this.MapFieldNamesToCodeNames('Dashboard Categories', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
16836
+ return result;
16837
+ }
16838
+
16839
+ @FieldResolver(() => [Dashboard_])
16840
+ async DashboardsArray(@Root() dashboardcategory_: DashboardCategory_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16841
+ this.CheckUserReadPermissions('Dashboards', userPayload);
16842
+ const sSQL = `SELECT * FROM [admin].[vwDashboards] WHERE [CategoryID]=${dashboardcategory_.ID} ` + this.getRowLevelSecurityWhereClause('Dashboards', userPayload, EntityPermissionType.Read, 'AND');
16843
+ const result = this.ArrayMapFieldNamesToCodeNames('Dashboards', await dataSource.query(sSQL));
16844
+ return result;
16845
+ }
16846
+
16847
+ @FieldResolver(() => [DashboardCategory_])
16848
+ async DashboardCategoriesArray(@Root() dashboardcategory_: DashboardCategory_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
16849
+ this.CheckUserReadPermissions('Dashboard Categories', userPayload);
16850
+ const sSQL = `SELECT * FROM [admin].[vwDashboardCategories] WHERE [ParentID]=${dashboardcategory_.ID} ` + this.getRowLevelSecurityWhereClause('Dashboard Categories', userPayload, EntityPermissionType.Read, 'AND');
16851
+ const result = this.ArrayMapFieldNamesToCodeNames('Dashboard Categories', await dataSource.query(sSQL));
16852
+ return result;
16853
+ }
16854
+
16855
+ @Mutation(() => DashboardCategory_)
16856
+ async CreateDashboardCategory(
16857
+ @Arg('input', () => CreateDashboardCategoryInput) input: CreateDashboardCategoryInput,
16858
+ @Ctx() { dataSource, userPayload }: AppContext,
16859
+ @PubSub() pubSub: PubSubEngine
16860
+ ) {
16861
+ if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
16862
+ const entityObject = <DashboardCategoryEntity>await new Metadata().GetEntityObject('Dashboard Categories', this.GetUserFromPayload(userPayload));
16863
+ await entityObject.NewRecord();
16864
+ entityObject.SetMany(input);
16865
+ if (await entityObject.Save()) {
16866
+ // save worked, fire the AfterCreate event and then return all the data
16867
+ await this.AfterCreate(dataSource, input); // fire event
16868
+ return entityObject.GetAll();
16869
+ }
16870
+ else
16871
+ // save failed, return null
16872
+ return null;
16873
+ }
16874
+ else
16875
+ return null;
16876
+ }
16877
+
16878
+ // Before/After CREATE Event Hooks for Sub-Classes to Override
16879
+ protected async BeforeCreate(dataSource: DataSource, input: CreateDashboardCategoryInput): Promise<boolean> {
16880
+ return true;
16881
+ }
16882
+ protected async AfterCreate(dataSource: DataSource, input: CreateDashboardCategoryInput) {
16883
+ }
16884
+
16885
+ @Mutation(() => DashboardCategory_)
16886
+ async UpdateDashboardCategory(
16887
+ @Arg('input', () => UpdateDashboardCategoryInput) input: UpdateDashboardCategoryInput,
16888
+ @Ctx() { dataSource, userPayload }: AppContext,
16889
+ @PubSub() pubSub: PubSubEngine
16890
+ ) {
16891
+ if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
16892
+ const entityObject = <DashboardCategoryEntity>await new Metadata().GetEntityObject('Dashboard Categories', this.GetUserFromPayload(userPayload));
16893
+ entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Dashboard Categories
16894
+
16895
+ if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
16896
+ // save worked, fire afterevent and return all the data
16897
+ await this.AfterUpdate(dataSource, input); // fire event
16898
+ return entityObject.GetAll();
16899
+ }
16900
+ else
16901
+ return null; // save failed, return null
16902
+ }
16903
+ else
16904
+ return null;
16905
+ }
16906
+
16907
+ // Before/After UPDATE Event Hooks for Sub-Classes to Override
16908
+ protected async BeforeUpdate(dataSource: DataSource, input: UpdateDashboardCategoryInput): Promise<boolean> {
16909
+ const i = input, d = dataSource; // prevent error
16910
+ return true;
16911
+ }
16912
+ protected async AfterUpdate(dataSource: DataSource, input: UpdateDashboardCategoryInput) {
16913
+ const i = input, d = dataSource; // prevent error
16914
+ }
16915
+
16916
+ }
16917
+
16918
+ //****************************************************************************
16919
+ // ENTITY CLASS for Report Categories
16920
+ //****************************************************************************
16921
+ @ObjectType()
16922
+ export class ReportCategory_ {
16923
+ @Field(() => Int)
16924
+ ID: number;
16925
+
16926
+ @Field()
16927
+ @MaxLength(200)
16928
+ Name: string;
16929
+
16930
+ @Field({nullable: true})
16931
+ Description?: string;
16932
+
16933
+ @Field(() => Int)
16934
+ ParentID: number;
16935
+
16936
+ @Field()
16937
+ @MaxLength(8)
16938
+ CreatedAt: Date;
16939
+
16940
+ @Field()
16941
+ @MaxLength(8)
16942
+ UpdatedAt: Date;
16943
+
16944
+ @Field()
16945
+ @MaxLength(200)
16946
+ Parent: string;
16947
+
16948
+ @Field(() => [ReportCategory_])
16949
+ ReportCategoriesArray: ReportCategory_[]; // Link to ReportCategories
16950
+
16951
+ @Field(() => [Report_])
16952
+ ReportsArray: Report_[]; // Link to Reports
16953
+
16954
+ }
16955
+
16956
+ //****************************************************************************
16957
+ // INPUT TYPE for Report Categories
16958
+ //****************************************************************************
16959
+ @InputType()
16960
+ export class CreateReportCategoryInput {
16961
+ @Field()
16962
+ Name: string;
16963
+
16964
+ @Field({ nullable: true })
16965
+ Description: string;
16966
+
16967
+ @Field(() => Int, )
16968
+ ParentID: number;
16969
+ }
16970
+
16971
+
16972
+ //****************************************************************************
16973
+ // INPUT TYPE for Report Categories
16974
+ //****************************************************************************
16975
+ @InputType()
16976
+ export class UpdateReportCategoryInput {
16977
+ @Field(() => Int, )
16978
+ ID: number;
16979
+
16980
+ @Field()
16981
+ Name: string;
16982
+
16983
+ @Field({ nullable: true })
16984
+ Description: string;
16985
+
16986
+ @Field(() => Int, )
16987
+ ParentID: number;
16988
+ }
16989
+
16990
+ //****************************************************************************
16991
+ // RESOLVER for Report Categories
16992
+ //****************************************************************************
16993
+ @ObjectType()
16994
+ export class RunReportCategoryViewResult {
16995
+ @Field(() => [ReportCategory_])
16996
+ Results: ReportCategory_[];
16997
+
16998
+ @Field(() => Int, {nullable: true})
16999
+ UserViewRunID?: number;
17000
+
17001
+ @Field(() => Int, {nullable: true})
17002
+ RowCount: number;
17003
+
17004
+ @Field(() => Int, {nullable: true})
17005
+ TotalRowCount: number;
17006
+
17007
+ @Field(() => Int, {nullable: true})
17008
+ ExecutionTime: number;
17009
+
17010
+ @Field({nullable: true})
17011
+ ErrorMessage?: string;
17012
+
17013
+ @Field(() => Boolean, {nullable: false})
17014
+ Success: boolean;
17015
+ }
17016
+
17017
+ @Resolver(ReportCategory_)
17018
+ export class ReportCategoryResolver extends ResolverBase {
17019
+ @Query(() => RunReportCategoryViewResult)
17020
+ async RunReportCategoryViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
17021
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
17022
+ }
17023
+
17024
+ @Query(() => RunReportCategoryViewResult)
17025
+ async RunReportCategoryViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
17026
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
17027
+ }
17028
+
17029
+ @Query(() => RunReportCategoryViewResult)
17030
+ async RunReportCategoryDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
17031
+ input.EntityName = 'Report Categories';
17032
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
17033
+ }
17034
+ @Query(() => ReportCategory_, { nullable: true })
17035
+ async ReportCategory(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ReportCategory_ | null> {
17036
+ this.CheckUserReadPermissions('Report Categories', userPayload);
17037
+ const sSQL = `SELECT * FROM [admin].[vwReportCategories] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Report Categories', userPayload, EntityPermissionType.Read, 'AND');
17038
+ const result = this.MapFieldNamesToCodeNames('Report Categories', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
17039
+ return result;
17040
+ }
17041
+
17042
+ @FieldResolver(() => [ReportCategory_])
17043
+ async ReportCategoriesArray(@Root() reportcategory_: ReportCategory_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
17044
+ this.CheckUserReadPermissions('Report Categories', userPayload);
17045
+ const sSQL = `SELECT * FROM [admin].[vwReportCategories] WHERE [ParentID]=${reportcategory_.ID} ` + this.getRowLevelSecurityWhereClause('Report Categories', userPayload, EntityPermissionType.Read, 'AND');
17046
+ const result = this.ArrayMapFieldNamesToCodeNames('Report Categories', await dataSource.query(sSQL));
17047
+ return result;
17048
+ }
17049
+
17050
+ @FieldResolver(() => [Report_])
17051
+ async ReportsArray(@Root() reportcategory_: ReportCategory_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
17052
+ this.CheckUserReadPermissions('Reports', userPayload);
17053
+ const sSQL = `SELECT * FROM [admin].[vwReports] WHERE [CategoryID]=${reportcategory_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
17054
+ const result = this.ArrayMapFieldNamesToCodeNames('Reports', await dataSource.query(sSQL));
17055
+ return result;
17056
+ }
17057
+
17058
+ @Mutation(() => ReportCategory_)
17059
+ async CreateReportCategory(
17060
+ @Arg('input', () => CreateReportCategoryInput) input: CreateReportCategoryInput,
17061
+ @Ctx() { dataSource, userPayload }: AppContext,
17062
+ @PubSub() pubSub: PubSubEngine
17063
+ ) {
17064
+ if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
17065
+ const entityObject = <ReportCategoryEntity>await new Metadata().GetEntityObject('Report Categories', this.GetUserFromPayload(userPayload));
17066
+ await entityObject.NewRecord();
17067
+ entityObject.SetMany(input);
17068
+ if (await entityObject.Save()) {
17069
+ // save worked, fire the AfterCreate event and then return all the data
17070
+ await this.AfterCreate(dataSource, input); // fire event
17071
+ return entityObject.GetAll();
17072
+ }
17073
+ else
17074
+ // save failed, return null
17075
+ return null;
17076
+ }
17077
+ else
17078
+ return null;
17079
+ }
17080
+
17081
+ // Before/After CREATE Event Hooks for Sub-Classes to Override
17082
+ protected async BeforeCreate(dataSource: DataSource, input: CreateReportCategoryInput): Promise<boolean> {
17083
+ return true;
17084
+ }
17085
+ protected async AfterCreate(dataSource: DataSource, input: CreateReportCategoryInput) {
17086
+ }
17087
+
17088
+ @Mutation(() => ReportCategory_)
17089
+ async UpdateReportCategory(
17090
+ @Arg('input', () => UpdateReportCategoryInput) input: UpdateReportCategoryInput,
17091
+ @Ctx() { dataSource, userPayload }: AppContext,
17092
+ @PubSub() pubSub: PubSubEngine
17093
+ ) {
17094
+ if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
17095
+ const entityObject = <ReportCategoryEntity>await new Metadata().GetEntityObject('Report Categories', this.GetUserFromPayload(userPayload));
17096
+ entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Report Categories
17097
+
17098
+ if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
17099
+ // save worked, fire afterevent and return all the data
17100
+ await this.AfterUpdate(dataSource, input); // fire event
17101
+ return entityObject.GetAll();
17102
+ }
17103
+ else
17104
+ return null; // save failed, return null
17105
+ }
17106
+ else
17107
+ return null;
17108
+ }
17109
+
17110
+ // Before/After UPDATE Event Hooks for Sub-Classes to Override
17111
+ protected async BeforeUpdate(dataSource: DataSource, input: UpdateReportCategoryInput): Promise<boolean> {
17112
+ const i = input, d = dataSource; // prevent error
17113
+ return true;
17114
+ }
17115
+ protected async AfterUpdate(dataSource: DataSource, input: UpdateReportCategoryInput) {
17116
+ const i = input, d = dataSource; // prevent error
17117
+ }
17118
+
16694
17119
  }