mapProductManagerListUpgradeGoodsSimpleResponse.js 1.68 KB
/* eslint-disable jsdoc/require-property-description, jsdoc/require-returns-description */
/**
 * @typedef {Object} ProductManagerListUpgradeGoodsSimpleParams
 * @property {number} currentPage [optional] - 当前页码
 * @property {number} pageSize [optional] - 每页条数
 * @property {string} commodityCode [optional] - UID(产品编码,模糊查询)对应commodity_code
 * @property {string} productType [optional] - 产品类型 1-轻改 2-权益、延保
 */

/**
 * @typedef {Object} ProductManagerListUpgradeGoodsSimpleRow
 * @property {string} errId - 错误码
 * @property {string} data - 成功返回数据
 */

/**
 * @typedef {Object} ProductManagerListUpgradeGoodsSimplePageResponse
 * @property {number} [pageNum]
 * @property {number} [pageSize]
 * @property {number} [total]
 * @property {ProductManagerListUpgradeGoodsSimpleRow[]} [list]
 */

/**
 * dj.api.smartcarlife.productManager.listUpgradeGoodsSimple 响应 → 页面数据
 * @param {ProductManagerListUpgradeGoodsSimpleRow} [row]
 * @returns {ProductManagerListUpgradeGoodsSimpleRow}
 * @see __contracts__/dj_api_smartcarlife_productManager_listUpgradeGoodsSimple.contract.md
 */
export function mapProductManagerListUpgradeGoodsSimpleRow(row = {}) {
	return { ...row };
}

/**
 * @param {ProductManagerListUpgradeGoodsSimplePageResponse} [res]
 * @returns {ProductManagerListUpgradeGoodsSimplePageResponse}
 */
export function mapProductManagerListUpgradeGoodsSimplePageResponse(res = {}) {
	const list = Array.isArray(res.list) ? res.list.map(mapProductManagerListUpgradeGoodsSimpleRow) : [];
	return {
		...res,
		list,
		pageNum: res.pageNum ?? res.currentPage,
	};
}

export default mapProductManagerListUpgradeGoodsSimpleRow;