@chevre/domain
Version:
Chevre Domain Library for Node.js
38 lines (37 loc) • 1.37 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.ownershipInfo2report = ownershipInfo2report;
/**
* 所有権レポートサービス
*/
// import * as json2csv from 'json2csv';
const moment = require("moment");
function ownershipInfo2report(params) {
var _a, _b, _c;
const ownershipInfo = params.ownershipInfo;
return {
id: ownershipInfo.id,
identifier: String(ownershipInfo.identifier),
ownedBy: (Array.isArray(ownershipInfo.ownedBy))
? {
typeOf: (_a = ownershipInfo.ownedBy[0]) === null || _a === void 0 ? void 0 : _a.typeOf,
id: String((_b = ownershipInfo.ownedBy[0]) === null || _b === void 0 ? void 0 : _b.id)
}
: {
typeOf: ownershipInfo.ownedBy.typeOf,
id: String(ownershipInfo.ownedBy.id)
},
typeOfGood: {
typeOf: ownershipInfo.typeOfGood.typeOf,
id: ownershipInfo.typeOfGood.id,
identifier: ownershipInfo.typeOfGood.identifier
},
ownedFrom: moment(ownershipInfo.ownedFrom)
.toISOString(),
ownedThrough: moment(ownershipInfo.ownedThrough)
.toISOString(),
seller: {
id: (_c = ownershipInfo.acquiredFrom) === null || _c === void 0 ? void 0 : _c.id
}
};
}
;