mirror of
https://github.com/strapi/strapi.git
synced 2025-11-13 16:52:18 +00:00
Handle relations on create data bookshelf
This commit is contained in:
parent
a2214ed0d7
commit
dba7361c89
@ -59,7 +59,9 @@ module.exports = {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
add: (values) => {
|
add: (values) => {
|
||||||
return <%= globalID %>.forge(values).save();
|
const data = await <%= globalID %>.forge(_.omit(values, _.keys(_.groupBy(strapi.models.<%= id %>.associations, 'alias')))).save();
|
||||||
|
await strapi.hook.bookshelf.load().manageRelations(strapi.models, <%= globalID %>, _.merge(_.clone(data.toJSON()), { values }));
|
||||||
|
return data;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user