@memberjunction/server 0.9.110 → 0.9.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.log.json +6 -0
- package/dist/generated/generated.js +705 -552
- package/dist/generated/generated.js.map +1 -1
- package/package.json +3 -3
- package/src/generated/generated.ts +807 -723
|
@@ -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: 1/
|
|
5
|
+
* GENERATED: 1/16/2024, 8:55:25 PM
|
|
6
6
|
*
|
|
7
7
|
* >>> DO NOT MODIFY THIS FILE!!!!!!!!!!!!
|
|
8
8
|
* >>> YOUR CHANGES WILL BE OVERWRITTEN
|
|
@@ -17,6 +17,8 @@ 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 } from '@memberjunction/core-entities';
|
|
21
|
+
|
|
20
22
|
|
|
21
23
|
//****************************************************************************
|
|
22
24
|
// ENTITY CLASS for Companies
|
|
@@ -155,40 +157,44 @@ export class CompanyResolver extends ResolverBase {
|
|
|
155
157
|
input.EntityName = 'Companies';
|
|
156
158
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
157
159
|
}
|
|
158
|
-
|
|
159
160
|
@Query(() => Company_, { nullable: true })
|
|
160
161
|
async Company(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Company_ | null> {
|
|
161
162
|
this.CheckUserReadPermissions('Companies', userPayload);
|
|
162
|
-
const sSQL = `SELECT * FROM [admin].vwCompanies WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Companies', userPayload, EntityPermissionType.Read, 'AND');
|
|
163
|
-
|
|
163
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanies] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Companies', userPayload, EntityPermissionType.Read, 'AND');
|
|
164
|
+
const result = this.MapFieldNamesToCodeNames('Companies', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
165
|
+
return result;
|
|
164
166
|
}
|
|
165
167
|
|
|
166
168
|
@Query(() => [Company_])
|
|
167
|
-
AllCompanies(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
169
|
+
async AllCompanies(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
168
170
|
this.CheckUserReadPermissions('Companies', userPayload);
|
|
169
|
-
const sSQL = 'SELECT * FROM [admin].vwCompanies' + this.getRowLevelSecurityWhereClause('Companies', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
170
|
-
|
|
171
|
+
const sSQL = 'SELECT * FROM [admin].[vwCompanies]' + this.getRowLevelSecurityWhereClause('Companies', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
172
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Companies', await dataSource.query(sSQL));
|
|
173
|
+
return result;
|
|
171
174
|
}
|
|
172
175
|
|
|
173
176
|
@FieldResolver(() => [Employee_])
|
|
174
177
|
async EmployeesArray(@Root() company_: Company_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
175
178
|
this.CheckUserReadPermissions('Employees', userPayload);
|
|
176
|
-
const sSQL = `SELECT * FROM [admin].[vwEmployees] WHERE CompanyID=${company_.ID} ` + this.getRowLevelSecurityWhereClause('Employees', userPayload, EntityPermissionType.Read, 'AND');
|
|
177
|
-
|
|
179
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployees] WHERE [CompanyID]=${company_.ID} ` + this.getRowLevelSecurityWhereClause('Employees', userPayload, EntityPermissionType.Read, 'AND');
|
|
180
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Employees', await dataSource.query(sSQL));
|
|
181
|
+
return result;
|
|
178
182
|
}
|
|
179
183
|
|
|
180
184
|
@FieldResolver(() => [CompanyIntegration_])
|
|
181
185
|
async CompanyIntegrationsArray(@Root() company_: Company_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
182
186
|
this.CheckUserReadPermissions('Company Integrations', userPayload);
|
|
183
|
-
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrations] WHERE CompanyName=${company_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
184
|
-
|
|
187
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrations] WHERE [CompanyName]=${company_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
188
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Company Integrations', await dataSource.query(sSQL));
|
|
189
|
+
return result;
|
|
185
190
|
}
|
|
186
191
|
|
|
187
192
|
@FieldResolver(() => [Workflow_])
|
|
188
193
|
async WorkflowsArray(@Root() company_: Company_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
189
194
|
this.CheckUserReadPermissions('Workflows', userPayload);
|
|
190
|
-
const sSQL = `SELECT * FROM [admin].[vwWorkflows] WHERE CompanyName=${company_.ID} ` + this.getRowLevelSecurityWhereClause('Workflows', userPayload, EntityPermissionType.Read, 'AND');
|
|
191
|
-
|
|
195
|
+
const sSQL = `SELECT * FROM [admin].[vwWorkflows] WHERE [CompanyName]=${company_.ID} ` + this.getRowLevelSecurityWhereClause('Workflows', userPayload, EntityPermissionType.Read, 'AND');
|
|
196
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Workflows', await dataSource.query(sSQL));
|
|
197
|
+
return result;
|
|
192
198
|
}
|
|
193
199
|
|
|
194
200
|
@Mutation(() => Company_)
|
|
@@ -198,7 +204,7 @@ export class CompanyResolver extends ResolverBase {
|
|
|
198
204
|
@PubSub() pubSub: PubSubEngine
|
|
199
205
|
) {
|
|
200
206
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
201
|
-
const entityObject = await new Metadata().GetEntityObject('Companies', this.GetUserFromPayload(userPayload));
|
|
207
|
+
const entityObject = <CompanyEntity>await new Metadata().GetEntityObject('Companies', this.GetUserFromPayload(userPayload));
|
|
202
208
|
await entityObject.NewRecord();
|
|
203
209
|
entityObject.SetMany(input);
|
|
204
210
|
if (await entityObject.Save()) {
|
|
@@ -216,11 +222,9 @@ export class CompanyResolver extends ResolverBase {
|
|
|
216
222
|
|
|
217
223
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
218
224
|
protected async BeforeCreate(dataSource: DataSource, input: CreateCompanyInput): Promise<boolean> {
|
|
219
|
-
const i = input, d = dataSource; // prevent error
|
|
220
225
|
return true;
|
|
221
226
|
}
|
|
222
227
|
protected async AfterCreate(dataSource: DataSource, input: CreateCompanyInput) {
|
|
223
|
-
const i = input, d = dataSource; // prevent error
|
|
224
228
|
}
|
|
225
229
|
|
|
226
230
|
@Mutation(() => Company_)
|
|
@@ -230,7 +234,7 @@ export class CompanyResolver extends ResolverBase {
|
|
|
230
234
|
@PubSub() pubSub: PubSubEngine
|
|
231
235
|
) {
|
|
232
236
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
233
|
-
const entityObject = await new Metadata().GetEntityObject('Companies', this.GetUserFromPayload(userPayload));
|
|
237
|
+
const entityObject = <CompanyEntity>await new Metadata().GetEntityObject('Companies', this.GetUserFromPayload(userPayload));
|
|
234
238
|
await entityObject.Load(input.ID) // Track Changes is turned on, so we need to get the latest data from DB first before we save
|
|
235
239
|
entityObject.SetMany(input);
|
|
236
240
|
if (await entityObject.Save()) {
|
|
@@ -254,14 +258,15 @@ export class CompanyResolver extends ResolverBase {
|
|
|
254
258
|
const i = input, d = dataSource; // prevent error
|
|
255
259
|
}
|
|
256
260
|
|
|
257
|
-
@Mutation(() =>
|
|
261
|
+
@Mutation(() => Company_)
|
|
258
262
|
async DeleteCompany(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
259
263
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
260
|
-
const entityObject = await new Metadata().GetEntityObject('Companies', this.GetUserFromPayload(userPayload));
|
|
261
|
-
await entityObject.Load(ID)
|
|
264
|
+
const entityObject = <CompanyEntity>await new Metadata().GetEntityObject('Companies', this.GetUserFromPayload(userPayload));
|
|
265
|
+
await entityObject.Load(ID);
|
|
266
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
262
267
|
if (await entityObject.Delete()) {
|
|
263
268
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
264
|
-
return
|
|
269
|
+
return returnValue;
|
|
265
270
|
}
|
|
266
271
|
else
|
|
267
272
|
return null; // delete failed, this will cause an exception
|
|
@@ -472,47 +477,52 @@ export class EmployeeResolver extends ResolverBase {
|
|
|
472
477
|
input.EntityName = 'Employees';
|
|
473
478
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
474
479
|
}
|
|
475
|
-
|
|
476
480
|
@Query(() => Employee_, { nullable: true })
|
|
477
481
|
async Employee(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Employee_ | null> {
|
|
478
482
|
this.CheckUserReadPermissions('Employees', userPayload);
|
|
479
|
-
const sSQL = `SELECT * FROM [admin].vwEmployees WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Employees', userPayload, EntityPermissionType.Read, 'AND');
|
|
480
|
-
|
|
483
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployees] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Employees', userPayload, EntityPermissionType.Read, 'AND');
|
|
484
|
+
const result = this.MapFieldNamesToCodeNames('Employees', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
485
|
+
return result;
|
|
481
486
|
}
|
|
482
487
|
|
|
483
488
|
@Query(() => [Employee_])
|
|
484
|
-
AllEmployees(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
489
|
+
async AllEmployees(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
485
490
|
this.CheckUserReadPermissions('Employees', userPayload);
|
|
486
|
-
const sSQL = 'SELECT * FROM [admin].vwEmployees' + this.getRowLevelSecurityWhereClause('Employees', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
487
|
-
|
|
491
|
+
const sSQL = 'SELECT * FROM [admin].[vwEmployees]' + this.getRowLevelSecurityWhereClause('Employees', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
492
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Employees', await dataSource.query(sSQL));
|
|
493
|
+
return result;
|
|
488
494
|
}
|
|
489
495
|
|
|
490
496
|
@FieldResolver(() => [Employee_])
|
|
491
497
|
async EmployeesArray(@Root() employee_: Employee_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
492
498
|
this.CheckUserReadPermissions('Employees', userPayload);
|
|
493
|
-
const sSQL = `SELECT * FROM [admin].[vwEmployees] WHERE SupervisorID=${employee_.ID} ` + this.getRowLevelSecurityWhereClause('Employees', userPayload, EntityPermissionType.Read, 'AND');
|
|
494
|
-
|
|
499
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployees] WHERE [SupervisorID]=${employee_.ID} ` + this.getRowLevelSecurityWhereClause('Employees', userPayload, EntityPermissionType.Read, 'AND');
|
|
500
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Employees', await dataSource.query(sSQL));
|
|
501
|
+
return result;
|
|
495
502
|
}
|
|
496
503
|
|
|
497
504
|
@FieldResolver(() => [EmployeeCompanyIntegration_])
|
|
498
505
|
async EmployeeCompanyIntegrationsArray(@Root() employee_: Employee_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
499
506
|
this.CheckUserReadPermissions('Employee Company Integrations', userPayload);
|
|
500
|
-
const sSQL = `SELECT * FROM [admin].[vwEmployeeCompanyIntegrations] WHERE EmployeeID=${employee_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
501
|
-
|
|
507
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployeeCompanyIntegrations] WHERE [EmployeeID]=${employee_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
508
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Employee Company Integrations', await dataSource.query(sSQL));
|
|
509
|
+
return result;
|
|
502
510
|
}
|
|
503
511
|
|
|
504
512
|
@FieldResolver(() => [EmployeeRole_])
|
|
505
513
|
async EmployeeRolesArray(@Root() employee_: Employee_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
506
514
|
this.CheckUserReadPermissions('Employee Roles', userPayload);
|
|
507
|
-
const sSQL = `SELECT * FROM [admin].[vwEmployeeRoles] WHERE EmployeeID=${employee_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
508
|
-
|
|
515
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployeeRoles] WHERE [EmployeeID]=${employee_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
516
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Employee Roles', await dataSource.query(sSQL));
|
|
517
|
+
return result;
|
|
509
518
|
}
|
|
510
519
|
|
|
511
520
|
@FieldResolver(() => [EmployeeSkill_])
|
|
512
521
|
async EmployeeSkillsArray(@Root() employee_: Employee_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
513
522
|
this.CheckUserReadPermissions('Employee Skills', userPayload);
|
|
514
|
-
const sSQL = `SELECT * FROM [admin].[vwEmployeeSkills] WHERE EmployeeID=${employee_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Skills', userPayload, EntityPermissionType.Read, 'AND');
|
|
515
|
-
|
|
523
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployeeSkills] WHERE [EmployeeID]=${employee_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Skills', userPayload, EntityPermissionType.Read, 'AND');
|
|
524
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Employee Skills', await dataSource.query(sSQL));
|
|
525
|
+
return result;
|
|
516
526
|
}
|
|
517
527
|
|
|
518
528
|
@Mutation(() => Employee_)
|
|
@@ -522,7 +532,7 @@ export class EmployeeResolver extends ResolverBase {
|
|
|
522
532
|
@PubSub() pubSub: PubSubEngine
|
|
523
533
|
) {
|
|
524
534
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
525
|
-
const entityObject = await new Metadata().GetEntityObject('Employees', this.GetUserFromPayload(userPayload));
|
|
535
|
+
const entityObject = <EmployeeEntity>await new Metadata().GetEntityObject('Employees', this.GetUserFromPayload(userPayload));
|
|
526
536
|
await entityObject.NewRecord();
|
|
527
537
|
entityObject.SetMany(input);
|
|
528
538
|
if (await entityObject.Save()) {
|
|
@@ -540,11 +550,9 @@ export class EmployeeResolver extends ResolverBase {
|
|
|
540
550
|
|
|
541
551
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
542
552
|
protected async BeforeCreate(dataSource: DataSource, input: CreateEmployeeInput): Promise<boolean> {
|
|
543
|
-
const i = input, d = dataSource; // prevent error
|
|
544
553
|
return true;
|
|
545
554
|
}
|
|
546
555
|
protected async AfterCreate(dataSource: DataSource, input: CreateEmployeeInput) {
|
|
547
|
-
const i = input, d = dataSource; // prevent error
|
|
548
556
|
}
|
|
549
557
|
|
|
550
558
|
@Mutation(() => Employee_)
|
|
@@ -554,7 +562,7 @@ export class EmployeeResolver extends ResolverBase {
|
|
|
554
562
|
@PubSub() pubSub: PubSubEngine
|
|
555
563
|
) {
|
|
556
564
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
557
|
-
const entityObject = await new Metadata().GetEntityObject('Employees', this.GetUserFromPayload(userPayload));
|
|
565
|
+
const entityObject = <EmployeeEntity>await new Metadata().GetEntityObject('Employees', this.GetUserFromPayload(userPayload));
|
|
558
566
|
await entityObject.Load(input.ID) // Track Changes is turned on, so we need to get the latest data from DB first before we save
|
|
559
567
|
entityObject.SetMany(input);
|
|
560
568
|
if (await entityObject.Save()) {
|
|
@@ -578,14 +586,15 @@ export class EmployeeResolver extends ResolverBase {
|
|
|
578
586
|
const i = input, d = dataSource; // prevent error
|
|
579
587
|
}
|
|
580
588
|
|
|
581
|
-
@Mutation(() =>
|
|
589
|
+
@Mutation(() => Employee_)
|
|
582
590
|
async DeleteEmployee(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
583
591
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
584
|
-
const entityObject = await new Metadata().GetEntityObject('Employees', this.GetUserFromPayload(userPayload));
|
|
585
|
-
await entityObject.Load(ID)
|
|
592
|
+
const entityObject = <EmployeeEntity>await new Metadata().GetEntityObject('Employees', this.GetUserFromPayload(userPayload));
|
|
593
|
+
await entityObject.Load(ID);
|
|
594
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
586
595
|
if (await entityObject.Delete()) {
|
|
587
596
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
588
|
-
return
|
|
597
|
+
return returnValue;
|
|
589
598
|
}
|
|
590
599
|
else
|
|
591
600
|
return null; // delete failed, this will cause an exception
|
|
@@ -723,12 +732,12 @@ export class UserFavoriteResolverBase extends ResolverBase {
|
|
|
723
732
|
input.EntityName = 'User Favorites';
|
|
724
733
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
725
734
|
}
|
|
726
|
-
|
|
727
735
|
@Query(() => UserFavorite_, { nullable: true })
|
|
728
736
|
async UserFavorite(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<UserFavorite_ | null> {
|
|
729
737
|
this.CheckUserReadPermissions('User Favorites', userPayload);
|
|
730
|
-
const sSQL = `SELECT * FROM [admin].vwUserFavorites WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('User Favorites', userPayload, EntityPermissionType.Read, 'AND');
|
|
731
|
-
|
|
738
|
+
const sSQL = `SELECT * FROM [admin].[vwUserFavorites] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('User Favorites', userPayload, EntityPermissionType.Read, 'AND');
|
|
739
|
+
const result = this.MapFieldNamesToCodeNames('User Favorites', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
740
|
+
return result;
|
|
732
741
|
}
|
|
733
742
|
|
|
734
743
|
@Mutation(() => UserFavorite_)
|
|
@@ -738,7 +747,7 @@ export class UserFavoriteResolverBase extends ResolverBase {
|
|
|
738
747
|
@PubSub() pubSub: PubSubEngine
|
|
739
748
|
) {
|
|
740
749
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
741
|
-
const entityObject = await new Metadata().GetEntityObject('User Favorites', this.GetUserFromPayload(userPayload));
|
|
750
|
+
const entityObject = <UserFavoriteEntity>await new Metadata().GetEntityObject('User Favorites', this.GetUserFromPayload(userPayload));
|
|
742
751
|
await entityObject.NewRecord();
|
|
743
752
|
entityObject.SetMany(input);
|
|
744
753
|
if (await entityObject.Save()) {
|
|
@@ -756,11 +765,9 @@ export class UserFavoriteResolverBase extends ResolverBase {
|
|
|
756
765
|
|
|
757
766
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
758
767
|
protected async BeforeCreate(dataSource: DataSource, input: CreateUserFavoriteInput): Promise<boolean> {
|
|
759
|
-
const i = input, d = dataSource; // prevent error
|
|
760
768
|
return true;
|
|
761
769
|
}
|
|
762
770
|
protected async AfterCreate(dataSource: DataSource, input: CreateUserFavoriteInput) {
|
|
763
|
-
const i = input, d = dataSource; // prevent error
|
|
764
771
|
}
|
|
765
772
|
|
|
766
773
|
@Mutation(() => UserFavorite_)
|
|
@@ -770,7 +777,7 @@ export class UserFavoriteResolverBase extends ResolverBase {
|
|
|
770
777
|
@PubSub() pubSub: PubSubEngine
|
|
771
778
|
) {
|
|
772
779
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
773
|
-
const entityObject = await new Metadata().GetEntityObject('User Favorites', this.GetUserFromPayload(userPayload));
|
|
780
|
+
const entityObject = <UserFavoriteEntity>await new Metadata().GetEntityObject('User Favorites', this.GetUserFromPayload(userPayload));
|
|
774
781
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for User Favorites
|
|
775
782
|
|
|
776
783
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -794,14 +801,15 @@ export class UserFavoriteResolverBase extends ResolverBase {
|
|
|
794
801
|
const i = input, d = dataSource; // prevent error
|
|
795
802
|
}
|
|
796
803
|
|
|
797
|
-
@Mutation(() =>
|
|
804
|
+
@Mutation(() => UserFavorite_)
|
|
798
805
|
async DeleteUserFavorite(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
799
806
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
800
|
-
const entityObject = await new Metadata().GetEntityObject('User Favorites', this.GetUserFromPayload(userPayload));
|
|
801
|
-
await entityObject.Load(ID)
|
|
807
|
+
const entityObject = <UserFavoriteEntity>await new Metadata().GetEntityObject('User Favorites', this.GetUserFromPayload(userPayload));
|
|
808
|
+
await entityObject.Load(ID);
|
|
809
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
802
810
|
if (await entityObject.Delete()) {
|
|
803
811
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
804
|
-
return
|
|
812
|
+
return returnValue;
|
|
805
813
|
}
|
|
806
814
|
else
|
|
807
815
|
return null; // delete failed, this will cause an exception
|
|
@@ -917,12 +925,12 @@ export class EmployeeCompanyIntegrationResolver extends ResolverBase {
|
|
|
917
925
|
input.EntityName = 'Employee Company Integrations';
|
|
918
926
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
919
927
|
}
|
|
920
|
-
|
|
921
928
|
@Query(() => EmployeeCompanyIntegration_, { nullable: true })
|
|
922
929
|
async EmployeeCompanyIntegration(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EmployeeCompanyIntegration_ | null> {
|
|
923
930
|
this.CheckUserReadPermissions('Employee Company Integrations', userPayload);
|
|
924
|
-
const sSQL = `SELECT * FROM [admin].vwEmployeeCompanyIntegrations WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Employee Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
925
|
-
|
|
931
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployeeCompanyIntegrations] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Employee Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
932
|
+
const result = this.MapFieldNamesToCodeNames('Employee Company Integrations', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
933
|
+
return result;
|
|
926
934
|
}
|
|
927
935
|
|
|
928
936
|
@Mutation(() => EmployeeCompanyIntegration_)
|
|
@@ -932,7 +940,7 @@ export class EmployeeCompanyIntegrationResolver extends ResolverBase {
|
|
|
932
940
|
@PubSub() pubSub: PubSubEngine
|
|
933
941
|
) {
|
|
934
942
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
935
|
-
const entityObject = await new Metadata().GetEntityObject('Employee Company Integrations', this.GetUserFromPayload(userPayload));
|
|
943
|
+
const entityObject = <EmployeeCompanyIntegrationEntity>await new Metadata().GetEntityObject('Employee Company Integrations', this.GetUserFromPayload(userPayload));
|
|
936
944
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Employee Company Integrations
|
|
937
945
|
|
|
938
946
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -1045,12 +1053,12 @@ export class EmployeeRoleResolver extends ResolverBase {
|
|
|
1045
1053
|
input.EntityName = 'Employee Roles';
|
|
1046
1054
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
1047
1055
|
}
|
|
1048
|
-
|
|
1049
1056
|
@Query(() => EmployeeRole_, { nullable: true })
|
|
1050
1057
|
async EmployeeRole(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EmployeeRole_ | null> {
|
|
1051
1058
|
this.CheckUserReadPermissions('Employee Roles', userPayload);
|
|
1052
|
-
const sSQL = `SELECT * FROM [admin].vwEmployeeRoles WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Employee Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
1053
|
-
|
|
1059
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployeeRoles] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Employee Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
1060
|
+
const result = this.MapFieldNamesToCodeNames('Employee Roles', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
1061
|
+
return result;
|
|
1054
1062
|
}
|
|
1055
1063
|
|
|
1056
1064
|
@Mutation(() => EmployeeRole_)
|
|
@@ -1060,7 +1068,7 @@ export class EmployeeRoleResolver extends ResolverBase {
|
|
|
1060
1068
|
@PubSub() pubSub: PubSubEngine
|
|
1061
1069
|
) {
|
|
1062
1070
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
1063
|
-
const entityObject = await new Metadata().GetEntityObject('Employee Roles', this.GetUserFromPayload(userPayload));
|
|
1071
|
+
const entityObject = <EmployeeRoleEntity>await new Metadata().GetEntityObject('Employee Roles', this.GetUserFromPayload(userPayload));
|
|
1064
1072
|
await entityObject.Load(input.ID) // Track Changes is turned on, so we need to get the latest data from DB first before we save
|
|
1065
1073
|
entityObject.SetMany(input);
|
|
1066
1074
|
if (await entityObject.Save()) {
|
|
@@ -1173,12 +1181,12 @@ export class EmployeeSkillResolver extends ResolverBase {
|
|
|
1173
1181
|
input.EntityName = 'Employee Skills';
|
|
1174
1182
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
1175
1183
|
}
|
|
1176
|
-
|
|
1177
1184
|
@Query(() => EmployeeSkill_, { nullable: true })
|
|
1178
1185
|
async EmployeeSkill(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EmployeeSkill_ | null> {
|
|
1179
1186
|
this.CheckUserReadPermissions('Employee Skills', userPayload);
|
|
1180
|
-
const sSQL = `SELECT * FROM [admin].vwEmployeeSkills WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Employee Skills', userPayload, EntityPermissionType.Read, 'AND');
|
|
1181
|
-
|
|
1187
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployeeSkills] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Employee Skills', userPayload, EntityPermissionType.Read, 'AND');
|
|
1188
|
+
const result = this.MapFieldNamesToCodeNames('Employee Skills', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
1189
|
+
return result;
|
|
1182
1190
|
}
|
|
1183
1191
|
|
|
1184
1192
|
@Mutation(() => EmployeeSkill_)
|
|
@@ -1188,7 +1196,7 @@ export class EmployeeSkillResolver extends ResolverBase {
|
|
|
1188
1196
|
@PubSub() pubSub: PubSubEngine
|
|
1189
1197
|
) {
|
|
1190
1198
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
1191
|
-
const entityObject = await new Metadata().GetEntityObject('Employee Skills', this.GetUserFromPayload(userPayload));
|
|
1199
|
+
const entityObject = <EmployeeSkillEntity>await new Metadata().GetEntityObject('Employee Skills', this.GetUserFromPayload(userPayload));
|
|
1192
1200
|
await entityObject.Load(input.ID) // Track Changes is turned on, so we need to get the latest data from DB first before we save
|
|
1193
1201
|
entityObject.SetMany(input);
|
|
1194
1202
|
if (await entityObject.Save()) {
|
|
@@ -1325,47 +1333,52 @@ export class RoleResolver extends ResolverBase {
|
|
|
1325
1333
|
input.EntityName = 'Roles';
|
|
1326
1334
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
1327
1335
|
}
|
|
1328
|
-
|
|
1329
1336
|
@Query(() => Role_, { nullable: true })
|
|
1330
1337
|
async Role(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Role_ | null> {
|
|
1331
1338
|
this.CheckUserReadPermissions('Roles', userPayload);
|
|
1332
|
-
const sSQL = `SELECT * FROM [admin].vwRoles WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
1333
|
-
|
|
1339
|
+
const sSQL = `SELECT * FROM [admin].[vwRoles] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
1340
|
+
const result = this.MapFieldNamesToCodeNames('Roles', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
1341
|
+
return result;
|
|
1334
1342
|
}
|
|
1335
1343
|
|
|
1336
1344
|
@Query(() => [Role_])
|
|
1337
|
-
AllRoles(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1345
|
+
async AllRoles(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1338
1346
|
this.CheckUserReadPermissions('Roles', userPayload);
|
|
1339
|
-
const sSQL = 'SELECT * FROM [admin].vwRoles' + this.getRowLevelSecurityWhereClause('Roles', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
1340
|
-
|
|
1347
|
+
const sSQL = 'SELECT * FROM [admin].[vwRoles]' + this.getRowLevelSecurityWhereClause('Roles', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
1348
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Roles', await dataSource.query(sSQL));
|
|
1349
|
+
return result;
|
|
1341
1350
|
}
|
|
1342
1351
|
|
|
1343
1352
|
@FieldResolver(() => [EmployeeRole_])
|
|
1344
1353
|
async EmployeeRolesArray(@Root() role_: Role_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1345
1354
|
this.CheckUserReadPermissions('Employee Roles', userPayload);
|
|
1346
|
-
const sSQL = `SELECT * FROM [admin].[vwEmployeeRoles] WHERE RoleID=${role_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
1347
|
-
|
|
1355
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployeeRoles] WHERE [RoleID]=${role_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
1356
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Employee Roles', await dataSource.query(sSQL));
|
|
1357
|
+
return result;
|
|
1348
1358
|
}
|
|
1349
1359
|
|
|
1350
1360
|
@FieldResolver(() => [EntityPermission_])
|
|
1351
1361
|
async EntityPermissionsArray(@Root() role_: Role_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1352
1362
|
this.CheckUserReadPermissions('Entity Permissions', userPayload);
|
|
1353
|
-
const sSQL = `SELECT * FROM [admin].[vwEntityPermissions] WHERE RoleName=${role_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Permissions', userPayload, EntityPermissionType.Read, 'AND');
|
|
1354
|
-
|
|
1363
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityPermissions] WHERE [RoleName]=${role_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Permissions', userPayload, EntityPermissionType.Read, 'AND');
|
|
1364
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Permissions', await dataSource.query(sSQL));
|
|
1365
|
+
return result;
|
|
1355
1366
|
}
|
|
1356
1367
|
|
|
1357
1368
|
@FieldResolver(() => [UserRole_])
|
|
1358
1369
|
async UserRolesArray(@Root() role_: Role_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1359
1370
|
this.CheckUserReadPermissions('User Roles', userPayload);
|
|
1360
|
-
const sSQL = `SELECT * FROM [admin].[vwUserRoles] WHERE RoleName=${role_.ID} ` + this.getRowLevelSecurityWhereClause('User Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
1361
|
-
|
|
1371
|
+
const sSQL = `SELECT * FROM [admin].[vwUserRoles] WHERE [RoleName]=${role_.ID} ` + this.getRowLevelSecurityWhereClause('User Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
1372
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Roles', await dataSource.query(sSQL));
|
|
1373
|
+
return result;
|
|
1362
1374
|
}
|
|
1363
1375
|
|
|
1364
1376
|
@FieldResolver(() => [AuthorizationRole_])
|
|
1365
1377
|
async AuthorizationRolesArray(@Root() role_: Role_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1366
1378
|
this.CheckUserReadPermissions('Authorization Roles', userPayload);
|
|
1367
|
-
const sSQL = `SELECT * FROM [admin].[vwAuthorizationRoles] WHERE RoleName=${role_.ID} ` + this.getRowLevelSecurityWhereClause('Authorization Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
1368
|
-
|
|
1379
|
+
const sSQL = `SELECT * FROM [admin].[vwAuthorizationRoles] WHERE [RoleName]=${role_.ID} ` + this.getRowLevelSecurityWhereClause('Authorization Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
1380
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Authorization Roles', await dataSource.query(sSQL));
|
|
1381
|
+
return result;
|
|
1369
1382
|
}
|
|
1370
1383
|
|
|
1371
1384
|
@Mutation(() => Role_)
|
|
@@ -1375,7 +1388,7 @@ export class RoleResolver extends ResolverBase {
|
|
|
1375
1388
|
@PubSub() pubSub: PubSubEngine
|
|
1376
1389
|
) {
|
|
1377
1390
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
1378
|
-
const entityObject = await new Metadata().GetEntityObject('Roles', this.GetUserFromPayload(userPayload));
|
|
1391
|
+
const entityObject = <RoleEntity>await new Metadata().GetEntityObject('Roles', this.GetUserFromPayload(userPayload));
|
|
1379
1392
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Roles
|
|
1380
1393
|
|
|
1381
1394
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -1479,33 +1492,36 @@ export class SkillResolver extends ResolverBase {
|
|
|
1479
1492
|
input.EntityName = 'Skills';
|
|
1480
1493
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
1481
1494
|
}
|
|
1482
|
-
|
|
1483
1495
|
@Query(() => Skill_, { nullable: true })
|
|
1484
1496
|
async Skill(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Skill_ | null> {
|
|
1485
1497
|
this.CheckUserReadPermissions('Skills', userPayload);
|
|
1486
|
-
const sSQL = `SELECT * FROM [admin].vwSkills WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Skills', userPayload, EntityPermissionType.Read, 'AND');
|
|
1487
|
-
|
|
1498
|
+
const sSQL = `SELECT * FROM [admin].[vwSkills] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Skills', userPayload, EntityPermissionType.Read, 'AND');
|
|
1499
|
+
const result = this.MapFieldNamesToCodeNames('Skills', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
1500
|
+
return result;
|
|
1488
1501
|
}
|
|
1489
1502
|
|
|
1490
1503
|
@Query(() => [Skill_])
|
|
1491
|
-
AllSkills(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1504
|
+
async AllSkills(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1492
1505
|
this.CheckUserReadPermissions('Skills', userPayload);
|
|
1493
|
-
const sSQL = 'SELECT * FROM [admin].vwSkills' + this.getRowLevelSecurityWhereClause('Skills', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
1494
|
-
|
|
1506
|
+
const sSQL = 'SELECT * FROM [admin].[vwSkills]' + this.getRowLevelSecurityWhereClause('Skills', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
1507
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Skills', await dataSource.query(sSQL));
|
|
1508
|
+
return result;
|
|
1495
1509
|
}
|
|
1496
1510
|
|
|
1497
1511
|
@FieldResolver(() => [EmployeeSkill_])
|
|
1498
1512
|
async EmployeeSkillsArray(@Root() skill_: Skill_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1499
1513
|
this.CheckUserReadPermissions('Employee Skills', userPayload);
|
|
1500
|
-
const sSQL = `SELECT * FROM [admin].[vwEmployeeSkills] WHERE SkillID=${skill_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Skills', userPayload, EntityPermissionType.Read, 'AND');
|
|
1501
|
-
|
|
1514
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployeeSkills] WHERE [SkillID]=${skill_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Skills', userPayload, EntityPermissionType.Read, 'AND');
|
|
1515
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Employee Skills', await dataSource.query(sSQL));
|
|
1516
|
+
return result;
|
|
1502
1517
|
}
|
|
1503
1518
|
|
|
1504
1519
|
@FieldResolver(() => [Skill_])
|
|
1505
1520
|
async SkillsArray(@Root() skill_: Skill_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1506
1521
|
this.CheckUserReadPermissions('Skills', userPayload);
|
|
1507
|
-
const sSQL = `SELECT * FROM [admin].[vwSkills] WHERE ParentID=${skill_.ID} ` + this.getRowLevelSecurityWhereClause('Skills', userPayload, EntityPermissionType.Read, 'AND');
|
|
1508
|
-
|
|
1522
|
+
const sSQL = `SELECT * FROM [admin].[vwSkills] WHERE [ParentID]=${skill_.ID} ` + this.getRowLevelSecurityWhereClause('Skills', userPayload, EntityPermissionType.Read, 'AND');
|
|
1523
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Skills', await dataSource.query(sSQL));
|
|
1524
|
+
return result;
|
|
1509
1525
|
}
|
|
1510
1526
|
|
|
1511
1527
|
}
|
|
@@ -1608,19 +1624,20 @@ export class IntegrationURLFormatResolver extends ResolverBase {
|
|
|
1608
1624
|
input.EntityName = 'Integration URL Formats';
|
|
1609
1625
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
1610
1626
|
}
|
|
1611
|
-
|
|
1612
1627
|
@Query(() => IntegrationURLFormat_, { nullable: true })
|
|
1613
1628
|
async IntegrationURLFormat(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<IntegrationURLFormat_ | null> {
|
|
1614
1629
|
this.CheckUserReadPermissions('Integration URL Formats', userPayload);
|
|
1615
|
-
const sSQL = `SELECT * FROM [admin].vwIntegrationURLFormats WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Integration URL Formats', userPayload, EntityPermissionType.Read, 'AND');
|
|
1616
|
-
|
|
1630
|
+
const sSQL = `SELECT * FROM [admin].[vwIntegrationURLFormats] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Integration URL Formats', userPayload, EntityPermissionType.Read, 'AND');
|
|
1631
|
+
const result = this.MapFieldNamesToCodeNames('Integration URL Formats', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
1632
|
+
return result;
|
|
1617
1633
|
}
|
|
1618
1634
|
|
|
1619
1635
|
@Query(() => [IntegrationURLFormat_])
|
|
1620
|
-
AllIntegrationURLFormats(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1636
|
+
async AllIntegrationURLFormats(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1621
1637
|
this.CheckUserReadPermissions('Integration URL Formats', userPayload);
|
|
1622
|
-
const sSQL = 'SELECT * FROM [admin].vwIntegrationURLFormats' + this.getRowLevelSecurityWhereClause('Integration URL Formats', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
1623
|
-
|
|
1638
|
+
const sSQL = 'SELECT * FROM [admin].[vwIntegrationURLFormats]' + this.getRowLevelSecurityWhereClause('Integration URL Formats', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
1639
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Integration URL Formats', await dataSource.query(sSQL));
|
|
1640
|
+
return result;
|
|
1624
1641
|
}
|
|
1625
1642
|
|
|
1626
1643
|
@Mutation(() => IntegrationURLFormat_)
|
|
@@ -1630,7 +1647,7 @@ export class IntegrationURLFormatResolver extends ResolverBase {
|
|
|
1630
1647
|
@PubSub() pubSub: PubSubEngine
|
|
1631
1648
|
) {
|
|
1632
1649
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
1633
|
-
const entityObject = await new Metadata().GetEntityObject('Integration URL Formats', this.GetUserFromPayload(userPayload));
|
|
1650
|
+
const entityObject = <IntegrationURLFormatEntity>await new Metadata().GetEntityObject('Integration URL Formats', this.GetUserFromPayload(userPayload));
|
|
1634
1651
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Integration URL Formats
|
|
1635
1652
|
|
|
1636
1653
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -1780,33 +1797,36 @@ export class IntegrationResolver extends ResolverBase {
|
|
|
1780
1797
|
input.EntityName = 'Integrations';
|
|
1781
1798
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
1782
1799
|
}
|
|
1783
|
-
|
|
1784
1800
|
@Query(() => Integration_, { nullable: true })
|
|
1785
1801
|
async Integration(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Integration_ | null> {
|
|
1786
1802
|
this.CheckUserReadPermissions('Integrations', userPayload);
|
|
1787
|
-
const sSQL = `SELECT * FROM [admin].vwIntegrations WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
1788
|
-
|
|
1803
|
+
const sSQL = `SELECT * FROM [admin].[vwIntegrations] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
1804
|
+
const result = this.MapFieldNamesToCodeNames('Integrations', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
1805
|
+
return result;
|
|
1789
1806
|
}
|
|
1790
1807
|
|
|
1791
1808
|
@Query(() => [Integration_])
|
|
1792
|
-
AllIntegrations(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1809
|
+
async AllIntegrations(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1793
1810
|
this.CheckUserReadPermissions('Integrations', userPayload);
|
|
1794
|
-
const sSQL = 'SELECT * FROM [admin].vwIntegrations' + this.getRowLevelSecurityWhereClause('Integrations', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
1795
|
-
|
|
1811
|
+
const sSQL = 'SELECT * FROM [admin].[vwIntegrations]' + this.getRowLevelSecurityWhereClause('Integrations', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
1812
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Integrations', await dataSource.query(sSQL));
|
|
1813
|
+
return result;
|
|
1796
1814
|
}
|
|
1797
1815
|
|
|
1798
1816
|
@FieldResolver(() => [IntegrationURLFormat_])
|
|
1799
1817
|
async IntegrationURLFormatsArray(@Root() integration_: Integration_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1800
1818
|
this.CheckUserReadPermissions('Integration URL Formats', userPayload);
|
|
1801
|
-
const sSQL = `SELECT * FROM [admin].[vwIntegrationURLFormats] WHERE IntegrationID=${integration_.ID} ` + this.getRowLevelSecurityWhereClause('Integration URL Formats', userPayload, EntityPermissionType.Read, 'AND');
|
|
1802
|
-
|
|
1819
|
+
const sSQL = `SELECT * FROM [admin].[vwIntegrationURLFormats] WHERE [IntegrationID]=${integration_.ID} ` + this.getRowLevelSecurityWhereClause('Integration URL Formats', userPayload, EntityPermissionType.Read, 'AND');
|
|
1820
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Integration URL Formats', await dataSource.query(sSQL));
|
|
1821
|
+
return result;
|
|
1803
1822
|
}
|
|
1804
1823
|
|
|
1805
1824
|
@FieldResolver(() => [CompanyIntegration_])
|
|
1806
1825
|
async CompanyIntegrationsArray(@Root() integration_: Integration_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
1807
1826
|
this.CheckUserReadPermissions('Company Integrations', userPayload);
|
|
1808
|
-
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrations] WHERE IntegrationName=${integration_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
1809
|
-
|
|
1827
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrations] WHERE [IntegrationName]=${integration_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
1828
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Company Integrations', await dataSource.query(sSQL));
|
|
1829
|
+
return result;
|
|
1810
1830
|
}
|
|
1811
1831
|
|
|
1812
1832
|
@Mutation(() => Integration_)
|
|
@@ -1816,7 +1836,7 @@ export class IntegrationResolver extends ResolverBase {
|
|
|
1816
1836
|
@PubSub() pubSub: PubSubEngine
|
|
1817
1837
|
) {
|
|
1818
1838
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
1819
|
-
const entityObject = await new Metadata().GetEntityObject('Integrations', this.GetUserFromPayload(userPayload));
|
|
1839
|
+
const entityObject = <IntegrationEntity>await new Metadata().GetEntityObject('Integrations', this.GetUserFromPayload(userPayload));
|
|
1820
1840
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Integrations
|
|
1821
1841
|
|
|
1822
1842
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -2040,40 +2060,44 @@ export class CompanyIntegrationResolver extends ResolverBase {
|
|
|
2040
2060
|
input.EntityName = 'Company Integrations';
|
|
2041
2061
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
2042
2062
|
}
|
|
2043
|
-
|
|
2044
2063
|
@Query(() => CompanyIntegration_, { nullable: true })
|
|
2045
2064
|
async CompanyIntegration(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<CompanyIntegration_ | null> {
|
|
2046
2065
|
this.CheckUserReadPermissions('Company Integrations', userPayload);
|
|
2047
|
-
const sSQL = `SELECT * FROM [admin].vwCompanyIntegrations WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
2048
|
-
|
|
2066
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrations] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
2067
|
+
const result = this.MapFieldNamesToCodeNames('Company Integrations', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
2068
|
+
return result;
|
|
2049
2069
|
}
|
|
2050
2070
|
|
|
2051
2071
|
@FieldResolver(() => [List_])
|
|
2052
2072
|
async ListsArray(@Root() companyintegration_: CompanyIntegration_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
2053
2073
|
this.CheckUserReadPermissions('Lists', userPayload);
|
|
2054
|
-
const sSQL = `SELECT * FROM [admin].[vwLists] WHERE CompanyIntegrationID=${companyintegration_.ID} ` + this.getRowLevelSecurityWhereClause('Lists', userPayload, EntityPermissionType.Read, 'AND');
|
|
2055
|
-
|
|
2074
|
+
const sSQL = `SELECT * FROM [admin].[vwLists] WHERE [CompanyIntegrationID]=${companyintegration_.ID} ` + this.getRowLevelSecurityWhereClause('Lists', userPayload, EntityPermissionType.Read, 'AND');
|
|
2075
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Lists', await dataSource.query(sSQL));
|
|
2076
|
+
return result;
|
|
2056
2077
|
}
|
|
2057
2078
|
|
|
2058
2079
|
@FieldResolver(() => [EmployeeCompanyIntegration_])
|
|
2059
2080
|
async EmployeeCompanyIntegrationsArray(@Root() companyintegration_: CompanyIntegration_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
2060
2081
|
this.CheckUserReadPermissions('Employee Company Integrations', userPayload);
|
|
2061
|
-
const sSQL = `SELECT * FROM [admin].[vwEmployeeCompanyIntegrations] WHERE CompanyIntegrationID=${companyintegration_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
2062
|
-
|
|
2082
|
+
const sSQL = `SELECT * FROM [admin].[vwEmployeeCompanyIntegrations] WHERE [CompanyIntegrationID]=${companyintegration_.ID} ` + this.getRowLevelSecurityWhereClause('Employee Company Integrations', userPayload, EntityPermissionType.Read, 'AND');
|
|
2083
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Employee Company Integrations', await dataSource.query(sSQL));
|
|
2084
|
+
return result;
|
|
2063
2085
|
}
|
|
2064
2086
|
|
|
2065
2087
|
@FieldResolver(() => [CompanyIntegrationRun_])
|
|
2066
2088
|
async CompanyIntegrationRunsArray(@Root() companyintegration_: CompanyIntegration_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
2067
2089
|
this.CheckUserReadPermissions('Company Integration Runs', userPayload);
|
|
2068
|
-
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRuns] WHERE CompanyIntegrationID=${companyintegration_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
2069
|
-
|
|
2090
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRuns] WHERE [CompanyIntegrationID]=${companyintegration_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
2091
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Company Integration Runs', await dataSource.query(sSQL));
|
|
2092
|
+
return result;
|
|
2070
2093
|
}
|
|
2071
2094
|
|
|
2072
2095
|
@FieldResolver(() => [CompanyIntegrationRecordMap_])
|
|
2073
2096
|
async CompanyIntegrationRecordMapsArray(@Root() companyintegration_: CompanyIntegration_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
2074
2097
|
this.CheckUserReadPermissions('Company Integration Record Maps', userPayload);
|
|
2075
|
-
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRecordMaps] WHERE CompanyIntegrationID=${companyintegration_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Record Maps', userPayload, EntityPermissionType.Read, 'AND');
|
|
2076
|
-
|
|
2098
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRecordMaps] WHERE [CompanyIntegrationID]=${companyintegration_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Record Maps', userPayload, EntityPermissionType.Read, 'AND');
|
|
2099
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Company Integration Record Maps', await dataSource.query(sSQL));
|
|
2100
|
+
return result;
|
|
2077
2101
|
}
|
|
2078
2102
|
|
|
2079
2103
|
@Mutation(() => CompanyIntegration_)
|
|
@@ -2083,7 +2107,7 @@ export class CompanyIntegrationResolver extends ResolverBase {
|
|
|
2083
2107
|
@PubSub() pubSub: PubSubEngine
|
|
2084
2108
|
) {
|
|
2085
2109
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
2086
|
-
const entityObject = await new Metadata().GetEntityObject('Company Integrations', this.GetUserFromPayload(userPayload));
|
|
2110
|
+
const entityObject = <CompanyIntegrationEntity>await new Metadata().GetEntityObject('Company Integrations', this.GetUserFromPayload(userPayload));
|
|
2087
2111
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Company Integrations
|
|
2088
2112
|
|
|
2089
2113
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -2256,7 +2280,7 @@ export class EntityField_ {
|
|
|
2256
2280
|
EntityCodeName?: string;
|
|
2257
2281
|
|
|
2258
2282
|
@Field({nullable: true})
|
|
2259
|
-
@MaxLength(
|
|
2283
|
+
@MaxLength(8000)
|
|
2260
2284
|
EntityClassName?: string;
|
|
2261
2285
|
|
|
2262
2286
|
@Field({nullable: true})
|
|
@@ -2280,7 +2304,7 @@ export class EntityField_ {
|
|
|
2280
2304
|
RelatedEntityCodeName?: string;
|
|
2281
2305
|
|
|
2282
2306
|
@Field({nullable: true})
|
|
2283
|
-
@MaxLength(
|
|
2307
|
+
@MaxLength(8000)
|
|
2284
2308
|
RelatedEntityClassName?: string;
|
|
2285
2309
|
|
|
2286
2310
|
@Field(() => [EntityFieldValue_])
|
|
@@ -2480,26 +2504,28 @@ export class EntityFieldResolver extends ResolverBase {
|
|
|
2480
2504
|
input.EntityName = 'Entity Fields';
|
|
2481
2505
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
2482
2506
|
}
|
|
2483
|
-
|
|
2484
2507
|
@Query(() => EntityField_, { nullable: true })
|
|
2485
2508
|
async EntityField(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityField_ | null> {
|
|
2486
2509
|
this.CheckUserReadPermissions('Entity Fields', userPayload);
|
|
2487
|
-
const sSQL = `SELECT * FROM [admin].vwEntityFields WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Fields', userPayload, EntityPermissionType.Read, 'AND');
|
|
2488
|
-
|
|
2510
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityFields] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Fields', userPayload, EntityPermissionType.Read, 'AND');
|
|
2511
|
+
const result = this.MapFieldNamesToCodeNames('Entity Fields', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
2512
|
+
return result;
|
|
2489
2513
|
}
|
|
2490
2514
|
|
|
2491
2515
|
@Query(() => [EntityField_])
|
|
2492
|
-
AllEntityFields(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
2516
|
+
async AllEntityFields(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
2493
2517
|
this.CheckUserReadPermissions('Entity Fields', userPayload);
|
|
2494
|
-
const sSQL = 'SELECT * FROM [admin].vwEntityFields' + this.getRowLevelSecurityWhereClause('Entity Fields', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
2495
|
-
|
|
2518
|
+
const sSQL = 'SELECT * FROM [admin].[vwEntityFields]' + this.getRowLevelSecurityWhereClause('Entity Fields', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
2519
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Fields', await dataSource.query(sSQL));
|
|
2520
|
+
return result;
|
|
2496
2521
|
}
|
|
2497
2522
|
|
|
2498
2523
|
@FieldResolver(() => [EntityFieldValue_])
|
|
2499
2524
|
async EntityFieldValuesArray(@Root() entityfield_: EntityField_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
2500
2525
|
this.CheckUserReadPermissions('Entity Field Values', userPayload);
|
|
2501
|
-
const sSQL = `SELECT * FROM [admin].[vwEntityFieldValues] WHERE EntityFieldID=${entityfield_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Field Values', userPayload, EntityPermissionType.Read, 'AND');
|
|
2502
|
-
|
|
2526
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityFieldValues] WHERE [EntityFieldID]=${entityfield_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Field Values', userPayload, EntityPermissionType.Read, 'AND');
|
|
2527
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Field Values', await dataSource.query(sSQL));
|
|
2528
|
+
return result;
|
|
2503
2529
|
}
|
|
2504
2530
|
|
|
2505
2531
|
@Mutation(() => EntityField_)
|
|
@@ -2509,7 +2535,7 @@ export class EntityFieldResolver extends ResolverBase {
|
|
|
2509
2535
|
@PubSub() pubSub: PubSubEngine
|
|
2510
2536
|
) {
|
|
2511
2537
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
2512
|
-
const entityObject = await new Metadata().GetEntityObject('Entity Fields', this.GetUserFromPayload(userPayload));
|
|
2538
|
+
const entityObject = <EntityFieldEntity>await new Metadata().GetEntityObject('Entity Fields', this.GetUserFromPayload(userPayload));
|
|
2513
2539
|
await entityObject.NewRecord();
|
|
2514
2540
|
entityObject.SetMany(input);
|
|
2515
2541
|
if (await entityObject.Save()) {
|
|
@@ -2527,11 +2553,9 @@ export class EntityFieldResolver extends ResolverBase {
|
|
|
2527
2553
|
|
|
2528
2554
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
2529
2555
|
protected async BeforeCreate(dataSource: DataSource, input: CreateEntityFieldInput): Promise<boolean> {
|
|
2530
|
-
const i = input, d = dataSource; // prevent error
|
|
2531
2556
|
return true;
|
|
2532
2557
|
}
|
|
2533
2558
|
protected async AfterCreate(dataSource: DataSource, input: CreateEntityFieldInput) {
|
|
2534
|
-
const i = input, d = dataSource; // prevent error
|
|
2535
2559
|
}
|
|
2536
2560
|
|
|
2537
2561
|
@Mutation(() => EntityField_)
|
|
@@ -2541,7 +2565,7 @@ export class EntityFieldResolver extends ResolverBase {
|
|
|
2541
2565
|
@PubSub() pubSub: PubSubEngine
|
|
2542
2566
|
) {
|
|
2543
2567
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
2544
|
-
const entityObject = await new Metadata().GetEntityObject('Entity Fields', this.GetUserFromPayload(userPayload));
|
|
2568
|
+
const entityObject = <EntityFieldEntity>await new Metadata().GetEntityObject('Entity Fields', this.GetUserFromPayload(userPayload));
|
|
2545
2569
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Entity Fields
|
|
2546
2570
|
|
|
2547
2571
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -2565,14 +2589,15 @@ export class EntityFieldResolver extends ResolverBase {
|
|
|
2565
2589
|
const i = input, d = dataSource; // prevent error
|
|
2566
2590
|
}
|
|
2567
2591
|
|
|
2568
|
-
@Mutation(() =>
|
|
2592
|
+
@Mutation(() => EntityField_)
|
|
2569
2593
|
async DeleteEntityField(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
2570
2594
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
2571
|
-
const entityObject = await new Metadata().GetEntityObject('Entity Fields', this.GetUserFromPayload(userPayload));
|
|
2572
|
-
await entityObject.Load(ID)
|
|
2595
|
+
const entityObject = <EntityFieldEntity>await new Metadata().GetEntityObject('Entity Fields', this.GetUserFromPayload(userPayload));
|
|
2596
|
+
await entityObject.Load(ID);
|
|
2597
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
2573
2598
|
if (await entityObject.Delete()) {
|
|
2574
2599
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
2575
|
-
return
|
|
2600
|
+
return returnValue;
|
|
2576
2601
|
}
|
|
2577
2602
|
else
|
|
2578
2603
|
return null; // delete failed, this will cause an exception
|
|
@@ -2737,11 +2762,11 @@ export class Entity_ {
|
|
|
2737
2762
|
CodeName?: string;
|
|
2738
2763
|
|
|
2739
2764
|
@Field({nullable: true})
|
|
2740
|
-
@MaxLength(
|
|
2765
|
+
@MaxLength(8000)
|
|
2741
2766
|
ClassName?: string;
|
|
2742
2767
|
|
|
2743
2768
|
@Field({nullable: true})
|
|
2744
|
-
@MaxLength(
|
|
2769
|
+
@MaxLength(8000)
|
|
2745
2770
|
BaseTableCodeName?: string;
|
|
2746
2771
|
|
|
2747
2772
|
@Field({nullable: true})
|
|
@@ -2823,6 +2848,9 @@ export class Entity_ {
|
|
|
2823
2848
|
//****************************************************************************
|
|
2824
2849
|
@InputType()
|
|
2825
2850
|
export class CreateEntityInput {
|
|
2851
|
+
@Field(() => Int, )
|
|
2852
|
+
ID: number;
|
|
2853
|
+
|
|
2826
2854
|
@Field(() => Int, { nullable: true })
|
|
2827
2855
|
ParentID: number;
|
|
2828
2856
|
|
|
@@ -3088,159 +3116,180 @@ export class EntityResolverBase extends ResolverBase {
|
|
|
3088
3116
|
input.EntityName = 'Entities';
|
|
3089
3117
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
3090
3118
|
}
|
|
3091
|
-
|
|
3092
3119
|
@Query(() => Entity_, { nullable: true })
|
|
3093
3120
|
async Entity(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Entity_ | null> {
|
|
3094
3121
|
this.CheckUserReadPermissions('Entities', userPayload);
|
|
3095
|
-
const sSQL = `SELECT * FROM [admin].vwEntities WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
3096
|
-
|
|
3122
|
+
const sSQL = `SELECT * FROM [admin].[vwEntities] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
3123
|
+
const result = this.MapFieldNamesToCodeNames('Entities', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
3124
|
+
return result;
|
|
3097
3125
|
}
|
|
3098
3126
|
|
|
3099
3127
|
@Query(() => [Entity_])
|
|
3100
|
-
AllEntities(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3128
|
+
async AllEntities(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3101
3129
|
this.CheckUserReadPermissions('Entities', userPayload);
|
|
3102
|
-
const sSQL = 'SELECT * FROM [admin].vwEntities' + this.getRowLevelSecurityWhereClause('Entities', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
3103
|
-
|
|
3130
|
+
const sSQL = 'SELECT * FROM [admin].[vwEntities]' + this.getRowLevelSecurityWhereClause('Entities', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
3131
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entities', await dataSource.query(sSQL));
|
|
3132
|
+
return result;
|
|
3104
3133
|
}
|
|
3105
3134
|
|
|
3106
3135
|
@FieldResolver(() => [EntityField_])
|
|
3107
3136
|
async EntityFieldsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3108
3137
|
this.CheckUserReadPermissions('Entity Fields', userPayload);
|
|
3109
|
-
const sSQL = `SELECT * FROM [admin].[vwEntityFields] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Fields', userPayload, EntityPermissionType.Read, 'AND');
|
|
3110
|
-
|
|
3138
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityFields] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Fields', userPayload, EntityPermissionType.Read, 'AND');
|
|
3139
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Fields', await dataSource.query(sSQL));
|
|
3140
|
+
return result;
|
|
3111
3141
|
}
|
|
3112
3142
|
|
|
3113
3143
|
@FieldResolver(() => [EntityPermission_])
|
|
3114
3144
|
async EntityPermissionsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3115
3145
|
this.CheckUserReadPermissions('Entity Permissions', userPayload);
|
|
3116
|
-
const sSQL = `SELECT * FROM [admin].[vwEntityPermissions] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Permissions', userPayload, EntityPermissionType.Read, 'AND');
|
|
3117
|
-
|
|
3146
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityPermissions] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Permissions', userPayload, EntityPermissionType.Read, 'AND');
|
|
3147
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Permissions', await dataSource.query(sSQL));
|
|
3148
|
+
return result;
|
|
3118
3149
|
}
|
|
3119
3150
|
|
|
3120
3151
|
@FieldResolver(() => [EntityRelationship_])
|
|
3121
3152
|
async EntityRelationshipsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3122
3153
|
this.CheckUserReadPermissions('Entity Relationships', userPayload);
|
|
3123
|
-
const sSQL = `SELECT * FROM [admin].[vwEntityRelationships] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Relationships', userPayload, EntityPermissionType.Read, 'AND');
|
|
3124
|
-
|
|
3154
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityRelationships] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Relationships', userPayload, EntityPermissionType.Read, 'AND');
|
|
3155
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Relationships', await dataSource.query(sSQL));
|
|
3156
|
+
return result;
|
|
3125
3157
|
}
|
|
3126
3158
|
|
|
3127
3159
|
@FieldResolver(() => [EntityAIAction_])
|
|
3128
3160
|
async EntityAIActionsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3129
3161
|
this.CheckUserReadPermissions('Entity AI Actions', userPayload);
|
|
3130
|
-
const sSQL = `SELECT * FROM [admin].[vwEntityAIActions] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entity AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
3131
|
-
|
|
3162
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityAIActions] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entity AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
3163
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity AI Actions', await dataSource.query(sSQL));
|
|
3164
|
+
return result;
|
|
3132
3165
|
}
|
|
3133
3166
|
|
|
3134
3167
|
@FieldResolver(() => [UserRecordLog_])
|
|
3135
3168
|
async UserRecordLogsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3136
3169
|
this.CheckUserReadPermissions('User Record Logs', userPayload);
|
|
3137
|
-
const sSQL = `SELECT * FROM [admin].[vwUserRecordLogs] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('User Record Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3138
|
-
|
|
3170
|
+
const sSQL = `SELECT * FROM [admin].[vwUserRecordLogs] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('User Record Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3171
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Record Logs', await dataSource.query(sSQL));
|
|
3172
|
+
return result;
|
|
3139
3173
|
}
|
|
3140
3174
|
|
|
3141
3175
|
@FieldResolver(() => [IntegrationURLFormat_])
|
|
3142
3176
|
async IntegrationURLFormatsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3143
3177
|
this.CheckUserReadPermissions('Integration URL Formats', userPayload);
|
|
3144
|
-
const sSQL = `SELECT * FROM [admin].[vwIntegrationURLFormats] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Integration URL Formats', userPayload, EntityPermissionType.Read, 'AND');
|
|
3145
|
-
|
|
3178
|
+
const sSQL = `SELECT * FROM [admin].[vwIntegrationURLFormats] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Integration URL Formats', userPayload, EntityPermissionType.Read, 'AND');
|
|
3179
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Integration URL Formats', await dataSource.query(sSQL));
|
|
3180
|
+
return result;
|
|
3146
3181
|
}
|
|
3147
3182
|
|
|
3148
3183
|
@FieldResolver(() => [Entity_])
|
|
3149
3184
|
async EntitiesArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3150
3185
|
this.CheckUserReadPermissions('Entities', userPayload);
|
|
3151
|
-
const sSQL = `SELECT * FROM [admin].[vwEntities] WHERE ParentID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
3152
|
-
|
|
3186
|
+
const sSQL = `SELECT * FROM [admin].[vwEntities] WHERE [ParentID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
3187
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entities', await dataSource.query(sSQL));
|
|
3188
|
+
return result;
|
|
3153
3189
|
}
|
|
3154
3190
|
|
|
3155
3191
|
@FieldResolver(() => [UserFavorite_])
|
|
3156
3192
|
async UserFavoritesArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3157
3193
|
this.CheckUserReadPermissions('User Favorites', userPayload);
|
|
3158
|
-
const sSQL = `SELECT * FROM [admin].[vwUserFavorites] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('User Favorites', userPayload, EntityPermissionType.Read, 'AND');
|
|
3159
|
-
|
|
3194
|
+
const sSQL = `SELECT * FROM [admin].[vwUserFavorites] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('User Favorites', userPayload, EntityPermissionType.Read, 'AND');
|
|
3195
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Favorites', await dataSource.query(sSQL));
|
|
3196
|
+
return result;
|
|
3160
3197
|
}
|
|
3161
3198
|
|
|
3162
3199
|
@FieldResolver(() => [CompanyIntegrationRunDetail_])
|
|
3163
3200
|
async CompanyIntegrationRunDetailsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3164
3201
|
this.CheckUserReadPermissions('Company Integration Run Details', userPayload);
|
|
3165
|
-
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRunDetails] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Run Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
3166
|
-
|
|
3202
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRunDetails] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Run Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
3203
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Company Integration Run Details', await dataSource.query(sSQL));
|
|
3204
|
+
return result;
|
|
3167
3205
|
}
|
|
3168
3206
|
|
|
3169
3207
|
@FieldResolver(() => [ApplicationEntity_])
|
|
3170
3208
|
async ApplicationEntitiesArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3171
3209
|
this.CheckUserReadPermissions('Application Entities', userPayload);
|
|
3172
|
-
const sSQL = `SELECT * FROM [admin].[vwApplicationEntities] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
3173
|
-
|
|
3210
|
+
const sSQL = `SELECT * FROM [admin].[vwApplicationEntities] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
3211
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Application Entities', await dataSource.query(sSQL));
|
|
3212
|
+
return result;
|
|
3174
3213
|
}
|
|
3175
3214
|
|
|
3176
3215
|
@FieldResolver(() => [UserApplicationEntity_])
|
|
3177
3216
|
async UserApplicationEntitiesArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3178
3217
|
this.CheckUserReadPermissions('User Application Entities', userPayload);
|
|
3179
|
-
const sSQL = `SELECT * FROM [admin].[vwUserApplicationEntities] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('User Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
3180
|
-
|
|
3218
|
+
const sSQL = `SELECT * FROM [admin].[vwUserApplicationEntities] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('User Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
3219
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Application Entities', await dataSource.query(sSQL));
|
|
3220
|
+
return result;
|
|
3181
3221
|
}
|
|
3182
3222
|
|
|
3183
3223
|
@FieldResolver(() => [List_])
|
|
3184
3224
|
async ListsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3185
3225
|
this.CheckUserReadPermissions('Lists', userPayload);
|
|
3186
|
-
const sSQL = `SELECT * FROM [admin].[vwLists] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Lists', userPayload, EntityPermissionType.Read, 'AND');
|
|
3187
|
-
|
|
3226
|
+
const sSQL = `SELECT * FROM [admin].[vwLists] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Lists', userPayload, EntityPermissionType.Read, 'AND');
|
|
3227
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Lists', await dataSource.query(sSQL));
|
|
3228
|
+
return result;
|
|
3188
3229
|
}
|
|
3189
3230
|
|
|
3190
3231
|
@FieldResolver(() => [UserView_])
|
|
3191
3232
|
async UserViewsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3192
3233
|
this.CheckUserReadPermissions('User Views', userPayload);
|
|
3193
|
-
const sSQL = `SELECT * FROM [admin].[vwUserViews] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('User Views', userPayload, EntityPermissionType.Read, 'AND');
|
|
3194
|
-
|
|
3234
|
+
const sSQL = `SELECT * FROM [admin].[vwUserViews] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('User Views', userPayload, EntityPermissionType.Read, 'AND');
|
|
3235
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Views', await dataSource.query(sSQL));
|
|
3236
|
+
return result;
|
|
3195
3237
|
}
|
|
3196
3238
|
|
|
3197
3239
|
@FieldResolver(() => [RecordChange_])
|
|
3198
3240
|
async RecordChangesArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3199
3241
|
this.CheckUserReadPermissions('Record Changes', userPayload);
|
|
3200
|
-
const sSQL = `SELECT * FROM [admin].[vwRecordChanges] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Record Changes', userPayload, EntityPermissionType.Read, 'AND');
|
|
3201
|
-
|
|
3242
|
+
const sSQL = `SELECT * FROM [admin].[vwRecordChanges] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Record Changes', userPayload, EntityPermissionType.Read, 'AND');
|
|
3243
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Record Changes', await dataSource.query(sSQL));
|
|
3244
|
+
return result;
|
|
3202
3245
|
}
|
|
3203
3246
|
|
|
3204
3247
|
@FieldResolver(() => [AuditLog_])
|
|
3205
3248
|
async AuditLogsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3206
3249
|
this.CheckUserReadPermissions('Audit Logs', userPayload);
|
|
3207
|
-
const sSQL = `SELECT * FROM [admin].[vwAuditLogs] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3208
|
-
|
|
3250
|
+
const sSQL = `SELECT * FROM [admin].[vwAuditLogs] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3251
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Audit Logs', await dataSource.query(sSQL));
|
|
3252
|
+
return result;
|
|
3209
3253
|
}
|
|
3210
3254
|
|
|
3211
3255
|
@FieldResolver(() => [ResourceType_])
|
|
3212
3256
|
async ResourceTypesArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3213
3257
|
this.CheckUserReadPermissions('Resource Types', userPayload);
|
|
3214
|
-
const sSQL = `SELECT * FROM [admin].[vwResourceTypes] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Resource Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
3215
|
-
|
|
3258
|
+
const sSQL = `SELECT * FROM [admin].[vwResourceTypes] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Resource Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
3259
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Resource Types', await dataSource.query(sSQL));
|
|
3260
|
+
return result;
|
|
3216
3261
|
}
|
|
3217
3262
|
|
|
3218
3263
|
@FieldResolver(() => [TaggedItem_])
|
|
3219
3264
|
async TaggedItemsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3220
3265
|
this.CheckUserReadPermissions('Tagged Items', userPayload);
|
|
3221
|
-
const sSQL = `SELECT * FROM [admin].[vwTaggedItems] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Tagged Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
3222
|
-
|
|
3266
|
+
const sSQL = `SELECT * FROM [admin].[vwTaggedItems] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Tagged Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
3267
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Tagged Items', await dataSource.query(sSQL));
|
|
3268
|
+
return result;
|
|
3223
3269
|
}
|
|
3224
3270
|
|
|
3225
3271
|
@FieldResolver(() => [DatasetItem_])
|
|
3226
3272
|
async DatasetItemsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3227
3273
|
this.CheckUserReadPermissions('Dataset Items', userPayload);
|
|
3228
|
-
const sSQL = `SELECT * FROM [admin].[vwDatasetItems] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Dataset Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
3229
|
-
|
|
3274
|
+
const sSQL = `SELECT * FROM [admin].[vwDatasetItems] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Dataset Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
3275
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Dataset Items', await dataSource.query(sSQL));
|
|
3276
|
+
return result;
|
|
3230
3277
|
}
|
|
3231
3278
|
|
|
3232
3279
|
@FieldResolver(() => [CompanyIntegrationRecordMap_])
|
|
3233
3280
|
async CompanyIntegrationRecordMapsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3234
3281
|
this.CheckUserReadPermissions('Company Integration Record Maps', userPayload);
|
|
3235
|
-
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRecordMaps] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Record Maps', userPayload, EntityPermissionType.Read, 'AND');
|
|
3236
|
-
|
|
3282
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRecordMaps] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Record Maps', userPayload, EntityPermissionType.Read, 'AND');
|
|
3283
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Company Integration Record Maps', await dataSource.query(sSQL));
|
|
3284
|
+
return result;
|
|
3237
3285
|
}
|
|
3238
3286
|
|
|
3239
3287
|
@FieldResolver(() => [RecordMergeLog_])
|
|
3240
3288
|
async RecordMergeLogsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3241
3289
|
this.CheckUserReadPermissions('Record Merge Logs', userPayload);
|
|
3242
|
-
const sSQL = `SELECT * FROM [admin].[vwRecordMergeLogs] WHERE EntityID=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Record Merge Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3243
|
-
|
|
3290
|
+
const sSQL = `SELECT * FROM [admin].[vwRecordMergeLogs] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Record Merge Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3291
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Record Merge Logs', await dataSource.query(sSQL));
|
|
3292
|
+
return result;
|
|
3244
3293
|
}
|
|
3245
3294
|
|
|
3246
3295
|
@Mutation(() => Entity_)
|
|
@@ -3250,7 +3299,7 @@ export class EntityResolverBase extends ResolverBase {
|
|
|
3250
3299
|
@PubSub() pubSub: PubSubEngine
|
|
3251
3300
|
) {
|
|
3252
3301
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
3253
|
-
const entityObject = await new Metadata().GetEntityObject('Entities', this.GetUserFromPayload(userPayload));
|
|
3302
|
+
const entityObject = <EntityEntity>await new Metadata().GetEntityObject('Entities', this.GetUserFromPayload(userPayload));
|
|
3254
3303
|
await entityObject.NewRecord();
|
|
3255
3304
|
entityObject.SetMany(input);
|
|
3256
3305
|
if (await entityObject.Save()) {
|
|
@@ -3268,11 +3317,9 @@ export class EntityResolverBase extends ResolverBase {
|
|
|
3268
3317
|
|
|
3269
3318
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
3270
3319
|
protected async BeforeCreate(dataSource: DataSource, input: CreateEntityInput): Promise<boolean> {
|
|
3271
|
-
const i = input, d = dataSource; // prevent error
|
|
3272
3320
|
return true;
|
|
3273
3321
|
}
|
|
3274
3322
|
protected async AfterCreate(dataSource: DataSource, input: CreateEntityInput) {
|
|
3275
|
-
const i = input, d = dataSource; // prevent error
|
|
3276
3323
|
}
|
|
3277
3324
|
|
|
3278
3325
|
@Mutation(() => Entity_)
|
|
@@ -3282,7 +3329,7 @@ export class EntityResolverBase extends ResolverBase {
|
|
|
3282
3329
|
@PubSub() pubSub: PubSubEngine
|
|
3283
3330
|
) {
|
|
3284
3331
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
3285
|
-
const entityObject = await new Metadata().GetEntityObject('Entities', this.GetUserFromPayload(userPayload));
|
|
3332
|
+
const entityObject = <EntityEntity>await new Metadata().GetEntityObject('Entities', this.GetUserFromPayload(userPayload));
|
|
3286
3333
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Entities
|
|
3287
3334
|
|
|
3288
3335
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -3306,14 +3353,15 @@ export class EntityResolverBase extends ResolverBase {
|
|
|
3306
3353
|
const i = input, d = dataSource; // prevent error
|
|
3307
3354
|
}
|
|
3308
3355
|
|
|
3309
|
-
@Mutation(() =>
|
|
3356
|
+
@Mutation(() => Entity_)
|
|
3310
3357
|
async DeleteEntity(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3311
3358
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
3312
|
-
const entityObject = await new Metadata().GetEntityObject('Entities', this.GetUserFromPayload(userPayload));
|
|
3313
|
-
await entityObject.Load(ID)
|
|
3359
|
+
const entityObject = <EntityEntity>await new Metadata().GetEntityObject('Entities', this.GetUserFromPayload(userPayload));
|
|
3360
|
+
await entityObject.Load(ID);
|
|
3361
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
3314
3362
|
if (await entityObject.Delete()) {
|
|
3315
3363
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
3316
|
-
return
|
|
3364
|
+
return returnValue;
|
|
3317
3365
|
}
|
|
3318
3366
|
else
|
|
3319
3367
|
return null; // delete failed, this will cause an exception
|
|
@@ -3595,145 +3643,164 @@ export class UserResolverBase extends ResolverBase {
|
|
|
3595
3643
|
input.EntityName = 'Users';
|
|
3596
3644
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
3597
3645
|
}
|
|
3598
|
-
|
|
3599
3646
|
@Query(() => User_, { nullable: true })
|
|
3600
3647
|
async User(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<User_ | null> {
|
|
3601
3648
|
this.CheckUserReadPermissions('Users', userPayload);
|
|
3602
|
-
const sSQL = `SELECT * FROM [admin].vwUsers WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Users', userPayload, EntityPermissionType.Read, 'AND');
|
|
3603
|
-
|
|
3649
|
+
const sSQL = `SELECT * FROM [admin].[vwUsers] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Users', userPayload, EntityPermissionType.Read, 'AND');
|
|
3650
|
+
const result = this.MapFieldNamesToCodeNames('Users', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
3651
|
+
return result;
|
|
3604
3652
|
}
|
|
3605
3653
|
|
|
3606
3654
|
@Query(() => [User_])
|
|
3607
|
-
AllUsers(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3655
|
+
async AllUsers(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3608
3656
|
this.CheckUserReadPermissions('Users', userPayload);
|
|
3609
|
-
const sSQL = 'SELECT * FROM [admin].vwUsers' + this.getRowLevelSecurityWhereClause('Users', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
3610
|
-
|
|
3657
|
+
const sSQL = 'SELECT * FROM [admin].[vwUsers]' + this.getRowLevelSecurityWhereClause('Users', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
3658
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Users', await dataSource.query(sSQL));
|
|
3659
|
+
return result;
|
|
3611
3660
|
}
|
|
3612
3661
|
|
|
3613
3662
|
@FieldResolver(() => [UserApplication_])
|
|
3614
3663
|
async UserApplicationsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3615
3664
|
this.CheckUserReadPermissions('User Applications', userPayload);
|
|
3616
|
-
const sSQL = `SELECT * FROM [admin].[vwUserApplications] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Applications', userPayload, EntityPermissionType.Read, 'AND');
|
|
3617
|
-
|
|
3665
|
+
const sSQL = `SELECT * FROM [admin].[vwUserApplications] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Applications', userPayload, EntityPermissionType.Read, 'AND');
|
|
3666
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Applications', await dataSource.query(sSQL));
|
|
3667
|
+
return result;
|
|
3618
3668
|
}
|
|
3619
3669
|
|
|
3620
3670
|
@FieldResolver(() => [UserRole_])
|
|
3621
3671
|
async UserRolesArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3622
3672
|
this.CheckUserReadPermissions('User Roles', userPayload);
|
|
3623
|
-
const sSQL = `SELECT * FROM [admin].[vwUserRoles] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
3624
|
-
|
|
3673
|
+
const sSQL = `SELECT * FROM [admin].[vwUserRoles] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
3674
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Roles', await dataSource.query(sSQL));
|
|
3675
|
+
return result;
|
|
3625
3676
|
}
|
|
3626
3677
|
|
|
3627
3678
|
@FieldResolver(() => [Workspace_])
|
|
3628
3679
|
async WorkspacesArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3629
3680
|
this.CheckUserReadPermissions('Workspaces', userPayload);
|
|
3630
|
-
const sSQL = `SELECT * FROM [admin].[vwWorkspaces] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Workspaces', userPayload, EntityPermissionType.Read, 'AND');
|
|
3631
|
-
|
|
3681
|
+
const sSQL = `SELECT * FROM [admin].[vwWorkspaces] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Workspaces', userPayload, EntityPermissionType.Read, 'AND');
|
|
3682
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Workspaces', await dataSource.query(sSQL));
|
|
3683
|
+
return result;
|
|
3632
3684
|
}
|
|
3633
3685
|
|
|
3634
3686
|
@FieldResolver(() => [Report_])
|
|
3635
3687
|
async ReportsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3636
3688
|
this.CheckUserReadPermissions('Reports', userPayload);
|
|
3637
|
-
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
3638
|
-
|
|
3689
|
+
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
3690
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Reports', await dataSource.query(sSQL));
|
|
3691
|
+
return result;
|
|
3639
3692
|
}
|
|
3640
3693
|
|
|
3641
3694
|
@FieldResolver(() => [ReportSnapshot_])
|
|
3642
3695
|
async ReportSnapshotsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3643
3696
|
this.CheckUserReadPermissions('Report Snapshots', userPayload);
|
|
3644
|
-
const sSQL = `SELECT * FROM [admin].[vwReportSnapshots] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Report Snapshots', userPayload, EntityPermissionType.Read, 'AND');
|
|
3645
|
-
|
|
3697
|
+
const sSQL = `SELECT * FROM [admin].[vwReportSnapshots] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Report Snapshots', userPayload, EntityPermissionType.Read, 'AND');
|
|
3698
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Report Snapshots', await dataSource.query(sSQL));
|
|
3699
|
+
return result;
|
|
3646
3700
|
}
|
|
3647
3701
|
|
|
3648
3702
|
@FieldResolver(() => [RecordChange_])
|
|
3649
3703
|
async RecordChangesArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3650
3704
|
this.CheckUserReadPermissions('Record Changes', userPayload);
|
|
3651
|
-
const sSQL = `SELECT * FROM [admin].[vwRecordChanges] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Record Changes', userPayload, EntityPermissionType.Read, 'AND');
|
|
3652
|
-
|
|
3705
|
+
const sSQL = `SELECT * FROM [admin].[vwRecordChanges] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Record Changes', userPayload, EntityPermissionType.Read, 'AND');
|
|
3706
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Record Changes', await dataSource.query(sSQL));
|
|
3707
|
+
return result;
|
|
3653
3708
|
}
|
|
3654
3709
|
|
|
3655
3710
|
@FieldResolver(() => [Dashboard_])
|
|
3656
3711
|
async DashboardsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3657
3712
|
this.CheckUserReadPermissions('Dashboards', userPayload);
|
|
3658
|
-
const sSQL = `SELECT * FROM [admin].[vwDashboards] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Dashboards', userPayload, EntityPermissionType.Read, 'AND');
|
|
3659
|
-
|
|
3713
|
+
const sSQL = `SELECT * FROM [admin].[vwDashboards] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Dashboards', userPayload, EntityPermissionType.Read, 'AND');
|
|
3714
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Dashboards', await dataSource.query(sSQL));
|
|
3715
|
+
return result;
|
|
3660
3716
|
}
|
|
3661
3717
|
|
|
3662
3718
|
@FieldResolver(() => [UserViewRun_])
|
|
3663
3719
|
async UserViewRunsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3664
3720
|
this.CheckUserReadPermissions('User View Runs', userPayload);
|
|
3665
|
-
const sSQL = `SELECT * FROM [admin].[vwUserViewRuns] WHERE RunByUserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User View Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3666
|
-
|
|
3721
|
+
const sSQL = `SELECT * FROM [admin].[vwUserViewRuns] WHERE [RunByUserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User View Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3722
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User View Runs', await dataSource.query(sSQL));
|
|
3723
|
+
return result;
|
|
3667
3724
|
}
|
|
3668
3725
|
|
|
3669
3726
|
@FieldResolver(() => [AuditLog_])
|
|
3670
3727
|
async AuditLogsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3671
3728
|
this.CheckUserReadPermissions('Audit Logs', userPayload);
|
|
3672
|
-
const sSQL = `SELECT * FROM [admin].[vwAuditLogs] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3673
|
-
|
|
3729
|
+
const sSQL = `SELECT * FROM [admin].[vwAuditLogs] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3730
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Audit Logs', await dataSource.query(sSQL));
|
|
3731
|
+
return result;
|
|
3674
3732
|
}
|
|
3675
3733
|
|
|
3676
3734
|
@FieldResolver(() => [List_])
|
|
3677
3735
|
async ListsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3678
3736
|
this.CheckUserReadPermissions('Lists', userPayload);
|
|
3679
|
-
const sSQL = `SELECT * FROM [admin].[vwLists] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Lists', userPayload, EntityPermissionType.Read, 'AND');
|
|
3680
|
-
|
|
3737
|
+
const sSQL = `SELECT * FROM [admin].[vwLists] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Lists', userPayload, EntityPermissionType.Read, 'AND');
|
|
3738
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Lists', await dataSource.query(sSQL));
|
|
3739
|
+
return result;
|
|
3681
3740
|
}
|
|
3682
3741
|
|
|
3683
3742
|
@FieldResolver(() => [UserFavorite_])
|
|
3684
3743
|
async UserFavoritesArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3685
3744
|
this.CheckUserReadPermissions('User Favorites', userPayload);
|
|
3686
|
-
const sSQL = `SELECT * FROM [admin].[vwUserFavorites] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Favorites', userPayload, EntityPermissionType.Read, 'AND');
|
|
3687
|
-
|
|
3745
|
+
const sSQL = `SELECT * FROM [admin].[vwUserFavorites] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Favorites', userPayload, EntityPermissionType.Read, 'AND');
|
|
3746
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Favorites', await dataSource.query(sSQL));
|
|
3747
|
+
return result;
|
|
3688
3748
|
}
|
|
3689
3749
|
|
|
3690
3750
|
@FieldResolver(() => [UserRecordLog_])
|
|
3691
3751
|
async UserRecordLogsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3692
3752
|
this.CheckUserReadPermissions('User Record Logs', userPayload);
|
|
3693
|
-
const sSQL = `SELECT * FROM [admin].[vwUserRecordLogs] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Record Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3694
|
-
|
|
3753
|
+
const sSQL = `SELECT * FROM [admin].[vwUserRecordLogs] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Record Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3754
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Record Logs', await dataSource.query(sSQL));
|
|
3755
|
+
return result;
|
|
3695
3756
|
}
|
|
3696
3757
|
|
|
3697
3758
|
@FieldResolver(() => [UserView_])
|
|
3698
3759
|
async UserViewsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3699
3760
|
this.CheckUserReadPermissions('User Views', userPayload);
|
|
3700
|
-
const sSQL = `SELECT * FROM [admin].[vwUserViews] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Views', userPayload, EntityPermissionType.Read, 'AND');
|
|
3701
|
-
|
|
3761
|
+
const sSQL = `SELECT * FROM [admin].[vwUserViews] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Views', userPayload, EntityPermissionType.Read, 'AND');
|
|
3762
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Views', await dataSource.query(sSQL));
|
|
3763
|
+
return result;
|
|
3702
3764
|
}
|
|
3703
3765
|
|
|
3704
3766
|
@FieldResolver(() => [CompanyIntegrationRun_])
|
|
3705
3767
|
async CompanyIntegrationRunsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3706
3768
|
this.CheckUserReadPermissions('Company Integration Runs', userPayload);
|
|
3707
|
-
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRuns] WHERE RunByUserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3708
|
-
|
|
3769
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRuns] WHERE [RunByUserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3770
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Company Integration Runs', await dataSource.query(sSQL));
|
|
3771
|
+
return result;
|
|
3709
3772
|
}
|
|
3710
3773
|
|
|
3711
3774
|
@FieldResolver(() => [UserNotification_])
|
|
3712
3775
|
async UserNotificationsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3713
3776
|
this.CheckUserReadPermissions('User Notifications', userPayload);
|
|
3714
|
-
const sSQL = `SELECT * FROM [admin].[vwUserNotifications] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Notifications', userPayload, EntityPermissionType.Read, 'AND');
|
|
3715
|
-
|
|
3777
|
+
const sSQL = `SELECT * FROM [admin].[vwUserNotifications] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('User Notifications', userPayload, EntityPermissionType.Read, 'AND');
|
|
3778
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Notifications', await dataSource.query(sSQL));
|
|
3779
|
+
return result;
|
|
3716
3780
|
}
|
|
3717
3781
|
|
|
3718
3782
|
@FieldResolver(() => [Conversation_])
|
|
3719
3783
|
async ConversationsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3720
3784
|
this.CheckUserReadPermissions('Conversations', userPayload);
|
|
3721
|
-
const sSQL = `SELECT * FROM [admin].[vwConversations] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Conversations', userPayload, EntityPermissionType.Read, 'AND');
|
|
3722
|
-
|
|
3785
|
+
const sSQL = `SELECT * FROM [admin].[vwConversations] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Conversations', userPayload, EntityPermissionType.Read, 'AND');
|
|
3786
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Conversations', await dataSource.query(sSQL));
|
|
3787
|
+
return result;
|
|
3723
3788
|
}
|
|
3724
3789
|
|
|
3725
3790
|
@FieldResolver(() => [ResourceFolder_])
|
|
3726
3791
|
async ResourceFoldersArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3727
3792
|
this.CheckUserReadPermissions('Resource Folders', userPayload);
|
|
3728
|
-
const sSQL = `SELECT * FROM [admin].[vwResourceFolders] WHERE UserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
|
|
3729
|
-
|
|
3793
|
+
const sSQL = `SELECT * FROM [admin].[vwResourceFolders] WHERE [UserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
|
|
3794
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Resource Folders', await dataSource.query(sSQL));
|
|
3795
|
+
return result;
|
|
3730
3796
|
}
|
|
3731
3797
|
|
|
3732
3798
|
@FieldResolver(() => [RecordMergeLog_])
|
|
3733
3799
|
async RecordMergeLogsArray(@Root() user_: User_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3734
3800
|
this.CheckUserReadPermissions('Record Merge Logs', userPayload);
|
|
3735
|
-
const sSQL = `SELECT * FROM [admin].[vwRecordMergeLogs] WHERE InitiatedByUserID=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Record Merge Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3736
|
-
|
|
3801
|
+
const sSQL = `SELECT * FROM [admin].[vwRecordMergeLogs] WHERE [InitiatedByUserID]=${user_.ID} ` + this.getRowLevelSecurityWhereClause('Record Merge Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
3802
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Record Merge Logs', await dataSource.query(sSQL));
|
|
3803
|
+
return result;
|
|
3737
3804
|
}
|
|
3738
3805
|
|
|
3739
3806
|
@Mutation(() => User_)
|
|
@@ -3743,7 +3810,7 @@ export class UserResolverBase extends ResolverBase {
|
|
|
3743
3810
|
@PubSub() pubSub: PubSubEngine
|
|
3744
3811
|
) {
|
|
3745
3812
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
3746
|
-
const entityObject = await new Metadata().GetEntityObject('Users', this.GetUserFromPayload(userPayload));
|
|
3813
|
+
const entityObject = <UserEntity>await new Metadata().GetEntityObject('Users', this.GetUserFromPayload(userPayload));
|
|
3747
3814
|
await entityObject.NewRecord();
|
|
3748
3815
|
entityObject.SetMany(input);
|
|
3749
3816
|
if (await entityObject.Save()) {
|
|
@@ -3761,11 +3828,9 @@ export class UserResolverBase extends ResolverBase {
|
|
|
3761
3828
|
|
|
3762
3829
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
3763
3830
|
protected async BeforeCreate(dataSource: DataSource, input: CreateUserInput): Promise<boolean> {
|
|
3764
|
-
const i = input, d = dataSource; // prevent error
|
|
3765
3831
|
return true;
|
|
3766
3832
|
}
|
|
3767
3833
|
protected async AfterCreate(dataSource: DataSource, input: CreateUserInput) {
|
|
3768
|
-
const i = input, d = dataSource; // prevent error
|
|
3769
3834
|
}
|
|
3770
3835
|
|
|
3771
3836
|
@Mutation(() => User_)
|
|
@@ -3775,7 +3840,7 @@ export class UserResolverBase extends ResolverBase {
|
|
|
3775
3840
|
@PubSub() pubSub: PubSubEngine
|
|
3776
3841
|
) {
|
|
3777
3842
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
3778
|
-
const entityObject = await new Metadata().GetEntityObject('Users', this.GetUserFromPayload(userPayload));
|
|
3843
|
+
const entityObject = <UserEntity>await new Metadata().GetEntityObject('Users', this.GetUserFromPayload(userPayload));
|
|
3779
3844
|
await entityObject.Load(input.ID) // Track Changes is turned on, so we need to get the latest data from DB first before we save
|
|
3780
3845
|
entityObject.SetMany(input);
|
|
3781
3846
|
if (await entityObject.Save()) {
|
|
@@ -3889,7 +3954,7 @@ export class EntityRelationship_ {
|
|
|
3889
3954
|
RelatedEntityBaseView: string;
|
|
3890
3955
|
|
|
3891
3956
|
@Field({nullable: true})
|
|
3892
|
-
@MaxLength(
|
|
3957
|
+
@MaxLength(8000)
|
|
3893
3958
|
RelatedEntityClassName?: string;
|
|
3894
3959
|
|
|
3895
3960
|
@Field({nullable: true})
|
|
@@ -3897,7 +3962,7 @@ export class EntityRelationship_ {
|
|
|
3897
3962
|
RelatedEntityCodeName?: string;
|
|
3898
3963
|
|
|
3899
3964
|
@Field({nullable: true})
|
|
3900
|
-
@MaxLength(
|
|
3965
|
+
@MaxLength(8000)
|
|
3901
3966
|
RelatedEntityBaseTableCodeName?: string;
|
|
3902
3967
|
|
|
3903
3968
|
@Field({nullable: true})
|
|
@@ -4041,19 +4106,20 @@ export class EntityRelationshipResolver extends ResolverBase {
|
|
|
4041
4106
|
input.EntityName = 'Entity Relationships';
|
|
4042
4107
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
4043
4108
|
}
|
|
4044
|
-
|
|
4045
4109
|
@Query(() => EntityRelationship_, { nullable: true })
|
|
4046
4110
|
async EntityRelationship(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityRelationship_ | null> {
|
|
4047
4111
|
this.CheckUserReadPermissions('Entity Relationships', userPayload);
|
|
4048
|
-
const sSQL = `SELECT * FROM [admin].vwEntityRelationships WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Relationships', userPayload, EntityPermissionType.Read, 'AND');
|
|
4049
|
-
|
|
4112
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityRelationships] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Relationships', userPayload, EntityPermissionType.Read, 'AND');
|
|
4113
|
+
const result = this.MapFieldNamesToCodeNames('Entity Relationships', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
4114
|
+
return result;
|
|
4050
4115
|
}
|
|
4051
4116
|
|
|
4052
4117
|
@Query(() => [EntityRelationship_])
|
|
4053
|
-
AllEntityRelationships(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4118
|
+
async AllEntityRelationships(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4054
4119
|
this.CheckUserReadPermissions('Entity Relationships', userPayload);
|
|
4055
|
-
const sSQL = 'SELECT * FROM [admin].vwEntityRelationships' + this.getRowLevelSecurityWhereClause('Entity Relationships', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
4056
|
-
|
|
4120
|
+
const sSQL = 'SELECT * FROM [admin].[vwEntityRelationships]' + this.getRowLevelSecurityWhereClause('Entity Relationships', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
4121
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Relationships', await dataSource.query(sSQL));
|
|
4122
|
+
return result;
|
|
4057
4123
|
}
|
|
4058
4124
|
|
|
4059
4125
|
@Mutation(() => EntityRelationship_)
|
|
@@ -4063,7 +4129,7 @@ export class EntityRelationshipResolver extends ResolverBase {
|
|
|
4063
4129
|
@PubSub() pubSub: PubSubEngine
|
|
4064
4130
|
) {
|
|
4065
4131
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
4066
|
-
const entityObject = await new Metadata().GetEntityObject('Entity Relationships', this.GetUserFromPayload(userPayload));
|
|
4132
|
+
const entityObject = <EntityRelationshipEntity>await new Metadata().GetEntityObject('Entity Relationships', this.GetUserFromPayload(userPayload));
|
|
4067
4133
|
await entityObject.NewRecord();
|
|
4068
4134
|
entityObject.SetMany(input);
|
|
4069
4135
|
if (await entityObject.Save()) {
|
|
@@ -4081,11 +4147,9 @@ export class EntityRelationshipResolver extends ResolverBase {
|
|
|
4081
4147
|
|
|
4082
4148
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
4083
4149
|
protected async BeforeCreate(dataSource: DataSource, input: CreateEntityRelationshipInput): Promise<boolean> {
|
|
4084
|
-
const i = input, d = dataSource; // prevent error
|
|
4085
4150
|
return true;
|
|
4086
4151
|
}
|
|
4087
4152
|
protected async AfterCreate(dataSource: DataSource, input: CreateEntityRelationshipInput) {
|
|
4088
|
-
const i = input, d = dataSource; // prevent error
|
|
4089
4153
|
}
|
|
4090
4154
|
|
|
4091
4155
|
@Mutation(() => EntityRelationship_)
|
|
@@ -4095,7 +4159,7 @@ export class EntityRelationshipResolver extends ResolverBase {
|
|
|
4095
4159
|
@PubSub() pubSub: PubSubEngine
|
|
4096
4160
|
) {
|
|
4097
4161
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
4098
|
-
const entityObject = await new Metadata().GetEntityObject('Entity Relationships', this.GetUserFromPayload(userPayload));
|
|
4162
|
+
const entityObject = <EntityRelationshipEntity>await new Metadata().GetEntityObject('Entity Relationships', this.GetUserFromPayload(userPayload));
|
|
4099
4163
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Entity Relationships
|
|
4100
4164
|
|
|
4101
4165
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -4119,14 +4183,15 @@ export class EntityRelationshipResolver extends ResolverBase {
|
|
|
4119
4183
|
const i = input, d = dataSource; // prevent error
|
|
4120
4184
|
}
|
|
4121
4185
|
|
|
4122
|
-
@Mutation(() =>
|
|
4186
|
+
@Mutation(() => EntityRelationship_)
|
|
4123
4187
|
async DeleteEntityRelationship(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4124
4188
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
4125
|
-
const entityObject = await new Metadata().GetEntityObject('Entity Relationships', this.GetUserFromPayload(userPayload));
|
|
4126
|
-
await entityObject.Load(ID)
|
|
4189
|
+
const entityObject = <EntityRelationshipEntity>await new Metadata().GetEntityObject('Entity Relationships', this.GetUserFromPayload(userPayload));
|
|
4190
|
+
await entityObject.Load(ID);
|
|
4191
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
4127
4192
|
if (await entityObject.Delete()) {
|
|
4128
4193
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
4129
|
-
return
|
|
4194
|
+
return returnValue;
|
|
4130
4195
|
}
|
|
4131
4196
|
else
|
|
4132
4197
|
return null; // delete failed, this will cause an exception
|
|
@@ -4272,12 +4337,12 @@ export class UserRecordLogResolver extends ResolverBase {
|
|
|
4272
4337
|
input.EntityName = 'User Record Logs';
|
|
4273
4338
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
4274
4339
|
}
|
|
4275
|
-
|
|
4276
4340
|
@Query(() => UserRecordLog_, { nullable: true })
|
|
4277
4341
|
async UserRecordLog(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<UserRecordLog_ | null> {
|
|
4278
4342
|
this.CheckUserReadPermissions('User Record Logs', userPayload);
|
|
4279
|
-
const sSQL = `SELECT * FROM [admin].vwUserRecordLogs WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('User Record Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
4280
|
-
|
|
4343
|
+
const sSQL = `SELECT * FROM [admin].[vwUserRecordLogs] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('User Record Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
4344
|
+
const result = this.MapFieldNamesToCodeNames('User Record Logs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
4345
|
+
return result;
|
|
4281
4346
|
}
|
|
4282
4347
|
|
|
4283
4348
|
@Mutation(() => UserRecordLog_)
|
|
@@ -4287,7 +4352,7 @@ export class UserRecordLogResolver extends ResolverBase {
|
|
|
4287
4352
|
@PubSub() pubSub: PubSubEngine
|
|
4288
4353
|
) {
|
|
4289
4354
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
4290
|
-
const entityObject = await new Metadata().GetEntityObject('User Record Logs', this.GetUserFromPayload(userPayload));
|
|
4355
|
+
const entityObject = <UserRecordLogEntity>await new Metadata().GetEntityObject('User Record Logs', this.GetUserFromPayload(userPayload));
|
|
4291
4356
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for User Record Logs
|
|
4292
4357
|
|
|
4293
4358
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -4570,33 +4635,36 @@ export class UserViewResolverBase extends ResolverBase {
|
|
|
4570
4635
|
input.EntityName = 'User Views';
|
|
4571
4636
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
4572
4637
|
}
|
|
4573
|
-
|
|
4574
4638
|
@Query(() => UserView_, { nullable: true })
|
|
4575
4639
|
async UserView(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<UserView_ | null> {
|
|
4576
4640
|
this.CheckUserReadPermissions('User Views', userPayload);
|
|
4577
|
-
const sSQL = `SELECT * FROM [admin].vwUserViews WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('User Views', userPayload, EntityPermissionType.Read, 'AND');
|
|
4578
|
-
|
|
4641
|
+
const sSQL = `SELECT * FROM [admin].[vwUserViews] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('User Views', userPayload, EntityPermissionType.Read, 'AND');
|
|
4642
|
+
const result = this.MapFieldNamesToCodeNames('User Views', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
4643
|
+
return result;
|
|
4579
4644
|
}
|
|
4580
4645
|
|
|
4581
4646
|
@Query(() => [UserView_])
|
|
4582
|
-
AllUserViews(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4647
|
+
async AllUserViews(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4583
4648
|
this.CheckUserReadPermissions('User Views', userPayload);
|
|
4584
|
-
const sSQL = 'SELECT * FROM [admin].vwUserViews' + this.getRowLevelSecurityWhereClause('User Views', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
4585
|
-
|
|
4649
|
+
const sSQL = 'SELECT * FROM [admin].[vwUserViews]' + this.getRowLevelSecurityWhereClause('User Views', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
4650
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Views', await dataSource.query(sSQL));
|
|
4651
|
+
return result;
|
|
4586
4652
|
}
|
|
4587
4653
|
|
|
4588
4654
|
@FieldResolver(() => [EntityRelationship_])
|
|
4589
4655
|
async EntityRelationshipsArray(@Root() userview_: UserView_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4590
4656
|
this.CheckUserReadPermissions('Entity Relationships', userPayload);
|
|
4591
|
-
const sSQL = `SELECT * FROM [admin].[vwEntityRelationships] WHERE DisplayUserViewGUID=${userview_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Relationships', userPayload, EntityPermissionType.Read, 'AND');
|
|
4592
|
-
|
|
4657
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityRelationships] WHERE [DisplayUserViewGUID]=${userview_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Relationships', userPayload, EntityPermissionType.Read, 'AND');
|
|
4658
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Relationships', await dataSource.query(sSQL));
|
|
4659
|
+
return result;
|
|
4593
4660
|
}
|
|
4594
4661
|
|
|
4595
4662
|
@FieldResolver(() => [UserViewRun_])
|
|
4596
4663
|
async UserViewRunsArray(@Root() userview_: UserView_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4597
4664
|
this.CheckUserReadPermissions('User View Runs', userPayload);
|
|
4598
|
-
const sSQL = `SELECT * FROM [admin].[vwUserViewRuns] WHERE UserViewID=${userview_.ID} ` + this.getRowLevelSecurityWhereClause('User View Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
4599
|
-
|
|
4665
|
+
const sSQL = `SELECT * FROM [admin].[vwUserViewRuns] WHERE [UserViewID]=${userview_.ID} ` + this.getRowLevelSecurityWhereClause('User View Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
4666
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User View Runs', await dataSource.query(sSQL));
|
|
4667
|
+
return result;
|
|
4600
4668
|
}
|
|
4601
4669
|
|
|
4602
4670
|
@Mutation(() => UserView_)
|
|
@@ -4606,7 +4674,7 @@ export class UserViewResolverBase extends ResolverBase {
|
|
|
4606
4674
|
@PubSub() pubSub: PubSubEngine
|
|
4607
4675
|
) {
|
|
4608
4676
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
4609
|
-
const entityObject = await new Metadata().GetEntityObject('User Views', this.GetUserFromPayload(userPayload));
|
|
4677
|
+
const entityObject = <UserViewEntity>await new Metadata().GetEntityObject('User Views', this.GetUserFromPayload(userPayload));
|
|
4610
4678
|
await entityObject.NewRecord();
|
|
4611
4679
|
entityObject.SetMany(input);
|
|
4612
4680
|
if (await entityObject.Save()) {
|
|
@@ -4624,11 +4692,9 @@ export class UserViewResolverBase extends ResolverBase {
|
|
|
4624
4692
|
|
|
4625
4693
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
4626
4694
|
protected async BeforeCreate(dataSource: DataSource, input: CreateUserViewInput): Promise<boolean> {
|
|
4627
|
-
const i = input, d = dataSource; // prevent error
|
|
4628
4695
|
return true;
|
|
4629
4696
|
}
|
|
4630
4697
|
protected async AfterCreate(dataSource: DataSource, input: CreateUserViewInput) {
|
|
4631
|
-
const i = input, d = dataSource; // prevent error
|
|
4632
4698
|
}
|
|
4633
4699
|
|
|
4634
4700
|
@Mutation(() => UserView_)
|
|
@@ -4638,7 +4704,7 @@ export class UserViewResolverBase extends ResolverBase {
|
|
|
4638
4704
|
@PubSub() pubSub: PubSubEngine
|
|
4639
4705
|
) {
|
|
4640
4706
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
4641
|
-
const entityObject = await new Metadata().GetEntityObject('User Views', this.GetUserFromPayload(userPayload));
|
|
4707
|
+
const entityObject = <UserViewEntity>await new Metadata().GetEntityObject('User Views', this.GetUserFromPayload(userPayload));
|
|
4642
4708
|
await entityObject.Load(input.ID) // Track Changes is turned on, so we need to get the latest data from DB first before we save
|
|
4643
4709
|
entityObject.SetMany(input);
|
|
4644
4710
|
if (await entityObject.Save()) {
|
|
@@ -4662,14 +4728,15 @@ export class UserViewResolverBase extends ResolverBase {
|
|
|
4662
4728
|
const i = input, d = dataSource; // prevent error
|
|
4663
4729
|
}
|
|
4664
4730
|
|
|
4665
|
-
@Mutation(() =>
|
|
4731
|
+
@Mutation(() => UserView_)
|
|
4666
4732
|
async DeleteUserView(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4667
4733
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
4668
|
-
const entityObject = await new Metadata().GetEntityObject('User Views', this.GetUserFromPayload(userPayload));
|
|
4669
|
-
await entityObject.Load(ID)
|
|
4734
|
+
const entityObject = <UserViewEntity>await new Metadata().GetEntityObject('User Views', this.GetUserFromPayload(userPayload));
|
|
4735
|
+
await entityObject.Load(ID);
|
|
4736
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
4670
4737
|
if (await entityObject.Delete()) {
|
|
4671
4738
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
4672
|
-
return
|
|
4739
|
+
return returnValue;
|
|
4673
4740
|
}
|
|
4674
4741
|
else
|
|
4675
4742
|
return null; // delete failed, this will cause an exception
|
|
@@ -4803,33 +4870,36 @@ export class CompanyIntegrationRunResolver extends ResolverBase {
|
|
|
4803
4870
|
input.EntityName = 'Company Integration Runs';
|
|
4804
4871
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
4805
4872
|
}
|
|
4806
|
-
|
|
4807
4873
|
@Query(() => CompanyIntegrationRun_, { nullable: true })
|
|
4808
4874
|
async CompanyIntegrationRun(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<CompanyIntegrationRun_ | null> {
|
|
4809
4875
|
this.CheckUserReadPermissions('Company Integration Runs', userPayload);
|
|
4810
|
-
const sSQL = `SELECT * FROM [admin].vwCompanyIntegrationRuns WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
4811
|
-
|
|
4876
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRuns] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
4877
|
+
const result = this.MapFieldNamesToCodeNames('Company Integration Runs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
4878
|
+
return result;
|
|
4812
4879
|
}
|
|
4813
4880
|
|
|
4814
4881
|
@FieldResolver(() => [CompanyIntegrationRunAPILog_])
|
|
4815
4882
|
async CompanyIntegrationRunAPILogsArray(@Root() companyintegrationrun_: CompanyIntegrationRun_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4816
4883
|
this.CheckUserReadPermissions('Company Integration Run API Logs', userPayload);
|
|
4817
|
-
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRunAPILogs] WHERE CompanyIntegrationRunID=${companyintegrationrun_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Run API Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
4818
|
-
|
|
4884
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRunAPILogs] WHERE [CompanyIntegrationRunID]=${companyintegrationrun_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Run API Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
4885
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Company Integration Run API Logs', await dataSource.query(sSQL));
|
|
4886
|
+
return result;
|
|
4819
4887
|
}
|
|
4820
4888
|
|
|
4821
4889
|
@FieldResolver(() => [ErrorLog_])
|
|
4822
4890
|
async ErrorLogsArray(@Root() companyintegrationrun_: CompanyIntegrationRun_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4823
4891
|
this.CheckUserReadPermissions('Error Logs', userPayload);
|
|
4824
|
-
const sSQL = `SELECT * FROM [admin].[vwErrorLogs] WHERE CompanyIntegrationRunID=${companyintegrationrun_.ID} ` + this.getRowLevelSecurityWhereClause('Error Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
4825
|
-
|
|
4892
|
+
const sSQL = `SELECT * FROM [admin].[vwErrorLogs] WHERE [CompanyIntegrationRunID]=${companyintegrationrun_.ID} ` + this.getRowLevelSecurityWhereClause('Error Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
4893
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Error Logs', await dataSource.query(sSQL));
|
|
4894
|
+
return result;
|
|
4826
4895
|
}
|
|
4827
4896
|
|
|
4828
4897
|
@FieldResolver(() => [CompanyIntegrationRunDetail_])
|
|
4829
4898
|
async CompanyIntegrationRunDetailsArray(@Root() companyintegrationrun_: CompanyIntegrationRun_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4830
4899
|
this.CheckUserReadPermissions('Company Integration Run Details', userPayload);
|
|
4831
|
-
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRunDetails] WHERE CompanyIntegrationRunID=${companyintegrationrun_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Run Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
4832
|
-
|
|
4900
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRunDetails] WHERE [CompanyIntegrationRunID]=${companyintegrationrun_.ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Run Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
4901
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Company Integration Run Details', await dataSource.query(sSQL));
|
|
4902
|
+
return result;
|
|
4833
4903
|
}
|
|
4834
4904
|
|
|
4835
4905
|
@Mutation(() => CompanyIntegrationRun_)
|
|
@@ -4839,7 +4909,7 @@ export class CompanyIntegrationRunResolver extends ResolverBase {
|
|
|
4839
4909
|
@PubSub() pubSub: PubSubEngine
|
|
4840
4910
|
) {
|
|
4841
4911
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
4842
|
-
const entityObject = await new Metadata().GetEntityObject('Company Integration Runs', this.GetUserFromPayload(userPayload));
|
|
4912
|
+
const entityObject = <CompanyIntegrationRunEntity>await new Metadata().GetEntityObject('Company Integration Runs', this.GetUserFromPayload(userPayload));
|
|
4843
4913
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Company Integration Runs
|
|
4844
4914
|
|
|
4845
4915
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -4982,19 +5052,20 @@ export class CompanyIntegrationRunDetailResolver extends ResolverBase {
|
|
|
4982
5052
|
input.EntityName = 'Company Integration Run Details';
|
|
4983
5053
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
4984
5054
|
}
|
|
4985
|
-
|
|
4986
5055
|
@Query(() => CompanyIntegrationRunDetail_, { nullable: true })
|
|
4987
5056
|
async CompanyIntegrationRunDetail(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<CompanyIntegrationRunDetail_ | null> {
|
|
4988
5057
|
this.CheckUserReadPermissions('Company Integration Run Details', userPayload);
|
|
4989
|
-
const sSQL = `SELECT * FROM [admin].vwCompanyIntegrationRunDetails WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Run Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
4990
|
-
|
|
5058
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRunDetails] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Run Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
5059
|
+
const result = this.MapFieldNamesToCodeNames('Company Integration Run Details', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
5060
|
+
return result;
|
|
4991
5061
|
}
|
|
4992
5062
|
|
|
4993
5063
|
@FieldResolver(() => [ErrorLog_])
|
|
4994
5064
|
async ErrorLogsArray(@Root() companyintegrationrundetail_: CompanyIntegrationRunDetail_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
4995
5065
|
this.CheckUserReadPermissions('Error Logs', userPayload);
|
|
4996
|
-
const sSQL = `SELECT * FROM [admin].[vwErrorLogs] WHERE CompanyIntegrationRunDetailID=${companyintegrationrundetail_.ID} ` + this.getRowLevelSecurityWhereClause('Error Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
4997
|
-
|
|
5066
|
+
const sSQL = `SELECT * FROM [admin].[vwErrorLogs] WHERE [CompanyIntegrationRunDetailID]=${companyintegrationrundetail_.ID} ` + this.getRowLevelSecurityWhereClause('Error Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
5067
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Error Logs', await dataSource.query(sSQL));
|
|
5068
|
+
return result;
|
|
4998
5069
|
}
|
|
4999
5070
|
|
|
5000
5071
|
@Mutation(() => CompanyIntegrationRunDetail_)
|
|
@@ -5004,7 +5075,7 @@ export class CompanyIntegrationRunDetailResolver extends ResolverBase {
|
|
|
5004
5075
|
@PubSub() pubSub: PubSubEngine
|
|
5005
5076
|
) {
|
|
5006
5077
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
5007
|
-
const entityObject = await new Metadata().GetEntityObject('Company Integration Run Details', this.GetUserFromPayload(userPayload));
|
|
5078
|
+
const entityObject = <CompanyIntegrationRunDetailEntity>await new Metadata().GetEntityObject('Company Integration Run Details', this.GetUserFromPayload(userPayload));
|
|
5008
5079
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Company Integration Run Details
|
|
5009
5080
|
|
|
5010
5081
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -5149,12 +5220,12 @@ export class ErrorLogResolver extends ResolverBase {
|
|
|
5149
5220
|
input.EntityName = 'Error Logs';
|
|
5150
5221
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
5151
5222
|
}
|
|
5152
|
-
|
|
5153
5223
|
@Query(() => ErrorLog_, { nullable: true })
|
|
5154
5224
|
async ErrorLog(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ErrorLog_ | null> {
|
|
5155
5225
|
this.CheckUserReadPermissions('Error Logs', userPayload);
|
|
5156
|
-
const sSQL = `SELECT * FROM [admin].vwErrorLogs WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Error Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
5157
|
-
|
|
5226
|
+
const sSQL = `SELECT * FROM [admin].[vwErrorLogs] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Error Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
5227
|
+
const result = this.MapFieldNamesToCodeNames('Error Logs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
5228
|
+
return result;
|
|
5158
5229
|
}
|
|
5159
5230
|
|
|
5160
5231
|
@Mutation(() => ErrorLog_)
|
|
@@ -5164,7 +5235,7 @@ export class ErrorLogResolver extends ResolverBase {
|
|
|
5164
5235
|
@PubSub() pubSub: PubSubEngine
|
|
5165
5236
|
) {
|
|
5166
5237
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
5167
|
-
const entityObject = await new Metadata().GetEntityObject('Error Logs', this.GetUserFromPayload(userPayload));
|
|
5238
|
+
const entityObject = <ErrorLogEntity>await new Metadata().GetEntityObject('Error Logs', this.GetUserFromPayload(userPayload));
|
|
5168
5239
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Error Logs
|
|
5169
5240
|
|
|
5170
5241
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -5281,33 +5352,36 @@ export class ApplicationResolver extends ResolverBase {
|
|
|
5281
5352
|
input.EntityName = 'Applications';
|
|
5282
5353
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
5283
5354
|
}
|
|
5284
|
-
|
|
5285
5355
|
@Query(() => Application_, { nullable: true })
|
|
5286
5356
|
async Application(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Application_ | null> {
|
|
5287
5357
|
this.CheckUserReadPermissions('Applications', userPayload);
|
|
5288
|
-
const sSQL = `SELECT * FROM [admin].vwApplications WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Applications', userPayload, EntityPermissionType.Read, 'AND');
|
|
5289
|
-
|
|
5358
|
+
const sSQL = `SELECT * FROM [admin].[vwApplications] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Applications', userPayload, EntityPermissionType.Read, 'AND');
|
|
5359
|
+
const result = this.MapFieldNamesToCodeNames('Applications', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
5360
|
+
return result;
|
|
5290
5361
|
}
|
|
5291
5362
|
|
|
5292
5363
|
@Query(() => [Application_])
|
|
5293
|
-
AllApplications(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
5364
|
+
async AllApplications(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
5294
5365
|
this.CheckUserReadPermissions('Applications', userPayload);
|
|
5295
|
-
const sSQL = 'SELECT * FROM [admin].vwApplications' + this.getRowLevelSecurityWhereClause('Applications', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
5296
|
-
|
|
5366
|
+
const sSQL = 'SELECT * FROM [admin].[vwApplications]' + this.getRowLevelSecurityWhereClause('Applications', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
5367
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Applications', await dataSource.query(sSQL));
|
|
5368
|
+
return result;
|
|
5297
5369
|
}
|
|
5298
5370
|
|
|
5299
5371
|
@FieldResolver(() => [ApplicationEntity_])
|
|
5300
5372
|
async ApplicationEntitiesArray(@Root() application_: Application_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
5301
5373
|
this.CheckUserReadPermissions('Application Entities', userPayload);
|
|
5302
|
-
const sSQL = `SELECT * FROM [admin].[vwApplicationEntities] WHERE ApplicationID=${application_.ID} ` + this.getRowLevelSecurityWhereClause('Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
5303
|
-
|
|
5374
|
+
const sSQL = `SELECT * FROM [admin].[vwApplicationEntities] WHERE [ApplicationID]=${application_.ID} ` + this.getRowLevelSecurityWhereClause('Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
5375
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Application Entities', await dataSource.query(sSQL));
|
|
5376
|
+
return result;
|
|
5304
5377
|
}
|
|
5305
5378
|
|
|
5306
5379
|
@FieldResolver(() => [UserApplication_])
|
|
5307
5380
|
async UserApplicationsArray(@Root() application_: Application_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
5308
5381
|
this.CheckUserReadPermissions('User Applications', userPayload);
|
|
5309
|
-
const sSQL = `SELECT * FROM [admin].[vwUserApplications] WHERE ApplicationID=${application_.ID} ` + this.getRowLevelSecurityWhereClause('User Applications', userPayload, EntityPermissionType.Read, 'AND');
|
|
5310
|
-
|
|
5382
|
+
const sSQL = `SELECT * FROM [admin].[vwUserApplications] WHERE [ApplicationID]=${application_.ID} ` + this.getRowLevelSecurityWhereClause('User Applications', userPayload, EntityPermissionType.Read, 'AND');
|
|
5383
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Applications', await dataSource.query(sSQL));
|
|
5384
|
+
return result;
|
|
5311
5385
|
}
|
|
5312
5386
|
|
|
5313
5387
|
@Mutation(() => Application_)
|
|
@@ -5317,7 +5391,7 @@ export class ApplicationResolver extends ResolverBase {
|
|
|
5317
5391
|
@PubSub() pubSub: PubSubEngine
|
|
5318
5392
|
) {
|
|
5319
5393
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
5320
|
-
const entityObject = await new Metadata().GetEntityObject('Applications', this.GetUserFromPayload(userPayload));
|
|
5394
|
+
const entityObject = <ApplicationEntity>await new Metadata().GetEntityObject('Applications', this.GetUserFromPayload(userPayload));
|
|
5321
5395
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Applications
|
|
5322
5396
|
|
|
5323
5397
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -5389,11 +5463,11 @@ export class ApplicationEntity_ {
|
|
|
5389
5463
|
EntityCodeName?: string;
|
|
5390
5464
|
|
|
5391
5465
|
@Field({nullable: true})
|
|
5392
|
-
@MaxLength(
|
|
5466
|
+
@MaxLength(8000)
|
|
5393
5467
|
EntityClassName?: string;
|
|
5394
5468
|
|
|
5395
5469
|
@Field({nullable: true})
|
|
5396
|
-
@MaxLength(
|
|
5470
|
+
@MaxLength(8000)
|
|
5397
5471
|
EntityBaseTableCodeName?: string;
|
|
5398
5472
|
|
|
5399
5473
|
}
|
|
@@ -5485,12 +5559,12 @@ export class ApplicationEntityResolver extends ResolverBase {
|
|
|
5485
5559
|
input.EntityName = 'Application Entities';
|
|
5486
5560
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
5487
5561
|
}
|
|
5488
|
-
|
|
5489
5562
|
@Query(() => ApplicationEntity_, { nullable: true })
|
|
5490
5563
|
async ApplicationEntity(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ApplicationEntity_ | null> {
|
|
5491
5564
|
this.CheckUserReadPermissions('Application Entities', userPayload);
|
|
5492
|
-
const sSQL = `SELECT * FROM [admin].vwApplicationEntities WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
5493
|
-
|
|
5565
|
+
const sSQL = `SELECT * FROM [admin].[vwApplicationEntities] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
5566
|
+
const result = this.MapFieldNamesToCodeNames('Application Entities', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
5567
|
+
return result;
|
|
5494
5568
|
}
|
|
5495
5569
|
|
|
5496
5570
|
@Mutation(() => ApplicationEntity_)
|
|
@@ -5500,7 +5574,7 @@ export class ApplicationEntityResolver extends ResolverBase {
|
|
|
5500
5574
|
@PubSub() pubSub: PubSubEngine
|
|
5501
5575
|
) {
|
|
5502
5576
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
5503
|
-
const entityObject = await new Metadata().GetEntityObject('Application Entities', this.GetUserFromPayload(userPayload));
|
|
5577
|
+
const entityObject = <ApplicationEntityEntity>await new Metadata().GetEntityObject('Application Entities', this.GetUserFromPayload(userPayload));
|
|
5504
5578
|
await entityObject.NewRecord();
|
|
5505
5579
|
entityObject.SetMany(input);
|
|
5506
5580
|
if (await entityObject.Save()) {
|
|
@@ -5518,11 +5592,9 @@ export class ApplicationEntityResolver extends ResolverBase {
|
|
|
5518
5592
|
|
|
5519
5593
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
5520
5594
|
protected async BeforeCreate(dataSource: DataSource, input: CreateApplicationEntityInput): Promise<boolean> {
|
|
5521
|
-
const i = input, d = dataSource; // prevent error
|
|
5522
5595
|
return true;
|
|
5523
5596
|
}
|
|
5524
5597
|
protected async AfterCreate(dataSource: DataSource, input: CreateApplicationEntityInput) {
|
|
5525
|
-
const i = input, d = dataSource; // prevent error
|
|
5526
5598
|
}
|
|
5527
5599
|
|
|
5528
5600
|
@Mutation(() => ApplicationEntity_)
|
|
@@ -5532,7 +5604,7 @@ export class ApplicationEntityResolver extends ResolverBase {
|
|
|
5532
5604
|
@PubSub() pubSub: PubSubEngine
|
|
5533
5605
|
) {
|
|
5534
5606
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
5535
|
-
const entityObject = await new Metadata().GetEntityObject('Application Entities', this.GetUserFromPayload(userPayload));
|
|
5607
|
+
const entityObject = <ApplicationEntityEntity>await new Metadata().GetEntityObject('Application Entities', this.GetUserFromPayload(userPayload));
|
|
5536
5608
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Application Entities
|
|
5537
5609
|
|
|
5538
5610
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -5556,14 +5628,15 @@ export class ApplicationEntityResolver extends ResolverBase {
|
|
|
5556
5628
|
const i = input, d = dataSource; // prevent error
|
|
5557
5629
|
}
|
|
5558
5630
|
|
|
5559
|
-
@Mutation(() =>
|
|
5631
|
+
@Mutation(() => ApplicationEntity_)
|
|
5560
5632
|
async DeleteApplicationEntity(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
5561
5633
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
5562
|
-
const entityObject = await new Metadata().GetEntityObject('Application Entities', this.GetUserFromPayload(userPayload));
|
|
5563
|
-
await entityObject.Load(ID)
|
|
5634
|
+
const entityObject = <ApplicationEntityEntity>await new Metadata().GetEntityObject('Application Entities', this.GetUserFromPayload(userPayload));
|
|
5635
|
+
await entityObject.Load(ID);
|
|
5636
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
5564
5637
|
if (await entityObject.Delete()) {
|
|
5565
5638
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
5566
|
-
return
|
|
5639
|
+
return returnValue;
|
|
5567
5640
|
}
|
|
5568
5641
|
else
|
|
5569
5642
|
return null; // delete failed, this will cause an exception
|
|
@@ -5779,19 +5852,20 @@ export class EntityPermissionResolver extends ResolverBase {
|
|
|
5779
5852
|
input.EntityName = 'Entity Permissions';
|
|
5780
5853
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
5781
5854
|
}
|
|
5782
|
-
|
|
5783
5855
|
@Query(() => EntityPermission_, { nullable: true })
|
|
5784
5856
|
async EntityPermission(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityPermission_ | null> {
|
|
5785
5857
|
this.CheckUserReadPermissions('Entity Permissions', userPayload);
|
|
5786
|
-
const sSQL = `SELECT * FROM [admin].vwEntityPermissions WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Permissions', userPayload, EntityPermissionType.Read, 'AND');
|
|
5787
|
-
|
|
5858
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityPermissions] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Permissions', userPayload, EntityPermissionType.Read, 'AND');
|
|
5859
|
+
const result = this.MapFieldNamesToCodeNames('Entity Permissions', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
5860
|
+
return result;
|
|
5788
5861
|
}
|
|
5789
5862
|
|
|
5790
5863
|
@Query(() => [EntityPermission_])
|
|
5791
|
-
AllEntityPermissions(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
5864
|
+
async AllEntityPermissions(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
5792
5865
|
this.CheckUserReadPermissions('Entity Permissions', userPayload);
|
|
5793
|
-
const sSQL = 'SELECT * FROM [admin].vwEntityPermissions' + this.getRowLevelSecurityWhereClause('Entity Permissions', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
5794
|
-
|
|
5866
|
+
const sSQL = 'SELECT * FROM [admin].[vwEntityPermissions]' + this.getRowLevelSecurityWhereClause('Entity Permissions', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
5867
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Permissions', await dataSource.query(sSQL));
|
|
5868
|
+
return result;
|
|
5795
5869
|
}
|
|
5796
5870
|
|
|
5797
5871
|
@Mutation(() => EntityPermission_)
|
|
@@ -5801,7 +5875,7 @@ export class EntityPermissionResolver extends ResolverBase {
|
|
|
5801
5875
|
@PubSub() pubSub: PubSubEngine
|
|
5802
5876
|
) {
|
|
5803
5877
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
5804
|
-
const entityObject = await new Metadata().GetEntityObject('Entity Permissions', this.GetUserFromPayload(userPayload));
|
|
5878
|
+
const entityObject = <EntityPermissionEntity>await new Metadata().GetEntityObject('Entity Permissions', this.GetUserFromPayload(userPayload));
|
|
5805
5879
|
await entityObject.NewRecord();
|
|
5806
5880
|
entityObject.SetMany(input);
|
|
5807
5881
|
if (await entityObject.Save()) {
|
|
@@ -5819,11 +5893,9 @@ export class EntityPermissionResolver extends ResolverBase {
|
|
|
5819
5893
|
|
|
5820
5894
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
5821
5895
|
protected async BeforeCreate(dataSource: DataSource, input: CreateEntityPermissionInput): Promise<boolean> {
|
|
5822
|
-
const i = input, d = dataSource; // prevent error
|
|
5823
5896
|
return true;
|
|
5824
5897
|
}
|
|
5825
5898
|
protected async AfterCreate(dataSource: DataSource, input: CreateEntityPermissionInput) {
|
|
5826
|
-
const i = input, d = dataSource; // prevent error
|
|
5827
5899
|
}
|
|
5828
5900
|
|
|
5829
5901
|
@Mutation(() => EntityPermission_)
|
|
@@ -5833,7 +5905,7 @@ export class EntityPermissionResolver extends ResolverBase {
|
|
|
5833
5905
|
@PubSub() pubSub: PubSubEngine
|
|
5834
5906
|
) {
|
|
5835
5907
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
5836
|
-
const entityObject = await new Metadata().GetEntityObject('Entity Permissions', this.GetUserFromPayload(userPayload));
|
|
5908
|
+
const entityObject = <EntityPermissionEntity>await new Metadata().GetEntityObject('Entity Permissions', this.GetUserFromPayload(userPayload));
|
|
5837
5909
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Entity Permissions
|
|
5838
5910
|
|
|
5839
5911
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -5857,14 +5929,15 @@ export class EntityPermissionResolver extends ResolverBase {
|
|
|
5857
5929
|
const i = input, d = dataSource; // prevent error
|
|
5858
5930
|
}
|
|
5859
5931
|
|
|
5860
|
-
@Mutation(() =>
|
|
5932
|
+
@Mutation(() => EntityPermission_)
|
|
5861
5933
|
async DeleteEntityPermission(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
5862
5934
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
5863
|
-
const entityObject = await new Metadata().GetEntityObject('Entity Permissions', this.GetUserFromPayload(userPayload));
|
|
5864
|
-
await entityObject.Load(ID)
|
|
5935
|
+
const entityObject = <EntityPermissionEntity>await new Metadata().GetEntityObject('Entity Permissions', this.GetUserFromPayload(userPayload));
|
|
5936
|
+
await entityObject.Load(ID);
|
|
5937
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
5865
5938
|
if (await entityObject.Delete()) {
|
|
5866
5939
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
5867
|
-
return
|
|
5940
|
+
return returnValue;
|
|
5868
5941
|
}
|
|
5869
5942
|
else
|
|
5870
5943
|
return null; // delete failed, this will cause an exception
|
|
@@ -5996,12 +6069,12 @@ export class UserApplicationEntityResolver extends ResolverBase {
|
|
|
5996
6069
|
input.EntityName = 'User Application Entities';
|
|
5997
6070
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
5998
6071
|
}
|
|
5999
|
-
|
|
6000
6072
|
@Query(() => UserApplicationEntity_, { nullable: true })
|
|
6001
6073
|
async UserApplicationEntity(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<UserApplicationEntity_ | null> {
|
|
6002
6074
|
this.CheckUserReadPermissions('User Application Entities', userPayload);
|
|
6003
|
-
const sSQL = `SELECT * FROM [admin].vwUserApplicationEntities WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('User Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
6004
|
-
|
|
6075
|
+
const sSQL = `SELECT * FROM [admin].[vwUserApplicationEntities] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('User Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
6076
|
+
const result = this.MapFieldNamesToCodeNames('User Application Entities', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
6077
|
+
return result;
|
|
6005
6078
|
}
|
|
6006
6079
|
|
|
6007
6080
|
@Mutation(() => UserApplicationEntity_)
|
|
@@ -6011,7 +6084,7 @@ export class UserApplicationEntityResolver extends ResolverBase {
|
|
|
6011
6084
|
@PubSub() pubSub: PubSubEngine
|
|
6012
6085
|
) {
|
|
6013
6086
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
6014
|
-
const entityObject = await new Metadata().GetEntityObject('User Application Entities', this.GetUserFromPayload(userPayload));
|
|
6087
|
+
const entityObject = <UserApplicationEntityEntity>await new Metadata().GetEntityObject('User Application Entities', this.GetUserFromPayload(userPayload));
|
|
6015
6088
|
await entityObject.NewRecord();
|
|
6016
6089
|
entityObject.SetMany(input);
|
|
6017
6090
|
if (await entityObject.Save()) {
|
|
@@ -6029,11 +6102,9 @@ export class UserApplicationEntityResolver extends ResolverBase {
|
|
|
6029
6102
|
|
|
6030
6103
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
6031
6104
|
protected async BeforeCreate(dataSource: DataSource, input: CreateUserApplicationEntityInput): Promise<boolean> {
|
|
6032
|
-
const i = input, d = dataSource; // prevent error
|
|
6033
6105
|
return true;
|
|
6034
6106
|
}
|
|
6035
6107
|
protected async AfterCreate(dataSource: DataSource, input: CreateUserApplicationEntityInput) {
|
|
6036
|
-
const i = input, d = dataSource; // prevent error
|
|
6037
6108
|
}
|
|
6038
6109
|
|
|
6039
6110
|
@Mutation(() => UserApplicationEntity_)
|
|
@@ -6043,7 +6114,7 @@ export class UserApplicationEntityResolver extends ResolverBase {
|
|
|
6043
6114
|
@PubSub() pubSub: PubSubEngine
|
|
6044
6115
|
) {
|
|
6045
6116
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
6046
|
-
const entityObject = await new Metadata().GetEntityObject('User Application Entities', this.GetUserFromPayload(userPayload));
|
|
6117
|
+
const entityObject = <UserApplicationEntityEntity>await new Metadata().GetEntityObject('User Application Entities', this.GetUserFromPayload(userPayload));
|
|
6047
6118
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for User Application Entities
|
|
6048
6119
|
|
|
6049
6120
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -6067,14 +6138,15 @@ export class UserApplicationEntityResolver extends ResolverBase {
|
|
|
6067
6138
|
const i = input, d = dataSource; // prevent error
|
|
6068
6139
|
}
|
|
6069
6140
|
|
|
6070
|
-
@Mutation(() =>
|
|
6141
|
+
@Mutation(() => UserApplicationEntity_)
|
|
6071
6142
|
async DeleteUserApplicationEntity(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
6072
6143
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
6073
|
-
const entityObject = await new Metadata().GetEntityObject('User Application Entities', this.GetUserFromPayload(userPayload));
|
|
6074
|
-
await entityObject.Load(ID)
|
|
6144
|
+
const entityObject = <UserApplicationEntityEntity>await new Metadata().GetEntityObject('User Application Entities', this.GetUserFromPayload(userPayload));
|
|
6145
|
+
await entityObject.Load(ID);
|
|
6146
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
6075
6147
|
if (await entityObject.Delete()) {
|
|
6076
6148
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
6077
|
-
return
|
|
6149
|
+
return returnValue;
|
|
6078
6150
|
}
|
|
6079
6151
|
else
|
|
6080
6152
|
return null; // delete failed, this will cause an exception
|
|
@@ -6192,19 +6264,20 @@ export class UserApplicationResolver extends ResolverBase {
|
|
|
6192
6264
|
input.EntityName = 'User Applications';
|
|
6193
6265
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
6194
6266
|
}
|
|
6195
|
-
|
|
6196
6267
|
@Query(() => UserApplication_, { nullable: true })
|
|
6197
6268
|
async UserApplication(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<UserApplication_ | null> {
|
|
6198
6269
|
this.CheckUserReadPermissions('User Applications', userPayload);
|
|
6199
|
-
const sSQL = `SELECT * FROM [admin].vwUserApplications WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('User Applications', userPayload, EntityPermissionType.Read, 'AND');
|
|
6200
|
-
|
|
6270
|
+
const sSQL = `SELECT * FROM [admin].[vwUserApplications] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('User Applications', userPayload, EntityPermissionType.Read, 'AND');
|
|
6271
|
+
const result = this.MapFieldNamesToCodeNames('User Applications', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
6272
|
+
return result;
|
|
6201
6273
|
}
|
|
6202
6274
|
|
|
6203
6275
|
@FieldResolver(() => [UserApplicationEntity_])
|
|
6204
6276
|
async UserApplicationEntitiesArray(@Root() userapplication_: UserApplication_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
6205
6277
|
this.CheckUserReadPermissions('User Application Entities', userPayload);
|
|
6206
|
-
const sSQL = `SELECT * FROM [admin].[vwUserApplicationEntities] WHERE UserApplicationID=${userapplication_.ID} ` + this.getRowLevelSecurityWhereClause('User Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
6207
|
-
|
|
6278
|
+
const sSQL = `SELECT * FROM [admin].[vwUserApplicationEntities] WHERE [UserApplicationID]=${userapplication_.ID} ` + this.getRowLevelSecurityWhereClause('User Application Entities', userPayload, EntityPermissionType.Read, 'AND');
|
|
6279
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Application Entities', await dataSource.query(sSQL));
|
|
6280
|
+
return result;
|
|
6208
6281
|
}
|
|
6209
6282
|
|
|
6210
6283
|
@Mutation(() => UserApplication_)
|
|
@@ -6214,7 +6287,7 @@ export class UserApplicationResolver extends ResolverBase {
|
|
|
6214
6287
|
@PubSub() pubSub: PubSubEngine
|
|
6215
6288
|
) {
|
|
6216
6289
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
6217
|
-
const entityObject = await new Metadata().GetEntityObject('User Applications', this.GetUserFromPayload(userPayload));
|
|
6290
|
+
const entityObject = <UserApplicationEntity>await new Metadata().GetEntityObject('User Applications', this.GetUserFromPayload(userPayload));
|
|
6218
6291
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for User Applications
|
|
6219
6292
|
|
|
6220
6293
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -6341,12 +6414,12 @@ export class CompanyIntegrationRunAPILogResolver extends ResolverBase {
|
|
|
6341
6414
|
input.EntityName = 'Company Integration Run API Logs';
|
|
6342
6415
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
6343
6416
|
}
|
|
6344
|
-
|
|
6345
6417
|
@Query(() => CompanyIntegrationRunAPILog_, { nullable: true })
|
|
6346
6418
|
async CompanyIntegrationRunAPILog(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<CompanyIntegrationRunAPILog_ | null> {
|
|
6347
6419
|
this.CheckUserReadPermissions('Company Integration Run API Logs', userPayload);
|
|
6348
|
-
const sSQL = `SELECT * FROM [admin].vwCompanyIntegrationRunAPILogs WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Run API Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
6349
|
-
|
|
6420
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRunAPILogs] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Run API Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
6421
|
+
const result = this.MapFieldNamesToCodeNames('Company Integration Run API Logs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
6422
|
+
return result;
|
|
6350
6423
|
}
|
|
6351
6424
|
|
|
6352
6425
|
@Mutation(() => CompanyIntegrationRunAPILog_)
|
|
@@ -6356,7 +6429,7 @@ export class CompanyIntegrationRunAPILogResolver extends ResolverBase {
|
|
|
6356
6429
|
@PubSub() pubSub: PubSubEngine
|
|
6357
6430
|
) {
|
|
6358
6431
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
6359
|
-
const entityObject = await new Metadata().GetEntityObject('Company Integration Run API Logs', this.GetUserFromPayload(userPayload));
|
|
6432
|
+
const entityObject = <CompanyIntegrationRunAPILogEntity>await new Metadata().GetEntityObject('Company Integration Run API Logs', this.GetUserFromPayload(userPayload));
|
|
6360
6433
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Company Integration Run API Logs
|
|
6361
6434
|
|
|
6362
6435
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -6530,19 +6603,20 @@ export class ListResolver extends ResolverBase {
|
|
|
6530
6603
|
input.EntityName = 'Lists';
|
|
6531
6604
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
6532
6605
|
}
|
|
6533
|
-
|
|
6534
6606
|
@Query(() => List_, { nullable: true })
|
|
6535
6607
|
async List(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<List_ | null> {
|
|
6536
6608
|
this.CheckUserReadPermissions('Lists', userPayload);
|
|
6537
|
-
const sSQL = `SELECT * FROM [admin].vwLists WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Lists', userPayload, EntityPermissionType.Read, 'AND');
|
|
6538
|
-
|
|
6609
|
+
const sSQL = `SELECT * FROM [admin].[vwLists] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Lists', userPayload, EntityPermissionType.Read, 'AND');
|
|
6610
|
+
const result = this.MapFieldNamesToCodeNames('Lists', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
6611
|
+
return result;
|
|
6539
6612
|
}
|
|
6540
6613
|
|
|
6541
6614
|
@FieldResolver(() => [ListDetail_])
|
|
6542
6615
|
async ListDetailsArray(@Root() list_: List_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
6543
6616
|
this.CheckUserReadPermissions('List Details', userPayload);
|
|
6544
|
-
const sSQL = `SELECT * FROM [admin].[vwListDetails] WHERE ListID=${list_.ID} ` + this.getRowLevelSecurityWhereClause('List Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
6545
|
-
|
|
6617
|
+
const sSQL = `SELECT * FROM [admin].[vwListDetails] WHERE [ListID]=${list_.ID} ` + this.getRowLevelSecurityWhereClause('List Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
6618
|
+
const result = this.ArrayMapFieldNamesToCodeNames('List Details', await dataSource.query(sSQL));
|
|
6619
|
+
return result;
|
|
6546
6620
|
}
|
|
6547
6621
|
|
|
6548
6622
|
@Mutation(() => List_)
|
|
@@ -6552,7 +6626,7 @@ export class ListResolver extends ResolverBase {
|
|
|
6552
6626
|
@PubSub() pubSub: PubSubEngine
|
|
6553
6627
|
) {
|
|
6554
6628
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
6555
|
-
const entityObject = await new Metadata().GetEntityObject('Lists', this.GetUserFromPayload(userPayload));
|
|
6629
|
+
const entityObject = <ListEntity>await new Metadata().GetEntityObject('Lists', this.GetUserFromPayload(userPayload));
|
|
6556
6630
|
await entityObject.NewRecord();
|
|
6557
6631
|
entityObject.SetMany(input);
|
|
6558
6632
|
if (await entityObject.Save()) {
|
|
@@ -6570,11 +6644,9 @@ export class ListResolver extends ResolverBase {
|
|
|
6570
6644
|
|
|
6571
6645
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
6572
6646
|
protected async BeforeCreate(dataSource: DataSource, input: CreateListInput): Promise<boolean> {
|
|
6573
|
-
const i = input, d = dataSource; // prevent error
|
|
6574
6647
|
return true;
|
|
6575
6648
|
}
|
|
6576
6649
|
protected async AfterCreate(dataSource: DataSource, input: CreateListInput) {
|
|
6577
|
-
const i = input, d = dataSource; // prevent error
|
|
6578
6650
|
}
|
|
6579
6651
|
|
|
6580
6652
|
@Mutation(() => List_)
|
|
@@ -6584,7 +6656,7 @@ export class ListResolver extends ResolverBase {
|
|
|
6584
6656
|
@PubSub() pubSub: PubSubEngine
|
|
6585
6657
|
) {
|
|
6586
6658
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
6587
|
-
const entityObject = await new Metadata().GetEntityObject('Lists', this.GetUserFromPayload(userPayload));
|
|
6659
|
+
const entityObject = <ListEntity>await new Metadata().GetEntityObject('Lists', this.GetUserFromPayload(userPayload));
|
|
6588
6660
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Lists
|
|
6589
6661
|
|
|
6590
6662
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -6608,14 +6680,15 @@ export class ListResolver extends ResolverBase {
|
|
|
6608
6680
|
const i = input, d = dataSource; // prevent error
|
|
6609
6681
|
}
|
|
6610
6682
|
|
|
6611
|
-
@Mutation(() =>
|
|
6683
|
+
@Mutation(() => List_)
|
|
6612
6684
|
async DeleteList(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
6613
6685
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
6614
|
-
const entityObject = await new Metadata().GetEntityObject('Lists', this.GetUserFromPayload(userPayload));
|
|
6615
|
-
await entityObject.Load(ID)
|
|
6686
|
+
const entityObject = <ListEntity>await new Metadata().GetEntityObject('Lists', this.GetUserFromPayload(userPayload));
|
|
6687
|
+
await entityObject.Load(ID);
|
|
6688
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
6616
6689
|
if (await entityObject.Delete()) {
|
|
6617
6690
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
6618
|
-
return
|
|
6691
|
+
return returnValue;
|
|
6619
6692
|
}
|
|
6620
6693
|
else
|
|
6621
6694
|
return null; // delete failed, this will cause an exception
|
|
@@ -6736,12 +6809,12 @@ export class ListDetailResolver extends ResolverBase {
|
|
|
6736
6809
|
input.EntityName = 'List Details';
|
|
6737
6810
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
6738
6811
|
}
|
|
6739
|
-
|
|
6740
6812
|
@Query(() => ListDetail_, { nullable: true })
|
|
6741
6813
|
async ListDetail(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ListDetail_ | null> {
|
|
6742
6814
|
this.CheckUserReadPermissions('List Details', userPayload);
|
|
6743
|
-
const sSQL = `SELECT * FROM [admin].vwListDetails WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('List Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
6744
|
-
|
|
6815
|
+
const sSQL = `SELECT * FROM [admin].[vwListDetails] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('List Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
6816
|
+
const result = this.MapFieldNamesToCodeNames('List Details', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
6817
|
+
return result;
|
|
6745
6818
|
}
|
|
6746
6819
|
|
|
6747
6820
|
@Mutation(() => ListDetail_)
|
|
@@ -6751,7 +6824,7 @@ export class ListDetailResolver extends ResolverBase {
|
|
|
6751
6824
|
@PubSub() pubSub: PubSubEngine
|
|
6752
6825
|
) {
|
|
6753
6826
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
6754
|
-
const entityObject = await new Metadata().GetEntityObject('List Details', this.GetUserFromPayload(userPayload));
|
|
6827
|
+
const entityObject = <ListDetailEntity>await new Metadata().GetEntityObject('List Details', this.GetUserFromPayload(userPayload));
|
|
6755
6828
|
await entityObject.NewRecord();
|
|
6756
6829
|
entityObject.SetMany(input);
|
|
6757
6830
|
if (await entityObject.Save()) {
|
|
@@ -6769,11 +6842,9 @@ export class ListDetailResolver extends ResolverBase {
|
|
|
6769
6842
|
|
|
6770
6843
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
6771
6844
|
protected async BeforeCreate(dataSource: DataSource, input: CreateListDetailInput): Promise<boolean> {
|
|
6772
|
-
const i = input, d = dataSource; // prevent error
|
|
6773
6845
|
return true;
|
|
6774
6846
|
}
|
|
6775
6847
|
protected async AfterCreate(dataSource: DataSource, input: CreateListDetailInput) {
|
|
6776
|
-
const i = input, d = dataSource; // prevent error
|
|
6777
6848
|
}
|
|
6778
6849
|
|
|
6779
6850
|
@Mutation(() => ListDetail_)
|
|
@@ -6783,7 +6854,7 @@ export class ListDetailResolver extends ResolverBase {
|
|
|
6783
6854
|
@PubSub() pubSub: PubSubEngine
|
|
6784
6855
|
) {
|
|
6785
6856
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
6786
|
-
const entityObject = await new Metadata().GetEntityObject('List Details', this.GetUserFromPayload(userPayload));
|
|
6857
|
+
const entityObject = <ListDetailEntity>await new Metadata().GetEntityObject('List Details', this.GetUserFromPayload(userPayload));
|
|
6787
6858
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for List Details
|
|
6788
6859
|
|
|
6789
6860
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -6807,14 +6878,15 @@ export class ListDetailResolver extends ResolverBase {
|
|
|
6807
6878
|
const i = input, d = dataSource; // prevent error
|
|
6808
6879
|
}
|
|
6809
6880
|
|
|
6810
|
-
@Mutation(() =>
|
|
6881
|
+
@Mutation(() => ListDetail_)
|
|
6811
6882
|
async DeleteListDetail(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
6812
6883
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
6813
|
-
const entityObject = await new Metadata().GetEntityObject('List Details', this.GetUserFromPayload(userPayload));
|
|
6814
|
-
await entityObject.Load(ID)
|
|
6884
|
+
const entityObject = <ListDetailEntity>await new Metadata().GetEntityObject('List Details', this.GetUserFromPayload(userPayload));
|
|
6885
|
+
await entityObject.Load(ID);
|
|
6886
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
6815
6887
|
if (await entityObject.Delete()) {
|
|
6816
6888
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
6817
|
-
return
|
|
6889
|
+
return returnValue;
|
|
6818
6890
|
}
|
|
6819
6891
|
else
|
|
6820
6892
|
return null; // delete failed, this will cause an exception
|
|
@@ -6946,19 +7018,20 @@ export class UserViewRunResolver extends ResolverBase {
|
|
|
6946
7018
|
input.EntityName = 'User View Runs';
|
|
6947
7019
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
6948
7020
|
}
|
|
6949
|
-
|
|
6950
7021
|
@Query(() => UserViewRun_, { nullable: true })
|
|
6951
7022
|
async UserViewRun(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<UserViewRun_ | null> {
|
|
6952
7023
|
this.CheckUserReadPermissions('User View Runs', userPayload);
|
|
6953
|
-
const sSQL = `SELECT * FROM [admin].vwUserViewRuns WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('User View Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
6954
|
-
|
|
7024
|
+
const sSQL = `SELECT * FROM [admin].[vwUserViewRuns] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('User View Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
7025
|
+
const result = this.MapFieldNamesToCodeNames('User View Runs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
7026
|
+
return result;
|
|
6955
7027
|
}
|
|
6956
7028
|
|
|
6957
7029
|
@FieldResolver(() => [UserViewRunDetail_])
|
|
6958
7030
|
async UserViewRunDetailsArray(@Root() userviewrun_: UserViewRun_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
6959
7031
|
this.CheckUserReadPermissions('User View Run Details', userPayload);
|
|
6960
|
-
const sSQL = `SELECT * FROM [admin].[vwUserViewRunDetails] WHERE UserViewRunID=${userviewrun_.ID} ` + this.getRowLevelSecurityWhereClause('User View Run Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
6961
|
-
|
|
7032
|
+
const sSQL = `SELECT * FROM [admin].[vwUserViewRunDetails] WHERE [UserViewRunID]=${userviewrun_.ID} ` + this.getRowLevelSecurityWhereClause('User View Run Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
7033
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User View Run Details', await dataSource.query(sSQL));
|
|
7034
|
+
return result;
|
|
6962
7035
|
}
|
|
6963
7036
|
|
|
6964
7037
|
@Mutation(() => UserViewRun_)
|
|
@@ -6968,7 +7041,7 @@ export class UserViewRunResolver extends ResolverBase {
|
|
|
6968
7041
|
@PubSub() pubSub: PubSubEngine
|
|
6969
7042
|
) {
|
|
6970
7043
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
6971
|
-
const entityObject = await new Metadata().GetEntityObject('User View Runs', this.GetUserFromPayload(userPayload));
|
|
7044
|
+
const entityObject = <UserViewRunEntity>await new Metadata().GetEntityObject('User View Runs', this.GetUserFromPayload(userPayload));
|
|
6972
7045
|
await entityObject.NewRecord();
|
|
6973
7046
|
entityObject.SetMany(input);
|
|
6974
7047
|
if (await entityObject.Save()) {
|
|
@@ -6986,11 +7059,9 @@ export class UserViewRunResolver extends ResolverBase {
|
|
|
6986
7059
|
|
|
6987
7060
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
6988
7061
|
protected async BeforeCreate(dataSource: DataSource, input: CreateUserViewRunInput): Promise<boolean> {
|
|
6989
|
-
const i = input, d = dataSource; // prevent error
|
|
6990
7062
|
return true;
|
|
6991
7063
|
}
|
|
6992
7064
|
protected async AfterCreate(dataSource: DataSource, input: CreateUserViewRunInput) {
|
|
6993
|
-
const i = input, d = dataSource; // prevent error
|
|
6994
7065
|
}
|
|
6995
7066
|
|
|
6996
7067
|
@Mutation(() => UserViewRun_)
|
|
@@ -7000,7 +7071,7 @@ export class UserViewRunResolver extends ResolverBase {
|
|
|
7000
7071
|
@PubSub() pubSub: PubSubEngine
|
|
7001
7072
|
) {
|
|
7002
7073
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
7003
|
-
const entityObject = await new Metadata().GetEntityObject('User View Runs', this.GetUserFromPayload(userPayload));
|
|
7074
|
+
const entityObject = <UserViewRunEntity>await new Metadata().GetEntityObject('User View Runs', this.GetUserFromPayload(userPayload));
|
|
7004
7075
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for User View Runs
|
|
7005
7076
|
|
|
7006
7077
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -7124,12 +7195,12 @@ export class UserViewRunDetailResolver extends ResolverBase {
|
|
|
7124
7195
|
input.EntityName = 'User View Run Details';
|
|
7125
7196
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
7126
7197
|
}
|
|
7127
|
-
|
|
7128
7198
|
@Query(() => UserViewRunDetail_, { nullable: true })
|
|
7129
7199
|
async UserViewRunDetail(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<UserViewRunDetail_ | null> {
|
|
7130
7200
|
this.CheckUserReadPermissions('User View Run Details', userPayload);
|
|
7131
|
-
const sSQL = `SELECT * FROM [admin].vwUserViewRunDetails WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('User View Run Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
7132
|
-
|
|
7201
|
+
const sSQL = `SELECT * FROM [admin].[vwUserViewRunDetails] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('User View Run Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
7202
|
+
const result = this.MapFieldNamesToCodeNames('User View Run Details', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
7203
|
+
return result;
|
|
7133
7204
|
}
|
|
7134
7205
|
|
|
7135
7206
|
@Mutation(() => UserViewRunDetail_)
|
|
@@ -7139,7 +7210,7 @@ export class UserViewRunDetailResolver extends ResolverBase {
|
|
|
7139
7210
|
@PubSub() pubSub: PubSubEngine
|
|
7140
7211
|
) {
|
|
7141
7212
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
7142
|
-
const entityObject = await new Metadata().GetEntityObject('User View Run Details', this.GetUserFromPayload(userPayload));
|
|
7213
|
+
const entityObject = <UserViewRunDetailEntity>await new Metadata().GetEntityObject('User View Run Details', this.GetUserFromPayload(userPayload));
|
|
7143
7214
|
await entityObject.NewRecord();
|
|
7144
7215
|
entityObject.SetMany(input);
|
|
7145
7216
|
if (await entityObject.Save()) {
|
|
@@ -7157,11 +7228,9 @@ export class UserViewRunDetailResolver extends ResolverBase {
|
|
|
7157
7228
|
|
|
7158
7229
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
7159
7230
|
protected async BeforeCreate(dataSource: DataSource, input: CreateUserViewRunDetailInput): Promise<boolean> {
|
|
7160
|
-
const i = input, d = dataSource; // prevent error
|
|
7161
7231
|
return true;
|
|
7162
7232
|
}
|
|
7163
7233
|
protected async AfterCreate(dataSource: DataSource, input: CreateUserViewRunDetailInput) {
|
|
7164
|
-
const i = input, d = dataSource; // prevent error
|
|
7165
7234
|
}
|
|
7166
7235
|
|
|
7167
7236
|
@Mutation(() => UserViewRunDetail_)
|
|
@@ -7171,7 +7240,7 @@ export class UserViewRunDetailResolver extends ResolverBase {
|
|
|
7171
7240
|
@PubSub() pubSub: PubSubEngine
|
|
7172
7241
|
) {
|
|
7173
7242
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
7174
|
-
const entityObject = await new Metadata().GetEntityObject('User View Run Details', this.GetUserFromPayload(userPayload));
|
|
7243
|
+
const entityObject = <UserViewRunDetailEntity>await new Metadata().GetEntityObject('User View Run Details', this.GetUserFromPayload(userPayload));
|
|
7175
7244
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for User View Run Details
|
|
7176
7245
|
|
|
7177
7246
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -7309,12 +7378,12 @@ export class WorkflowRunResolver extends ResolverBase {
|
|
|
7309
7378
|
input.EntityName = 'Workflow Runs';
|
|
7310
7379
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
7311
7380
|
}
|
|
7312
|
-
|
|
7313
7381
|
@Query(() => WorkflowRun_, { nullable: true })
|
|
7314
7382
|
async WorkflowRun(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<WorkflowRun_ | null> {
|
|
7315
7383
|
this.CheckUserReadPermissions('Workflow Runs', userPayload);
|
|
7316
|
-
const sSQL = `SELECT * FROM [admin].vwWorkflowRuns WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Workflow Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
7317
|
-
|
|
7384
|
+
const sSQL = `SELECT * FROM [admin].[vwWorkflowRuns] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Workflow Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
7385
|
+
const result = this.MapFieldNamesToCodeNames('Workflow Runs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
7386
|
+
return result;
|
|
7318
7387
|
}
|
|
7319
7388
|
|
|
7320
7389
|
@Mutation(() => WorkflowRun_)
|
|
@@ -7324,7 +7393,7 @@ export class WorkflowRunResolver extends ResolverBase {
|
|
|
7324
7393
|
@PubSub() pubSub: PubSubEngine
|
|
7325
7394
|
) {
|
|
7326
7395
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
7327
|
-
const entityObject = await new Metadata().GetEntityObject('Workflow Runs', this.GetUserFromPayload(userPayload));
|
|
7396
|
+
const entityObject = <WorkflowRunEntity>await new Metadata().GetEntityObject('Workflow Runs', this.GetUserFromPayload(userPayload));
|
|
7328
7397
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Workflow Runs
|
|
7329
7398
|
|
|
7330
7399
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -7461,26 +7530,28 @@ export class WorkflowResolver extends ResolverBase {
|
|
|
7461
7530
|
input.EntityName = 'Workflows';
|
|
7462
7531
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
7463
7532
|
}
|
|
7464
|
-
|
|
7465
7533
|
@Query(() => Workflow_, { nullable: true })
|
|
7466
7534
|
async Workflow(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Workflow_ | null> {
|
|
7467
7535
|
this.CheckUserReadPermissions('Workflows', userPayload);
|
|
7468
|
-
const sSQL = `SELECT * FROM [admin].vwWorkflows WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Workflows', userPayload, EntityPermissionType.Read, 'AND');
|
|
7469
|
-
|
|
7536
|
+
const sSQL = `SELECT * FROM [admin].[vwWorkflows] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Workflows', userPayload, EntityPermissionType.Read, 'AND');
|
|
7537
|
+
const result = this.MapFieldNamesToCodeNames('Workflows', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
7538
|
+
return result;
|
|
7470
7539
|
}
|
|
7471
7540
|
|
|
7472
7541
|
@FieldResolver(() => [Report_])
|
|
7473
7542
|
async ReportsArray(@Root() workflow_: Workflow_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
7474
7543
|
this.CheckUserReadPermissions('Reports', userPayload);
|
|
7475
|
-
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE OutputWorkflowID=${workflow_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
7476
|
-
|
|
7544
|
+
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE [OutputWorkflowID]=${workflow_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
7545
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Reports', await dataSource.query(sSQL));
|
|
7546
|
+
return result;
|
|
7477
7547
|
}
|
|
7478
7548
|
|
|
7479
7549
|
@FieldResolver(() => [WorkflowRun_])
|
|
7480
7550
|
async WorkflowRunsArray(@Root() workflow_: Workflow_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
7481
7551
|
this.CheckUserReadPermissions('Workflow Runs', userPayload);
|
|
7482
|
-
const sSQL = `SELECT * FROM [admin].[vwWorkflowRuns] WHERE WorkflowName=${workflow_.ID} ` + this.getRowLevelSecurityWhereClause('Workflow Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
7483
|
-
|
|
7552
|
+
const sSQL = `SELECT * FROM [admin].[vwWorkflowRuns] WHERE [WorkflowName]=${workflow_.ID} ` + this.getRowLevelSecurityWhereClause('Workflow Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
7553
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Workflow Runs', await dataSource.query(sSQL));
|
|
7554
|
+
return result;
|
|
7484
7555
|
}
|
|
7485
7556
|
|
|
7486
7557
|
@Mutation(() => Workflow_)
|
|
@@ -7490,7 +7561,7 @@ export class WorkflowResolver extends ResolverBase {
|
|
|
7490
7561
|
@PubSub() pubSub: PubSubEngine
|
|
7491
7562
|
) {
|
|
7492
7563
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
7493
|
-
const entityObject = await new Metadata().GetEntityObject('Workflows', this.GetUserFromPayload(userPayload));
|
|
7564
|
+
const entityObject = <WorkflowEntity>await new Metadata().GetEntityObject('Workflows', this.GetUserFromPayload(userPayload));
|
|
7494
7565
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Workflows
|
|
7495
7566
|
|
|
7496
7567
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -7617,19 +7688,20 @@ export class WorkflowEngineResolver extends ResolverBase {
|
|
|
7617
7688
|
input.EntityName = 'Workflow Engines';
|
|
7618
7689
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
7619
7690
|
}
|
|
7620
|
-
|
|
7621
7691
|
@Query(() => WorkflowEngine_, { nullable: true })
|
|
7622
7692
|
async WorkflowEngine(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<WorkflowEngine_ | null> {
|
|
7623
7693
|
this.CheckUserReadPermissions('Workflow Engines', userPayload);
|
|
7624
|
-
const sSQL = `SELECT * FROM [admin].vwWorkflowEngines WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Workflow Engines', userPayload, EntityPermissionType.Read, 'AND');
|
|
7625
|
-
|
|
7694
|
+
const sSQL = `SELECT * FROM [admin].[vwWorkflowEngines] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Workflow Engines', userPayload, EntityPermissionType.Read, 'AND');
|
|
7695
|
+
const result = this.MapFieldNamesToCodeNames('Workflow Engines', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
7696
|
+
return result;
|
|
7626
7697
|
}
|
|
7627
7698
|
|
|
7628
7699
|
@FieldResolver(() => [Workflow_])
|
|
7629
7700
|
async WorkflowsArray(@Root() workflowengine_: WorkflowEngine_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
7630
7701
|
this.CheckUserReadPermissions('Workflows', userPayload);
|
|
7631
|
-
const sSQL = `SELECT * FROM [admin].[vwWorkflows] WHERE WorkflowEngineName=${workflowengine_.ID} ` + this.getRowLevelSecurityWhereClause('Workflows', userPayload, EntityPermissionType.Read, 'AND');
|
|
7632
|
-
|
|
7702
|
+
const sSQL = `SELECT * FROM [admin].[vwWorkflows] WHERE [WorkflowEngineName]=${workflowengine_.ID} ` + this.getRowLevelSecurityWhereClause('Workflows', userPayload, EntityPermissionType.Read, 'AND');
|
|
7703
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Workflows', await dataSource.query(sSQL));
|
|
7704
|
+
return result;
|
|
7633
7705
|
}
|
|
7634
7706
|
|
|
7635
7707
|
@Mutation(() => WorkflowEngine_)
|
|
@@ -7639,7 +7711,7 @@ export class WorkflowEngineResolver extends ResolverBase {
|
|
|
7639
7711
|
@PubSub() pubSub: PubSubEngine
|
|
7640
7712
|
) {
|
|
7641
7713
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
7642
|
-
const entityObject = await new Metadata().GetEntityObject('Workflow Engines', this.GetUserFromPayload(userPayload));
|
|
7714
|
+
const entityObject = <WorkflowEngineEntity>await new Metadata().GetEntityObject('Workflow Engines', this.GetUserFromPayload(userPayload));
|
|
7643
7715
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Workflow Engines
|
|
7644
7716
|
|
|
7645
7717
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -7790,12 +7862,12 @@ export class RecordChangeResolver extends ResolverBase {
|
|
|
7790
7862
|
input.EntityName = 'Record Changes';
|
|
7791
7863
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
7792
7864
|
}
|
|
7793
|
-
|
|
7794
7865
|
@Query(() => RecordChange_, { nullable: true })
|
|
7795
7866
|
async RecordChange(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<RecordChange_ | null> {
|
|
7796
7867
|
this.CheckUserReadPermissions('Record Changes', userPayload);
|
|
7797
|
-
const sSQL = `SELECT * FROM [admin].vwRecordChanges WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Record Changes', userPayload, EntityPermissionType.Read, 'AND');
|
|
7798
|
-
|
|
7868
|
+
const sSQL = `SELECT * FROM [admin].[vwRecordChanges] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Record Changes', userPayload, EntityPermissionType.Read, 'AND');
|
|
7869
|
+
const result = this.MapFieldNamesToCodeNames('Record Changes', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
7870
|
+
return result;
|
|
7799
7871
|
}
|
|
7800
7872
|
|
|
7801
7873
|
@Mutation(() => RecordChange_)
|
|
@@ -7805,7 +7877,7 @@ export class RecordChangeResolver extends ResolverBase {
|
|
|
7805
7877
|
@PubSub() pubSub: PubSubEngine
|
|
7806
7878
|
) {
|
|
7807
7879
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
7808
|
-
const entityObject = await new Metadata().GetEntityObject('Record Changes', this.GetUserFromPayload(userPayload));
|
|
7880
|
+
const entityObject = <RecordChangeEntity>await new Metadata().GetEntityObject('Record Changes', this.GetUserFromPayload(userPayload));
|
|
7809
7881
|
await entityObject.NewRecord();
|
|
7810
7882
|
entityObject.SetMany(input);
|
|
7811
7883
|
if (await entityObject.Save()) {
|
|
@@ -7823,11 +7895,9 @@ export class RecordChangeResolver extends ResolverBase {
|
|
|
7823
7895
|
|
|
7824
7896
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
7825
7897
|
protected async BeforeCreate(dataSource: DataSource, input: CreateRecordChangeInput): Promise<boolean> {
|
|
7826
|
-
const i = input, d = dataSource; // prevent error
|
|
7827
7898
|
return true;
|
|
7828
7899
|
}
|
|
7829
7900
|
protected async AfterCreate(dataSource: DataSource, input: CreateRecordChangeInput) {
|
|
7830
|
-
const i = input, d = dataSource; // prevent error
|
|
7831
7901
|
}
|
|
7832
7902
|
|
|
7833
7903
|
}
|
|
@@ -7917,19 +7987,20 @@ export class UserRoleResolver extends ResolverBase {
|
|
|
7917
7987
|
input.EntityName = 'User Roles';
|
|
7918
7988
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
7919
7989
|
}
|
|
7920
|
-
|
|
7921
7990
|
@Query(() => UserRole_, { nullable: true })
|
|
7922
7991
|
async UserRole(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<UserRole_ | null> {
|
|
7923
7992
|
this.CheckUserReadPermissions('User Roles', userPayload);
|
|
7924
|
-
const sSQL = `SELECT * FROM [admin].vwUserRoles WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('User Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
7925
|
-
|
|
7993
|
+
const sSQL = `SELECT * FROM [admin].[vwUserRoles] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('User Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
7994
|
+
const result = this.MapFieldNamesToCodeNames('User Roles', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
7995
|
+
return result;
|
|
7926
7996
|
}
|
|
7927
7997
|
|
|
7928
7998
|
@Query(() => [UserRole_])
|
|
7929
|
-
AllUserRoles(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
7999
|
+
async AllUserRoles(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
7930
8000
|
this.CheckUserReadPermissions('User Roles', userPayload);
|
|
7931
|
-
const sSQL = 'SELECT * FROM [admin].vwUserRoles' + this.getRowLevelSecurityWhereClause('User Roles', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
7932
|
-
|
|
8001
|
+
const sSQL = 'SELECT * FROM [admin].[vwUserRoles]' + this.getRowLevelSecurityWhereClause('User Roles', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8002
|
+
const result = this.ArrayMapFieldNamesToCodeNames('User Roles', await dataSource.query(sSQL));
|
|
8003
|
+
return result;
|
|
7933
8004
|
}
|
|
7934
8005
|
|
|
7935
8006
|
@Mutation(() => UserRole_)
|
|
@@ -7939,7 +8010,7 @@ export class UserRoleResolver extends ResolverBase {
|
|
|
7939
8010
|
@PubSub() pubSub: PubSubEngine
|
|
7940
8011
|
) {
|
|
7941
8012
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
7942
|
-
const entityObject = await new Metadata().GetEntityObject('User Roles', this.GetUserFromPayload(userPayload));
|
|
8013
|
+
const entityObject = <UserRoleEntity>await new Metadata().GetEntityObject('User Roles', this.GetUserFromPayload(userPayload));
|
|
7943
8014
|
await entityObject.NewRecord();
|
|
7944
8015
|
entityObject.SetMany(input);
|
|
7945
8016
|
if (await entityObject.Save()) {
|
|
@@ -7957,11 +8028,9 @@ export class UserRoleResolver extends ResolverBase {
|
|
|
7957
8028
|
|
|
7958
8029
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
7959
8030
|
protected async BeforeCreate(dataSource: DataSource, input: CreateUserRoleInput): Promise<boolean> {
|
|
7960
|
-
const i = input, d = dataSource; // prevent error
|
|
7961
8031
|
return true;
|
|
7962
8032
|
}
|
|
7963
8033
|
protected async AfterCreate(dataSource: DataSource, input: CreateUserRoleInput) {
|
|
7964
|
-
const i = input, d = dataSource; // prevent error
|
|
7965
8034
|
}
|
|
7966
8035
|
|
|
7967
8036
|
}
|
|
@@ -8040,26 +8109,28 @@ export class RowLevelSecurityFilterResolver extends ResolverBase {
|
|
|
8040
8109
|
input.EntityName = 'Row Level Security Filters';
|
|
8041
8110
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
8042
8111
|
}
|
|
8043
|
-
|
|
8044
8112
|
@Query(() => RowLevelSecurityFilter_, { nullable: true })
|
|
8045
8113
|
async RowLevelSecurityFilter(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<RowLevelSecurityFilter_ | null> {
|
|
8046
8114
|
this.CheckUserReadPermissions('Row Level Security Filters', userPayload);
|
|
8047
|
-
const sSQL = `SELECT * FROM [admin].vwRowLevelSecurityFilters WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Row Level Security Filters', userPayload, EntityPermissionType.Read, 'AND');
|
|
8048
|
-
|
|
8115
|
+
const sSQL = `SELECT * FROM [admin].[vwRowLevelSecurityFilters] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Row Level Security Filters', userPayload, EntityPermissionType.Read, 'AND');
|
|
8116
|
+
const result = this.MapFieldNamesToCodeNames('Row Level Security Filters', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
8117
|
+
return result;
|
|
8049
8118
|
}
|
|
8050
8119
|
|
|
8051
8120
|
@Query(() => [RowLevelSecurityFilter_])
|
|
8052
|
-
AllRowLevelSecurityFilters(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8121
|
+
async AllRowLevelSecurityFilters(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8053
8122
|
this.CheckUserReadPermissions('Row Level Security Filters', userPayload);
|
|
8054
|
-
const sSQL = 'SELECT * FROM [admin].vwRowLevelSecurityFilters' + this.getRowLevelSecurityWhereClause('Row Level Security Filters', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8055
|
-
|
|
8123
|
+
const sSQL = 'SELECT * FROM [admin].[vwRowLevelSecurityFilters]' + this.getRowLevelSecurityWhereClause('Row Level Security Filters', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8124
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Row Level Security Filters', await dataSource.query(sSQL));
|
|
8125
|
+
return result;
|
|
8056
8126
|
}
|
|
8057
8127
|
|
|
8058
8128
|
@FieldResolver(() => [EntityPermission_])
|
|
8059
8129
|
async EntityPermissionsArray(@Root() rowlevelsecurityfilter_: RowLevelSecurityFilter_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8060
8130
|
this.CheckUserReadPermissions('Entity Permissions', userPayload);
|
|
8061
|
-
const sSQL = `SELECT * FROM [admin].[vwEntityPermissions] WHERE ReadRLSFilterID=${rowlevelsecurityfilter_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Permissions', userPayload, EntityPermissionType.Read, 'AND');
|
|
8062
|
-
|
|
8131
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityPermissions] WHERE [ReadRLSFilterID]=${rowlevelsecurityfilter_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Permissions', userPayload, EntityPermissionType.Read, 'AND');
|
|
8132
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Permissions', await dataSource.query(sSQL));
|
|
8133
|
+
return result;
|
|
8063
8134
|
}
|
|
8064
8135
|
|
|
8065
8136
|
}
|
|
@@ -8226,12 +8297,12 @@ export class AuditLogResolver extends ResolverBase {
|
|
|
8226
8297
|
input.EntityName = 'Audit Logs';
|
|
8227
8298
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
8228
8299
|
}
|
|
8229
|
-
|
|
8230
8300
|
@Query(() => AuditLog_, { nullable: true })
|
|
8231
8301
|
async AuditLog(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AuditLog_ | null> {
|
|
8232
8302
|
this.CheckUserReadPermissions('Audit Logs', userPayload);
|
|
8233
|
-
const sSQL = `SELECT * FROM [admin].vwAuditLogs WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Audit Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
8234
|
-
|
|
8303
|
+
const sSQL = `SELECT * FROM [admin].[vwAuditLogs] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Audit Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
8304
|
+
const result = this.MapFieldNamesToCodeNames('Audit Logs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
8305
|
+
return result;
|
|
8235
8306
|
}
|
|
8236
8307
|
|
|
8237
8308
|
@Mutation(() => AuditLog_)
|
|
@@ -8241,7 +8312,7 @@ export class AuditLogResolver extends ResolverBase {
|
|
|
8241
8312
|
@PubSub() pubSub: PubSubEngine
|
|
8242
8313
|
) {
|
|
8243
8314
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
8244
|
-
const entityObject = await new Metadata().GetEntityObject('Audit Logs', this.GetUserFromPayload(userPayload));
|
|
8315
|
+
const entityObject = <AuditLogEntity>await new Metadata().GetEntityObject('Audit Logs', this.GetUserFromPayload(userPayload));
|
|
8245
8316
|
await entityObject.NewRecord();
|
|
8246
8317
|
entityObject.SetMany(input);
|
|
8247
8318
|
if (await entityObject.Save()) {
|
|
@@ -8259,11 +8330,9 @@ export class AuditLogResolver extends ResolverBase {
|
|
|
8259
8330
|
|
|
8260
8331
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
8261
8332
|
protected async BeforeCreate(dataSource: DataSource, input: CreateAuditLogInput): Promise<boolean> {
|
|
8262
|
-
const i = input, d = dataSource; // prevent error
|
|
8263
8333
|
return true;
|
|
8264
8334
|
}
|
|
8265
8335
|
protected async AfterCreate(dataSource: DataSource, input: CreateAuditLogInput) {
|
|
8266
|
-
const i = input, d = dataSource; // prevent error
|
|
8267
8336
|
}
|
|
8268
8337
|
|
|
8269
8338
|
@Mutation(() => AuditLog_)
|
|
@@ -8273,7 +8342,7 @@ export class AuditLogResolver extends ResolverBase {
|
|
|
8273
8342
|
@PubSub() pubSub: PubSubEngine
|
|
8274
8343
|
) {
|
|
8275
8344
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
8276
|
-
const entityObject = await new Metadata().GetEntityObject('Audit Logs', this.GetUserFromPayload(userPayload));
|
|
8345
|
+
const entityObject = <AuditLogEntity>await new Metadata().GetEntityObject('Audit Logs', this.GetUserFromPayload(userPayload));
|
|
8277
8346
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Audit Logs
|
|
8278
8347
|
|
|
8279
8348
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -8388,47 +8457,52 @@ export class AuthorizationResolver extends ResolverBase {
|
|
|
8388
8457
|
input.EntityName = 'Authorizations';
|
|
8389
8458
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
8390
8459
|
}
|
|
8391
|
-
|
|
8392
8460
|
@Query(() => Authorization_, { nullable: true })
|
|
8393
8461
|
async Authorization(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Authorization_ | null> {
|
|
8394
8462
|
this.CheckUserReadPermissions('Authorizations', userPayload);
|
|
8395
|
-
const sSQL = `SELECT * FROM [admin].vwAuthorizations WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Authorizations', userPayload, EntityPermissionType.Read, 'AND');
|
|
8396
|
-
|
|
8463
|
+
const sSQL = `SELECT * FROM [admin].[vwAuthorizations] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Authorizations', userPayload, EntityPermissionType.Read, 'AND');
|
|
8464
|
+
const result = this.MapFieldNamesToCodeNames('Authorizations', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
8465
|
+
return result;
|
|
8397
8466
|
}
|
|
8398
8467
|
|
|
8399
8468
|
@Query(() => [Authorization_])
|
|
8400
|
-
AllAuthorizations(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8469
|
+
async AllAuthorizations(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8401
8470
|
this.CheckUserReadPermissions('Authorizations', userPayload);
|
|
8402
|
-
const sSQL = 'SELECT * FROM [admin].vwAuthorizations' + this.getRowLevelSecurityWhereClause('Authorizations', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8403
|
-
|
|
8471
|
+
const sSQL = 'SELECT * FROM [admin].[vwAuthorizations]' + this.getRowLevelSecurityWhereClause('Authorizations', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8472
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Authorizations', await dataSource.query(sSQL));
|
|
8473
|
+
return result;
|
|
8404
8474
|
}
|
|
8405
8475
|
|
|
8406
8476
|
@FieldResolver(() => [AuthorizationRole_])
|
|
8407
8477
|
async AuthorizationRolesArray(@Root() authorization_: Authorization_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8408
8478
|
this.CheckUserReadPermissions('Authorization Roles', userPayload);
|
|
8409
|
-
const sSQL = `SELECT * FROM [admin].[vwAuthorizationRoles] WHERE AuthorizationID=${authorization_.ID} ` + this.getRowLevelSecurityWhereClause('Authorization Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
8410
|
-
|
|
8479
|
+
const sSQL = `SELECT * FROM [admin].[vwAuthorizationRoles] WHERE [AuthorizationID]=${authorization_.ID} ` + this.getRowLevelSecurityWhereClause('Authorization Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
8480
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Authorization Roles', await dataSource.query(sSQL));
|
|
8481
|
+
return result;
|
|
8411
8482
|
}
|
|
8412
8483
|
|
|
8413
8484
|
@FieldResolver(() => [Authorization_])
|
|
8414
8485
|
async AuthorizationsArray(@Root() authorization_: Authorization_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8415
8486
|
this.CheckUserReadPermissions('Authorizations', userPayload);
|
|
8416
|
-
const sSQL = `SELECT * FROM [admin].[vwAuthorizations] WHERE ParentID=${authorization_.ID} ` + this.getRowLevelSecurityWhereClause('Authorizations', userPayload, EntityPermissionType.Read, 'AND');
|
|
8417
|
-
|
|
8487
|
+
const sSQL = `SELECT * FROM [admin].[vwAuthorizations] WHERE [ParentID]=${authorization_.ID} ` + this.getRowLevelSecurityWhereClause('Authorizations', userPayload, EntityPermissionType.Read, 'AND');
|
|
8488
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Authorizations', await dataSource.query(sSQL));
|
|
8489
|
+
return result;
|
|
8418
8490
|
}
|
|
8419
8491
|
|
|
8420
8492
|
@FieldResolver(() => [AuditLogType_])
|
|
8421
8493
|
async AuditLogTypesArray(@Root() authorization_: Authorization_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8422
8494
|
this.CheckUserReadPermissions('Audit Log Types', userPayload);
|
|
8423
|
-
const sSQL = `SELECT * FROM [admin].[vwAuditLogTypes] WHERE AuthorizationName=${authorization_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Log Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
8424
|
-
|
|
8495
|
+
const sSQL = `SELECT * FROM [admin].[vwAuditLogTypes] WHERE [AuthorizationName]=${authorization_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Log Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
8496
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Audit Log Types', await dataSource.query(sSQL));
|
|
8497
|
+
return result;
|
|
8425
8498
|
}
|
|
8426
8499
|
|
|
8427
8500
|
@FieldResolver(() => [AuditLog_])
|
|
8428
8501
|
async AuditLogsArray(@Root() authorization_: Authorization_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8429
8502
|
this.CheckUserReadPermissions('Audit Logs', userPayload);
|
|
8430
|
-
const sSQL = `SELECT * FROM [admin].[vwAuditLogs] WHERE AuthorizationName=${authorization_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
8431
|
-
|
|
8503
|
+
const sSQL = `SELECT * FROM [admin].[vwAuditLogs] WHERE [AuthorizationName]=${authorization_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
8504
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Audit Logs', await dataSource.query(sSQL));
|
|
8505
|
+
return result;
|
|
8432
8506
|
}
|
|
8433
8507
|
|
|
8434
8508
|
}
|
|
@@ -8506,19 +8580,20 @@ export class AuthorizationRoleResolver extends ResolverBase {
|
|
|
8506
8580
|
input.EntityName = 'Authorization Roles';
|
|
8507
8581
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
8508
8582
|
}
|
|
8509
|
-
|
|
8510
8583
|
@Query(() => AuthorizationRole_, { nullable: true })
|
|
8511
8584
|
async AuthorizationRole(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AuthorizationRole_ | null> {
|
|
8512
8585
|
this.CheckUserReadPermissions('Authorization Roles', userPayload);
|
|
8513
|
-
const sSQL = `SELECT * FROM [admin].vwAuthorizationRoles WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Authorization Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
8514
|
-
|
|
8586
|
+
const sSQL = `SELECT * FROM [admin].[vwAuthorizationRoles] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Authorization Roles', userPayload, EntityPermissionType.Read, 'AND');
|
|
8587
|
+
const result = this.MapFieldNamesToCodeNames('Authorization Roles', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
8588
|
+
return result;
|
|
8515
8589
|
}
|
|
8516
8590
|
|
|
8517
8591
|
@Query(() => [AuthorizationRole_])
|
|
8518
|
-
AllAuthorizationRoles(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8592
|
+
async AllAuthorizationRoles(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8519
8593
|
this.CheckUserReadPermissions('Authorization Roles', userPayload);
|
|
8520
|
-
const sSQL = 'SELECT * FROM [admin].vwAuthorizationRoles' + this.getRowLevelSecurityWhereClause('Authorization Roles', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8521
|
-
|
|
8594
|
+
const sSQL = 'SELECT * FROM [admin].[vwAuthorizationRoles]' + this.getRowLevelSecurityWhereClause('Authorization Roles', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8595
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Authorization Roles', await dataSource.query(sSQL));
|
|
8596
|
+
return result;
|
|
8522
8597
|
}
|
|
8523
8598
|
|
|
8524
8599
|
}
|
|
@@ -8608,33 +8683,36 @@ export class AuditLogTypeResolver extends ResolverBase {
|
|
|
8608
8683
|
input.EntityName = 'Audit Log Types';
|
|
8609
8684
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
8610
8685
|
}
|
|
8611
|
-
|
|
8612
8686
|
@Query(() => AuditLogType_, { nullable: true })
|
|
8613
8687
|
async AuditLogType(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AuditLogType_ | null> {
|
|
8614
8688
|
this.CheckUserReadPermissions('Audit Log Types', userPayload);
|
|
8615
|
-
const sSQL = `SELECT * FROM [admin].vwAuditLogTypes WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Audit Log Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
8616
|
-
|
|
8689
|
+
const sSQL = `SELECT * FROM [admin].[vwAuditLogTypes] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Audit Log Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
8690
|
+
const result = this.MapFieldNamesToCodeNames('Audit Log Types', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
8691
|
+
return result;
|
|
8617
8692
|
}
|
|
8618
8693
|
|
|
8619
8694
|
@Query(() => [AuditLogType_])
|
|
8620
|
-
AllAuditLogTypes(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8695
|
+
async AllAuditLogTypes(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8621
8696
|
this.CheckUserReadPermissions('Audit Log Types', userPayload);
|
|
8622
|
-
const sSQL = 'SELECT * FROM [admin].vwAuditLogTypes' + this.getRowLevelSecurityWhereClause('Audit Log Types', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8623
|
-
|
|
8697
|
+
const sSQL = 'SELECT * FROM [admin].[vwAuditLogTypes]' + this.getRowLevelSecurityWhereClause('Audit Log Types', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8698
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Audit Log Types', await dataSource.query(sSQL));
|
|
8699
|
+
return result;
|
|
8624
8700
|
}
|
|
8625
8701
|
|
|
8626
8702
|
@FieldResolver(() => [AuditLog_])
|
|
8627
8703
|
async AuditLogsArray(@Root() auditlogtype_: AuditLogType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8628
8704
|
this.CheckUserReadPermissions('Audit Logs', userPayload);
|
|
8629
|
-
const sSQL = `SELECT * FROM [admin].[vwAuditLogs] WHERE AuditLogTypeName=${auditlogtype_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
8630
|
-
|
|
8705
|
+
const sSQL = `SELECT * FROM [admin].[vwAuditLogs] WHERE [AuditLogTypeName]=${auditlogtype_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
8706
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Audit Logs', await dataSource.query(sSQL));
|
|
8707
|
+
return result;
|
|
8631
8708
|
}
|
|
8632
8709
|
|
|
8633
8710
|
@FieldResolver(() => [AuditLogType_])
|
|
8634
8711
|
async AuditLogTypesArray(@Root() auditlogtype_: AuditLogType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8635
8712
|
this.CheckUserReadPermissions('Audit Log Types', userPayload);
|
|
8636
|
-
const sSQL = `SELECT * FROM [admin].[vwAuditLogTypes] WHERE ParentID=${auditlogtype_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Log Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
8637
|
-
|
|
8713
|
+
const sSQL = `SELECT * FROM [admin].[vwAuditLogTypes] WHERE [ParentID]=${auditlogtype_.ID} ` + this.getRowLevelSecurityWhereClause('Audit Log Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
8714
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Audit Log Types', await dataSource.query(sSQL));
|
|
8715
|
+
return result;
|
|
8638
8716
|
}
|
|
8639
8717
|
|
|
8640
8718
|
}
|
|
@@ -8725,19 +8803,20 @@ export class EntityFieldValueResolver extends ResolverBase {
|
|
|
8725
8803
|
input.EntityName = 'Entity Field Values';
|
|
8726
8804
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
8727
8805
|
}
|
|
8728
|
-
|
|
8729
8806
|
@Query(() => EntityFieldValue_, { nullable: true })
|
|
8730
8807
|
async EntityFieldValue(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityFieldValue_ | null> {
|
|
8731
8808
|
this.CheckUserReadPermissions('Entity Field Values', userPayload);
|
|
8732
|
-
const sSQL = `SELECT * FROM [admin].vwEntityFieldValues WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Field Values', userPayload, EntityPermissionType.Read, 'AND');
|
|
8733
|
-
|
|
8809
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityFieldValues] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Field Values', userPayload, EntityPermissionType.Read, 'AND');
|
|
8810
|
+
const result = this.MapFieldNamesToCodeNames('Entity Field Values', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
8811
|
+
return result;
|
|
8734
8812
|
}
|
|
8735
8813
|
|
|
8736
8814
|
@Query(() => [EntityFieldValue_])
|
|
8737
|
-
AllEntityFieldValues(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8815
|
+
async AllEntityFieldValues(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8738
8816
|
this.CheckUserReadPermissions('Entity Field Values', userPayload);
|
|
8739
|
-
const sSQL = 'SELECT * FROM [admin].vwEntityFieldValues' + this.getRowLevelSecurityWhereClause('Entity Field Values', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8740
|
-
|
|
8817
|
+
const sSQL = 'SELECT * FROM [admin].[vwEntityFieldValues]' + this.getRowLevelSecurityWhereClause('Entity Field Values', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8818
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Field Values', await dataSource.query(sSQL));
|
|
8819
|
+
return result;
|
|
8741
8820
|
}
|
|
8742
8821
|
|
|
8743
8822
|
}
|
|
@@ -8868,40 +8947,44 @@ export class AIModelResolver extends ResolverBase {
|
|
|
8868
8947
|
input.EntityName = 'AI Models';
|
|
8869
8948
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
8870
8949
|
}
|
|
8871
|
-
|
|
8872
8950
|
@Query(() => AIModel_, { nullable: true })
|
|
8873
8951
|
async AIModel(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIModel_ | null> {
|
|
8874
8952
|
this.CheckUserReadPermissions('AI Models', userPayload);
|
|
8875
|
-
const sSQL = `SELECT * FROM [admin].vwAIModels WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('AI Models', userPayload, EntityPermissionType.Read, 'AND');
|
|
8876
|
-
|
|
8953
|
+
const sSQL = `SELECT * FROM [admin].[vwAIModels] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('AI Models', userPayload, EntityPermissionType.Read, 'AND');
|
|
8954
|
+
const result = this.MapFieldNamesToCodeNames('AI Models', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
8955
|
+
return result;
|
|
8877
8956
|
}
|
|
8878
8957
|
|
|
8879
8958
|
@Query(() => [AIModel_])
|
|
8880
|
-
AllAIModels(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8959
|
+
async AllAIModels(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8881
8960
|
this.CheckUserReadPermissions('AI Models', userPayload);
|
|
8882
|
-
const sSQL = 'SELECT * FROM [admin].vwAIModels' + this.getRowLevelSecurityWhereClause('AI Models', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8883
|
-
|
|
8961
|
+
const sSQL = 'SELECT * FROM [admin].[vwAIModels]' + this.getRowLevelSecurityWhereClause('AI Models', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
8962
|
+
const result = this.ArrayMapFieldNamesToCodeNames('AI Models', await dataSource.query(sSQL));
|
|
8963
|
+
return result;
|
|
8884
8964
|
}
|
|
8885
8965
|
|
|
8886
8966
|
@FieldResolver(() => [AIAction_])
|
|
8887
8967
|
async AIActionsArray(@Root() aimodel_: AIModel_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8888
8968
|
this.CheckUserReadPermissions('AI Actions', userPayload);
|
|
8889
|
-
const sSQL = `SELECT * FROM [admin].[vwAIActions] WHERE DefaultModelID=${aimodel_.ID} ` + this.getRowLevelSecurityWhereClause('AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
8890
|
-
|
|
8969
|
+
const sSQL = `SELECT * FROM [admin].[vwAIActions] WHERE [DefaultModelID]=${aimodel_.ID} ` + this.getRowLevelSecurityWhereClause('AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
8970
|
+
const result = this.ArrayMapFieldNamesToCodeNames('AI Actions', await dataSource.query(sSQL));
|
|
8971
|
+
return result;
|
|
8891
8972
|
}
|
|
8892
8973
|
|
|
8893
8974
|
@FieldResolver(() => [AIModelAction_])
|
|
8894
8975
|
async AIModelActionsArray(@Root() aimodel_: AIModel_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8895
8976
|
this.CheckUserReadPermissions('AI Model Actions', userPayload);
|
|
8896
|
-
const sSQL = `SELECT * FROM [admin].[vwAIModelActions] WHERE AIModelID=${aimodel_.ID} ` + this.getRowLevelSecurityWhereClause('AI Model Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
8897
|
-
|
|
8977
|
+
const sSQL = `SELECT * FROM [admin].[vwAIModelActions] WHERE [AIModelID]=${aimodel_.ID} ` + this.getRowLevelSecurityWhereClause('AI Model Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
8978
|
+
const result = this.ArrayMapFieldNamesToCodeNames('AI Model Actions', await dataSource.query(sSQL));
|
|
8979
|
+
return result;
|
|
8898
8980
|
}
|
|
8899
8981
|
|
|
8900
8982
|
@FieldResolver(() => [EntityAIAction_])
|
|
8901
8983
|
async EntityAIActionsArray(@Root() aimodel_: AIModel_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
8902
8984
|
this.CheckUserReadPermissions('Entity AI Actions', userPayload);
|
|
8903
|
-
const sSQL = `SELECT * FROM [admin].[vwEntityAIActions] WHERE AIModelID=${aimodel_.ID} ` + this.getRowLevelSecurityWhereClause('Entity AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
8904
|
-
|
|
8985
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityAIActions] WHERE [AIModelID]=${aimodel_.ID} ` + this.getRowLevelSecurityWhereClause('Entity AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
8986
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity AI Actions', await dataSource.query(sSQL));
|
|
8987
|
+
return result;
|
|
8905
8988
|
}
|
|
8906
8989
|
|
|
8907
8990
|
@Mutation(() => AIModel_)
|
|
@@ -8911,7 +8994,7 @@ export class AIModelResolver extends ResolverBase {
|
|
|
8911
8994
|
@PubSub() pubSub: PubSubEngine
|
|
8912
8995
|
) {
|
|
8913
8996
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
8914
|
-
const entityObject = await new Metadata().GetEntityObject('AI Models', this.GetUserFromPayload(userPayload));
|
|
8997
|
+
const entityObject = <AIModelEntity>await new Metadata().GetEntityObject('AI Models', this.GetUserFromPayload(userPayload));
|
|
8915
8998
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for AI Models
|
|
8916
8999
|
|
|
8917
9000
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -9049,33 +9132,36 @@ export class AIActionResolver extends ResolverBase {
|
|
|
9049
9132
|
input.EntityName = 'AI Actions';
|
|
9050
9133
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
9051
9134
|
}
|
|
9052
|
-
|
|
9053
9135
|
@Query(() => AIAction_, { nullable: true })
|
|
9054
9136
|
async AIAction(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIAction_ | null> {
|
|
9055
9137
|
this.CheckUserReadPermissions('AI Actions', userPayload);
|
|
9056
|
-
const sSQL = `SELECT * FROM [admin].vwAIActions WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
9057
|
-
|
|
9138
|
+
const sSQL = `SELECT * FROM [admin].[vwAIActions] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
9139
|
+
const result = this.MapFieldNamesToCodeNames('AI Actions', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
9140
|
+
return result;
|
|
9058
9141
|
}
|
|
9059
9142
|
|
|
9060
9143
|
@Query(() => [AIAction_])
|
|
9061
|
-
AllAIActions(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9144
|
+
async AllAIActions(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9062
9145
|
this.CheckUserReadPermissions('AI Actions', userPayload);
|
|
9063
|
-
const sSQL = 'SELECT * FROM [admin].vwAIActions' + this.getRowLevelSecurityWhereClause('AI Actions', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
9064
|
-
|
|
9146
|
+
const sSQL = 'SELECT * FROM [admin].[vwAIActions]' + this.getRowLevelSecurityWhereClause('AI Actions', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
9147
|
+
const result = this.ArrayMapFieldNamesToCodeNames('AI Actions', await dataSource.query(sSQL));
|
|
9148
|
+
return result;
|
|
9065
9149
|
}
|
|
9066
9150
|
|
|
9067
9151
|
@FieldResolver(() => [AIModelAction_])
|
|
9068
9152
|
async AIModelActionsArray(@Root() aiaction_: AIAction_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9069
9153
|
this.CheckUserReadPermissions('AI Model Actions', userPayload);
|
|
9070
|
-
const sSQL = `SELECT * FROM [admin].[vwAIModelActions] WHERE AIActionID=${aiaction_.ID} ` + this.getRowLevelSecurityWhereClause('AI Model Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
9071
|
-
|
|
9154
|
+
const sSQL = `SELECT * FROM [admin].[vwAIModelActions] WHERE [AIActionID]=${aiaction_.ID} ` + this.getRowLevelSecurityWhereClause('AI Model Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
9155
|
+
const result = this.ArrayMapFieldNamesToCodeNames('AI Model Actions', await dataSource.query(sSQL));
|
|
9156
|
+
return result;
|
|
9072
9157
|
}
|
|
9073
9158
|
|
|
9074
9159
|
@FieldResolver(() => [EntityAIAction_])
|
|
9075
9160
|
async EntityAIActionsArray(@Root() aiaction_: AIAction_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9076
9161
|
this.CheckUserReadPermissions('Entity AI Actions', userPayload);
|
|
9077
|
-
const sSQL = `SELECT * FROM [admin].[vwEntityAIActions] WHERE AIActionID=${aiaction_.ID} ` + this.getRowLevelSecurityWhereClause('Entity AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
9078
|
-
|
|
9162
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityAIActions] WHERE [AIActionID]=${aiaction_.ID} ` + this.getRowLevelSecurityWhereClause('Entity AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
9163
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity AI Actions', await dataSource.query(sSQL));
|
|
9164
|
+
return result;
|
|
9079
9165
|
}
|
|
9080
9166
|
|
|
9081
9167
|
@Mutation(() => AIAction_)
|
|
@@ -9085,7 +9171,7 @@ export class AIActionResolver extends ResolverBase {
|
|
|
9085
9171
|
@PubSub() pubSub: PubSubEngine
|
|
9086
9172
|
) {
|
|
9087
9173
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
9088
|
-
const entityObject = await new Metadata().GetEntityObject('AI Actions', this.GetUserFromPayload(userPayload));
|
|
9174
|
+
const entityObject = <AIActionEntity>await new Metadata().GetEntityObject('AI Actions', this.GetUserFromPayload(userPayload));
|
|
9089
9175
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for AI Actions
|
|
9090
9176
|
|
|
9091
9177
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -9208,19 +9294,20 @@ export class AIModelActionResolver extends ResolverBase {
|
|
|
9208
9294
|
input.EntityName = 'AI Model Actions';
|
|
9209
9295
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
9210
9296
|
}
|
|
9211
|
-
|
|
9212
9297
|
@Query(() => AIModelAction_, { nullable: true })
|
|
9213
9298
|
async AIModelAction(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIModelAction_ | null> {
|
|
9214
9299
|
this.CheckUserReadPermissions('AI Model Actions', userPayload);
|
|
9215
|
-
const sSQL = `SELECT * FROM [admin].vwAIModelActions WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('AI Model Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
9216
|
-
|
|
9300
|
+
const sSQL = `SELECT * FROM [admin].[vwAIModelActions] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('AI Model Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
9301
|
+
const result = this.MapFieldNamesToCodeNames('AI Model Actions', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
9302
|
+
return result;
|
|
9217
9303
|
}
|
|
9218
9304
|
|
|
9219
9305
|
@Query(() => [AIModelAction_])
|
|
9220
|
-
AllAIModelActions(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9306
|
+
async AllAIModelActions(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9221
9307
|
this.CheckUserReadPermissions('AI Model Actions', userPayload);
|
|
9222
|
-
const sSQL = 'SELECT * FROM [admin].vwAIModelActions' + this.getRowLevelSecurityWhereClause('AI Model Actions', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
9223
|
-
|
|
9308
|
+
const sSQL = 'SELECT * FROM [admin].[vwAIModelActions]' + this.getRowLevelSecurityWhereClause('AI Model Actions', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
9309
|
+
const result = this.ArrayMapFieldNamesToCodeNames('AI Model Actions', await dataSource.query(sSQL));
|
|
9310
|
+
return result;
|
|
9224
9311
|
}
|
|
9225
9312
|
|
|
9226
9313
|
@Mutation(() => AIModelAction_)
|
|
@@ -9230,7 +9317,7 @@ export class AIModelActionResolver extends ResolverBase {
|
|
|
9230
9317
|
@PubSub() pubSub: PubSubEngine
|
|
9231
9318
|
) {
|
|
9232
9319
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
9233
|
-
const entityObject = await new Metadata().GetEntityObject('AI Model Actions', this.GetUserFromPayload(userPayload));
|
|
9320
|
+
const entityObject = <AIModelActionEntity>await new Metadata().GetEntityObject('AI Model Actions', this.GetUserFromPayload(userPayload));
|
|
9234
9321
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for AI Model Actions
|
|
9235
9322
|
|
|
9236
9323
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -9411,19 +9498,20 @@ export class EntityAIActionResolver extends ResolverBase {
|
|
|
9411
9498
|
input.EntityName = 'Entity AI Actions';
|
|
9412
9499
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
9413
9500
|
}
|
|
9414
|
-
|
|
9415
9501
|
@Query(() => EntityAIAction_, { nullable: true })
|
|
9416
9502
|
async EntityAIAction(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityAIAction_ | null> {
|
|
9417
9503
|
this.CheckUserReadPermissions('Entity AI Actions', userPayload);
|
|
9418
|
-
const sSQL = `SELECT * FROM [admin].vwEntityAIActions WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Entity AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
9419
|
-
|
|
9504
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityAIActions] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity AI Actions', userPayload, EntityPermissionType.Read, 'AND');
|
|
9505
|
+
const result = this.MapFieldNamesToCodeNames('Entity AI Actions', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
9506
|
+
return result;
|
|
9420
9507
|
}
|
|
9421
9508
|
|
|
9422
9509
|
@Query(() => [EntityAIAction_])
|
|
9423
|
-
AllEntityAIActions(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9510
|
+
async AllEntityAIActions(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9424
9511
|
this.CheckUserReadPermissions('Entity AI Actions', userPayload);
|
|
9425
|
-
const sSQL = 'SELECT * FROM [admin].vwEntityAIActions' + this.getRowLevelSecurityWhereClause('Entity AI Actions', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
9426
|
-
|
|
9512
|
+
const sSQL = 'SELECT * FROM [admin].[vwEntityAIActions]' + this.getRowLevelSecurityWhereClause('Entity AI Actions', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
9513
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity AI Actions', await dataSource.query(sSQL));
|
|
9514
|
+
return result;
|
|
9427
9515
|
}
|
|
9428
9516
|
|
|
9429
9517
|
@Mutation(() => EntityAIAction_)
|
|
@@ -9433,7 +9521,7 @@ export class EntityAIActionResolver extends ResolverBase {
|
|
|
9433
9521
|
@PubSub() pubSub: PubSubEngine
|
|
9434
9522
|
) {
|
|
9435
9523
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
9436
|
-
const entityObject = await new Metadata().GetEntityObject('Entity AI Actions', this.GetUserFromPayload(userPayload));
|
|
9524
|
+
const entityObject = <EntityAIActionEntity>await new Metadata().GetEntityObject('Entity AI Actions', this.GetUserFromPayload(userPayload));
|
|
9437
9525
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Entity AI Actions
|
|
9438
9526
|
|
|
9439
9527
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -9538,26 +9626,28 @@ export class AIModelTypeResolver extends ResolverBase {
|
|
|
9538
9626
|
input.EntityName = 'AI Model Types';
|
|
9539
9627
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
9540
9628
|
}
|
|
9541
|
-
|
|
9542
9629
|
@Query(() => AIModelType_, { nullable: true })
|
|
9543
9630
|
async AIModelType(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<AIModelType_ | null> {
|
|
9544
9631
|
this.CheckUserReadPermissions('AI Model Types', userPayload);
|
|
9545
|
-
const sSQL = `SELECT * FROM [admin].vwAIModelTypes WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('AI Model Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
9546
|
-
|
|
9632
|
+
const sSQL = `SELECT * FROM [admin].[vwAIModelTypes] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('AI Model Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
9633
|
+
const result = this.MapFieldNamesToCodeNames('AI Model Types', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
9634
|
+
return result;
|
|
9547
9635
|
}
|
|
9548
9636
|
|
|
9549
9637
|
@Query(() => [AIModelType_])
|
|
9550
|
-
AllAIModelTypes(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9638
|
+
async AllAIModelTypes(@Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9551
9639
|
this.CheckUserReadPermissions('AI Model Types', userPayload);
|
|
9552
|
-
const sSQL = 'SELECT * FROM [admin].vwAIModelTypes' + this.getRowLevelSecurityWhereClause('AI Model Types', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
9553
|
-
|
|
9640
|
+
const sSQL = 'SELECT * FROM [admin].[vwAIModelTypes]' + this.getRowLevelSecurityWhereClause('AI Model Types', userPayload, EntityPermissionType.Read, ' WHERE');
|
|
9641
|
+
const result = this.ArrayMapFieldNamesToCodeNames('AI Model Types', await dataSource.query(sSQL));
|
|
9642
|
+
return result;
|
|
9554
9643
|
}
|
|
9555
9644
|
|
|
9556
9645
|
@FieldResolver(() => [AIModel_])
|
|
9557
9646
|
async AIModelsArray(@Root() aimodeltype_: AIModelType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9558
9647
|
this.CheckUserReadPermissions('AI Models', userPayload);
|
|
9559
|
-
const sSQL = `SELECT * FROM [admin].[vwAIModels] WHERE AIModelTypeID=${aimodeltype_.ID} ` + this.getRowLevelSecurityWhereClause('AI Models', userPayload, EntityPermissionType.Read, 'AND');
|
|
9560
|
-
|
|
9648
|
+
const sSQL = `SELECT * FROM [admin].[vwAIModels] WHERE [AIModelTypeID]=${aimodeltype_.ID} ` + this.getRowLevelSecurityWhereClause('AI Models', userPayload, EntityPermissionType.Read, 'AND');
|
|
9649
|
+
const result = this.ArrayMapFieldNamesToCodeNames('AI Models', await dataSource.query(sSQL));
|
|
9650
|
+
return result;
|
|
9561
9651
|
}
|
|
9562
9652
|
|
|
9563
9653
|
@Mutation(() => AIModelType_)
|
|
@@ -9567,7 +9657,7 @@ export class AIModelTypeResolver extends ResolverBase {
|
|
|
9567
9657
|
@PubSub() pubSub: PubSubEngine
|
|
9568
9658
|
) {
|
|
9569
9659
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
9570
|
-
const entityObject = await new Metadata().GetEntityObject('AI Model Types', this.GetUserFromPayload(userPayload));
|
|
9660
|
+
const entityObject = <AIModelTypeEntity>await new Metadata().GetEntityObject('AI Model Types', this.GetUserFromPayload(userPayload));
|
|
9571
9661
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for AI Model Types
|
|
9572
9662
|
|
|
9573
9663
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -9667,19 +9757,20 @@ export class QueueTypeResolver extends ResolverBase {
|
|
|
9667
9757
|
input.EntityName = 'Queue Types';
|
|
9668
9758
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
9669
9759
|
}
|
|
9670
|
-
|
|
9671
9760
|
@Query(() => QueueType_, { nullable: true })
|
|
9672
9761
|
async QueueType(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<QueueType_ | null> {
|
|
9673
9762
|
this.CheckUserReadPermissions('Queue Types', userPayload);
|
|
9674
|
-
const sSQL = `SELECT * FROM [admin].vwQueueTypes WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Queue Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
9675
|
-
|
|
9763
|
+
const sSQL = `SELECT * FROM [admin].[vwQueueTypes] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Queue Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
9764
|
+
const result = this.MapFieldNamesToCodeNames('Queue Types', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
9765
|
+
return result;
|
|
9676
9766
|
}
|
|
9677
9767
|
|
|
9678
9768
|
@FieldResolver(() => [Queue_])
|
|
9679
9769
|
async QueuesArray(@Root() queuetype_: QueueType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9680
9770
|
this.CheckUserReadPermissions('Queues', userPayload);
|
|
9681
|
-
const sSQL = `SELECT * FROM [admin].[vwQueues] WHERE QueueTypeID=${queuetype_.ID} ` + this.getRowLevelSecurityWhereClause('Queues', userPayload, EntityPermissionType.Read, 'AND');
|
|
9682
|
-
|
|
9771
|
+
const sSQL = `SELECT * FROM [admin].[vwQueues] WHERE [QueueTypeID]=${queuetype_.ID} ` + this.getRowLevelSecurityWhereClause('Queues', userPayload, EntityPermissionType.Read, 'AND');
|
|
9772
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Queues', await dataSource.query(sSQL));
|
|
9773
|
+
return result;
|
|
9683
9774
|
}
|
|
9684
9775
|
|
|
9685
9776
|
}
|
|
@@ -9925,19 +10016,20 @@ export class QueueResolver extends ResolverBase {
|
|
|
9925
10016
|
input.EntityName = 'Queues';
|
|
9926
10017
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
9927
10018
|
}
|
|
9928
|
-
|
|
9929
10019
|
@Query(() => Queue_, { nullable: true })
|
|
9930
10020
|
async Queue(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Queue_ | null> {
|
|
9931
10021
|
this.CheckUserReadPermissions('Queues', userPayload);
|
|
9932
|
-
const sSQL = `SELECT * FROM [admin].vwQueues WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Queues', userPayload, EntityPermissionType.Read, 'AND');
|
|
9933
|
-
|
|
10022
|
+
const sSQL = `SELECT * FROM [admin].[vwQueues] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Queues', userPayload, EntityPermissionType.Read, 'AND');
|
|
10023
|
+
const result = this.MapFieldNamesToCodeNames('Queues', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
10024
|
+
return result;
|
|
9934
10025
|
}
|
|
9935
10026
|
|
|
9936
10027
|
@FieldResolver(() => [QueueTask_])
|
|
9937
10028
|
async QueueTasksArray(@Root() queue_: Queue_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9938
10029
|
this.CheckUserReadPermissions('Queue Tasks', userPayload);
|
|
9939
|
-
const sSQL = `SELECT * FROM [admin].[vwQueueTasks] WHERE QueueID=${queue_.ID} ` + this.getRowLevelSecurityWhereClause('Queue Tasks', userPayload, EntityPermissionType.Read, 'AND');
|
|
9940
|
-
|
|
10030
|
+
const sSQL = `SELECT * FROM [admin].[vwQueueTasks] WHERE [QueueID]=${queue_.ID} ` + this.getRowLevelSecurityWhereClause('Queue Tasks', userPayload, EntityPermissionType.Read, 'AND');
|
|
10031
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Queue Tasks', await dataSource.query(sSQL));
|
|
10032
|
+
return result;
|
|
9941
10033
|
}
|
|
9942
10034
|
|
|
9943
10035
|
@Mutation(() => Queue_)
|
|
@@ -9947,7 +10039,7 @@ export class QueueResolver extends ResolverBase {
|
|
|
9947
10039
|
@PubSub() pubSub: PubSubEngine
|
|
9948
10040
|
) {
|
|
9949
10041
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
9950
|
-
const entityObject = await new Metadata().GetEntityObject('Queues', this.GetUserFromPayload(userPayload));
|
|
10042
|
+
const entityObject = <QueueEntity>await new Metadata().GetEntityObject('Queues', this.GetUserFromPayload(userPayload));
|
|
9951
10043
|
await entityObject.NewRecord();
|
|
9952
10044
|
entityObject.SetMany(input);
|
|
9953
10045
|
if (await entityObject.Save()) {
|
|
@@ -9965,11 +10057,9 @@ export class QueueResolver extends ResolverBase {
|
|
|
9965
10057
|
|
|
9966
10058
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
9967
10059
|
protected async BeforeCreate(dataSource: DataSource, input: CreateQueueInput): Promise<boolean> {
|
|
9968
|
-
const i = input, d = dataSource; // prevent error
|
|
9969
10060
|
return true;
|
|
9970
10061
|
}
|
|
9971
10062
|
protected async AfterCreate(dataSource: DataSource, input: CreateQueueInput) {
|
|
9972
|
-
const i = input, d = dataSource; // prevent error
|
|
9973
10063
|
}
|
|
9974
10064
|
|
|
9975
10065
|
@Mutation(() => Queue_)
|
|
@@ -9979,7 +10069,7 @@ export class QueueResolver extends ResolverBase {
|
|
|
9979
10069
|
@PubSub() pubSub: PubSubEngine
|
|
9980
10070
|
) {
|
|
9981
10071
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
9982
|
-
const entityObject = await new Metadata().GetEntityObject('Queues', this.GetUserFromPayload(userPayload));
|
|
10072
|
+
const entityObject = <QueueEntity>await new Metadata().GetEntityObject('Queues', this.GetUserFromPayload(userPayload));
|
|
9983
10073
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Queues
|
|
9984
10074
|
|
|
9985
10075
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -10159,12 +10249,12 @@ export class QueueTaskResolver extends ResolverBase {
|
|
|
10159
10249
|
input.EntityName = 'Queue Tasks';
|
|
10160
10250
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
10161
10251
|
}
|
|
10162
|
-
|
|
10163
10252
|
@Query(() => QueueTask_, { nullable: true })
|
|
10164
10253
|
async QueueTask(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<QueueTask_ | null> {
|
|
10165
10254
|
this.CheckUserReadPermissions('Queue Tasks', userPayload);
|
|
10166
|
-
const sSQL = `SELECT * FROM [admin].vwQueueTasks WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Queue Tasks', userPayload, EntityPermissionType.Read, 'AND');
|
|
10167
|
-
|
|
10255
|
+
const sSQL = `SELECT * FROM [admin].[vwQueueTasks] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Queue Tasks', userPayload, EntityPermissionType.Read, 'AND');
|
|
10256
|
+
const result = this.MapFieldNamesToCodeNames('Queue Tasks', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
10257
|
+
return result;
|
|
10168
10258
|
}
|
|
10169
10259
|
|
|
10170
10260
|
@Mutation(() => QueueTask_)
|
|
@@ -10174,7 +10264,7 @@ export class QueueTaskResolver extends ResolverBase {
|
|
|
10174
10264
|
@PubSub() pubSub: PubSubEngine
|
|
10175
10265
|
) {
|
|
10176
10266
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
10177
|
-
const entityObject = await new Metadata().GetEntityObject('Queue Tasks', this.GetUserFromPayload(userPayload));
|
|
10267
|
+
const entityObject = <QueueTaskEntity>await new Metadata().GetEntityObject('Queue Tasks', this.GetUserFromPayload(userPayload));
|
|
10178
10268
|
await entityObject.NewRecord();
|
|
10179
10269
|
entityObject.SetMany(input);
|
|
10180
10270
|
if (await entityObject.Save()) {
|
|
@@ -10192,11 +10282,9 @@ export class QueueTaskResolver extends ResolverBase {
|
|
|
10192
10282
|
|
|
10193
10283
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
10194
10284
|
protected async BeforeCreate(dataSource: DataSource, input: CreateQueueTaskInput): Promise<boolean> {
|
|
10195
|
-
const i = input, d = dataSource; // prevent error
|
|
10196
10285
|
return true;
|
|
10197
10286
|
}
|
|
10198
10287
|
protected async AfterCreate(dataSource: DataSource, input: CreateQueueTaskInput) {
|
|
10199
|
-
const i = input, d = dataSource; // prevent error
|
|
10200
10288
|
}
|
|
10201
10289
|
|
|
10202
10290
|
@Mutation(() => QueueTask_)
|
|
@@ -10206,7 +10294,7 @@ export class QueueTaskResolver extends ResolverBase {
|
|
|
10206
10294
|
@PubSub() pubSub: PubSubEngine
|
|
10207
10295
|
) {
|
|
10208
10296
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
10209
|
-
const entityObject = await new Metadata().GetEntityObject('Queue Tasks', this.GetUserFromPayload(userPayload));
|
|
10297
|
+
const entityObject = <QueueTaskEntity>await new Metadata().GetEntityObject('Queue Tasks', this.GetUserFromPayload(userPayload));
|
|
10210
10298
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Queue Tasks
|
|
10211
10299
|
|
|
10212
10300
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -10343,13 +10431,13 @@ export class DashboardResolver extends ResolverBase {
|
|
|
10343
10431
|
input.EntityName = 'Dashboards';
|
|
10344
10432
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
10345
10433
|
}
|
|
10346
|
-
|
|
10347
10434
|
@Query(() => Dashboard_, { nullable: true })
|
|
10348
10435
|
async Dashboard(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Dashboard_ | null> {
|
|
10349
10436
|
this.CheckUserReadPermissions('Dashboards', userPayload);
|
|
10350
|
-
const sSQL = `SELECT * FROM [admin].vwDashboards WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Dashboards', userPayload, EntityPermissionType.Read, 'AND');
|
|
10437
|
+
const sSQL = `SELECT * FROM [admin].[vwDashboards] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Dashboards', userPayload, EntityPermissionType.Read, 'AND');
|
|
10351
10438
|
this.createRecordAccessAuditLogRecord(userPayload, 'Dashboards', ID)
|
|
10352
|
-
|
|
10439
|
+
const result = this.MapFieldNamesToCodeNames('Dashboards', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
10440
|
+
return result;
|
|
10353
10441
|
}
|
|
10354
10442
|
|
|
10355
10443
|
@Mutation(() => Dashboard_)
|
|
@@ -10359,7 +10447,7 @@ export class DashboardResolver extends ResolverBase {
|
|
|
10359
10447
|
@PubSub() pubSub: PubSubEngine
|
|
10360
10448
|
) {
|
|
10361
10449
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
10362
|
-
const entityObject = await new Metadata().GetEntityObject('Dashboards', this.GetUserFromPayload(userPayload));
|
|
10450
|
+
const entityObject = <DashboardEntity>await new Metadata().GetEntityObject('Dashboards', this.GetUserFromPayload(userPayload));
|
|
10363
10451
|
await entityObject.NewRecord();
|
|
10364
10452
|
entityObject.SetMany(input);
|
|
10365
10453
|
if (await entityObject.Save()) {
|
|
@@ -10377,11 +10465,9 @@ export class DashboardResolver extends ResolverBase {
|
|
|
10377
10465
|
|
|
10378
10466
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
10379
10467
|
protected async BeforeCreate(dataSource: DataSource, input: CreateDashboardInput): Promise<boolean> {
|
|
10380
|
-
const i = input, d = dataSource; // prevent error
|
|
10381
10468
|
return true;
|
|
10382
10469
|
}
|
|
10383
10470
|
protected async AfterCreate(dataSource: DataSource, input: CreateDashboardInput) {
|
|
10384
|
-
const i = input, d = dataSource; // prevent error
|
|
10385
10471
|
}
|
|
10386
10472
|
|
|
10387
10473
|
@Mutation(() => Dashboard_)
|
|
@@ -10391,7 +10477,7 @@ export class DashboardResolver extends ResolverBase {
|
|
|
10391
10477
|
@PubSub() pubSub: PubSubEngine
|
|
10392
10478
|
) {
|
|
10393
10479
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
10394
|
-
const entityObject = await new Metadata().GetEntityObject('Dashboards', this.GetUserFromPayload(userPayload));
|
|
10480
|
+
const entityObject = <DashboardEntity>await new Metadata().GetEntityObject('Dashboards', this.GetUserFromPayload(userPayload));
|
|
10395
10481
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Dashboards
|
|
10396
10482
|
|
|
10397
10483
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -10415,14 +10501,15 @@ export class DashboardResolver extends ResolverBase {
|
|
|
10415
10501
|
const i = input, d = dataSource; // prevent error
|
|
10416
10502
|
}
|
|
10417
10503
|
|
|
10418
|
-
@Mutation(() =>
|
|
10504
|
+
@Mutation(() => Dashboard_)
|
|
10419
10505
|
async DeleteDashboard(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
10420
10506
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
10421
|
-
const entityObject = await new Metadata().GetEntityObject('Dashboards', this.GetUserFromPayload(userPayload));
|
|
10422
|
-
await entityObject.Load(ID)
|
|
10507
|
+
const entityObject = <DashboardEntity>await new Metadata().GetEntityObject('Dashboards', this.GetUserFromPayload(userPayload));
|
|
10508
|
+
await entityObject.Load(ID);
|
|
10509
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
10423
10510
|
if (await entityObject.Delete()) {
|
|
10424
10511
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
10425
|
-
return
|
|
10512
|
+
return returnValue;
|
|
10426
10513
|
}
|
|
10427
10514
|
else
|
|
10428
10515
|
return null; // delete failed, this will cause an exception
|
|
@@ -10505,20 +10592,21 @@ export class OutputTriggerTypeResolver extends ResolverBase {
|
|
|
10505
10592
|
input.EntityName = 'Output Trigger Types';
|
|
10506
10593
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
10507
10594
|
}
|
|
10508
|
-
|
|
10509
10595
|
@Query(() => OutputTriggerType_, { nullable: true })
|
|
10510
10596
|
async OutputTriggerType(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<OutputTriggerType_ | null> {
|
|
10511
10597
|
this.CheckUserReadPermissions('Output Trigger Types', userPayload);
|
|
10512
|
-
const sSQL = `SELECT * FROM [admin].vwOutputTriggerTypes WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Output Trigger Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
10598
|
+
const sSQL = `SELECT * FROM [admin].[vwOutputTriggerTypes] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Output Trigger Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
10513
10599
|
this.createRecordAccessAuditLogRecord(userPayload, 'Output Trigger Types', ID)
|
|
10514
|
-
|
|
10600
|
+
const result = this.MapFieldNamesToCodeNames('Output Trigger Types', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
10601
|
+
return result;
|
|
10515
10602
|
}
|
|
10516
10603
|
|
|
10517
10604
|
@FieldResolver(() => [Report_])
|
|
10518
10605
|
async ReportsArray(@Root() outputtriggertype_: OutputTriggerType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
10519
10606
|
this.CheckUserReadPermissions('Reports', userPayload);
|
|
10520
|
-
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE OutputTriggerTypeID=${outputtriggertype_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
10521
|
-
|
|
10607
|
+
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE [OutputTriggerTypeID]=${outputtriggertype_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
10608
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Reports', await dataSource.query(sSQL));
|
|
10609
|
+
return result;
|
|
10522
10610
|
}
|
|
10523
10611
|
|
|
10524
10612
|
}
|
|
@@ -10589,20 +10677,21 @@ export class OutputFormatTypeResolver extends ResolverBase {
|
|
|
10589
10677
|
input.EntityName = 'Output Format Types';
|
|
10590
10678
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
10591
10679
|
}
|
|
10592
|
-
|
|
10593
10680
|
@Query(() => OutputFormatType_, { nullable: true })
|
|
10594
10681
|
async OutputFormatType(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<OutputFormatType_ | null> {
|
|
10595
10682
|
this.CheckUserReadPermissions('Output Format Types', userPayload);
|
|
10596
|
-
const sSQL = `SELECT * FROM [admin].vwOutputFormatTypes WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Output Format Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
10683
|
+
const sSQL = `SELECT * FROM [admin].[vwOutputFormatTypes] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Output Format Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
10597
10684
|
this.createRecordAccessAuditLogRecord(userPayload, 'Output Format Types', ID)
|
|
10598
|
-
|
|
10685
|
+
const result = this.MapFieldNamesToCodeNames('Output Format Types', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
10686
|
+
return result;
|
|
10599
10687
|
}
|
|
10600
10688
|
|
|
10601
10689
|
@FieldResolver(() => [Report_])
|
|
10602
10690
|
async ReportsArray(@Root() outputformattype_: OutputFormatType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
10603
10691
|
this.CheckUserReadPermissions('Reports', userPayload);
|
|
10604
|
-
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE OutputFormatTypeID=${outputformattype_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
10605
|
-
|
|
10692
|
+
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE [OutputFormatTypeID]=${outputformattype_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
10693
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Reports', await dataSource.query(sSQL));
|
|
10694
|
+
return result;
|
|
10606
10695
|
}
|
|
10607
10696
|
|
|
10608
10697
|
}
|
|
@@ -10670,20 +10759,21 @@ export class OutputDeliveryTypeResolver extends ResolverBase {
|
|
|
10670
10759
|
input.EntityName = 'Output Delivery Types';
|
|
10671
10760
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
10672
10761
|
}
|
|
10673
|
-
|
|
10674
10762
|
@Query(() => OutputDeliveryType_, { nullable: true })
|
|
10675
10763
|
async OutputDeliveryType(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<OutputDeliveryType_ | null> {
|
|
10676
10764
|
this.CheckUserReadPermissions('Output Delivery Types', userPayload);
|
|
10677
|
-
const sSQL = `SELECT * FROM [admin].vwOutputDeliveryTypes WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Output Delivery Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
10765
|
+
const sSQL = `SELECT * FROM [admin].[vwOutputDeliveryTypes] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Output Delivery Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
10678
10766
|
this.createRecordAccessAuditLogRecord(userPayload, 'Output Delivery Types', ID)
|
|
10679
|
-
|
|
10767
|
+
const result = this.MapFieldNamesToCodeNames('Output Delivery Types', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
10768
|
+
return result;
|
|
10680
10769
|
}
|
|
10681
10770
|
|
|
10682
10771
|
@FieldResolver(() => [Report_])
|
|
10683
10772
|
async ReportsArray(@Root() outputdeliverytype_: OutputDeliveryType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
10684
10773
|
this.CheckUserReadPermissions('Reports', userPayload);
|
|
10685
|
-
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE OutputDeliveryTypeID=${outputdeliverytype_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
10686
|
-
|
|
10774
|
+
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE [OutputDeliveryTypeID]=${outputdeliverytype_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
10775
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Reports', await dataSource.query(sSQL));
|
|
10776
|
+
return result;
|
|
10687
10777
|
}
|
|
10688
10778
|
|
|
10689
10779
|
}
|
|
@@ -10932,19 +11022,20 @@ export class ReportResolver extends ResolverBase {
|
|
|
10932
11022
|
input.EntityName = 'Reports';
|
|
10933
11023
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
10934
11024
|
}
|
|
10935
|
-
|
|
10936
11025
|
@Query(() => Report_, { nullable: true })
|
|
10937
11026
|
async Report(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Report_ | null> {
|
|
10938
11027
|
this.CheckUserReadPermissions('Reports', userPayload);
|
|
10939
|
-
const sSQL = `SELECT * FROM [admin].vwReports WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
10940
|
-
|
|
11028
|
+
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
11029
|
+
const result = this.MapFieldNamesToCodeNames('Reports', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
11030
|
+
return result;
|
|
10941
11031
|
}
|
|
10942
11032
|
|
|
10943
11033
|
@FieldResolver(() => [ReportSnapshot_])
|
|
10944
11034
|
async ReportSnapshotsArray(@Root() report_: Report_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
10945
11035
|
this.CheckUserReadPermissions('Report Snapshots', userPayload);
|
|
10946
|
-
const sSQL = `SELECT * FROM [admin].[vwReportSnapshots] WHERE ReportID=${report_.ID} ` + this.getRowLevelSecurityWhereClause('Report Snapshots', userPayload, EntityPermissionType.Read, 'AND');
|
|
10947
|
-
|
|
11036
|
+
const sSQL = `SELECT * FROM [admin].[vwReportSnapshots] WHERE [ReportID]=${report_.ID} ` + this.getRowLevelSecurityWhereClause('Report Snapshots', userPayload, EntityPermissionType.Read, 'AND');
|
|
11037
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Report Snapshots', await dataSource.query(sSQL));
|
|
11038
|
+
return result;
|
|
10948
11039
|
}
|
|
10949
11040
|
|
|
10950
11041
|
@Mutation(() => Report_)
|
|
@@ -10954,7 +11045,7 @@ export class ReportResolver extends ResolverBase {
|
|
|
10954
11045
|
@PubSub() pubSub: PubSubEngine
|
|
10955
11046
|
) {
|
|
10956
11047
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
10957
|
-
const entityObject = await new Metadata().GetEntityObject('Reports', this.GetUserFromPayload(userPayload));
|
|
11048
|
+
const entityObject = <ReportEntity>await new Metadata().GetEntityObject('Reports', this.GetUserFromPayload(userPayload));
|
|
10958
11049
|
await entityObject.NewRecord();
|
|
10959
11050
|
entityObject.SetMany(input);
|
|
10960
11051
|
if (await entityObject.Save()) {
|
|
@@ -10972,11 +11063,9 @@ export class ReportResolver extends ResolverBase {
|
|
|
10972
11063
|
|
|
10973
11064
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
10974
11065
|
protected async BeforeCreate(dataSource: DataSource, input: CreateReportInput): Promise<boolean> {
|
|
10975
|
-
const i = input, d = dataSource; // prevent error
|
|
10976
11066
|
return true;
|
|
10977
11067
|
}
|
|
10978
11068
|
protected async AfterCreate(dataSource: DataSource, input: CreateReportInput) {
|
|
10979
|
-
const i = input, d = dataSource; // prevent error
|
|
10980
11069
|
}
|
|
10981
11070
|
|
|
10982
11071
|
@Mutation(() => Report_)
|
|
@@ -10986,7 +11075,7 @@ export class ReportResolver extends ResolverBase {
|
|
|
10986
11075
|
@PubSub() pubSub: PubSubEngine
|
|
10987
11076
|
) {
|
|
10988
11077
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
10989
|
-
const entityObject = await new Metadata().GetEntityObject('Reports', this.GetUserFromPayload(userPayload));
|
|
11078
|
+
const entityObject = <ReportEntity>await new Metadata().GetEntityObject('Reports', this.GetUserFromPayload(userPayload));
|
|
10990
11079
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Reports
|
|
10991
11080
|
|
|
10992
11081
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -11010,14 +11099,15 @@ export class ReportResolver extends ResolverBase {
|
|
|
11010
11099
|
const i = input, d = dataSource; // prevent error
|
|
11011
11100
|
}
|
|
11012
11101
|
|
|
11013
|
-
@Mutation(() =>
|
|
11102
|
+
@Mutation(() => Report_)
|
|
11014
11103
|
async DeleteReport(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
11015
11104
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
11016
|
-
const entityObject = await new Metadata().GetEntityObject('Reports', this.GetUserFromPayload(userPayload));
|
|
11017
|
-
await entityObject.Load(ID)
|
|
11105
|
+
const entityObject = <ReportEntity>await new Metadata().GetEntityObject('Reports', this.GetUserFromPayload(userPayload));
|
|
11106
|
+
await entityObject.Load(ID);
|
|
11107
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
11018
11108
|
if (await entityObject.Delete()) {
|
|
11019
11109
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
11020
|
-
return
|
|
11110
|
+
return returnValue;
|
|
11021
11111
|
}
|
|
11022
11112
|
else
|
|
11023
11113
|
return null; // delete failed, this will cause an exception
|
|
@@ -11146,12 +11236,12 @@ export class ReportSnapshotResolver extends ResolverBase {
|
|
|
11146
11236
|
input.EntityName = 'Report Snapshots';
|
|
11147
11237
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
11148
11238
|
}
|
|
11149
|
-
|
|
11150
11239
|
@Query(() => ReportSnapshot_, { nullable: true })
|
|
11151
11240
|
async ReportSnapshot(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ReportSnapshot_ | null> {
|
|
11152
11241
|
this.CheckUserReadPermissions('Report Snapshots', userPayload);
|
|
11153
|
-
const sSQL = `SELECT * FROM [admin].vwReportSnapshots WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Report Snapshots', userPayload, EntityPermissionType.Read, 'AND');
|
|
11154
|
-
|
|
11242
|
+
const sSQL = `SELECT * FROM [admin].[vwReportSnapshots] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Report Snapshots', userPayload, EntityPermissionType.Read, 'AND');
|
|
11243
|
+
const result = this.MapFieldNamesToCodeNames('Report Snapshots', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
11244
|
+
return result;
|
|
11155
11245
|
}
|
|
11156
11246
|
|
|
11157
11247
|
@Mutation(() => ReportSnapshot_)
|
|
@@ -11161,7 +11251,7 @@ export class ReportSnapshotResolver extends ResolverBase {
|
|
|
11161
11251
|
@PubSub() pubSub: PubSubEngine
|
|
11162
11252
|
) {
|
|
11163
11253
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
11164
|
-
const entityObject = await new Metadata().GetEntityObject('Report Snapshots', this.GetUserFromPayload(userPayload));
|
|
11254
|
+
const entityObject = <ReportSnapshotEntity>await new Metadata().GetEntityObject('Report Snapshots', this.GetUserFromPayload(userPayload));
|
|
11165
11255
|
await entityObject.NewRecord();
|
|
11166
11256
|
entityObject.SetMany(input);
|
|
11167
11257
|
if (await entityObject.Save()) {
|
|
@@ -11179,11 +11269,9 @@ export class ReportSnapshotResolver extends ResolverBase {
|
|
|
11179
11269
|
|
|
11180
11270
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
11181
11271
|
protected async BeforeCreate(dataSource: DataSource, input: CreateReportSnapshotInput): Promise<boolean> {
|
|
11182
|
-
const i = input, d = dataSource; // prevent error
|
|
11183
11272
|
return true;
|
|
11184
11273
|
}
|
|
11185
11274
|
protected async AfterCreate(dataSource: DataSource, input: CreateReportSnapshotInput) {
|
|
11186
|
-
const i = input, d = dataSource; // prevent error
|
|
11187
11275
|
}
|
|
11188
11276
|
|
|
11189
11277
|
@Mutation(() => ReportSnapshot_)
|
|
@@ -11193,7 +11281,7 @@ export class ReportSnapshotResolver extends ResolverBase {
|
|
|
11193
11281
|
@PubSub() pubSub: PubSubEngine
|
|
11194
11282
|
) {
|
|
11195
11283
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
11196
|
-
const entityObject = await new Metadata().GetEntityObject('Report Snapshots', this.GetUserFromPayload(userPayload));
|
|
11284
|
+
const entityObject = <ReportSnapshotEntity>await new Metadata().GetEntityObject('Report Snapshots', this.GetUserFromPayload(userPayload));
|
|
11197
11285
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Report Snapshots
|
|
11198
11286
|
|
|
11199
11287
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -11217,14 +11305,15 @@ export class ReportSnapshotResolver extends ResolverBase {
|
|
|
11217
11305
|
const i = input, d = dataSource; // prevent error
|
|
11218
11306
|
}
|
|
11219
11307
|
|
|
11220
|
-
@Mutation(() =>
|
|
11308
|
+
@Mutation(() => ReportSnapshot_)
|
|
11221
11309
|
async DeleteReportSnapshot(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
11222
11310
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
11223
|
-
const entityObject = await new Metadata().GetEntityObject('Report Snapshots', this.GetUserFromPayload(userPayload));
|
|
11224
|
-
await entityObject.Load(ID)
|
|
11311
|
+
const entityObject = <ReportSnapshotEntity>await new Metadata().GetEntityObject('Report Snapshots', this.GetUserFromPayload(userPayload));
|
|
11312
|
+
await entityObject.Load(ID);
|
|
11313
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
11225
11314
|
if (await entityObject.Delete()) {
|
|
11226
11315
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
11227
|
-
return
|
|
11316
|
+
return returnValue;
|
|
11228
11317
|
}
|
|
11229
11318
|
else
|
|
11230
11319
|
return null; // delete failed, this will cause an exception
|
|
@@ -11333,27 +11422,29 @@ export class ResourceTypeResolver extends ResolverBase {
|
|
|
11333
11422
|
input.EntityName = 'Resource Types';
|
|
11334
11423
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
11335
11424
|
}
|
|
11336
|
-
|
|
11337
11425
|
@Query(() => ResourceType_, { nullable: true })
|
|
11338
11426
|
async ResourceType(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ResourceType_ | null> {
|
|
11339
11427
|
this.CheckUserReadPermissions('Resource Types', userPayload);
|
|
11340
|
-
const sSQL = `SELECT * FROM [admin].vwResourceTypes WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Resource Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
11428
|
+
const sSQL = `SELECT * FROM [admin].[vwResourceTypes] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Resource Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
11341
11429
|
this.createRecordAccessAuditLogRecord(userPayload, 'Resource Types', ID)
|
|
11342
|
-
|
|
11430
|
+
const result = this.MapFieldNamesToCodeNames('Resource Types', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
11431
|
+
return result;
|
|
11343
11432
|
}
|
|
11344
11433
|
|
|
11345
11434
|
@FieldResolver(() => [WorkspaceItem_])
|
|
11346
11435
|
async WorkspaceItemsArray(@Root() resourcetype_: ResourceType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
11347
11436
|
this.CheckUserReadPermissions('Workspace Items', userPayload);
|
|
11348
|
-
const sSQL = `SELECT * FROM [admin].[vwWorkspaceItems] WHERE ResourceTypeID=${resourcetype_.ID} ` + this.getRowLevelSecurityWhereClause('Workspace Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
11349
|
-
|
|
11437
|
+
const sSQL = `SELECT * FROM [admin].[vwWorkspaceItems] WHERE [ResourceTypeID]=${resourcetype_.ID} ` + this.getRowLevelSecurityWhereClause('Workspace Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
11438
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Workspace Items', await dataSource.query(sSQL));
|
|
11439
|
+
return result;
|
|
11350
11440
|
}
|
|
11351
11441
|
|
|
11352
11442
|
@FieldResolver(() => [ResourceFolder_])
|
|
11353
11443
|
async ResourceFoldersArray(@Root() resourcetype_: ResourceType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
11354
11444
|
this.CheckUserReadPermissions('Resource Folders', userPayload);
|
|
11355
|
-
const sSQL = `SELECT * FROM [admin].[vwResourceFolders] WHERE ResourceTypeName=${resourcetype_.ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
|
|
11356
|
-
|
|
11445
|
+
const sSQL = `SELECT * FROM [admin].[vwResourceFolders] WHERE [ResourceTypeName]=${resourcetype_.ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
|
|
11446
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Resource Folders', await dataSource.query(sSQL));
|
|
11447
|
+
return result;
|
|
11357
11448
|
}
|
|
11358
11449
|
|
|
11359
11450
|
}
|
|
@@ -11435,27 +11526,29 @@ export class TagResolver extends ResolverBase {
|
|
|
11435
11526
|
input.EntityName = 'Tags';
|
|
11436
11527
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
11437
11528
|
}
|
|
11438
|
-
|
|
11439
11529
|
@Query(() => Tag_, { nullable: true })
|
|
11440
11530
|
async Tag(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Tag_ | null> {
|
|
11441
11531
|
this.CheckUserReadPermissions('Tags', userPayload);
|
|
11442
|
-
const sSQL = `SELECT * FROM [admin].vwTags WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Tags', userPayload, EntityPermissionType.Read, 'AND');
|
|
11532
|
+
const sSQL = `SELECT * FROM [admin].[vwTags] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Tags', userPayload, EntityPermissionType.Read, 'AND');
|
|
11443
11533
|
this.createRecordAccessAuditLogRecord(userPayload, 'Tags', ID)
|
|
11444
|
-
|
|
11534
|
+
const result = this.MapFieldNamesToCodeNames('Tags', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
11535
|
+
return result;
|
|
11445
11536
|
}
|
|
11446
11537
|
|
|
11447
11538
|
@FieldResolver(() => [Tag_])
|
|
11448
11539
|
async TagsArray(@Root() tag_: Tag_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
11449
11540
|
this.CheckUserReadPermissions('Tags', userPayload);
|
|
11450
|
-
const sSQL = `SELECT * FROM [admin].[vwTags] WHERE ParentID=${tag_.ID} ` + this.getRowLevelSecurityWhereClause('Tags', userPayload, EntityPermissionType.Read, 'AND');
|
|
11451
|
-
|
|
11541
|
+
const sSQL = `SELECT * FROM [admin].[vwTags] WHERE [ParentID]=${tag_.ID} ` + this.getRowLevelSecurityWhereClause('Tags', userPayload, EntityPermissionType.Read, 'AND');
|
|
11542
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Tags', await dataSource.query(sSQL));
|
|
11543
|
+
return result;
|
|
11452
11544
|
}
|
|
11453
11545
|
|
|
11454
11546
|
@FieldResolver(() => [TaggedItem_])
|
|
11455
11547
|
async TaggedItemsArray(@Root() tag_: Tag_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
11456
11548
|
this.CheckUserReadPermissions('Tagged Items', userPayload);
|
|
11457
|
-
const sSQL = `SELECT * FROM [admin].[vwTaggedItems] WHERE TagID=${tag_.ID} ` + this.getRowLevelSecurityWhereClause('Tagged Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
11458
|
-
|
|
11549
|
+
const sSQL = `SELECT * FROM [admin].[vwTaggedItems] WHERE [TagID]=${tag_.ID} ` + this.getRowLevelSecurityWhereClause('Tagged Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
11550
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Tagged Items', await dataSource.query(sSQL));
|
|
11551
|
+
return result;
|
|
11459
11552
|
}
|
|
11460
11553
|
|
|
11461
11554
|
}
|
|
@@ -11531,13 +11624,13 @@ export class TaggedItemResolver extends ResolverBase {
|
|
|
11531
11624
|
input.EntityName = 'Tagged Items';
|
|
11532
11625
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
11533
11626
|
}
|
|
11534
|
-
|
|
11535
11627
|
@Query(() => TaggedItem_, { nullable: true })
|
|
11536
11628
|
async TaggedItem(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<TaggedItem_ | null> {
|
|
11537
11629
|
this.CheckUserReadPermissions('Tagged Items', userPayload);
|
|
11538
|
-
const sSQL = `SELECT * FROM [admin].vwTaggedItems WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Tagged Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
11630
|
+
const sSQL = `SELECT * FROM [admin].[vwTaggedItems] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Tagged Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
11539
11631
|
this.createRecordAccessAuditLogRecord(userPayload, 'Tagged Items', ID)
|
|
11540
|
-
|
|
11632
|
+
const result = this.MapFieldNamesToCodeNames('Tagged Items', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
11633
|
+
return result;
|
|
11541
11634
|
}
|
|
11542
11635
|
|
|
11543
11636
|
}
|
|
@@ -11647,20 +11740,21 @@ export class WorkspaceResolver extends ResolverBase {
|
|
|
11647
11740
|
input.EntityName = 'Workspaces';
|
|
11648
11741
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
11649
11742
|
}
|
|
11650
|
-
|
|
11651
11743
|
@Query(() => Workspace_, { nullable: true })
|
|
11652
11744
|
async Workspace(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Workspace_ | null> {
|
|
11653
11745
|
this.CheckUserReadPermissions('Workspaces', userPayload);
|
|
11654
|
-
const sSQL = `SELECT * FROM [admin].vwWorkspaces WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Workspaces', userPayload, EntityPermissionType.Read, 'AND');
|
|
11746
|
+
const sSQL = `SELECT * FROM [admin].[vwWorkspaces] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Workspaces', userPayload, EntityPermissionType.Read, 'AND');
|
|
11655
11747
|
this.createRecordAccessAuditLogRecord(userPayload, 'Workspaces', ID)
|
|
11656
|
-
|
|
11748
|
+
const result = this.MapFieldNamesToCodeNames('Workspaces', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
11749
|
+
return result;
|
|
11657
11750
|
}
|
|
11658
11751
|
|
|
11659
11752
|
@FieldResolver(() => [WorkspaceItem_])
|
|
11660
11753
|
async WorkspaceItemsArray(@Root() workspace_: Workspace_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
11661
11754
|
this.CheckUserReadPermissions('Workspace Items', userPayload);
|
|
11662
|
-
const sSQL = `SELECT * FROM [admin].[vwWorkspaceItems] WHERE WorkSpaceID=${workspace_.ID} ` + this.getRowLevelSecurityWhereClause('Workspace Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
11663
|
-
|
|
11755
|
+
const sSQL = `SELECT * FROM [admin].[vwWorkspaceItems] WHERE [WorkSpaceID]=${workspace_.ID} ` + this.getRowLevelSecurityWhereClause('Workspace Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
11756
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Workspace Items', await dataSource.query(sSQL));
|
|
11757
|
+
return result;
|
|
11664
11758
|
}
|
|
11665
11759
|
|
|
11666
11760
|
@Mutation(() => Workspace_)
|
|
@@ -11670,7 +11764,7 @@ export class WorkspaceResolver extends ResolverBase {
|
|
|
11670
11764
|
@PubSub() pubSub: PubSubEngine
|
|
11671
11765
|
) {
|
|
11672
11766
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
11673
|
-
const entityObject = await new Metadata().GetEntityObject('Workspaces', this.GetUserFromPayload(userPayload));
|
|
11767
|
+
const entityObject = <WorkspaceEntity>await new Metadata().GetEntityObject('Workspaces', this.GetUserFromPayload(userPayload));
|
|
11674
11768
|
await entityObject.NewRecord();
|
|
11675
11769
|
entityObject.SetMany(input);
|
|
11676
11770
|
if (await entityObject.Save()) {
|
|
@@ -11688,11 +11782,9 @@ export class WorkspaceResolver extends ResolverBase {
|
|
|
11688
11782
|
|
|
11689
11783
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
11690
11784
|
protected async BeforeCreate(dataSource: DataSource, input: CreateWorkspaceInput): Promise<boolean> {
|
|
11691
|
-
const i = input, d = dataSource; // prevent error
|
|
11692
11785
|
return true;
|
|
11693
11786
|
}
|
|
11694
11787
|
protected async AfterCreate(dataSource: DataSource, input: CreateWorkspaceInput) {
|
|
11695
|
-
const i = input, d = dataSource; // prevent error
|
|
11696
11788
|
}
|
|
11697
11789
|
|
|
11698
11790
|
@Mutation(() => Workspace_)
|
|
@@ -11702,7 +11794,7 @@ export class WorkspaceResolver extends ResolverBase {
|
|
|
11702
11794
|
@PubSub() pubSub: PubSubEngine
|
|
11703
11795
|
) {
|
|
11704
11796
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
11705
|
-
const entityObject = await new Metadata().GetEntityObject('Workspaces', this.GetUserFromPayload(userPayload));
|
|
11797
|
+
const entityObject = <WorkspaceEntity>await new Metadata().GetEntityObject('Workspaces', this.GetUserFromPayload(userPayload));
|
|
11706
11798
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Workspaces
|
|
11707
11799
|
|
|
11708
11800
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -11726,14 +11818,15 @@ export class WorkspaceResolver extends ResolverBase {
|
|
|
11726
11818
|
const i = input, d = dataSource; // prevent error
|
|
11727
11819
|
}
|
|
11728
11820
|
|
|
11729
|
-
@Mutation(() =>
|
|
11821
|
+
@Mutation(() => Workspace_)
|
|
11730
11822
|
async DeleteWorkspace(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
11731
11823
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
11732
|
-
const entityObject = await new Metadata().GetEntityObject('Workspaces', this.GetUserFromPayload(userPayload));
|
|
11733
|
-
await entityObject.Load(ID)
|
|
11824
|
+
const entityObject = <WorkspaceEntity>await new Metadata().GetEntityObject('Workspaces', this.GetUserFromPayload(userPayload));
|
|
11825
|
+
await entityObject.Load(ID);
|
|
11826
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
11734
11827
|
if (await entityObject.Delete()) {
|
|
11735
11828
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
11736
|
-
return
|
|
11829
|
+
return returnValue;
|
|
11737
11830
|
}
|
|
11738
11831
|
else
|
|
11739
11832
|
return null; // delete failed, this will cause an exception
|
|
@@ -11896,13 +11989,13 @@ export class WorkspaceItemResolver extends ResolverBase {
|
|
|
11896
11989
|
input.EntityName = 'Workspace Items';
|
|
11897
11990
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
11898
11991
|
}
|
|
11899
|
-
|
|
11900
11992
|
@Query(() => WorkspaceItem_, { nullable: true })
|
|
11901
11993
|
async WorkspaceItem(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<WorkspaceItem_ | null> {
|
|
11902
11994
|
this.CheckUserReadPermissions('Workspace Items', userPayload);
|
|
11903
|
-
const sSQL = `SELECT * FROM [admin].vwWorkspaceItems WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Workspace Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
11995
|
+
const sSQL = `SELECT * FROM [admin].[vwWorkspaceItems] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Workspace Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
11904
11996
|
this.createRecordAccessAuditLogRecord(userPayload, 'Workspace Items', ID)
|
|
11905
|
-
|
|
11997
|
+
const result = this.MapFieldNamesToCodeNames('Workspace Items', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
11998
|
+
return result;
|
|
11906
11999
|
}
|
|
11907
12000
|
|
|
11908
12001
|
@Mutation(() => WorkspaceItem_)
|
|
@@ -11912,7 +12005,7 @@ export class WorkspaceItemResolver extends ResolverBase {
|
|
|
11912
12005
|
@PubSub() pubSub: PubSubEngine
|
|
11913
12006
|
) {
|
|
11914
12007
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
11915
|
-
const entityObject = await new Metadata().GetEntityObject('Workspace Items', this.GetUserFromPayload(userPayload));
|
|
12008
|
+
const entityObject = <WorkspaceItemEntity>await new Metadata().GetEntityObject('Workspace Items', this.GetUserFromPayload(userPayload));
|
|
11916
12009
|
await entityObject.NewRecord();
|
|
11917
12010
|
entityObject.SetMany(input);
|
|
11918
12011
|
if (await entityObject.Save()) {
|
|
@@ -11930,11 +12023,9 @@ export class WorkspaceItemResolver extends ResolverBase {
|
|
|
11930
12023
|
|
|
11931
12024
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
11932
12025
|
protected async BeforeCreate(dataSource: DataSource, input: CreateWorkspaceItemInput): Promise<boolean> {
|
|
11933
|
-
const i = input, d = dataSource; // prevent error
|
|
11934
12026
|
return true;
|
|
11935
12027
|
}
|
|
11936
12028
|
protected async AfterCreate(dataSource: DataSource, input: CreateWorkspaceItemInput) {
|
|
11937
|
-
const i = input, d = dataSource; // prevent error
|
|
11938
12029
|
}
|
|
11939
12030
|
|
|
11940
12031
|
@Mutation(() => WorkspaceItem_)
|
|
@@ -11944,7 +12035,7 @@ export class WorkspaceItemResolver extends ResolverBase {
|
|
|
11944
12035
|
@PubSub() pubSub: PubSubEngine
|
|
11945
12036
|
) {
|
|
11946
12037
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
11947
|
-
const entityObject = await new Metadata().GetEntityObject('Workspace Items', this.GetUserFromPayload(userPayload));
|
|
12038
|
+
const entityObject = <WorkspaceItemEntity>await new Metadata().GetEntityObject('Workspace Items', this.GetUserFromPayload(userPayload));
|
|
11948
12039
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Workspace Items
|
|
11949
12040
|
|
|
11950
12041
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -11968,14 +12059,15 @@ export class WorkspaceItemResolver extends ResolverBase {
|
|
|
11968
12059
|
const i = input, d = dataSource; // prevent error
|
|
11969
12060
|
}
|
|
11970
12061
|
|
|
11971
|
-
@Mutation(() =>
|
|
12062
|
+
@Mutation(() => WorkspaceItem_)
|
|
11972
12063
|
async DeleteWorkspaceItem(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
11973
12064
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
11974
|
-
const entityObject = await new Metadata().GetEntityObject('Workspace Items', this.GetUserFromPayload(userPayload));
|
|
11975
|
-
await entityObject.Load(ID)
|
|
12065
|
+
const entityObject = <WorkspaceItemEntity>await new Metadata().GetEntityObject('Workspace Items', this.GetUserFromPayload(userPayload));
|
|
12066
|
+
await entityObject.Load(ID);
|
|
12067
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
11976
12068
|
if (await entityObject.Delete()) {
|
|
11977
12069
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
11978
|
-
return
|
|
12070
|
+
return returnValue;
|
|
11979
12071
|
}
|
|
11980
12072
|
else
|
|
11981
12073
|
return null; // delete failed, this will cause an exception
|
|
@@ -12066,19 +12158,20 @@ export class DatasetResolver extends ResolverBase {
|
|
|
12066
12158
|
input.EntityName = 'Datasets';
|
|
12067
12159
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
12068
12160
|
}
|
|
12069
|
-
|
|
12070
12161
|
@Query(() => Dataset_, { nullable: true })
|
|
12071
12162
|
async Dataset(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Dataset_ | null> {
|
|
12072
12163
|
this.CheckUserReadPermissions('Datasets', userPayload);
|
|
12073
|
-
const sSQL = `SELECT * FROM [admin].vwDatasets WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Datasets', userPayload, EntityPermissionType.Read, 'AND');
|
|
12074
|
-
|
|
12164
|
+
const sSQL = `SELECT * FROM [admin].[vwDatasets] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Datasets', userPayload, EntityPermissionType.Read, 'AND');
|
|
12165
|
+
const result = this.MapFieldNamesToCodeNames('Datasets', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
12166
|
+
return result;
|
|
12075
12167
|
}
|
|
12076
12168
|
|
|
12077
12169
|
@FieldResolver(() => [DatasetItem_])
|
|
12078
12170
|
async DatasetItemsArray(@Root() dataset_: Dataset_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
12079
12171
|
this.CheckUserReadPermissions('Dataset Items', userPayload);
|
|
12080
|
-
const sSQL = `SELECT * FROM [admin].[vwDatasetItems] WHERE DatasetName=${dataset_.ID} ` + this.getRowLevelSecurityWhereClause('Dataset Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
12081
|
-
|
|
12172
|
+
const sSQL = `SELECT * FROM [admin].[vwDatasetItems] WHERE [DatasetName]=${dataset_.ID} ` + this.getRowLevelSecurityWhereClause('Dataset Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
12173
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Dataset Items', await dataSource.query(sSQL));
|
|
12174
|
+
return result;
|
|
12082
12175
|
}
|
|
12083
12176
|
|
|
12084
12177
|
}
|
|
@@ -12172,12 +12265,12 @@ export class DatasetItemResolver extends ResolverBase {
|
|
|
12172
12265
|
input.EntityName = 'Dataset Items';
|
|
12173
12266
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
12174
12267
|
}
|
|
12175
|
-
|
|
12176
12268
|
@Query(() => DatasetItem_, { nullable: true })
|
|
12177
12269
|
async DatasetItem(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<DatasetItem_ | null> {
|
|
12178
12270
|
this.CheckUserReadPermissions('Dataset Items', userPayload);
|
|
12179
|
-
const sSQL = `SELECT * FROM [admin].vwDatasetItems WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Dataset Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
12180
|
-
|
|
12271
|
+
const sSQL = `SELECT * FROM [admin].[vwDatasetItems] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Dataset Items', userPayload, EntityPermissionType.Read, 'AND');
|
|
12272
|
+
const result = this.MapFieldNamesToCodeNames('Dataset Items', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
12273
|
+
return result;
|
|
12181
12274
|
}
|
|
12182
12275
|
|
|
12183
12276
|
}
|
|
@@ -12314,19 +12407,20 @@ export class ConversationDetailResolver extends ResolverBase {
|
|
|
12314
12407
|
input.EntityName = 'Conversation Details';
|
|
12315
12408
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
12316
12409
|
}
|
|
12317
|
-
|
|
12318
12410
|
@Query(() => ConversationDetail_, { nullable: true })
|
|
12319
12411
|
async ConversationDetail(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ConversationDetail_ | null> {
|
|
12320
12412
|
this.CheckUserReadPermissions('Conversation Details', userPayload);
|
|
12321
|
-
const sSQL = `SELECT * FROM [admin].vwConversationDetails WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Conversation Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
12322
|
-
|
|
12413
|
+
const sSQL = `SELECT * FROM [admin].[vwConversationDetails] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Conversation Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
12414
|
+
const result = this.MapFieldNamesToCodeNames('Conversation Details', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
12415
|
+
return result;
|
|
12323
12416
|
}
|
|
12324
12417
|
|
|
12325
12418
|
@FieldResolver(() => [Report_])
|
|
12326
12419
|
async ReportsArray(@Root() conversationdetail_: ConversationDetail_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
12327
12420
|
this.CheckUserReadPermissions('Reports', userPayload);
|
|
12328
|
-
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE ConversationDetailID=${conversationdetail_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
12329
|
-
|
|
12421
|
+
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE [ConversationDetailID]=${conversationdetail_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
12422
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Reports', await dataSource.query(sSQL));
|
|
12423
|
+
return result;
|
|
12330
12424
|
}
|
|
12331
12425
|
|
|
12332
12426
|
@Mutation(() => ConversationDetail_)
|
|
@@ -12336,7 +12430,7 @@ export class ConversationDetailResolver extends ResolverBase {
|
|
|
12336
12430
|
@PubSub() pubSub: PubSubEngine
|
|
12337
12431
|
) {
|
|
12338
12432
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
12339
|
-
const entityObject = await new Metadata().GetEntityObject('Conversation Details', this.GetUserFromPayload(userPayload));
|
|
12433
|
+
const entityObject = <ConversationDetailEntity>await new Metadata().GetEntityObject('Conversation Details', this.GetUserFromPayload(userPayload));
|
|
12340
12434
|
await entityObject.NewRecord();
|
|
12341
12435
|
entityObject.SetMany(input);
|
|
12342
12436
|
if (await entityObject.Save()) {
|
|
@@ -12354,11 +12448,9 @@ export class ConversationDetailResolver extends ResolverBase {
|
|
|
12354
12448
|
|
|
12355
12449
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
12356
12450
|
protected async BeforeCreate(dataSource: DataSource, input: CreateConversationDetailInput): Promise<boolean> {
|
|
12357
|
-
const i = input, d = dataSource; // prevent error
|
|
12358
12451
|
return true;
|
|
12359
12452
|
}
|
|
12360
12453
|
protected async AfterCreate(dataSource: DataSource, input: CreateConversationDetailInput) {
|
|
12361
|
-
const i = input, d = dataSource; // prevent error
|
|
12362
12454
|
}
|
|
12363
12455
|
|
|
12364
12456
|
@Mutation(() => ConversationDetail_)
|
|
@@ -12368,7 +12460,7 @@ export class ConversationDetailResolver extends ResolverBase {
|
|
|
12368
12460
|
@PubSub() pubSub: PubSubEngine
|
|
12369
12461
|
) {
|
|
12370
12462
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
12371
|
-
const entityObject = await new Metadata().GetEntityObject('Conversation Details', this.GetUserFromPayload(userPayload));
|
|
12463
|
+
const entityObject = <ConversationDetailEntity>await new Metadata().GetEntityObject('Conversation Details', this.GetUserFromPayload(userPayload));
|
|
12372
12464
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Conversation Details
|
|
12373
12465
|
|
|
12374
12466
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -12392,14 +12484,15 @@ export class ConversationDetailResolver extends ResolverBase {
|
|
|
12392
12484
|
const i = input, d = dataSource; // prevent error
|
|
12393
12485
|
}
|
|
12394
12486
|
|
|
12395
|
-
@Mutation(() =>
|
|
12487
|
+
@Mutation(() => ConversationDetail_)
|
|
12396
12488
|
async DeleteConversationDetail(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
12397
12489
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
12398
|
-
const entityObject = await new Metadata().GetEntityObject('Conversation Details', this.GetUserFromPayload(userPayload));
|
|
12399
|
-
await entityObject.Load(ID)
|
|
12490
|
+
const entityObject = <ConversationDetailEntity>await new Metadata().GetEntityObject('Conversation Details', this.GetUserFromPayload(userPayload));
|
|
12491
|
+
await entityObject.Load(ID);
|
|
12492
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
12400
12493
|
if (await entityObject.Delete()) {
|
|
12401
12494
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
12402
|
-
return
|
|
12495
|
+
return returnValue;
|
|
12403
12496
|
}
|
|
12404
12497
|
else
|
|
12405
12498
|
return null; // delete failed, this will cause an exception
|
|
@@ -12536,26 +12629,28 @@ export class ConversationResolver extends ResolverBase {
|
|
|
12536
12629
|
input.EntityName = 'Conversations';
|
|
12537
12630
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
12538
12631
|
}
|
|
12539
|
-
|
|
12540
12632
|
@Query(() => Conversation_, { nullable: true })
|
|
12541
12633
|
async Conversation(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<Conversation_ | null> {
|
|
12542
12634
|
this.CheckUserReadPermissions('Conversations', userPayload);
|
|
12543
|
-
const sSQL = `SELECT * FROM [admin].vwConversations WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Conversations', userPayload, EntityPermissionType.Read, 'AND');
|
|
12544
|
-
|
|
12635
|
+
const sSQL = `SELECT * FROM [admin].[vwConversations] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Conversations', userPayload, EntityPermissionType.Read, 'AND');
|
|
12636
|
+
const result = this.MapFieldNamesToCodeNames('Conversations', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
12637
|
+
return result;
|
|
12545
12638
|
}
|
|
12546
12639
|
|
|
12547
12640
|
@FieldResolver(() => [ConversationDetail_])
|
|
12548
12641
|
async ConversationDetailsArray(@Root() conversation_: Conversation_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
12549
12642
|
this.CheckUserReadPermissions('Conversation Details', userPayload);
|
|
12550
|
-
const sSQL = `SELECT * FROM [admin].[vwConversationDetails] WHERE ConversationID=${conversation_.ID} ` + this.getRowLevelSecurityWhereClause('Conversation Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
12551
|
-
|
|
12643
|
+
const sSQL = `SELECT * FROM [admin].[vwConversationDetails] WHERE [ConversationID]=${conversation_.ID} ` + this.getRowLevelSecurityWhereClause('Conversation Details', userPayload, EntityPermissionType.Read, 'AND');
|
|
12644
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Conversation Details', await dataSource.query(sSQL));
|
|
12645
|
+
return result;
|
|
12552
12646
|
}
|
|
12553
12647
|
|
|
12554
12648
|
@FieldResolver(() => [Report_])
|
|
12555
12649
|
async ReportsArray(@Root() conversation_: Conversation_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
12556
12650
|
this.CheckUserReadPermissions('Reports', userPayload);
|
|
12557
|
-
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE ConversationID=${conversation_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
12558
|
-
|
|
12651
|
+
const sSQL = `SELECT * FROM [admin].[vwReports] WHERE [ConversationID]=${conversation_.ID} ` + this.getRowLevelSecurityWhereClause('Reports', userPayload, EntityPermissionType.Read, 'AND');
|
|
12652
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Reports', await dataSource.query(sSQL));
|
|
12653
|
+
return result;
|
|
12559
12654
|
}
|
|
12560
12655
|
|
|
12561
12656
|
@Mutation(() => Conversation_)
|
|
@@ -12565,7 +12660,7 @@ export class ConversationResolver extends ResolverBase {
|
|
|
12565
12660
|
@PubSub() pubSub: PubSubEngine
|
|
12566
12661
|
) {
|
|
12567
12662
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
12568
|
-
const entityObject = await new Metadata().GetEntityObject('Conversations', this.GetUserFromPayload(userPayload));
|
|
12663
|
+
const entityObject = <ConversationEntity>await new Metadata().GetEntityObject('Conversations', this.GetUserFromPayload(userPayload));
|
|
12569
12664
|
await entityObject.NewRecord();
|
|
12570
12665
|
entityObject.SetMany(input);
|
|
12571
12666
|
if (await entityObject.Save()) {
|
|
@@ -12583,11 +12678,9 @@ export class ConversationResolver extends ResolverBase {
|
|
|
12583
12678
|
|
|
12584
12679
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
12585
12680
|
protected async BeforeCreate(dataSource: DataSource, input: CreateConversationInput): Promise<boolean> {
|
|
12586
|
-
const i = input, d = dataSource; // prevent error
|
|
12587
12681
|
return true;
|
|
12588
12682
|
}
|
|
12589
12683
|
protected async AfterCreate(dataSource: DataSource, input: CreateConversationInput) {
|
|
12590
|
-
const i = input, d = dataSource; // prevent error
|
|
12591
12684
|
}
|
|
12592
12685
|
|
|
12593
12686
|
@Mutation(() => Conversation_)
|
|
@@ -12597,7 +12690,7 @@ export class ConversationResolver extends ResolverBase {
|
|
|
12597
12690
|
@PubSub() pubSub: PubSubEngine
|
|
12598
12691
|
) {
|
|
12599
12692
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
12600
|
-
const entityObject = await new Metadata().GetEntityObject('Conversations', this.GetUserFromPayload(userPayload));
|
|
12693
|
+
const entityObject = <ConversationEntity>await new Metadata().GetEntityObject('Conversations', this.GetUserFromPayload(userPayload));
|
|
12601
12694
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Conversations
|
|
12602
12695
|
|
|
12603
12696
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -12621,14 +12714,15 @@ export class ConversationResolver extends ResolverBase {
|
|
|
12621
12714
|
const i = input, d = dataSource; // prevent error
|
|
12622
12715
|
}
|
|
12623
12716
|
|
|
12624
|
-
@Mutation(() =>
|
|
12717
|
+
@Mutation(() => Conversation_)
|
|
12625
12718
|
async DeleteConversation(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
12626
12719
|
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
12627
|
-
const entityObject = await new Metadata().GetEntityObject('Conversations', this.GetUserFromPayload(userPayload));
|
|
12628
|
-
await entityObject.Load(ID)
|
|
12720
|
+
const entityObject = <ConversationEntity>await new Metadata().GetEntityObject('Conversations', this.GetUserFromPayload(userPayload));
|
|
12721
|
+
await entityObject.Load(ID);
|
|
12722
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
12629
12723
|
if (await entityObject.Delete()) {
|
|
12630
12724
|
await this.AfterDelete(dataSource, ID); // fire event
|
|
12631
|
-
return
|
|
12725
|
+
return returnValue;
|
|
12632
12726
|
}
|
|
12633
12727
|
else
|
|
12634
12728
|
return null; // delete failed, this will cause an exception
|
|
@@ -12804,12 +12898,12 @@ export class UserNotificationResolver extends ResolverBase {
|
|
|
12804
12898
|
input.EntityName = 'User Notifications';
|
|
12805
12899
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
12806
12900
|
}
|
|
12807
|
-
|
|
12808
12901
|
@Query(() => UserNotification_, { nullable: true })
|
|
12809
12902
|
async UserNotification(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<UserNotification_ | null> {
|
|
12810
12903
|
this.CheckUserReadPermissions('User Notifications', userPayload);
|
|
12811
|
-
const sSQL = `SELECT * FROM [admin].vwUserNotifications WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('User Notifications', userPayload, EntityPermissionType.Read, 'AND');
|
|
12812
|
-
|
|
12904
|
+
const sSQL = `SELECT * FROM [admin].[vwUserNotifications] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('User Notifications', userPayload, EntityPermissionType.Read, 'AND');
|
|
12905
|
+
const result = this.MapFieldNamesToCodeNames('User Notifications', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
12906
|
+
return result;
|
|
12813
12907
|
}
|
|
12814
12908
|
|
|
12815
12909
|
@Mutation(() => UserNotification_)
|
|
@@ -12819,7 +12913,7 @@ export class UserNotificationResolver extends ResolverBase {
|
|
|
12819
12913
|
@PubSub() pubSub: PubSubEngine
|
|
12820
12914
|
) {
|
|
12821
12915
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
12822
|
-
const entityObject = await new Metadata().GetEntityObject('User Notifications', this.GetUserFromPayload(userPayload));
|
|
12916
|
+
const entityObject = <UserNotificationEntity>await new Metadata().GetEntityObject('User Notifications', this.GetUserFromPayload(userPayload));
|
|
12823
12917
|
await entityObject.NewRecord();
|
|
12824
12918
|
entityObject.SetMany(input);
|
|
12825
12919
|
if (await entityObject.Save()) {
|
|
@@ -12837,11 +12931,9 @@ export class UserNotificationResolver extends ResolverBase {
|
|
|
12837
12931
|
|
|
12838
12932
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
12839
12933
|
protected async BeforeCreate(dataSource: DataSource, input: CreateUserNotificationInput): Promise<boolean> {
|
|
12840
|
-
const i = input, d = dataSource; // prevent error
|
|
12841
12934
|
return true;
|
|
12842
12935
|
}
|
|
12843
12936
|
protected async AfterCreate(dataSource: DataSource, input: CreateUserNotificationInput) {
|
|
12844
|
-
const i = input, d = dataSource; // prevent error
|
|
12845
12937
|
}
|
|
12846
12938
|
|
|
12847
12939
|
@Mutation(() => UserNotification_)
|
|
@@ -12851,7 +12943,7 @@ export class UserNotificationResolver extends ResolverBase {
|
|
|
12851
12943
|
@PubSub() pubSub: PubSubEngine
|
|
12852
12944
|
) {
|
|
12853
12945
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
12854
|
-
const entityObject = await new Metadata().GetEntityObject('User Notifications', this.GetUserFromPayload(userPayload));
|
|
12946
|
+
const entityObject = <UserNotificationEntity>await new Metadata().GetEntityObject('User Notifications', this.GetUserFromPayload(userPayload));
|
|
12855
12947
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for User Notifications
|
|
12856
12948
|
|
|
12857
12949
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -13013,19 +13105,20 @@ export class ResourceFolderResolver extends ResolverBase {
|
|
|
13013
13105
|
input.EntityName = 'Resource Folders';
|
|
13014
13106
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
13015
13107
|
}
|
|
13016
|
-
|
|
13017
13108
|
@Query(() => ResourceFolder_, { nullable: true })
|
|
13018
13109
|
async ResourceFolder(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<ResourceFolder_ | null> {
|
|
13019
13110
|
this.CheckUserReadPermissions('Resource Folders', userPayload);
|
|
13020
|
-
const sSQL = `SELECT * FROM [admin].vwResourceFolders WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
|
|
13021
|
-
|
|
13111
|
+
const sSQL = `SELECT * FROM [admin].[vwResourceFolders] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
|
|
13112
|
+
const result = this.MapFieldNamesToCodeNames('Resource Folders', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
13113
|
+
return result;
|
|
13022
13114
|
}
|
|
13023
13115
|
|
|
13024
13116
|
@FieldResolver(() => [ResourceFolder_])
|
|
13025
13117
|
async ResourceFoldersArray(@Root() resourcefolder_: ResourceFolder_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
13026
13118
|
this.CheckUserReadPermissions('Resource Folders', userPayload);
|
|
13027
|
-
const sSQL = `SELECT * FROM [admin].[vwResourceFolders] WHERE ParentID=${resourcefolder_.ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
|
|
13028
|
-
|
|
13119
|
+
const sSQL = `SELECT * FROM [admin].[vwResourceFolders] WHERE [ParentID]=${resourcefolder_.ID} ` + this.getRowLevelSecurityWhereClause('Resource Folders', userPayload, EntityPermissionType.Read, 'AND');
|
|
13120
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Resource Folders', await dataSource.query(sSQL));
|
|
13121
|
+
return result;
|
|
13029
13122
|
}
|
|
13030
13123
|
|
|
13031
13124
|
@Mutation(() => ResourceFolder_)
|
|
@@ -13035,7 +13128,7 @@ export class ResourceFolderResolver extends ResolverBase {
|
|
|
13035
13128
|
@PubSub() pubSub: PubSubEngine
|
|
13036
13129
|
) {
|
|
13037
13130
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
13038
|
-
const entityObject = await new Metadata().GetEntityObject('Resource Folders', this.GetUserFromPayload(userPayload));
|
|
13131
|
+
const entityObject = <ResourceFolderEntity>await new Metadata().GetEntityObject('Resource Folders', this.GetUserFromPayload(userPayload));
|
|
13039
13132
|
await entityObject.NewRecord();
|
|
13040
13133
|
entityObject.SetMany(input);
|
|
13041
13134
|
if (await entityObject.Save()) {
|
|
@@ -13053,11 +13146,9 @@ export class ResourceFolderResolver extends ResolverBase {
|
|
|
13053
13146
|
|
|
13054
13147
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
13055
13148
|
protected async BeforeCreate(dataSource: DataSource, input: CreateResourceFolderInput): Promise<boolean> {
|
|
13056
|
-
const i = input, d = dataSource; // prevent error
|
|
13057
13149
|
return true;
|
|
13058
13150
|
}
|
|
13059
13151
|
protected async AfterCreate(dataSource: DataSource, input: CreateResourceFolderInput) {
|
|
13060
|
-
const i = input, d = dataSource; // prevent error
|
|
13061
13152
|
}
|
|
13062
13153
|
|
|
13063
13154
|
@Mutation(() => ResourceFolder_)
|
|
@@ -13067,7 +13158,7 @@ export class ResourceFolderResolver extends ResolverBase {
|
|
|
13067
13158
|
@PubSub() pubSub: PubSubEngine
|
|
13068
13159
|
) {
|
|
13069
13160
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
13070
|
-
const entityObject = await new Metadata().GetEntityObject('Resource Folders', this.GetUserFromPayload(userPayload));
|
|
13161
|
+
const entityObject = <ResourceFolderEntity>await new Metadata().GetEntityObject('Resource Folders', this.GetUserFromPayload(userPayload));
|
|
13071
13162
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Resource Folders
|
|
13072
13163
|
|
|
13073
13164
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -13208,12 +13299,12 @@ export class SchemaInfoResolver extends ResolverBase {
|
|
|
13208
13299
|
input.EntityName = 'Schema Info';
|
|
13209
13300
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
13210
13301
|
}
|
|
13211
|
-
|
|
13212
13302
|
@Query(() => SchemaInfo_, { nullable: true })
|
|
13213
13303
|
async SchemaInfo(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<SchemaInfo_ | null> {
|
|
13214
13304
|
this.CheckUserReadPermissions('Schema Info', userPayload);
|
|
13215
|
-
const sSQL = `SELECT * FROM [admin].vwSchemaInfos WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Schema Info', userPayload, EntityPermissionType.Read, 'AND');
|
|
13216
|
-
|
|
13305
|
+
const sSQL = `SELECT * FROM [admin].[vwSchemaInfos] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Schema Info', userPayload, EntityPermissionType.Read, 'AND');
|
|
13306
|
+
const result = this.MapFieldNamesToCodeNames('Schema Info', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
13307
|
+
return result;
|
|
13217
13308
|
}
|
|
13218
13309
|
|
|
13219
13310
|
@Mutation(() => SchemaInfo_)
|
|
@@ -13223,7 +13314,7 @@ export class SchemaInfoResolver extends ResolverBase {
|
|
|
13223
13314
|
@PubSub() pubSub: PubSubEngine
|
|
13224
13315
|
) {
|
|
13225
13316
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
13226
|
-
const entityObject = await new Metadata().GetEntityObject('Schema Info', this.GetUserFromPayload(userPayload));
|
|
13317
|
+
const entityObject = <SchemaInfoEntity>await new Metadata().GetEntityObject('Schema Info', this.GetUserFromPayload(userPayload));
|
|
13227
13318
|
await entityObject.NewRecord();
|
|
13228
13319
|
entityObject.SetMany(input);
|
|
13229
13320
|
if (await entityObject.Save()) {
|
|
@@ -13241,11 +13332,9 @@ export class SchemaInfoResolver extends ResolverBase {
|
|
|
13241
13332
|
|
|
13242
13333
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
13243
13334
|
protected async BeforeCreate(dataSource: DataSource, input: CreateSchemaInfoInput): Promise<boolean> {
|
|
13244
|
-
const i = input, d = dataSource; // prevent error
|
|
13245
13335
|
return true;
|
|
13246
13336
|
}
|
|
13247
13337
|
protected async AfterCreate(dataSource: DataSource, input: CreateSchemaInfoInput) {
|
|
13248
|
-
const i = input, d = dataSource; // prevent error
|
|
13249
13338
|
}
|
|
13250
13339
|
|
|
13251
13340
|
@Mutation(() => SchemaInfo_)
|
|
@@ -13255,7 +13344,7 @@ export class SchemaInfoResolver extends ResolverBase {
|
|
|
13255
13344
|
@PubSub() pubSub: PubSubEngine
|
|
13256
13345
|
) {
|
|
13257
13346
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
13258
|
-
const entityObject = await new Metadata().GetEntityObject('Schema Info', this.GetUserFromPayload(userPayload));
|
|
13347
|
+
const entityObject = <SchemaInfoEntity>await new Metadata().GetEntityObject('Schema Info', this.GetUserFromPayload(userPayload));
|
|
13259
13348
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Schema Info
|
|
13260
13349
|
|
|
13261
13350
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -13401,12 +13490,12 @@ export class CompanyIntegrationRecordMapResolver extends ResolverBase {
|
|
|
13401
13490
|
input.EntityName = 'Company Integration Record Maps';
|
|
13402
13491
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
13403
13492
|
}
|
|
13404
|
-
|
|
13405
13493
|
@Query(() => CompanyIntegrationRecordMap_, { nullable: true })
|
|
13406
13494
|
async CompanyIntegrationRecordMap(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<CompanyIntegrationRecordMap_ | null> {
|
|
13407
13495
|
this.CheckUserReadPermissions('Company Integration Record Maps', userPayload);
|
|
13408
|
-
const sSQL = `SELECT * FROM [admin].vwCompanyIntegrationRecordMaps WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Record Maps', userPayload, EntityPermissionType.Read, 'AND');
|
|
13409
|
-
|
|
13496
|
+
const sSQL = `SELECT * FROM [admin].[vwCompanyIntegrationRecordMaps] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Company Integration Record Maps', userPayload, EntityPermissionType.Read, 'AND');
|
|
13497
|
+
const result = this.MapFieldNamesToCodeNames('Company Integration Record Maps', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
13498
|
+
return result;
|
|
13410
13499
|
}
|
|
13411
13500
|
|
|
13412
13501
|
@Mutation(() => CompanyIntegrationRecordMap_)
|
|
@@ -13416,7 +13505,7 @@ export class CompanyIntegrationRecordMapResolver extends ResolverBase {
|
|
|
13416
13505
|
@PubSub() pubSub: PubSubEngine
|
|
13417
13506
|
) {
|
|
13418
13507
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
13419
|
-
const entityObject = await new Metadata().GetEntityObject('Company Integration Record Maps', this.GetUserFromPayload(userPayload));
|
|
13508
|
+
const entityObject = <CompanyIntegrationRecordMapEntity>await new Metadata().GetEntityObject('Company Integration Record Maps', this.GetUserFromPayload(userPayload));
|
|
13420
13509
|
await entityObject.NewRecord();
|
|
13421
13510
|
entityObject.SetMany(input);
|
|
13422
13511
|
if (await entityObject.Save()) {
|
|
@@ -13434,11 +13523,9 @@ export class CompanyIntegrationRecordMapResolver extends ResolverBase {
|
|
|
13434
13523
|
|
|
13435
13524
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
13436
13525
|
protected async BeforeCreate(dataSource: DataSource, input: CreateCompanyIntegrationRecordMapInput): Promise<boolean> {
|
|
13437
|
-
const i = input, d = dataSource; // prevent error
|
|
13438
13526
|
return true;
|
|
13439
13527
|
}
|
|
13440
13528
|
protected async AfterCreate(dataSource: DataSource, input: CreateCompanyIntegrationRecordMapInput) {
|
|
13441
|
-
const i = input, d = dataSource; // prevent error
|
|
13442
13529
|
}
|
|
13443
13530
|
|
|
13444
13531
|
@Mutation(() => CompanyIntegrationRecordMap_)
|
|
@@ -13448,7 +13535,7 @@ export class CompanyIntegrationRecordMapResolver extends ResolverBase {
|
|
|
13448
13535
|
@PubSub() pubSub: PubSubEngine
|
|
13449
13536
|
) {
|
|
13450
13537
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
13451
|
-
const entityObject = await new Metadata().GetEntityObject('Company Integration Record Maps', this.GetUserFromPayload(userPayload));
|
|
13538
|
+
const entityObject = <CompanyIntegrationRecordMapEntity>await new Metadata().GetEntityObject('Company Integration Record Maps', this.GetUserFromPayload(userPayload));
|
|
13452
13539
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Company Integration Record Maps
|
|
13453
13540
|
|
|
13454
13541
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -13658,19 +13745,20 @@ export class RecordMergeLogResolver extends ResolverBase {
|
|
|
13658
13745
|
input.EntityName = 'Record Merge Logs';
|
|
13659
13746
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
13660
13747
|
}
|
|
13661
|
-
|
|
13662
13748
|
@Query(() => RecordMergeLog_, { nullable: true })
|
|
13663
13749
|
async RecordMergeLog(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<RecordMergeLog_ | null> {
|
|
13664
13750
|
this.CheckUserReadPermissions('Record Merge Logs', userPayload);
|
|
13665
|
-
const sSQL = `SELECT * FROM [admin].vwRecordMergeLogs WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Record Merge Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
13666
|
-
|
|
13751
|
+
const sSQL = `SELECT * FROM [admin].[vwRecordMergeLogs] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Record Merge Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
13752
|
+
const result = this.MapFieldNamesToCodeNames('Record Merge Logs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
13753
|
+
return result;
|
|
13667
13754
|
}
|
|
13668
13755
|
|
|
13669
13756
|
@FieldResolver(() => [RecordMergeDeletionLog_])
|
|
13670
13757
|
async RecordMergeDeletionLogsArray(@Root() recordmergelog_: RecordMergeLog_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
13671
13758
|
this.CheckUserReadPermissions('Record Merge Deletion Logs', userPayload);
|
|
13672
|
-
const sSQL = `SELECT * FROM [admin].[vwRecordMergeDeletionLogs] WHERE RecordMergeLogID=${recordmergelog_.ID} ` + this.getRowLevelSecurityWhereClause('Record Merge Deletion Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
13673
|
-
|
|
13759
|
+
const sSQL = `SELECT * FROM [admin].[vwRecordMergeDeletionLogs] WHERE [RecordMergeLogID]=${recordmergelog_.ID} ` + this.getRowLevelSecurityWhereClause('Record Merge Deletion Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
13760
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Record Merge Deletion Logs', await dataSource.query(sSQL));
|
|
13761
|
+
return result;
|
|
13674
13762
|
}
|
|
13675
13763
|
|
|
13676
13764
|
@Mutation(() => RecordMergeLog_)
|
|
@@ -13680,7 +13768,7 @@ export class RecordMergeLogResolver extends ResolverBase {
|
|
|
13680
13768
|
@PubSub() pubSub: PubSubEngine
|
|
13681
13769
|
) {
|
|
13682
13770
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
13683
|
-
const entityObject = await new Metadata().GetEntityObject('Record Merge Logs', this.GetUserFromPayload(userPayload));
|
|
13771
|
+
const entityObject = <RecordMergeLogEntity>await new Metadata().GetEntityObject('Record Merge Logs', this.GetUserFromPayload(userPayload));
|
|
13684
13772
|
await entityObject.NewRecord();
|
|
13685
13773
|
entityObject.SetMany(input);
|
|
13686
13774
|
if (await entityObject.Save()) {
|
|
@@ -13698,11 +13786,9 @@ export class RecordMergeLogResolver extends ResolverBase {
|
|
|
13698
13786
|
|
|
13699
13787
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
13700
13788
|
protected async BeforeCreate(dataSource: DataSource, input: CreateRecordMergeLogInput): Promise<boolean> {
|
|
13701
|
-
const i = input, d = dataSource; // prevent error
|
|
13702
13789
|
return true;
|
|
13703
13790
|
}
|
|
13704
13791
|
protected async AfterCreate(dataSource: DataSource, input: CreateRecordMergeLogInput) {
|
|
13705
|
-
const i = input, d = dataSource; // prevent error
|
|
13706
13792
|
}
|
|
13707
13793
|
|
|
13708
13794
|
@Mutation(() => RecordMergeLog_)
|
|
@@ -13712,7 +13798,7 @@ export class RecordMergeLogResolver extends ResolverBase {
|
|
|
13712
13798
|
@PubSub() pubSub: PubSubEngine
|
|
13713
13799
|
) {
|
|
13714
13800
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
13715
|
-
const entityObject = await new Metadata().GetEntityObject('Record Merge Logs', this.GetUserFromPayload(userPayload));
|
|
13801
|
+
const entityObject = <RecordMergeLogEntity>await new Metadata().GetEntityObject('Record Merge Logs', this.GetUserFromPayload(userPayload));
|
|
13716
13802
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Record Merge Logs
|
|
13717
13803
|
|
|
13718
13804
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
@@ -13854,12 +13940,12 @@ export class RecordMergeDeletionLogResolver extends ResolverBase {
|
|
|
13854
13940
|
input.EntityName = 'Record Merge Deletion Logs';
|
|
13855
13941
|
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
13856
13942
|
}
|
|
13857
|
-
|
|
13858
13943
|
@Query(() => RecordMergeDeletionLog_, { nullable: true })
|
|
13859
13944
|
async RecordMergeDeletionLog(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<RecordMergeDeletionLog_ | null> {
|
|
13860
13945
|
this.CheckUserReadPermissions('Record Merge Deletion Logs', userPayload);
|
|
13861
|
-
const sSQL = `SELECT * FROM [admin].vwRecordMergeDeletionLogs WHERE ID=${ID} ` + this.getRowLevelSecurityWhereClause('Record Merge Deletion Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
13862
|
-
|
|
13946
|
+
const sSQL = `SELECT * FROM [admin].[vwRecordMergeDeletionLogs] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Record Merge Deletion Logs', userPayload, EntityPermissionType.Read, 'AND');
|
|
13947
|
+
const result = this.MapFieldNamesToCodeNames('Record Merge Deletion Logs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
13948
|
+
return result;
|
|
13863
13949
|
}
|
|
13864
13950
|
|
|
13865
13951
|
@Mutation(() => RecordMergeDeletionLog_)
|
|
@@ -13869,7 +13955,7 @@ export class RecordMergeDeletionLogResolver extends ResolverBase {
|
|
|
13869
13955
|
@PubSub() pubSub: PubSubEngine
|
|
13870
13956
|
) {
|
|
13871
13957
|
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
13872
|
-
const entityObject = await new Metadata().GetEntityObject('Record Merge Deletion Logs', this.GetUserFromPayload(userPayload));
|
|
13958
|
+
const entityObject = <RecordMergeDeletionLogEntity>await new Metadata().GetEntityObject('Record Merge Deletion Logs', this.GetUserFromPayload(userPayload));
|
|
13873
13959
|
await entityObject.NewRecord();
|
|
13874
13960
|
entityObject.SetMany(input);
|
|
13875
13961
|
if (await entityObject.Save()) {
|
|
@@ -13887,11 +13973,9 @@ export class RecordMergeDeletionLogResolver extends ResolverBase {
|
|
|
13887
13973
|
|
|
13888
13974
|
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
13889
13975
|
protected async BeforeCreate(dataSource: DataSource, input: CreateRecordMergeDeletionLogInput): Promise<boolean> {
|
|
13890
|
-
const i = input, d = dataSource; // prevent error
|
|
13891
13976
|
return true;
|
|
13892
13977
|
}
|
|
13893
13978
|
protected async AfterCreate(dataSource: DataSource, input: CreateRecordMergeDeletionLogInput) {
|
|
13894
|
-
const i = input, d = dataSource; // prevent error
|
|
13895
13979
|
}
|
|
13896
13980
|
|
|
13897
13981
|
@Mutation(() => RecordMergeDeletionLog_)
|
|
@@ -13901,7 +13985,7 @@ export class RecordMergeDeletionLogResolver extends ResolverBase {
|
|
|
13901
13985
|
@PubSub() pubSub: PubSubEngine
|
|
13902
13986
|
) {
|
|
13903
13987
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
13904
|
-
const entityObject = await new Metadata().GetEntityObject('Record Merge Deletion Logs', this.GetUserFromPayload(userPayload));
|
|
13988
|
+
const entityObject = <RecordMergeDeletionLogEntity>await new Metadata().GetEntityObject('Record Merge Deletion Logs', this.GetUserFromPayload(userPayload));
|
|
13905
13989
|
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Record Merge Deletion Logs
|
|
13906
13990
|
|
|
13907
13991
|
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|