Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 18x 18x 18x 18x 18x 1x 1x 1x 1x 1x 1x | import ProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/ProcessDto';
import { checkErrorInResponse, NAME as APPLICATION_NAME, ResponseState } from '../PohodaApplication';
import APohodaConnector from './APohodaConnector';
export const NAME = `${APPLICATION_NAME}-put-stock-connector`;
export default class PohodaPutStockConnector extends APohodaConnector<IInput, IOutput, IResponse> {
public getName(): string {
return NAME;
}
protected getSchema(): string {
return 'http://www.stormware.cz/schema/version_2/stock.xsd';
}
// eslint-disable-next-line @typescript-eslint/require-await
protected async createItemData(dto: ProcessDto<IInput>): Promise<object> {
const { id, ...data } = dto.getJsonData();
return {
/* eslint-disable @typescript-eslint/naming-convention */
'itemData:stock': {
'@_version': '2.0',
'itemData:actionType': {
'itemData:update': {
'filter:filter': {
'filter:id': id,
},
},
},
'itemData:stockHeader': Object.entries(data).map(([key, value]) => ({ [`itemData:${key}`]: value })),
},
/* eslint-enable @typescript-eslint/naming-convention */
};
}
protected getItemData(data: IResponse): IOutput {
checkErrorInResponse(data.stockItemResponse.importDetails?.detail);
return data.stockItemResponse.producedDetails;
}
}
export interface IInput {
id: number;
count: number;
}
export interface IResponse {
stockItemResponse: {
importDetails?: {
detail: {
state: ResponseState;
note: string;
};
};
producedDetails: {
id: string;
code: string;
};
};
}
export interface IOutput {
id: string;
code: string;
}
|