mirror of
https://github.com/strapi/strapi.git
synced 2025-07-26 02:20:32 +00:00
15 lines
316 B
JavaScript
15 lines
316 B
JavaScript
'use strict';
|
|
|
|
const _ = require('lodash');
|
|
|
|
module.exports = {
|
|
replaceIdByPrimaryKey: (params, model) => {
|
|
const newParams = { ...params };
|
|
if (_.has(params, 'id')) {
|
|
delete newParams.id;
|
|
newParams[model.primaryKey] = params[model.primaryKey] || params.id;
|
|
}
|
|
return newParams;
|
|
},
|
|
};
|