158 lines
3.8 KiB
TypeScript
158 lines
3.8 KiB
TypeScript
import { ReferenceFieldDataType } from "@app/core/common/enum/reference-field-data-type";
|
|
import { ReferenceTypeExternalApiHTTPMethodType } from "@app/core/common/enum/reference-type-external-api-http-method-type";
|
|
import { ReferenceTypeSourceType } from "@app/core/common/enum/reference-type-source-type";
|
|
import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
|
|
|
|
export interface ReferenceType extends BaseEntity{
|
|
name: string;
|
|
code: string;
|
|
definition: ReferenceTypeDefinition;
|
|
}
|
|
|
|
export interface ReferenceTypeDefinition{
|
|
fields: ReferenceTypeField[];
|
|
sources: ReferenceTypeSourceBaseConfiguration[];
|
|
}
|
|
|
|
export interface ReferenceTypeField {
|
|
code: string;
|
|
label: string;
|
|
description: string;
|
|
dataType: ReferenceFieldDataType;
|
|
}
|
|
|
|
export interface ReferenceTypeSourceBaseConfiguration extends ReferenceTypeSourceExternalApiConfiguration, ReferenceTypeSourceStaticOptionConfiguration{
|
|
type: ReferenceTypeSourceType;
|
|
key: string;
|
|
label: string;
|
|
ordinal: number;
|
|
}
|
|
|
|
export interface ReferenceTypeSourceExternalApiConfiguration{
|
|
url: string;
|
|
results: ResultsConfiguration;
|
|
paginationPath: string;
|
|
contentType: string;
|
|
//funderQuery?: string;
|
|
firstPage: string;
|
|
httpMethod: ReferenceTypeExternalApiHTTPMethodType;
|
|
requestBody?: string;
|
|
filterType?: string;
|
|
auth: AuthenticationConfiguration;
|
|
queries?: QueryConfig[];
|
|
}
|
|
|
|
export interface ResultsConfiguration{
|
|
resultsArrayPath: string;
|
|
fieldsMapping: ResultFieldsMappingConfiguration[];
|
|
}
|
|
|
|
|
|
export interface ResultFieldsMappingConfiguration{
|
|
code: string;
|
|
responsePath: string;
|
|
}
|
|
|
|
export interface AuthenticationConfiguration{
|
|
authUrl: string;
|
|
authMethod: ReferenceTypeExternalApiHTTPMethodType;
|
|
authTokenPath: string;
|
|
authRequestBody: string;
|
|
type: string;
|
|
}
|
|
|
|
export interface QueryConfig{
|
|
condition: string;
|
|
separator: string;
|
|
value: string;
|
|
ordinal: number;
|
|
}
|
|
|
|
export interface ReferenceTypeSourceStaticOptionConfiguration{
|
|
options: ReferenceTypeStaticOption[];
|
|
}
|
|
|
|
export interface ReferenceTypeStaticOption{
|
|
code: string;
|
|
value: string;
|
|
}
|
|
|
|
|
|
// Persist
|
|
|
|
export interface ReferenceTypePersist extends BaseEntityPersist{
|
|
name: string;
|
|
code: string;
|
|
definition: ReferenceTypeDefinitionPersist;
|
|
}
|
|
|
|
export interface ReferenceTypeDefinitionPersist{
|
|
fields?: ReferenceTypeFieldPersist[];
|
|
sources: ReferenceTypeSourceBaseConfigurationPersist[];
|
|
}
|
|
|
|
export interface ReferenceTypeFieldPersist {
|
|
code: string;
|
|
label: string;
|
|
description: string;
|
|
dataType: ReferenceFieldDataType;
|
|
}
|
|
|
|
export interface ReferenceTypeSourceBaseConfigurationPersist extends ReferenceTypeSourceExternalApiConfigurationPersist, ReferenceTypeSourceStaticOptionConfigurationPersist{
|
|
type: ReferenceTypeSourceType;
|
|
key: string;
|
|
label: string;
|
|
ordinal: number;
|
|
}
|
|
|
|
export interface ReferenceTypeSourceExternalApiConfigurationPersist{
|
|
url: string;
|
|
results: ResultsConfigurationPersist;
|
|
paginationPath: string;
|
|
contentType: string;
|
|
// toDo move to a general query
|
|
//funderQuery?: string;
|
|
firstPage: string;
|
|
httpMethod: ReferenceTypeExternalApiHTTPMethodType;
|
|
requestBody?: string;
|
|
filterType?: string;
|
|
auth: AuthenticationConfigurationPersist;
|
|
queries?: QueryConfigPersist[];
|
|
}
|
|
|
|
export interface ResultsConfigurationPersist{
|
|
resultsArrayPath: string;
|
|
fieldsMapping: ResultFieldsMappingConfigurationPersist[];
|
|
}
|
|
|
|
|
|
|
|
export interface ResultFieldsMappingConfigurationPersist{
|
|
code: string;
|
|
responsePath: string;
|
|
}
|
|
|
|
export interface AuthenticationConfigurationPersist{
|
|
authUrl: string;
|
|
authMethod: ReferenceTypeExternalApiHTTPMethodType;
|
|
authTokenPath: string;
|
|
authRequestBody: string;
|
|
type: string;
|
|
}
|
|
|
|
export interface QueryConfigPersist{
|
|
condition: string;
|
|
separator: string;
|
|
value: string;
|
|
ordinal: number;
|
|
}
|
|
|
|
export interface ReferenceTypeSourceStaticOptionConfigurationPersist {
|
|
options: ReferenceTypeStaticOptionPersist[];
|
|
}
|
|
|
|
export interface ReferenceTypeStaticOptionPersist{
|
|
code: string;
|
|
value: string;
|
|
}
|