@memberjunction/server 0.9.142 → 0.9.151
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 +21 -0
- package/dist/generated/generated.js +1616 -1
- package/dist/generated/generated.js.map +1 -1
- package/dist/resolvers/AskSkipResolver.js +145 -154
- package/dist/resolvers/AskSkipResolver.js.map +1 -1
- package/package.json +9 -8
- package/src/generated/generated.ts +1251 -2
- package/src/resolvers/AskSkipResolver.ts +184 -172
- package/tsconfig.json +2 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ALL ENTITIES - TypeGraphQL Type Class Definition - AUTO GENERATED FILE
|
|
3
3
|
* Generated Entities and Resolvers for Server
|
|
4
4
|
*
|
|
5
|
-
* GENERATED: 2/
|
|
5
|
+
* GENERATED: 2/10/2024, 9:49:33 AM
|
|
6
6
|
*
|
|
7
7
|
* >>> DO NOT MODIFY THIS FILE!!!!!!!!!!!!
|
|
8
8
|
* >>> YOUR CHANGES WILL BE OVERWRITTEN
|
|
@@ -17,7 +17,7 @@ import { AppContext } from '@memberjunction/server';
|
|
|
17
17
|
import { MaxLength } from 'class-validator';
|
|
18
18
|
import { DataSource } from 'typeorm';
|
|
19
19
|
|
|
20
|
-
import { CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, ResourceFolderEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity } from '@memberjunction/core-entities';
|
|
20
|
+
import { CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, ResourceFolderEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity } from '@memberjunction/core-entities';
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
//****************************************************************************
|
|
@@ -2855,6 +2855,12 @@ export class Entity_ {
|
|
|
2855
2855
|
@Field(() => [QueryField_])
|
|
2856
2856
|
QueryFieldsArray: QueryField_[]; // Link to QueryFields
|
|
2857
2857
|
|
|
2858
|
+
@Field(() => [Conversation_])
|
|
2859
|
+
ConversationsArray: Conversation_[]; // Link to Conversations
|
|
2860
|
+
|
|
2861
|
+
@Field(() => [EntityDocument_])
|
|
2862
|
+
EntityDocumentsArray: EntityDocument_[]; // Link to EntityDocuments
|
|
2863
|
+
|
|
2858
2864
|
}
|
|
2859
2865
|
|
|
2860
2866
|
//****************************************************************************
|
|
@@ -3313,6 +3319,22 @@ export class EntityResolverBase extends ResolverBase {
|
|
|
3313
3319
|
const result = this.ArrayMapFieldNamesToCodeNames('Query Fields', await dataSource.query(sSQL));
|
|
3314
3320
|
return result;
|
|
3315
3321
|
}
|
|
3322
|
+
|
|
3323
|
+
@FieldResolver(() => [Conversation_])
|
|
3324
|
+
async ConversationsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3325
|
+
this.CheckUserReadPermissions('Conversations', userPayload);
|
|
3326
|
+
const sSQL = `SELECT * FROM [admin].[vwConversations] WHERE [LinkedEntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Conversations', userPayload, EntityPermissionType.Read, 'AND');
|
|
3327
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Conversations', await dataSource.query(sSQL));
|
|
3328
|
+
return result;
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
@FieldResolver(() => [EntityDocument_])
|
|
3332
|
+
async EntityDocumentsArray(@Root() entity_: Entity_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
3333
|
+
this.CheckUserReadPermissions('Entity Documents', userPayload);
|
|
3334
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityDocuments] WHERE [EntityID]=${entity_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Documents', userPayload, EntityPermissionType.Read, 'AND');
|
|
3335
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Documents', await dataSource.query(sSQL));
|
|
3336
|
+
return result;
|
|
3337
|
+
}
|
|
3316
3338
|
|
|
3317
3339
|
@Mutation(() => Entity_)
|
|
3318
3340
|
async CreateEntity(
|
|
@@ -8893,6 +8915,9 @@ export class AIModel_ {
|
|
|
8893
8915
|
@Field(() => [EntityAIAction_])
|
|
8894
8916
|
EntityAIActionsArray: EntityAIAction_[]; // Link to EntityAIActions
|
|
8895
8917
|
|
|
8918
|
+
@Field(() => [VectorIndex_])
|
|
8919
|
+
VectorIndexesArray: VectorIndex_[]; // Link to VectorIndexes
|
|
8920
|
+
|
|
8896
8921
|
}
|
|
8897
8922
|
|
|
8898
8923
|
//****************************************************************************
|
|
@@ -9008,6 +9033,14 @@ export class AIModelResolver extends ResolverBase {
|
|
|
9008
9033
|
const result = this.ArrayMapFieldNamesToCodeNames('Entity AI Actions', await dataSource.query(sSQL));
|
|
9009
9034
|
return result;
|
|
9010
9035
|
}
|
|
9036
|
+
|
|
9037
|
+
@FieldResolver(() => [VectorIndex_])
|
|
9038
|
+
async VectorIndexesArray(@Root() aimodel_: AIModel_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
9039
|
+
this.CheckUserReadPermissions('Vector Indexes', userPayload);
|
|
9040
|
+
const sSQL = `SELECT * FROM [admin].[vwVectorIndexes] WHERE [EmbeddingModelID]=${aimodel_.ID} ` + this.getRowLevelSecurityWhereClause('Vector Indexes', userPayload, EntityPermissionType.Read, 'AND');
|
|
9041
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Vector Indexes', await dataSource.query(sSQL));
|
|
9042
|
+
return result;
|
|
9043
|
+
}
|
|
9011
9044
|
|
|
9012
9045
|
@Mutation(() => AIModel_)
|
|
9013
9046
|
async UpdateAIModel(
|
|
@@ -12569,6 +12602,12 @@ export class Conversation_ {
|
|
|
12569
12602
|
@MaxLength(100)
|
|
12570
12603
|
Type: string;
|
|
12571
12604
|
|
|
12605
|
+
@Field(() => Int, {nullable: true})
|
|
12606
|
+
LinkedEntityID?: number;
|
|
12607
|
+
|
|
12608
|
+
@Field(() => Int, {nullable: true})
|
|
12609
|
+
LinkedRecordID?: number;
|
|
12610
|
+
|
|
12572
12611
|
@Field()
|
|
12573
12612
|
@MaxLength(8)
|
|
12574
12613
|
CreatedAt: Date;
|
|
@@ -12580,6 +12619,10 @@ export class Conversation_ {
|
|
|
12580
12619
|
@Field()
|
|
12581
12620
|
@MaxLength(200)
|
|
12582
12621
|
User: string;
|
|
12622
|
+
|
|
12623
|
+
@Field({nullable: true})
|
|
12624
|
+
@MaxLength(510)
|
|
12625
|
+
LinkedEntity?: string;
|
|
12583
12626
|
|
|
12584
12627
|
@Field(() => [ConversationDetail_])
|
|
12585
12628
|
ConversationDetailsArray: ConversationDetail_[]; // Link to ConversationDetails
|
|
@@ -12608,6 +12651,12 @@ export class CreateConversationInput {
|
|
|
12608
12651
|
|
|
12609
12652
|
@Field()
|
|
12610
12653
|
Type: string;
|
|
12654
|
+
|
|
12655
|
+
@Field(() => Int, { nullable: true })
|
|
12656
|
+
LinkedEntityID: number;
|
|
12657
|
+
|
|
12658
|
+
@Field(() => Int, { nullable: true })
|
|
12659
|
+
LinkedRecordID: number;
|
|
12611
12660
|
}
|
|
12612
12661
|
|
|
12613
12662
|
|
|
@@ -12633,6 +12682,12 @@ export class UpdateConversationInput {
|
|
|
12633
12682
|
|
|
12634
12683
|
@Field()
|
|
12635
12684
|
Type: string;
|
|
12685
|
+
|
|
12686
|
+
@Field(() => Int, { nullable: true })
|
|
12687
|
+
LinkedEntityID: number;
|
|
12688
|
+
|
|
12689
|
+
@Field(() => Int, { nullable: true })
|
|
12690
|
+
LinkedRecordID: number;
|
|
12636
12691
|
}
|
|
12637
12692
|
|
|
12638
12693
|
//****************************************************************************
|
|
@@ -14928,4 +14983,1198 @@ export class QueryPermissionResolver extends ResolverBase {
|
|
|
14928
14983
|
const i = input, d = dataSource; // prevent error
|
|
14929
14984
|
}
|
|
14930
14985
|
|
|
14986
|
+
}
|
|
14987
|
+
|
|
14988
|
+
//****************************************************************************
|
|
14989
|
+
// ENTITY CLASS for Vector Indexes
|
|
14990
|
+
//****************************************************************************
|
|
14991
|
+
@ObjectType()
|
|
14992
|
+
export class VectorIndex_ {
|
|
14993
|
+
@Field(() => Int)
|
|
14994
|
+
ID: number;
|
|
14995
|
+
|
|
14996
|
+
@Field()
|
|
14997
|
+
@MaxLength(510)
|
|
14998
|
+
Name: string;
|
|
14999
|
+
|
|
15000
|
+
@Field({nullable: true})
|
|
15001
|
+
Description?: string;
|
|
15002
|
+
|
|
15003
|
+
@Field(() => Int)
|
|
15004
|
+
VectorDatabaseID: number;
|
|
15005
|
+
|
|
15006
|
+
@Field(() => Int)
|
|
15007
|
+
EmbeddingModelID: number;
|
|
15008
|
+
|
|
15009
|
+
@Field()
|
|
15010
|
+
@MaxLength(8)
|
|
15011
|
+
CreatedAt: Date;
|
|
15012
|
+
|
|
15013
|
+
@Field()
|
|
15014
|
+
@MaxLength(8)
|
|
15015
|
+
UpdatedAt: Date;
|
|
15016
|
+
|
|
15017
|
+
@Field()
|
|
15018
|
+
@MaxLength(200)
|
|
15019
|
+
VectorDatabase: string;
|
|
15020
|
+
|
|
15021
|
+
@Field()
|
|
15022
|
+
@MaxLength(100)
|
|
15023
|
+
EmbeddingModel: string;
|
|
15024
|
+
|
|
15025
|
+
}
|
|
15026
|
+
|
|
15027
|
+
//****************************************************************************
|
|
15028
|
+
// INPUT TYPE for Vector Indexes
|
|
15029
|
+
//****************************************************************************
|
|
15030
|
+
@InputType()
|
|
15031
|
+
export class CreateVectorIndexInput {
|
|
15032
|
+
@Field()
|
|
15033
|
+
Name: string;
|
|
15034
|
+
|
|
15035
|
+
@Field({ nullable: true })
|
|
15036
|
+
Description: string;
|
|
15037
|
+
|
|
15038
|
+
@Field(() => Int, )
|
|
15039
|
+
VectorDatabaseID: number;
|
|
15040
|
+
|
|
15041
|
+
@Field(() => Int, )
|
|
15042
|
+
EmbeddingModelID: number;
|
|
15043
|
+
}
|
|
15044
|
+
|
|
15045
|
+
|
|
15046
|
+
//****************************************************************************
|
|
15047
|
+
// INPUT TYPE for Vector Indexes
|
|
15048
|
+
//****************************************************************************
|
|
15049
|
+
@InputType()
|
|
15050
|
+
export class UpdateVectorIndexInput {
|
|
15051
|
+
@Field(() => Int, )
|
|
15052
|
+
ID: number;
|
|
15053
|
+
|
|
15054
|
+
@Field()
|
|
15055
|
+
Name: string;
|
|
15056
|
+
|
|
15057
|
+
@Field({ nullable: true })
|
|
15058
|
+
Description: string;
|
|
15059
|
+
|
|
15060
|
+
@Field(() => Int, )
|
|
15061
|
+
VectorDatabaseID: number;
|
|
15062
|
+
|
|
15063
|
+
@Field(() => Int, )
|
|
15064
|
+
EmbeddingModelID: number;
|
|
15065
|
+
}
|
|
15066
|
+
|
|
15067
|
+
//****************************************************************************
|
|
15068
|
+
// RESOLVER for Vector Indexes
|
|
15069
|
+
//****************************************************************************
|
|
15070
|
+
@ObjectType()
|
|
15071
|
+
export class RunVectorIndexViewResult {
|
|
15072
|
+
@Field(() => [VectorIndex_])
|
|
15073
|
+
Results: VectorIndex_[];
|
|
15074
|
+
|
|
15075
|
+
@Field(() => Int, {nullable: true})
|
|
15076
|
+
UserViewRunID?: number;
|
|
15077
|
+
|
|
15078
|
+
@Field(() => Int, {nullable: true})
|
|
15079
|
+
RowCount: number;
|
|
15080
|
+
|
|
15081
|
+
@Field(() => Int, {nullable: true})
|
|
15082
|
+
TotalRowCount: number;
|
|
15083
|
+
|
|
15084
|
+
@Field(() => Int, {nullable: true})
|
|
15085
|
+
ExecutionTime: number;
|
|
15086
|
+
|
|
15087
|
+
@Field({nullable: true})
|
|
15088
|
+
ErrorMessage?: string;
|
|
15089
|
+
|
|
15090
|
+
@Field(() => Boolean, {nullable: false})
|
|
15091
|
+
Success: boolean;
|
|
15092
|
+
}
|
|
15093
|
+
|
|
15094
|
+
@Resolver(VectorIndex_)
|
|
15095
|
+
export class VectorIndexResolver extends ResolverBase {
|
|
15096
|
+
@Query(() => RunVectorIndexViewResult)
|
|
15097
|
+
async RunVectorIndexViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15098
|
+
return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
|
|
15099
|
+
}
|
|
15100
|
+
|
|
15101
|
+
@Query(() => RunVectorIndexViewResult)
|
|
15102
|
+
async RunVectorIndexViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15103
|
+
return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
|
|
15104
|
+
}
|
|
15105
|
+
|
|
15106
|
+
@Query(() => RunVectorIndexViewResult)
|
|
15107
|
+
async RunVectorIndexDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15108
|
+
input.EntityName = 'Vector Indexes';
|
|
15109
|
+
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
15110
|
+
}
|
|
15111
|
+
@Query(() => VectorIndex_, { nullable: true })
|
|
15112
|
+
async VectorIndex(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<VectorIndex_ | null> {
|
|
15113
|
+
this.CheckUserReadPermissions('Vector Indexes', userPayload);
|
|
15114
|
+
const sSQL = `SELECT * FROM [admin].[vwVectorIndexes] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Vector Indexes', userPayload, EntityPermissionType.Read, 'AND');
|
|
15115
|
+
const result = this.MapFieldNamesToCodeNames('Vector Indexes', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
15116
|
+
return result;
|
|
15117
|
+
}
|
|
15118
|
+
|
|
15119
|
+
@Mutation(() => VectorIndex_)
|
|
15120
|
+
async CreateVectorIndex(
|
|
15121
|
+
@Arg('input', () => CreateVectorIndexInput) input: CreateVectorIndexInput,
|
|
15122
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
15123
|
+
@PubSub() pubSub: PubSubEngine
|
|
15124
|
+
) {
|
|
15125
|
+
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
15126
|
+
const entityObject = <VectorIndexEntity>await new Metadata().GetEntityObject('Vector Indexes', this.GetUserFromPayload(userPayload));
|
|
15127
|
+
await entityObject.NewRecord();
|
|
15128
|
+
entityObject.SetMany(input);
|
|
15129
|
+
if (await entityObject.Save()) {
|
|
15130
|
+
// save worked, fire the AfterCreate event and then return all the data
|
|
15131
|
+
await this.AfterCreate(dataSource, input); // fire event
|
|
15132
|
+
return entityObject.GetAll();
|
|
15133
|
+
}
|
|
15134
|
+
else
|
|
15135
|
+
// save failed, return null
|
|
15136
|
+
return null;
|
|
15137
|
+
}
|
|
15138
|
+
else
|
|
15139
|
+
return null;
|
|
15140
|
+
}
|
|
15141
|
+
|
|
15142
|
+
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
15143
|
+
protected async BeforeCreate(dataSource: DataSource, input: CreateVectorIndexInput): Promise<boolean> {
|
|
15144
|
+
return true;
|
|
15145
|
+
}
|
|
15146
|
+
protected async AfterCreate(dataSource: DataSource, input: CreateVectorIndexInput) {
|
|
15147
|
+
}
|
|
15148
|
+
|
|
15149
|
+
@Mutation(() => VectorIndex_)
|
|
15150
|
+
async UpdateVectorIndex(
|
|
15151
|
+
@Arg('input', () => UpdateVectorIndexInput) input: UpdateVectorIndexInput,
|
|
15152
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
15153
|
+
@PubSub() pubSub: PubSubEngine
|
|
15154
|
+
) {
|
|
15155
|
+
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
15156
|
+
const entityObject = <VectorIndexEntity>await new Metadata().GetEntityObject('Vector Indexes', this.GetUserFromPayload(userPayload));
|
|
15157
|
+
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Vector Indexes
|
|
15158
|
+
|
|
15159
|
+
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
15160
|
+
// save worked, fire afterevent and return all the data
|
|
15161
|
+
await this.AfterUpdate(dataSource, input); // fire event
|
|
15162
|
+
return entityObject.GetAll();
|
|
15163
|
+
}
|
|
15164
|
+
else
|
|
15165
|
+
return null; // save failed, return null
|
|
15166
|
+
}
|
|
15167
|
+
else
|
|
15168
|
+
return null;
|
|
15169
|
+
}
|
|
15170
|
+
|
|
15171
|
+
// Before/After UPDATE Event Hooks for Sub-Classes to Override
|
|
15172
|
+
protected async BeforeUpdate(dataSource: DataSource, input: UpdateVectorIndexInput): Promise<boolean> {
|
|
15173
|
+
const i = input, d = dataSource; // prevent error
|
|
15174
|
+
return true;
|
|
15175
|
+
}
|
|
15176
|
+
protected async AfterUpdate(dataSource: DataSource, input: UpdateVectorIndexInput) {
|
|
15177
|
+
const i = input, d = dataSource; // prevent error
|
|
15178
|
+
}
|
|
15179
|
+
|
|
15180
|
+
}
|
|
15181
|
+
|
|
15182
|
+
//****************************************************************************
|
|
15183
|
+
// ENTITY CLASS for Entity Document Types
|
|
15184
|
+
//****************************************************************************
|
|
15185
|
+
@ObjectType()
|
|
15186
|
+
export class EntityDocumentType_ {
|
|
15187
|
+
@Field(() => Int)
|
|
15188
|
+
ID: number;
|
|
15189
|
+
|
|
15190
|
+
@Field()
|
|
15191
|
+
@MaxLength(200)
|
|
15192
|
+
Name: string;
|
|
15193
|
+
|
|
15194
|
+
@Field({nullable: true})
|
|
15195
|
+
Description?: string;
|
|
15196
|
+
|
|
15197
|
+
@Field()
|
|
15198
|
+
@MaxLength(8)
|
|
15199
|
+
CreatedAt: Date;
|
|
15200
|
+
|
|
15201
|
+
@Field()
|
|
15202
|
+
@MaxLength(8)
|
|
15203
|
+
UpdatedAt: Date;
|
|
15204
|
+
|
|
15205
|
+
@Field(() => [EntityDocument_])
|
|
15206
|
+
EntityDocumentsArray: EntityDocument_[]; // Link to EntityDocuments
|
|
15207
|
+
|
|
15208
|
+
}
|
|
15209
|
+
|
|
15210
|
+
//****************************************************************************
|
|
15211
|
+
// INPUT TYPE for Entity Document Types
|
|
15212
|
+
//****************************************************************************
|
|
15213
|
+
@InputType()
|
|
15214
|
+
export class CreateEntityDocumentTypeInput {
|
|
15215
|
+
@Field()
|
|
15216
|
+
Name: string;
|
|
15217
|
+
|
|
15218
|
+
@Field({ nullable: true })
|
|
15219
|
+
Description: string;
|
|
15220
|
+
}
|
|
15221
|
+
|
|
15222
|
+
|
|
15223
|
+
//****************************************************************************
|
|
15224
|
+
// INPUT TYPE for Entity Document Types
|
|
15225
|
+
//****************************************************************************
|
|
15226
|
+
@InputType()
|
|
15227
|
+
export class UpdateEntityDocumentTypeInput {
|
|
15228
|
+
@Field(() => Int, )
|
|
15229
|
+
ID: number;
|
|
15230
|
+
|
|
15231
|
+
@Field()
|
|
15232
|
+
Name: string;
|
|
15233
|
+
|
|
15234
|
+
@Field({ nullable: true })
|
|
15235
|
+
Description: string;
|
|
15236
|
+
}
|
|
15237
|
+
|
|
15238
|
+
//****************************************************************************
|
|
15239
|
+
// RESOLVER for Entity Document Types
|
|
15240
|
+
//****************************************************************************
|
|
15241
|
+
@ObjectType()
|
|
15242
|
+
export class RunEntityDocumentTypeViewResult {
|
|
15243
|
+
@Field(() => [EntityDocumentType_])
|
|
15244
|
+
Results: EntityDocumentType_[];
|
|
15245
|
+
|
|
15246
|
+
@Field(() => Int, {nullable: true})
|
|
15247
|
+
UserViewRunID?: number;
|
|
15248
|
+
|
|
15249
|
+
@Field(() => Int, {nullable: true})
|
|
15250
|
+
RowCount: number;
|
|
15251
|
+
|
|
15252
|
+
@Field(() => Int, {nullable: true})
|
|
15253
|
+
TotalRowCount: number;
|
|
15254
|
+
|
|
15255
|
+
@Field(() => Int, {nullable: true})
|
|
15256
|
+
ExecutionTime: number;
|
|
15257
|
+
|
|
15258
|
+
@Field({nullable: true})
|
|
15259
|
+
ErrorMessage?: string;
|
|
15260
|
+
|
|
15261
|
+
@Field(() => Boolean, {nullable: false})
|
|
15262
|
+
Success: boolean;
|
|
15263
|
+
}
|
|
15264
|
+
|
|
15265
|
+
@Resolver(EntityDocumentType_)
|
|
15266
|
+
export class EntityDocumentTypeResolver extends ResolverBase {
|
|
15267
|
+
@Query(() => RunEntityDocumentTypeViewResult)
|
|
15268
|
+
async RunEntityDocumentTypeViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15269
|
+
return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
|
|
15270
|
+
}
|
|
15271
|
+
|
|
15272
|
+
@Query(() => RunEntityDocumentTypeViewResult)
|
|
15273
|
+
async RunEntityDocumentTypeViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15274
|
+
return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
|
|
15275
|
+
}
|
|
15276
|
+
|
|
15277
|
+
@Query(() => RunEntityDocumentTypeViewResult)
|
|
15278
|
+
async RunEntityDocumentTypeDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15279
|
+
input.EntityName = 'Entity Document Types';
|
|
15280
|
+
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
15281
|
+
}
|
|
15282
|
+
@Query(() => EntityDocumentType_, { nullable: true })
|
|
15283
|
+
async EntityDocumentType(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityDocumentType_ | null> {
|
|
15284
|
+
this.CheckUserReadPermissions('Entity Document Types', userPayload);
|
|
15285
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityDocumentTypes] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Document Types', userPayload, EntityPermissionType.Read, 'AND');
|
|
15286
|
+
const result = this.MapFieldNamesToCodeNames('Entity Document Types', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
15287
|
+
return result;
|
|
15288
|
+
}
|
|
15289
|
+
|
|
15290
|
+
@FieldResolver(() => [EntityDocument_])
|
|
15291
|
+
async EntityDocumentsArray(@Root() entitydocumenttype_: EntityDocumentType_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15292
|
+
this.CheckUserReadPermissions('Entity Documents', userPayload);
|
|
15293
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityDocuments] WHERE [TypeID]=${entitydocumenttype_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Documents', userPayload, EntityPermissionType.Read, 'AND');
|
|
15294
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Documents', await dataSource.query(sSQL));
|
|
15295
|
+
return result;
|
|
15296
|
+
}
|
|
15297
|
+
|
|
15298
|
+
@Mutation(() => EntityDocumentType_)
|
|
15299
|
+
async CreateEntityDocumentType(
|
|
15300
|
+
@Arg('input', () => CreateEntityDocumentTypeInput) input: CreateEntityDocumentTypeInput,
|
|
15301
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
15302
|
+
@PubSub() pubSub: PubSubEngine
|
|
15303
|
+
) {
|
|
15304
|
+
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
15305
|
+
const entityObject = <EntityDocumentTypeEntity>await new Metadata().GetEntityObject('Entity Document Types', this.GetUserFromPayload(userPayload));
|
|
15306
|
+
await entityObject.NewRecord();
|
|
15307
|
+
entityObject.SetMany(input);
|
|
15308
|
+
if (await entityObject.Save()) {
|
|
15309
|
+
// save worked, fire the AfterCreate event and then return all the data
|
|
15310
|
+
await this.AfterCreate(dataSource, input); // fire event
|
|
15311
|
+
return entityObject.GetAll();
|
|
15312
|
+
}
|
|
15313
|
+
else
|
|
15314
|
+
// save failed, return null
|
|
15315
|
+
return null;
|
|
15316
|
+
}
|
|
15317
|
+
else
|
|
15318
|
+
return null;
|
|
15319
|
+
}
|
|
15320
|
+
|
|
15321
|
+
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
15322
|
+
protected async BeforeCreate(dataSource: DataSource, input: CreateEntityDocumentTypeInput): Promise<boolean> {
|
|
15323
|
+
return true;
|
|
15324
|
+
}
|
|
15325
|
+
protected async AfterCreate(dataSource: DataSource, input: CreateEntityDocumentTypeInput) {
|
|
15326
|
+
}
|
|
15327
|
+
|
|
15328
|
+
@Mutation(() => EntityDocumentType_)
|
|
15329
|
+
async UpdateEntityDocumentType(
|
|
15330
|
+
@Arg('input', () => UpdateEntityDocumentTypeInput) input: UpdateEntityDocumentTypeInput,
|
|
15331
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
15332
|
+
@PubSub() pubSub: PubSubEngine
|
|
15333
|
+
) {
|
|
15334
|
+
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
15335
|
+
const entityObject = <EntityDocumentTypeEntity>await new Metadata().GetEntityObject('Entity Document Types', this.GetUserFromPayload(userPayload));
|
|
15336
|
+
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Entity Document Types
|
|
15337
|
+
|
|
15338
|
+
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
15339
|
+
// save worked, fire afterevent and return all the data
|
|
15340
|
+
await this.AfterUpdate(dataSource, input); // fire event
|
|
15341
|
+
return entityObject.GetAll();
|
|
15342
|
+
}
|
|
15343
|
+
else
|
|
15344
|
+
return null; // save failed, return null
|
|
15345
|
+
}
|
|
15346
|
+
else
|
|
15347
|
+
return null;
|
|
15348
|
+
}
|
|
15349
|
+
|
|
15350
|
+
// Before/After UPDATE Event Hooks for Sub-Classes to Override
|
|
15351
|
+
protected async BeforeUpdate(dataSource: DataSource, input: UpdateEntityDocumentTypeInput): Promise<boolean> {
|
|
15352
|
+
const i = input, d = dataSource; // prevent error
|
|
15353
|
+
return true;
|
|
15354
|
+
}
|
|
15355
|
+
protected async AfterUpdate(dataSource: DataSource, input: UpdateEntityDocumentTypeInput) {
|
|
15356
|
+
const i = input, d = dataSource; // prevent error
|
|
15357
|
+
}
|
|
15358
|
+
|
|
15359
|
+
}
|
|
15360
|
+
|
|
15361
|
+
//****************************************************************************
|
|
15362
|
+
// ENTITY CLASS for Entity Document Runs
|
|
15363
|
+
//****************************************************************************
|
|
15364
|
+
@ObjectType()
|
|
15365
|
+
export class EntityDocumentRun_ {
|
|
15366
|
+
@Field(() => Int)
|
|
15367
|
+
ID: number;
|
|
15368
|
+
|
|
15369
|
+
@Field(() => Int)
|
|
15370
|
+
EntityDocumentID: number;
|
|
15371
|
+
|
|
15372
|
+
@Field({nullable: true})
|
|
15373
|
+
@MaxLength(8)
|
|
15374
|
+
StartedAt?: Date;
|
|
15375
|
+
|
|
15376
|
+
@Field({nullable: true})
|
|
15377
|
+
@MaxLength(8)
|
|
15378
|
+
EndedAt?: Date;
|
|
15379
|
+
|
|
15380
|
+
@Field()
|
|
15381
|
+
@MaxLength(30)
|
|
15382
|
+
Status: string;
|
|
15383
|
+
|
|
15384
|
+
@Field()
|
|
15385
|
+
@MaxLength(8)
|
|
15386
|
+
CreatedAt: Date;
|
|
15387
|
+
|
|
15388
|
+
@Field()
|
|
15389
|
+
@MaxLength(8)
|
|
15390
|
+
UpdatedAt: Date;
|
|
15391
|
+
|
|
15392
|
+
@Field()
|
|
15393
|
+
@MaxLength(500)
|
|
15394
|
+
EntityDocument: string;
|
|
15395
|
+
|
|
15396
|
+
}
|
|
15397
|
+
|
|
15398
|
+
//****************************************************************************
|
|
15399
|
+
// INPUT TYPE for Entity Document Runs
|
|
15400
|
+
//****************************************************************************
|
|
15401
|
+
@InputType()
|
|
15402
|
+
export class CreateEntityDocumentRunInput {
|
|
15403
|
+
@Field(() => Int, )
|
|
15404
|
+
EntityDocumentID: number;
|
|
15405
|
+
|
|
15406
|
+
@Field({ nullable: true })
|
|
15407
|
+
StartedAt: Date;
|
|
15408
|
+
|
|
15409
|
+
@Field({ nullable: true })
|
|
15410
|
+
EndedAt: Date;
|
|
15411
|
+
|
|
15412
|
+
@Field()
|
|
15413
|
+
Status: string;
|
|
15414
|
+
}
|
|
15415
|
+
|
|
15416
|
+
|
|
15417
|
+
//****************************************************************************
|
|
15418
|
+
// INPUT TYPE for Entity Document Runs
|
|
15419
|
+
//****************************************************************************
|
|
15420
|
+
@InputType()
|
|
15421
|
+
export class UpdateEntityDocumentRunInput {
|
|
15422
|
+
@Field(() => Int, )
|
|
15423
|
+
ID: number;
|
|
15424
|
+
|
|
15425
|
+
@Field(() => Int, )
|
|
15426
|
+
EntityDocumentID: number;
|
|
15427
|
+
|
|
15428
|
+
@Field({ nullable: true })
|
|
15429
|
+
StartedAt: Date;
|
|
15430
|
+
|
|
15431
|
+
@Field({ nullable: true })
|
|
15432
|
+
EndedAt: Date;
|
|
15433
|
+
|
|
15434
|
+
@Field()
|
|
15435
|
+
Status: string;
|
|
15436
|
+
}
|
|
15437
|
+
|
|
15438
|
+
//****************************************************************************
|
|
15439
|
+
// RESOLVER for Entity Document Runs
|
|
15440
|
+
//****************************************************************************
|
|
15441
|
+
@ObjectType()
|
|
15442
|
+
export class RunEntityDocumentRunViewResult {
|
|
15443
|
+
@Field(() => [EntityDocumentRun_])
|
|
15444
|
+
Results: EntityDocumentRun_[];
|
|
15445
|
+
|
|
15446
|
+
@Field(() => Int, {nullable: true})
|
|
15447
|
+
UserViewRunID?: number;
|
|
15448
|
+
|
|
15449
|
+
@Field(() => Int, {nullable: true})
|
|
15450
|
+
RowCount: number;
|
|
15451
|
+
|
|
15452
|
+
@Field(() => Int, {nullable: true})
|
|
15453
|
+
TotalRowCount: number;
|
|
15454
|
+
|
|
15455
|
+
@Field(() => Int, {nullable: true})
|
|
15456
|
+
ExecutionTime: number;
|
|
15457
|
+
|
|
15458
|
+
@Field({nullable: true})
|
|
15459
|
+
ErrorMessage?: string;
|
|
15460
|
+
|
|
15461
|
+
@Field(() => Boolean, {nullable: false})
|
|
15462
|
+
Success: boolean;
|
|
15463
|
+
}
|
|
15464
|
+
|
|
15465
|
+
@Resolver(EntityDocumentRun_)
|
|
15466
|
+
export class EntityDocumentRunResolver extends ResolverBase {
|
|
15467
|
+
@Query(() => RunEntityDocumentRunViewResult)
|
|
15468
|
+
async RunEntityDocumentRunViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15469
|
+
return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
|
|
15470
|
+
}
|
|
15471
|
+
|
|
15472
|
+
@Query(() => RunEntityDocumentRunViewResult)
|
|
15473
|
+
async RunEntityDocumentRunViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15474
|
+
return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
|
|
15475
|
+
}
|
|
15476
|
+
|
|
15477
|
+
@Query(() => RunEntityDocumentRunViewResult)
|
|
15478
|
+
async RunEntityDocumentRunDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15479
|
+
input.EntityName = 'Entity Document Runs';
|
|
15480
|
+
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
15481
|
+
}
|
|
15482
|
+
@Query(() => EntityDocumentRun_, { nullable: true })
|
|
15483
|
+
async EntityDocumentRun(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityDocumentRun_ | null> {
|
|
15484
|
+
this.CheckUserReadPermissions('Entity Document Runs', userPayload);
|
|
15485
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityDocumentRuns] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Document Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
15486
|
+
const result = this.MapFieldNamesToCodeNames('Entity Document Runs', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
15487
|
+
return result;
|
|
15488
|
+
}
|
|
15489
|
+
|
|
15490
|
+
@Mutation(() => EntityDocumentRun_)
|
|
15491
|
+
async CreateEntityDocumentRun(
|
|
15492
|
+
@Arg('input', () => CreateEntityDocumentRunInput) input: CreateEntityDocumentRunInput,
|
|
15493
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
15494
|
+
@PubSub() pubSub: PubSubEngine
|
|
15495
|
+
) {
|
|
15496
|
+
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
15497
|
+
const entityObject = <EntityDocumentRunEntity>await new Metadata().GetEntityObject('Entity Document Runs', this.GetUserFromPayload(userPayload));
|
|
15498
|
+
await entityObject.NewRecord();
|
|
15499
|
+
entityObject.SetMany(input);
|
|
15500
|
+
if (await entityObject.Save()) {
|
|
15501
|
+
// save worked, fire the AfterCreate event and then return all the data
|
|
15502
|
+
await this.AfterCreate(dataSource, input); // fire event
|
|
15503
|
+
return entityObject.GetAll();
|
|
15504
|
+
}
|
|
15505
|
+
else
|
|
15506
|
+
// save failed, return null
|
|
15507
|
+
return null;
|
|
15508
|
+
}
|
|
15509
|
+
else
|
|
15510
|
+
return null;
|
|
15511
|
+
}
|
|
15512
|
+
|
|
15513
|
+
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
15514
|
+
protected async BeforeCreate(dataSource: DataSource, input: CreateEntityDocumentRunInput): Promise<boolean> {
|
|
15515
|
+
return true;
|
|
15516
|
+
}
|
|
15517
|
+
protected async AfterCreate(dataSource: DataSource, input: CreateEntityDocumentRunInput) {
|
|
15518
|
+
}
|
|
15519
|
+
|
|
15520
|
+
@Mutation(() => EntityDocumentRun_)
|
|
15521
|
+
async UpdateEntityDocumentRun(
|
|
15522
|
+
@Arg('input', () => UpdateEntityDocumentRunInput) input: UpdateEntityDocumentRunInput,
|
|
15523
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
15524
|
+
@PubSub() pubSub: PubSubEngine
|
|
15525
|
+
) {
|
|
15526
|
+
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
15527
|
+
const entityObject = <EntityDocumentRunEntity>await new Metadata().GetEntityObject('Entity Document Runs', this.GetUserFromPayload(userPayload));
|
|
15528
|
+
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Entity Document Runs
|
|
15529
|
+
|
|
15530
|
+
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
15531
|
+
// save worked, fire afterevent and return all the data
|
|
15532
|
+
await this.AfterUpdate(dataSource, input); // fire event
|
|
15533
|
+
return entityObject.GetAll();
|
|
15534
|
+
}
|
|
15535
|
+
else
|
|
15536
|
+
return null; // save failed, return null
|
|
15537
|
+
}
|
|
15538
|
+
else
|
|
15539
|
+
return null;
|
|
15540
|
+
}
|
|
15541
|
+
|
|
15542
|
+
// Before/After UPDATE Event Hooks for Sub-Classes to Override
|
|
15543
|
+
protected async BeforeUpdate(dataSource: DataSource, input: UpdateEntityDocumentRunInput): Promise<boolean> {
|
|
15544
|
+
const i = input, d = dataSource; // prevent error
|
|
15545
|
+
return true;
|
|
15546
|
+
}
|
|
15547
|
+
protected async AfterUpdate(dataSource: DataSource, input: UpdateEntityDocumentRunInput) {
|
|
15548
|
+
const i = input, d = dataSource; // prevent error
|
|
15549
|
+
}
|
|
15550
|
+
|
|
15551
|
+
}
|
|
15552
|
+
|
|
15553
|
+
//****************************************************************************
|
|
15554
|
+
// ENTITY CLASS for Vector Databases
|
|
15555
|
+
//****************************************************************************
|
|
15556
|
+
@ObjectType()
|
|
15557
|
+
export class VectorDatabase_ {
|
|
15558
|
+
@Field(() => Int)
|
|
15559
|
+
ID: number;
|
|
15560
|
+
|
|
15561
|
+
@Field()
|
|
15562
|
+
@MaxLength(200)
|
|
15563
|
+
Name: string;
|
|
15564
|
+
|
|
15565
|
+
@Field({nullable: true})
|
|
15566
|
+
Description?: string;
|
|
15567
|
+
|
|
15568
|
+
@Field({nullable: true})
|
|
15569
|
+
@MaxLength(510)
|
|
15570
|
+
DefaultURL?: string;
|
|
15571
|
+
|
|
15572
|
+
@Field({nullable: true})
|
|
15573
|
+
@MaxLength(200)
|
|
15574
|
+
ClassKey?: string;
|
|
15575
|
+
|
|
15576
|
+
@Field()
|
|
15577
|
+
@MaxLength(8)
|
|
15578
|
+
CreatedAt: Date;
|
|
15579
|
+
|
|
15580
|
+
@Field()
|
|
15581
|
+
@MaxLength(8)
|
|
15582
|
+
UpdatedAt: Date;
|
|
15583
|
+
|
|
15584
|
+
@Field(() => [VectorIndex_])
|
|
15585
|
+
VectorIndexesArray: VectorIndex_[]; // Link to VectorIndexes
|
|
15586
|
+
|
|
15587
|
+
}
|
|
15588
|
+
|
|
15589
|
+
//****************************************************************************
|
|
15590
|
+
// INPUT TYPE for Vector Databases
|
|
15591
|
+
//****************************************************************************
|
|
15592
|
+
@InputType()
|
|
15593
|
+
export class CreateVectorDatabaseInput {
|
|
15594
|
+
@Field()
|
|
15595
|
+
Name: string;
|
|
15596
|
+
|
|
15597
|
+
@Field({ nullable: true })
|
|
15598
|
+
Description: string;
|
|
15599
|
+
|
|
15600
|
+
@Field({ nullable: true })
|
|
15601
|
+
DefaultURL: string;
|
|
15602
|
+
|
|
15603
|
+
@Field({ nullable: true })
|
|
15604
|
+
ClassKey: string;
|
|
15605
|
+
}
|
|
15606
|
+
|
|
15607
|
+
|
|
15608
|
+
//****************************************************************************
|
|
15609
|
+
// INPUT TYPE for Vector Databases
|
|
15610
|
+
//****************************************************************************
|
|
15611
|
+
@InputType()
|
|
15612
|
+
export class UpdateVectorDatabaseInput {
|
|
15613
|
+
@Field(() => Int, )
|
|
15614
|
+
ID: number;
|
|
15615
|
+
|
|
15616
|
+
@Field()
|
|
15617
|
+
Name: string;
|
|
15618
|
+
|
|
15619
|
+
@Field({ nullable: true })
|
|
15620
|
+
Description: string;
|
|
15621
|
+
|
|
15622
|
+
@Field({ nullable: true })
|
|
15623
|
+
DefaultURL: string;
|
|
15624
|
+
|
|
15625
|
+
@Field({ nullable: true })
|
|
15626
|
+
ClassKey: string;
|
|
15627
|
+
}
|
|
15628
|
+
|
|
15629
|
+
//****************************************************************************
|
|
15630
|
+
// RESOLVER for Vector Databases
|
|
15631
|
+
//****************************************************************************
|
|
15632
|
+
@ObjectType()
|
|
15633
|
+
export class RunVectorDatabaseViewResult {
|
|
15634
|
+
@Field(() => [VectorDatabase_])
|
|
15635
|
+
Results: VectorDatabase_[];
|
|
15636
|
+
|
|
15637
|
+
@Field(() => Int, {nullable: true})
|
|
15638
|
+
UserViewRunID?: number;
|
|
15639
|
+
|
|
15640
|
+
@Field(() => Int, {nullable: true})
|
|
15641
|
+
RowCount: number;
|
|
15642
|
+
|
|
15643
|
+
@Field(() => Int, {nullable: true})
|
|
15644
|
+
TotalRowCount: number;
|
|
15645
|
+
|
|
15646
|
+
@Field(() => Int, {nullable: true})
|
|
15647
|
+
ExecutionTime: number;
|
|
15648
|
+
|
|
15649
|
+
@Field({nullable: true})
|
|
15650
|
+
ErrorMessage?: string;
|
|
15651
|
+
|
|
15652
|
+
@Field(() => Boolean, {nullable: false})
|
|
15653
|
+
Success: boolean;
|
|
15654
|
+
}
|
|
15655
|
+
|
|
15656
|
+
@Resolver(VectorDatabase_)
|
|
15657
|
+
export class VectorDatabaseResolver extends ResolverBase {
|
|
15658
|
+
@Query(() => RunVectorDatabaseViewResult)
|
|
15659
|
+
async RunVectorDatabaseViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15660
|
+
return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
|
|
15661
|
+
}
|
|
15662
|
+
|
|
15663
|
+
@Query(() => RunVectorDatabaseViewResult)
|
|
15664
|
+
async RunVectorDatabaseViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15665
|
+
return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
|
|
15666
|
+
}
|
|
15667
|
+
|
|
15668
|
+
@Query(() => RunVectorDatabaseViewResult)
|
|
15669
|
+
async RunVectorDatabaseDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15670
|
+
input.EntityName = 'Vector Databases';
|
|
15671
|
+
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
15672
|
+
}
|
|
15673
|
+
@Query(() => VectorDatabase_, { nullable: true })
|
|
15674
|
+
async VectorDatabase(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<VectorDatabase_ | null> {
|
|
15675
|
+
this.CheckUserReadPermissions('Vector Databases', userPayload);
|
|
15676
|
+
const sSQL = `SELECT * FROM [admin].[vwVectorDatabases] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Vector Databases', userPayload, EntityPermissionType.Read, 'AND');
|
|
15677
|
+
const result = this.MapFieldNamesToCodeNames('Vector Databases', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
15678
|
+
return result;
|
|
15679
|
+
}
|
|
15680
|
+
|
|
15681
|
+
@FieldResolver(() => [VectorIndex_])
|
|
15682
|
+
async VectorIndexesArray(@Root() vectordatabase_: VectorDatabase_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15683
|
+
this.CheckUserReadPermissions('Vector Indexes', userPayload);
|
|
15684
|
+
const sSQL = `SELECT * FROM [admin].[vwVectorIndexes] WHERE [VectorDatabaseID]=${vectordatabase_.ID} ` + this.getRowLevelSecurityWhereClause('Vector Indexes', userPayload, EntityPermissionType.Read, 'AND');
|
|
15685
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Vector Indexes', await dataSource.query(sSQL));
|
|
15686
|
+
return result;
|
|
15687
|
+
}
|
|
15688
|
+
|
|
15689
|
+
@Mutation(() => VectorDatabase_)
|
|
15690
|
+
async CreateVectorDatabase(
|
|
15691
|
+
@Arg('input', () => CreateVectorDatabaseInput) input: CreateVectorDatabaseInput,
|
|
15692
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
15693
|
+
@PubSub() pubSub: PubSubEngine
|
|
15694
|
+
) {
|
|
15695
|
+
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
15696
|
+
const entityObject = <VectorDatabaseEntity>await new Metadata().GetEntityObject('Vector Databases', this.GetUserFromPayload(userPayload));
|
|
15697
|
+
await entityObject.NewRecord();
|
|
15698
|
+
entityObject.SetMany(input);
|
|
15699
|
+
if (await entityObject.Save()) {
|
|
15700
|
+
// save worked, fire the AfterCreate event and then return all the data
|
|
15701
|
+
await this.AfterCreate(dataSource, input); // fire event
|
|
15702
|
+
return entityObject.GetAll();
|
|
15703
|
+
}
|
|
15704
|
+
else
|
|
15705
|
+
// save failed, return null
|
|
15706
|
+
return null;
|
|
15707
|
+
}
|
|
15708
|
+
else
|
|
15709
|
+
return null;
|
|
15710
|
+
}
|
|
15711
|
+
|
|
15712
|
+
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
15713
|
+
protected async BeforeCreate(dataSource: DataSource, input: CreateVectorDatabaseInput): Promise<boolean> {
|
|
15714
|
+
return true;
|
|
15715
|
+
}
|
|
15716
|
+
protected async AfterCreate(dataSource: DataSource, input: CreateVectorDatabaseInput) {
|
|
15717
|
+
}
|
|
15718
|
+
|
|
15719
|
+
@Mutation(() => VectorDatabase_)
|
|
15720
|
+
async UpdateVectorDatabase(
|
|
15721
|
+
@Arg('input', () => UpdateVectorDatabaseInput) input: UpdateVectorDatabaseInput,
|
|
15722
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
15723
|
+
@PubSub() pubSub: PubSubEngine
|
|
15724
|
+
) {
|
|
15725
|
+
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
15726
|
+
const entityObject = <VectorDatabaseEntity>await new Metadata().GetEntityObject('Vector Databases', this.GetUserFromPayload(userPayload));
|
|
15727
|
+
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Vector Databases
|
|
15728
|
+
|
|
15729
|
+
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
15730
|
+
// save worked, fire afterevent and return all the data
|
|
15731
|
+
await this.AfterUpdate(dataSource, input); // fire event
|
|
15732
|
+
return entityObject.GetAll();
|
|
15733
|
+
}
|
|
15734
|
+
else
|
|
15735
|
+
return null; // save failed, return null
|
|
15736
|
+
}
|
|
15737
|
+
else
|
|
15738
|
+
return null;
|
|
15739
|
+
}
|
|
15740
|
+
|
|
15741
|
+
// Before/After UPDATE Event Hooks for Sub-Classes to Override
|
|
15742
|
+
protected async BeforeUpdate(dataSource: DataSource, input: UpdateVectorDatabaseInput): Promise<boolean> {
|
|
15743
|
+
const i = input, d = dataSource; // prevent error
|
|
15744
|
+
return true;
|
|
15745
|
+
}
|
|
15746
|
+
protected async AfterUpdate(dataSource: DataSource, input: UpdateVectorDatabaseInput) {
|
|
15747
|
+
const i = input, d = dataSource; // prevent error
|
|
15748
|
+
}
|
|
15749
|
+
|
|
15750
|
+
}
|
|
15751
|
+
|
|
15752
|
+
//****************************************************************************
|
|
15753
|
+
// ENTITY CLASS for Entity Record Documents
|
|
15754
|
+
//****************************************************************************
|
|
15755
|
+
@ObjectType()
|
|
15756
|
+
export class EntityRecordDocument_ {
|
|
15757
|
+
@Field(() => Int)
|
|
15758
|
+
ID: number;
|
|
15759
|
+
|
|
15760
|
+
@Field(() => Int)
|
|
15761
|
+
EntityID: number;
|
|
15762
|
+
|
|
15763
|
+
@Field()
|
|
15764
|
+
@MaxLength(510)
|
|
15765
|
+
RecordID: string;
|
|
15766
|
+
|
|
15767
|
+
@Field({nullable: true})
|
|
15768
|
+
DocumentText?: string;
|
|
15769
|
+
|
|
15770
|
+
@Field(() => Int)
|
|
15771
|
+
VectorIndexID: number;
|
|
15772
|
+
|
|
15773
|
+
@Field({nullable: true})
|
|
15774
|
+
@MaxLength(100)
|
|
15775
|
+
VectorID?: string;
|
|
15776
|
+
|
|
15777
|
+
@Field({nullable: true})
|
|
15778
|
+
VectorJSON?: string;
|
|
15779
|
+
|
|
15780
|
+
@Field()
|
|
15781
|
+
@MaxLength(8)
|
|
15782
|
+
EntityRecordUpdatedAt: Date;
|
|
15783
|
+
|
|
15784
|
+
@Field()
|
|
15785
|
+
@MaxLength(8)
|
|
15786
|
+
CreatedAt: Date;
|
|
15787
|
+
|
|
15788
|
+
@Field()
|
|
15789
|
+
@MaxLength(8)
|
|
15790
|
+
UpdatedAt: Date;
|
|
15791
|
+
|
|
15792
|
+
}
|
|
15793
|
+
|
|
15794
|
+
//****************************************************************************
|
|
15795
|
+
// INPUT TYPE for Entity Record Documents
|
|
15796
|
+
//****************************************************************************
|
|
15797
|
+
@InputType()
|
|
15798
|
+
export class CreateEntityRecordDocumentInput {
|
|
15799
|
+
@Field(() => Int, )
|
|
15800
|
+
EntityID: number;
|
|
15801
|
+
|
|
15802
|
+
@Field()
|
|
15803
|
+
RecordID: string;
|
|
15804
|
+
|
|
15805
|
+
@Field({ nullable: true })
|
|
15806
|
+
DocumentText: string;
|
|
15807
|
+
|
|
15808
|
+
@Field(() => Int, )
|
|
15809
|
+
VectorIndexID: number;
|
|
15810
|
+
|
|
15811
|
+
@Field({ nullable: true })
|
|
15812
|
+
VectorID: string;
|
|
15813
|
+
|
|
15814
|
+
@Field({ nullable: true })
|
|
15815
|
+
VectorJSON: string;
|
|
15816
|
+
|
|
15817
|
+
@Field()
|
|
15818
|
+
EntityRecordUpdatedAt: Date;
|
|
15819
|
+
}
|
|
15820
|
+
|
|
15821
|
+
|
|
15822
|
+
//****************************************************************************
|
|
15823
|
+
// INPUT TYPE for Entity Record Documents
|
|
15824
|
+
//****************************************************************************
|
|
15825
|
+
@InputType()
|
|
15826
|
+
export class UpdateEntityRecordDocumentInput {
|
|
15827
|
+
@Field(() => Int, )
|
|
15828
|
+
ID: number;
|
|
15829
|
+
|
|
15830
|
+
@Field(() => Int, )
|
|
15831
|
+
EntityID: number;
|
|
15832
|
+
|
|
15833
|
+
@Field()
|
|
15834
|
+
RecordID: string;
|
|
15835
|
+
|
|
15836
|
+
@Field({ nullable: true })
|
|
15837
|
+
DocumentText: string;
|
|
15838
|
+
|
|
15839
|
+
@Field(() => Int, )
|
|
15840
|
+
VectorIndexID: number;
|
|
15841
|
+
|
|
15842
|
+
@Field({ nullable: true })
|
|
15843
|
+
VectorID: string;
|
|
15844
|
+
|
|
15845
|
+
@Field({ nullable: true })
|
|
15846
|
+
VectorJSON: string;
|
|
15847
|
+
|
|
15848
|
+
@Field()
|
|
15849
|
+
EntityRecordUpdatedAt: Date;
|
|
15850
|
+
}
|
|
15851
|
+
|
|
15852
|
+
//****************************************************************************
|
|
15853
|
+
// RESOLVER for Entity Record Documents
|
|
15854
|
+
//****************************************************************************
|
|
15855
|
+
@ObjectType()
|
|
15856
|
+
export class RunEntityRecordDocumentViewResult {
|
|
15857
|
+
@Field(() => [EntityRecordDocument_])
|
|
15858
|
+
Results: EntityRecordDocument_[];
|
|
15859
|
+
|
|
15860
|
+
@Field(() => Int, {nullable: true})
|
|
15861
|
+
UserViewRunID?: number;
|
|
15862
|
+
|
|
15863
|
+
@Field(() => Int, {nullable: true})
|
|
15864
|
+
RowCount: number;
|
|
15865
|
+
|
|
15866
|
+
@Field(() => Int, {nullable: true})
|
|
15867
|
+
TotalRowCount: number;
|
|
15868
|
+
|
|
15869
|
+
@Field(() => Int, {nullable: true})
|
|
15870
|
+
ExecutionTime: number;
|
|
15871
|
+
|
|
15872
|
+
@Field({nullable: true})
|
|
15873
|
+
ErrorMessage?: string;
|
|
15874
|
+
|
|
15875
|
+
@Field(() => Boolean, {nullable: false})
|
|
15876
|
+
Success: boolean;
|
|
15877
|
+
}
|
|
15878
|
+
|
|
15879
|
+
@Resolver(EntityRecordDocument_)
|
|
15880
|
+
export class EntityRecordDocumentResolver extends ResolverBase {
|
|
15881
|
+
@Query(() => RunEntityRecordDocumentViewResult)
|
|
15882
|
+
async RunEntityRecordDocumentViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15883
|
+
return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
|
|
15884
|
+
}
|
|
15885
|
+
|
|
15886
|
+
@Query(() => RunEntityRecordDocumentViewResult)
|
|
15887
|
+
async RunEntityRecordDocumentViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15888
|
+
return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
|
|
15889
|
+
}
|
|
15890
|
+
|
|
15891
|
+
@Query(() => RunEntityRecordDocumentViewResult)
|
|
15892
|
+
async RunEntityRecordDocumentDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
15893
|
+
input.EntityName = 'Entity Record Documents';
|
|
15894
|
+
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
15895
|
+
}
|
|
15896
|
+
@Query(() => EntityRecordDocument_, { nullable: true })
|
|
15897
|
+
async EntityRecordDocument(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityRecordDocument_ | null> {
|
|
15898
|
+
this.CheckUserReadPermissions('Entity Record Documents', userPayload);
|
|
15899
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityRecordDocuments] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Record Documents', userPayload, EntityPermissionType.Read, 'AND');
|
|
15900
|
+
const result = this.MapFieldNamesToCodeNames('Entity Record Documents', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
15901
|
+
return result;
|
|
15902
|
+
}
|
|
15903
|
+
|
|
15904
|
+
@Mutation(() => EntityRecordDocument_)
|
|
15905
|
+
async CreateEntityRecordDocument(
|
|
15906
|
+
@Arg('input', () => CreateEntityRecordDocumentInput) input: CreateEntityRecordDocumentInput,
|
|
15907
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
15908
|
+
@PubSub() pubSub: PubSubEngine
|
|
15909
|
+
) {
|
|
15910
|
+
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
15911
|
+
const entityObject = <EntityRecordDocumentEntity>await new Metadata().GetEntityObject('Entity Record Documents', this.GetUserFromPayload(userPayload));
|
|
15912
|
+
await entityObject.NewRecord();
|
|
15913
|
+
entityObject.SetMany(input);
|
|
15914
|
+
if (await entityObject.Save()) {
|
|
15915
|
+
// save worked, fire the AfterCreate event and then return all the data
|
|
15916
|
+
await this.AfterCreate(dataSource, input); // fire event
|
|
15917
|
+
return entityObject.GetAll();
|
|
15918
|
+
}
|
|
15919
|
+
else
|
|
15920
|
+
// save failed, return null
|
|
15921
|
+
return null;
|
|
15922
|
+
}
|
|
15923
|
+
else
|
|
15924
|
+
return null;
|
|
15925
|
+
}
|
|
15926
|
+
|
|
15927
|
+
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
15928
|
+
protected async BeforeCreate(dataSource: DataSource, input: CreateEntityRecordDocumentInput): Promise<boolean> {
|
|
15929
|
+
return true;
|
|
15930
|
+
}
|
|
15931
|
+
protected async AfterCreate(dataSource: DataSource, input: CreateEntityRecordDocumentInput) {
|
|
15932
|
+
}
|
|
15933
|
+
|
|
15934
|
+
@Mutation(() => EntityRecordDocument_)
|
|
15935
|
+
async UpdateEntityRecordDocument(
|
|
15936
|
+
@Arg('input', () => UpdateEntityRecordDocumentInput) input: UpdateEntityRecordDocumentInput,
|
|
15937
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
15938
|
+
@PubSub() pubSub: PubSubEngine
|
|
15939
|
+
) {
|
|
15940
|
+
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
15941
|
+
const entityObject = <EntityRecordDocumentEntity>await new Metadata().GetEntityObject('Entity Record Documents', this.GetUserFromPayload(userPayload));
|
|
15942
|
+
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Entity Record Documents
|
|
15943
|
+
|
|
15944
|
+
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
15945
|
+
// save worked, fire afterevent and return all the data
|
|
15946
|
+
await this.AfterUpdate(dataSource, input); // fire event
|
|
15947
|
+
return entityObject.GetAll();
|
|
15948
|
+
}
|
|
15949
|
+
else
|
|
15950
|
+
return null; // save failed, return null
|
|
15951
|
+
}
|
|
15952
|
+
else
|
|
15953
|
+
return null;
|
|
15954
|
+
}
|
|
15955
|
+
|
|
15956
|
+
// Before/After UPDATE Event Hooks for Sub-Classes to Override
|
|
15957
|
+
protected async BeforeUpdate(dataSource: DataSource, input: UpdateEntityRecordDocumentInput): Promise<boolean> {
|
|
15958
|
+
const i = input, d = dataSource; // prevent error
|
|
15959
|
+
return true;
|
|
15960
|
+
}
|
|
15961
|
+
protected async AfterUpdate(dataSource: DataSource, input: UpdateEntityRecordDocumentInput) {
|
|
15962
|
+
const i = input, d = dataSource; // prevent error
|
|
15963
|
+
}
|
|
15964
|
+
|
|
15965
|
+
}
|
|
15966
|
+
|
|
15967
|
+
//****************************************************************************
|
|
15968
|
+
// ENTITY CLASS for Entity Documents
|
|
15969
|
+
//****************************************************************************
|
|
15970
|
+
@ObjectType()
|
|
15971
|
+
export class EntityDocument_ {
|
|
15972
|
+
@Field(() => Int)
|
|
15973
|
+
ID: number;
|
|
15974
|
+
|
|
15975
|
+
@Field()
|
|
15976
|
+
@MaxLength(500)
|
|
15977
|
+
Name: string;
|
|
15978
|
+
|
|
15979
|
+
@Field(() => Int)
|
|
15980
|
+
EntityID: number;
|
|
15981
|
+
|
|
15982
|
+
@Field(() => Int)
|
|
15983
|
+
TypeID: number;
|
|
15984
|
+
|
|
15985
|
+
@Field()
|
|
15986
|
+
@MaxLength(30)
|
|
15987
|
+
Status: string;
|
|
15988
|
+
|
|
15989
|
+
@Field({nullable: true})
|
|
15990
|
+
Template?: string;
|
|
15991
|
+
|
|
15992
|
+
@Field()
|
|
15993
|
+
@MaxLength(8)
|
|
15994
|
+
CreatedAt: Date;
|
|
15995
|
+
|
|
15996
|
+
@Field()
|
|
15997
|
+
@MaxLength(8)
|
|
15998
|
+
UpdatedAt: Date;
|
|
15999
|
+
|
|
16000
|
+
@Field()
|
|
16001
|
+
@MaxLength(510)
|
|
16002
|
+
Entity: string;
|
|
16003
|
+
|
|
16004
|
+
@Field()
|
|
16005
|
+
@MaxLength(200)
|
|
16006
|
+
Type: string;
|
|
16007
|
+
|
|
16008
|
+
@Field(() => [EntityDocumentRun_])
|
|
16009
|
+
EntityDocumentRunsArray: EntityDocumentRun_[]; // Link to EntityDocumentRuns
|
|
16010
|
+
|
|
16011
|
+
}
|
|
16012
|
+
|
|
16013
|
+
//****************************************************************************
|
|
16014
|
+
// INPUT TYPE for Entity Documents
|
|
16015
|
+
//****************************************************************************
|
|
16016
|
+
@InputType()
|
|
16017
|
+
export class CreateEntityDocumentInput {
|
|
16018
|
+
@Field()
|
|
16019
|
+
Name: string;
|
|
16020
|
+
|
|
16021
|
+
@Field(() => Int, )
|
|
16022
|
+
EntityID: number;
|
|
16023
|
+
|
|
16024
|
+
@Field(() => Int, )
|
|
16025
|
+
TypeID: number;
|
|
16026
|
+
|
|
16027
|
+
@Field()
|
|
16028
|
+
Status: string;
|
|
16029
|
+
|
|
16030
|
+
@Field({ nullable: true })
|
|
16031
|
+
Template: string;
|
|
16032
|
+
}
|
|
16033
|
+
|
|
16034
|
+
|
|
16035
|
+
//****************************************************************************
|
|
16036
|
+
// INPUT TYPE for Entity Documents
|
|
16037
|
+
//****************************************************************************
|
|
16038
|
+
@InputType()
|
|
16039
|
+
export class UpdateEntityDocumentInput {
|
|
16040
|
+
@Field(() => Int, )
|
|
16041
|
+
ID: number;
|
|
16042
|
+
|
|
16043
|
+
@Field()
|
|
16044
|
+
Name: string;
|
|
16045
|
+
|
|
16046
|
+
@Field(() => Int, )
|
|
16047
|
+
EntityID: number;
|
|
16048
|
+
|
|
16049
|
+
@Field(() => Int, )
|
|
16050
|
+
TypeID: number;
|
|
16051
|
+
|
|
16052
|
+
@Field()
|
|
16053
|
+
Status: string;
|
|
16054
|
+
|
|
16055
|
+
@Field({ nullable: true })
|
|
16056
|
+
Template: string;
|
|
16057
|
+
}
|
|
16058
|
+
|
|
16059
|
+
//****************************************************************************
|
|
16060
|
+
// RESOLVER for Entity Documents
|
|
16061
|
+
//****************************************************************************
|
|
16062
|
+
@ObjectType()
|
|
16063
|
+
export class RunEntityDocumentViewResult {
|
|
16064
|
+
@Field(() => [EntityDocument_])
|
|
16065
|
+
Results: EntityDocument_[];
|
|
16066
|
+
|
|
16067
|
+
@Field(() => Int, {nullable: true})
|
|
16068
|
+
UserViewRunID?: number;
|
|
16069
|
+
|
|
16070
|
+
@Field(() => Int, {nullable: true})
|
|
16071
|
+
RowCount: number;
|
|
16072
|
+
|
|
16073
|
+
@Field(() => Int, {nullable: true})
|
|
16074
|
+
TotalRowCount: number;
|
|
16075
|
+
|
|
16076
|
+
@Field(() => Int, {nullable: true})
|
|
16077
|
+
ExecutionTime: number;
|
|
16078
|
+
|
|
16079
|
+
@Field({nullable: true})
|
|
16080
|
+
ErrorMessage?: string;
|
|
16081
|
+
|
|
16082
|
+
@Field(() => Boolean, {nullable: false})
|
|
16083
|
+
Success: boolean;
|
|
16084
|
+
}
|
|
16085
|
+
|
|
16086
|
+
@Resolver(EntityDocument_)
|
|
16087
|
+
export class EntityDocumentResolver extends ResolverBase {
|
|
16088
|
+
@Query(() => RunEntityDocumentViewResult)
|
|
16089
|
+
async RunEntityDocumentViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
16090
|
+
return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
|
|
16091
|
+
}
|
|
16092
|
+
|
|
16093
|
+
@Query(() => RunEntityDocumentViewResult)
|
|
16094
|
+
async RunEntityDocumentViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
16095
|
+
return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
|
|
16096
|
+
}
|
|
16097
|
+
|
|
16098
|
+
@Query(() => RunEntityDocumentViewResult)
|
|
16099
|
+
async RunEntityDocumentDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
16100
|
+
input.EntityName = 'Entity Documents';
|
|
16101
|
+
return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
|
|
16102
|
+
}
|
|
16103
|
+
@Query(() => EntityDocument_, { nullable: true })
|
|
16104
|
+
async EntityDocument(@Arg('ID', () => Int) ID: Number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<EntityDocument_ | null> {
|
|
16105
|
+
this.CheckUserReadPermissions('Entity Documents', userPayload);
|
|
16106
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityDocuments] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Entity Documents', userPayload, EntityPermissionType.Read, 'AND');
|
|
16107
|
+
const result = this.MapFieldNamesToCodeNames('Entity Documents', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
|
|
16108
|
+
return result;
|
|
16109
|
+
}
|
|
16110
|
+
|
|
16111
|
+
@FieldResolver(() => [EntityDocumentRun_])
|
|
16112
|
+
async EntityDocumentRunsArray(@Root() entitydocument_: EntityDocument_, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
16113
|
+
this.CheckUserReadPermissions('Entity Document Runs', userPayload);
|
|
16114
|
+
const sSQL = `SELECT * FROM [admin].[vwEntityDocumentRuns] WHERE [EntityDocumentID]=${entitydocument_.ID} ` + this.getRowLevelSecurityWhereClause('Entity Document Runs', userPayload, EntityPermissionType.Read, 'AND');
|
|
16115
|
+
const result = this.ArrayMapFieldNamesToCodeNames('Entity Document Runs', await dataSource.query(sSQL));
|
|
16116
|
+
return result;
|
|
16117
|
+
}
|
|
16118
|
+
|
|
16119
|
+
@Mutation(() => EntityDocument_)
|
|
16120
|
+
async CreateEntityDocument(
|
|
16121
|
+
@Arg('input', () => CreateEntityDocumentInput) input: CreateEntityDocumentInput,
|
|
16122
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
16123
|
+
@PubSub() pubSub: PubSubEngine
|
|
16124
|
+
) {
|
|
16125
|
+
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
16126
|
+
const entityObject = <EntityDocumentEntity>await new Metadata().GetEntityObject('Entity Documents', this.GetUserFromPayload(userPayload));
|
|
16127
|
+
await entityObject.NewRecord();
|
|
16128
|
+
entityObject.SetMany(input);
|
|
16129
|
+
if (await entityObject.Save()) {
|
|
16130
|
+
// save worked, fire the AfterCreate event and then return all the data
|
|
16131
|
+
await this.AfterCreate(dataSource, input); // fire event
|
|
16132
|
+
return entityObject.GetAll();
|
|
16133
|
+
}
|
|
16134
|
+
else
|
|
16135
|
+
// save failed, return null
|
|
16136
|
+
return null;
|
|
16137
|
+
}
|
|
16138
|
+
else
|
|
16139
|
+
return null;
|
|
16140
|
+
}
|
|
16141
|
+
|
|
16142
|
+
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
16143
|
+
protected async BeforeCreate(dataSource: DataSource, input: CreateEntityDocumentInput): Promise<boolean> {
|
|
16144
|
+
return true;
|
|
16145
|
+
}
|
|
16146
|
+
protected async AfterCreate(dataSource: DataSource, input: CreateEntityDocumentInput) {
|
|
16147
|
+
}
|
|
16148
|
+
|
|
16149
|
+
@Mutation(() => EntityDocument_)
|
|
16150
|
+
async UpdateEntityDocument(
|
|
16151
|
+
@Arg('input', () => UpdateEntityDocumentInput) input: UpdateEntityDocumentInput,
|
|
16152
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
16153
|
+
@PubSub() pubSub: PubSubEngine
|
|
16154
|
+
) {
|
|
16155
|
+
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
16156
|
+
const entityObject = <EntityDocumentEntity>await new Metadata().GetEntityObject('Entity Documents', this.GetUserFromPayload(userPayload));
|
|
16157
|
+
entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Entity Documents
|
|
16158
|
+
|
|
16159
|
+
if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
|
|
16160
|
+
// save worked, fire afterevent and return all the data
|
|
16161
|
+
await this.AfterUpdate(dataSource, input); // fire event
|
|
16162
|
+
return entityObject.GetAll();
|
|
16163
|
+
}
|
|
16164
|
+
else
|
|
16165
|
+
return null; // save failed, return null
|
|
16166
|
+
}
|
|
16167
|
+
else
|
|
16168
|
+
return null;
|
|
16169
|
+
}
|
|
16170
|
+
|
|
16171
|
+
// Before/After UPDATE Event Hooks for Sub-Classes to Override
|
|
16172
|
+
protected async BeforeUpdate(dataSource: DataSource, input: UpdateEntityDocumentInput): Promise<boolean> {
|
|
16173
|
+
const i = input, d = dataSource; // prevent error
|
|
16174
|
+
return true;
|
|
16175
|
+
}
|
|
16176
|
+
protected async AfterUpdate(dataSource: DataSource, input: UpdateEntityDocumentInput) {
|
|
16177
|
+
const i = input, d = dataSource; // prevent error
|
|
16178
|
+
}
|
|
16179
|
+
|
|
14931
16180
|
}
|