Commit c14d5699 authored by Maksym Tishchenko's avatar Maksym Tishchenko
Browse files

Source descriptors

parent 94f1e49d
......@@ -111,7 +111,13 @@
"InventoryViabilityRule": "Inventory viability rule",
"InventoryViabilityRule_plural": "Inventory viability rules",
"InventoryViabilityData": "Inventory viability data",
"InventoryViabilityData_plural": "Inventory viability datas"
"InventoryViabilityData_plural": "Inventory viability datas",
"SourceDescriptor": "Source descriptor",
"SourceDescriptor_plural": "Source descriptors",
"SourceDescriptorCode": "Source descriptor code",
"SourceDescriptorCode_plural": "Source descriptor codes",
"SourceDescriptorLang": "Source descriptor translation",
"SourceDescriptorLang_plural": "Source descriptor translations"
},
"Cooperator": {
"id": "Cooperator ID",
......@@ -1208,6 +1214,29 @@
"shipAddress": "Shipping address",
"shipCountry": "Shipping country",
"shipTelephone": "Shipping telephone"
},
"SourceDescriptor": {
"codedName": "Descriptor name",
"categoryCode": "Category",
"dataTypeCode": "Data Type",
"isCoded": "Is Coded?",
"maxLength": "Max Length",
"numericFormat": "Numeric Format",
"numericMaximum": "Numeric Maximum",
"numericMinimum": "Numeric Minimum",
"originalValueTypeCode": "Original Value Type",
"originalValueFormat": "Original Value Format",
"ontologyUrl": "Ontology URL"
},
"SourceDescriptorCode": {
"sourceDescriptor": "Descriptor",
"code": "Code"
},
"SourceDescriptorLang": {
"sourceDescriptor": "Descriptor",
"sysLang": "Language",
"title": "Title",
"description": "Description"
}
}
}
\ No newline at end of file
/**
* SourceDescriptor
*
* GRIN-Global CE API
*/
class SourceDescriptor {
public createdBy: string;
public createdDate: Date;
public modifiedBy: string;
public modifiedDate: Date;
public ownedBy: string;
public ownedDate: Date;
public id: number;
public categoryCode: string;
public codedName: string;
public dataTypeCode: string;
public isCoded: string;
public maxLength: number;
public numericFormat: string;
public numericMaximum: number;
public numericMinimum: number;
public ontologyUrl: string;
public originalValueFormat: string;
public originalValueTypeCode: string;
public note: string;
public static CodeGroup = {
categoryCode: "SOURCE_DESCRIPTOR_CATEGORY",
dataTypeCode: 'CROP_TRAIT_DATA_TYPE', // SOURCE_DESCRIPTOR_DATA_TYPE
originalValueTypeCode: 'CROP_TRAIT_DATA_TYPE', // SOURCE_DESCRIPTOR_DATA_TYPE
}
}
export default SourceDescriptor;
import AclSid from '@gringlobal-ce/client/model/acl/AclSid';
import SourceDescriptor from '@gringlobal-ce/client/model/gringlobal/SourceDescriptor';
/**
* SourceDescriptorCode
*
* GRIN-Global CE API
*/
class SourceDescriptorCode {
public createdBy: number;
public createdDate: Date;
public modifiedBy: number;
public modifiedDate: Date;
public ownedBy: AclSid;
public ownedDate: Date;
public code: string;
public id: number;
public sourceDescriptor: SourceDescriptor;
}
export default SourceDescriptorCode;
import DateFilter from '@gringlobal-ce/client/model/gringlobal/DateFilter';
import SourceDescriptorFilter from '@gringlobal-ce/client/model/gringlobal/SourceDescriptorFilter';
/**
* SourceDescriptorCodeFilter
*
* GRIN-Global CE API
*/
class SourceDescriptorCodeFilter {
public NOT: SourceDescriptorCodeFilter;
public NULL: string[];
public NOTNULL: string[];
public id: number[];
public createdBy: number[];
public createdDate: DateFilter;
public modifiedBy: number[];
public modifiedDate: DateFilter;
public ownedBy: number[];
public ownedDate: DateFilter;
public code: string[];
public sourceDescriptorFilter: Partial<SourceDescriptorFilter>;
}
export default SourceDescriptorCodeFilter;
import AclSid from '@gringlobal-ce/client/model/acl/AclSid';
import SourceDescriptorCode from '@gringlobal-ce/client/model/gringlobal/SourceDescriptorCode';
import SysLang from '@gringlobal-ce/client/model/gringlobal/SysLang';
/**
* SourceDescriptorCodeLang
*
* GRIN-Global CE API
*/
class SourceDescriptorCodeLang {
public createdBy: number;
public createdDate: Date;
public modifiedBy: number;
public modifiedDate: Date;
public ownedBy: AclSid;
public ownedDate: Date;
public entity: SourceDescriptorCode;
public description: string;
public title: string;
public sysLang: SysLang;
public id: number;
}
export default SourceDescriptorCodeLang;
import DateFilter from '@gringlobal-ce/client/model/gringlobal/DateFilter';
import StringFilter from '@gringlobal-ce/client/model/common/StringFilter';
import NumberFilter from '@gringlobal-ce/client/model/common/NumberFilter';
/**
* SourceDescriptorFilter
*
* GRIN-Global CE API
*/
class SourceDescriptorFilter {
public NOT: SourceDescriptorFilter;
public NULL: string[];
public NOTNULL: string[];
public id: number[];
public createdBy: number[];
public createdDate: DateFilter;
public modifiedBy: number[];
public modifiedDate: DateFilter;
public ownedBy: number[];
public ownedDate: DateFilter;
public categoryCode: string[];
public codedName: string[];
public dataTypeCode: string[];
public description: StringFilter;
public coded: boolean;
public maxLength: NumberFilter;
public note: StringFilter;
public numericFormat: string[];
public numericMaximum: NumberFilter;
public numericMinimum: NumberFilter;
public ontologyUrl: string[];
public originalValueFormat: string[];
public originalValueTypeCode: string[];
}
export default SourceDescriptorFilter;
import AclSid from '@gringlobal-ce/client/model/acl/AclSid';
import SourceDescriptor from '@gringlobal-ce/client/model/gringlobal/SourceDescriptor';
import SysLang from '@gringlobal-ce/client/model/gringlobal/SysLang';
/**
* SourceDescriptorLang
*
* GRIN-Global CE API
*/
class SourceDescriptorLang {
public createdBy: number;
public createdDate: Date;
public modifiedBy: number;
public modifiedDate: Date;
public ownedBy: AclSid;
public ownedDate: Date;
public entity: SourceDescriptor;
public description: string;
public title: string;
public sysLang: SysLang;
public id: number;
}
export default SourceDescriptorLang;
import TranslatedSourceDescriptorCode from '@gringlobal-ce/client/model/gringlobal/TranslatedSourceDescriptorCode';
/**
* TranslatedSourceDescriptor
*
* GRIN-Global CE API
*/
class TranslatedSourceDescriptor {
public createdBy: string;
public createdDate: Date;
public modifiedBy: string;
public modifiedDate: Date;
public ownedBy: string;
public ownedDate: Date;
public id: number;
public categoryCode: string;
public codedName: string;
public dataTypeCode: string;
public isCoded: string;
public maxLength: number;
public numericFormat: string;
public numericMaximum: number;
public numericMinimum: number;
public ontologyUrl: string;
public originalValueFormat: string;
public originalValueTypeCode: string;
public note: string;
public title: string;
public description: string;
public codes: TranslatedSourceDescriptorCode[];
}
export default TranslatedSourceDescriptor;
import AclSid from '@gringlobal-ce/client/model/acl/AclSid';
import SourceDescriptor from '@gringlobal-ce/client/model/gringlobal/SourceDescriptor';
/**
* TranslatedSourceDescriptorCode
*
* GRIN-Global CE API
*/
class TranslatedSourceDescriptorCode {
public createdBy: number;
public createdDate: Date;
public modifiedBy: number;
public modifiedDate: Date;
public ownedBy: AclSid;
public ownedDate: Date;
public code: string;
public id: number;
public sourceDescriptor: SourceDescriptor;
public title: string;
public description: string;
}
export default TranslatedSourceDescriptorCode;
......@@ -76,6 +76,12 @@ import InventoryViabilityAction from './InventoryViabilityAction';
import InventoryViabilityRule from './InventoryViabilityRule';
import InventoryViabilityRuleFilter from './InventoryViabilityRuleFilter';
import AuditLogFilter from './AuditLogFilter';
import SourceDescriptor from './SourceDescriptor';
import SourceDescriptorFilter from './SourceDescriptorFilter';
import SourceDescriptorLang from './SourceDescriptorLang';
import SourceDescriptorCode from './SourceDescriptorCode';
import SourceDescriptorCodeFilter from './SourceDescriptorCodeFilter';
import SourceDescriptorCodeLang from './SourceDescriptorCodeLang';
export {
AuditLog,
......@@ -120,6 +126,12 @@ export {
InventoryViabilityActionFilter, InventoryViabilityAction,
InventoryViabilityRule,
InventoryViabilityRuleFilter,
SourceDescriptor,
SourceDescriptorFilter,
SourceDescriptorLang,
SourceDescriptorCode,
SourceDescriptorCodeFilter,
SourceDescriptorCodeLang,
};
......@@ -158,6 +170,8 @@ type OrderRequestItemActionFilteredPage = FilteredPage<OrderRequestItemAction, O
type InventoryViabilityFilteredPage = FilteredPage<InventoryViability, InventoryViabilityFilter>;
type InventoryViabilityActionFilteredPage = FilteredPage<InventoryViabilityAction, InventoryViabilityActionFilter>;
type InventoryViabilityRuleFilteredPage = FilteredPage<InventoryViabilityRule, InventoryViabilityRuleFilter>;
type SourceDescriptorFilteredPage = FilteredPage<SourceDescriptor, SourceDescriptorFilter>;
type SourceDescriptorCodeFilteredPage = FilteredPage<SourceDescriptorCode, SourceDescriptorCodeFilter>;
// Crop Trait Observation
interface IObservationData {
......@@ -210,5 +224,7 @@ export {
IWithObservationsData,
InventoryViabilityFilteredPage,
InventoryViabilityActionFilteredPage,
InventoryViabilityRuleFilteredPage
InventoryViabilityRuleFilteredPage,
SourceDescriptorFilteredPage,
SourceDescriptorCodeFilteredPage
};
......@@ -96,7 +96,13 @@
"InventoryViabilityRule": "Inventory viability rule",
"InventoryViabilityRule_plural": "Inventory viability rules",
"InventoryViabilityData": "Inventory viability data",
"InventoryViabilityData_plural": "Inventory viability datas"
"InventoryViabilityData_plural": "Inventory viability datas",
"SourceDescriptor": "Source descriptor",
"SourceDescriptor_plural": "Source descriptors",
"SourceDescriptorCode": "Source descriptor code",
"SourceDescriptorCode_plural": "Source descriptor codes",
"SourceDescriptorLang": "Source descriptor translation",
"SourceDescriptorLang_plural": "Source descriptor translations"
},
"Cooperator": {
"id": "Cooperator ID",
......@@ -1196,5 +1202,28 @@
"shipAddress": "Shipping address",
"shipCountry": "Shipping country",
"shipTelephone": "Shipping telephone"
},
"SourceDescriptor": {
"codedName": "Descriptor name",
"categoryCode": "Category",
"dataTypeCode": "Data Type",
"isCoded": "Is Coded?",
"maxLength": "Max Length",
"numericFormat": "Numeric Format",
"numericMaximum": "Numeric Maximum",
"numericMinimum": "Numeric Minimum",
"originalValueTypeCode": "Original Value Type",
"originalValueFormat": "Original Value Format",
"ontologyUrl": "Ontology URL"
},
"SourceDescriptorCode": {
"sourceDescriptor": "Descriptor",
"code": "Code"
},
"SourceDescriptorLang": {
"sourceDescriptor": "Descriptor",
"sysLang": "Language",
"title": "Title",
"description": "Description"
}
}
import * as UrlTemplate from 'url-template';
import * as QueryString from 'query-string';
import { AxiosInstance, AxiosRequestConfig } from 'axios';
import SourceDescriptor from '@gringlobal-ce/client/model/gringlobal/SourceDescriptor';
import TranslatedSourceDescriptor from '@gringlobal-ce/client/model/gringlobal/TranslatedSourceDescriptor';
import SourceDescriptorLang from '@gringlobal-ce/client/model/gringlobal/SourceDescriptorLang';
import SourceDescriptorCode from '@gringlobal-ce/client/model/gringlobal/SourceDescriptorCode';
import TranslatedSourceDescriptorCode from '@gringlobal-ce/client/model/gringlobal/TranslatedSourceDescriptorCode';
import SourceDescriptorCodeLang from '@gringlobal-ce/client/model/gringlobal/SourceDescriptorCodeLang';
import SourceDescriptorFilter from '@gringlobal-ce/client/model/gringlobal/SourceDescriptorFilter';
import SourceDescriptorCodeFilter from '@gringlobal-ce/client/model/gringlobal/SourceDescriptorCodeFilter';
import { SourceDescriptorCodeFilteredPage, SourceDescriptorFilteredPage } from '@gringlobal-ce/client/model/gringlobal';
import { IPageRequest } from '@gringlobal-ce/client/model/page';
const URL_UPDATE = `/api/v1/a/source-descriptor`;
const URL_CREATE = `/api/v1/a/source-descriptor`;
const URL_UPDATE_LANG = UrlTemplate.parse(`/api/v1/a/source-descriptor/{entityId}/lang/{sysLangId}`);
const URL_DELETE_LANG = UrlTemplate.parse(`/api/v1/a/source-descriptor/{entityId}/lang/{sysLangId}`);
const URL_UPDATE_CODE = `/api/v1/a/source-descriptor/code`;
const URL_CREATE_CODE = `/api/v1/a/source-descriptor/code`;
const URL_UPDATE_CODE_LANG = UrlTemplate.parse(`/api/v1/a/source-descriptor/code/{entityId}/lang/{sysLangId}`);
const URL_DELETE_CODE_LANG = UrlTemplate.parse(`/api/v1/a/source-descriptor/code/{entityId}/lang/{sysLangId}`);
const URL_LIST = `/api/v1/a/source-descriptor/list`;
const URL_LIST_CODE = `/api/v1/a/source-descriptor/code/list`;
const URL_GET = UrlTemplate.parse(`/api/v1/a/source-descriptor/{id}`);
const URL_REMOVE = UrlTemplate.parse(`/api/v1/a/source-descriptor/{id}`);
const URL_LIST_LANG = UrlTemplate.parse(`/api/v1/a/source-descriptor/{entityId}/langs`);
const URL_GET_CODE = UrlTemplate.parse(`/api/v1/a/source-descriptor/code/{id}`);
const URL_REMOVE_CODE = UrlTemplate.parse(`/api/v1/a/source-descriptor/code/{id}`);
const URL_LIST_CODE_LANG = UrlTemplate.parse(`/api/v1/a/source-descriptor/code/{entityId}/langs`);
/**
* SourceDescriptor service
*
* GRIN-Global CE API
*/
class SourceDescriptorService {
private _axios: AxiosInstance;
public constructor(axios: AxiosInstance) {
this._axios = axios;
}
/**
* update at /api/v1/a/source-descriptor
*
* @param data Request body
* @param xhrConfig additional xhr config
*/
public update = (data: Partial<SourceDescriptor>, xhrConfig?: AxiosRequestConfig): Promise<SourceDescriptor> => {
const apiUrl = URL_UPDATE;
// console.log(`Fetching from ${apiUrl}`);
const content = { data };
return this._axios.request({
...xhrConfig,
url: apiUrl,
method: 'PUT',
...content,
}).then(({ data }) => data as SourceDescriptor);
}
/**
* create at /api/v1/a/source-descriptor
*
* @param data Request body
* @param xhrConfig additional xhr config
*/
public create = (data: TranslatedSourceDescriptor, xhrConfig?: AxiosRequestConfig): Promise<TranslatedSourceDescriptor> => {
const apiUrl = URL_CREATE;
// console.log(`Fetching from ${apiUrl}`);
const content = { data };
return this._axios.request({
...xhrConfig,
url: apiUrl,
method: 'POST',
...content,
}).then(({ data }) => data as TranslatedSourceDescriptor);
}
/**
* updateLang at /api/v1/a/source-descriptor/{entityId}/lang/{sysLangId}
*
* @param data Request body
* @param entityId undefined
* @param sysLangId undefined
* @param xhrConfig additional xhr config
*/
public updateLang = (data: SourceDescriptorLang, entityId: number, sysLangId: number, xhrConfig?: AxiosRequestConfig): Promise<SourceDescriptorLang> => {
const apiUrl = URL_UPDATE_LANG.expand({ entityId, sysLangId });
// console.log(`Fetching from ${apiUrl}`);
const content = { data };
return this._axios.request({
...xhrConfig,
url: apiUrl,
method: 'PUT',
...content,
}).then(({ data }) => data as SourceDescriptorLang);
}
/**
* deleteLang at /api/v1/a/source-descriptor/{entityId}/lang/{sysLangId}
*
* @param entityId undefined
* @param sysLangId undefined
* @param xhrConfig additional xhr config
*/
public deleteLang = (entityId: number, sysLangId: number, xhrConfig?: AxiosRequestConfig): Promise<SourceDescriptorLang> => {
const apiUrl = URL_DELETE_LANG.expand({ entityId, sysLangId });
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
return this._axios.request({
...xhrConfig,
url: apiUrl,
method: 'DELETE',
...content,
}).then(({ data }) => data as SourceDescriptorLang);
}
/**
* updateCode at /api/v1/a/source-descriptor/code
*
* @param data Request body
* @param xhrConfig additional xhr config
*/
public updateCode = (data: SourceDescriptorCode, xhrConfig?: AxiosRequestConfig): Promise<SourceDescriptorCode> => {
const apiUrl = URL_UPDATE_CODE;
// console.log(`Fetching from ${apiUrl}`);
const content = { data };
return this._axios.request({
...xhrConfig,
url: apiUrl,
method: 'PUT',
...content,
}).then(({ data }) => data as SourceDescriptorCode);
}
/**
* createCode at /api/v1/a/source-descriptor/code
*
* @param data Request body
* @param xhrConfig additional xhr config
*/
public createCode = (data: TranslatedSourceDescriptorCode, xhrConfig?: AxiosRequestConfig): Promise<TranslatedSourceDescriptorCode> => {
const apiUrl = URL_CREATE_CODE;
// console.log(`Fetching from ${apiUrl}`);
const content = { data };
return this._axios.request({
...xhrConfig,
url: apiUrl,
method: 'POST',
...content,
}).then(({ data }) => data as TranslatedSourceDescriptorCode);
}
/**
* updateCodeLang at /api/v1/a/source-descriptor/code/{entityId}/lang/{sysLangId}
*
* @param data Request body
* @param entityId undefined
* @param sysLangId undefined
* @param xhrConfig additional xhr config
*/
public updateCodeLang = (data: SourceDescriptorCodeLang, entityId: number, sysLangId: number, xhrConfig?: AxiosRequestConfig): Promise<SourceDescriptorCodeLang> => {
const apiUrl = URL_UPDATE_CODE_LANG.expand({ entityId, sysLangId });
// console.log(`Fetching from ${apiUrl}`);
const content = { data };
return this._axios.request({
...xhrConfig,
url: apiUrl,
method: 'PUT',
...content,
}).then(({ data }) => data as SourceDescriptorCodeLang);
}
/**
* deleteCodeLang at /api/v1/a/source-descriptor/code/{entityId}/lang/{sysLangId}
*
* @param entityId undefined
* @param sysLangId undefined
* @param xhrConfig additional xhr config
*/
public deleteCodeLang = (entityId: number, sysLangId: number, xhrConfig?: AxiosRequestConfig): Promise<SourceDescriptorCodeLang> => {
const apiUrl = URL_DELETE_CODE_LANG.expand({ entityId, sysLangId });
// console.log(`Fetching from ${apiUrl}`);
const content = { /* No content in request body */ };
return this._axios.request({
...xhrConfig,
url: apiUrl,
method: 'DELETE',
...content,
}).then(({ data }) => data as SourceDescriptorCodeLang);
}