mirror of
https://github.com/strapi/strapi.git
synced 2025-12-29 08:04:51 +00:00
Remove relation on delete data bookshelf
This commit is contained in:
parent
915dd37942
commit
0a7b65be04
@ -26,12 +26,12 @@
|
||||
"cheerio": "^1.0.0-rc.2",
|
||||
"fs-extra": "^0.30.0",
|
||||
"sanitize.css": "^4.1.0",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.6.3",
|
||||
"strapi-helper-plugin": "file:../strapi-helper-plugin",
|
||||
"strapi-utils": "3.0.0-alpha.6.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^5.1.0",
|
||||
"eslint": "^4.9.0",
|
||||
"cross-env": "^5.1.1",
|
||||
"eslint": "^4.10.0",
|
||||
"eslint-config-airbnb": "^15.1.0",
|
||||
"eslint-config-airbnb-base": "^11.3.2",
|
||||
"eslint-config-prettier": "^2.6.0",
|
||||
@ -66,4 +66,4 @@
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,4 +56,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
"dependencies": {
|
||||
"fs-extra": "^4.0.1",
|
||||
"lodash": "^4.17.4",
|
||||
"strapi-admin": "3.0.0-alpha.6.3"
|
||||
"strapi-admin": "file:../strapi-admin"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
@ -41,4 +41,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ module.exports = {
|
||||
* @return {Promise}
|
||||
*/
|
||||
|
||||
add: (values) => {
|
||||
add: async (values) => {
|
||||
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;
|
||||
@ -72,7 +72,7 @@ module.exports = {
|
||||
|
||||
edit: async (params, values) => {
|
||||
await strapi.hook.bookshelf.load().manageRelations(strapi.models, <%= globalID %>, _.merge(_.clone(params), { values }));
|
||||
return <%= globalID %>.forge(params).save(_.omit(values, _.keys(_.groupBy(strapi.models.<%= id %>.associations, 'alias'))), {path: true});
|
||||
return <%= globalID %>.forge(params).save(_.omit(values, _.keys(_.groupBy(strapi.models.<%= id %>.associations, 'alias'))), {path: true});
|
||||
},
|
||||
|
||||
/**
|
||||
@ -82,6 +82,9 @@ module.exports = {
|
||||
*/
|
||||
|
||||
remove: (params) => {
|
||||
_.forEach(<%= globalID %>.associations, async association => {
|
||||
await <%= globalID %>.forge(params)[association.alias]().detach();
|
||||
});
|
||||
return <%= globalID %>.forge(params).destroy();
|
||||
},
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
"fs-extra": "^4.0.0",
|
||||
"get-installed-path": "^3.0.1",
|
||||
"lodash": "^4.17.4",
|
||||
"strapi-utils": "3.0.0-alpha.6.3"
|
||||
"strapi-utils": "file:../strapi-utils"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "npm prune"
|
||||
@ -46,4 +46,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
"fs-extra": "^4.0.0",
|
||||
"lodash": "^4.17.4",
|
||||
"reportback": "^2.0.1",
|
||||
"strapi-utils": "3.0.0-alpha.6.3"
|
||||
"strapi-utils": "file:../strapi-utils"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
@ -115,4 +115,4 @@
|
||||
"webpack-hot-middleware": "^2.18.2",
|
||||
"whatwg-fetch": "^2.0.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,4 +46,4 @@
|
||||
"npm": ">= 5.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
"mongoose-double": "0.0.1",
|
||||
"mongoose-float": "^1.0.2",
|
||||
"pluralize": "^6.0.0",
|
||||
"strapi-utils": "3.0.0-alpha.6.3"
|
||||
"strapi-utils": "file:../strapi-utils"
|
||||
},
|
||||
"strapi": {
|
||||
"isHook": true
|
||||
@ -49,4 +49,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,11 +46,11 @@
|
||||
"dependencies": {
|
||||
"prop-types": "^15.5.10",
|
||||
"react-select": "^1.0.0-rc.5",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.6.3"
|
||||
"strapi-helper-plugin": "file:../strapi-helper-plugin"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^5.1.0",
|
||||
"eslint": "^4.9.0",
|
||||
"cross-env": "^5.1.1",
|
||||
"eslint": "^4.10.0",
|
||||
"eslint-config-airbnb": "^15.1.0",
|
||||
"eslint-config-airbnb-base": "^11.3.2",
|
||||
"eslint-config-prettier": "^2.6.0",
|
||||
@ -65,4 +65,4 @@
|
||||
"rimraf": "^2.6.2",
|
||||
"webpack": "^3.8.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ export function* getTableExistance() {
|
||||
yield put(checkIfTableExistsSucceeded(tableExists));
|
||||
|
||||
} catch(error) {
|
||||
window.strapi.notification.error('An error occured');
|
||||
window.Strapi.notification.error('An error occured');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -36,8 +36,8 @@
|
||||
"strapi-generate-api": "3.0.0-alpha.6.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^5.1.0",
|
||||
"eslint": "^4.9.0",
|
||||
"cross-env": "^5.1.1",
|
||||
"eslint": "^4.10.0",
|
||||
"eslint-config-airbnb": "^15.1.0",
|
||||
"eslint-config-airbnb-base": "^11.3.2",
|
||||
"eslint-config-prettier": "^2.6.0",
|
||||
@ -50,7 +50,7 @@
|
||||
"plop": "^1.9.0",
|
||||
"prettier": "^1.7.4",
|
||||
"rimraf": "^2.6.2",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.6.3",
|
||||
"strapi-helper-plugin": "file:../strapi-helper-plugin",
|
||||
"webpack": "^3.8.1"
|
||||
},
|
||||
"author": {
|
||||
@ -70,4 +70,4 @@
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,8 +33,8 @@
|
||||
"reactstrap": "^4.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"cross-env": "^5.1.0",
|
||||
"eslint": "^4.9.0",
|
||||
"cross-env": "^5.1.1",
|
||||
"eslint": "^4.10.0",
|
||||
"eslint-config-airbnb": "^15.1.0",
|
||||
"eslint-config-airbnb-base": "^11.3.2",
|
||||
"eslint-config-prettier": "^2.6.0",
|
||||
@ -47,7 +47,7 @@
|
||||
"plop": "^1.9.0",
|
||||
"prettier": "^1.7.4",
|
||||
"rimraf": "^2.6.2",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.6.3",
|
||||
"strapi-helper-plugin": "file:../strapi-helper-plugin",
|
||||
"webpack": "^3.8.1"
|
||||
},
|
||||
"author": {
|
||||
@ -67,4 +67,4 @@
|
||||
"npm": ">= 3.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,4 +45,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,13 +52,13 @@
|
||||
"node-schedule": "^1.2.0",
|
||||
"semver": "^5.4.1",
|
||||
"stack-trace": "0.0.10",
|
||||
"strapi-generate": "3.0.0-alpha.6.3",
|
||||
"strapi-generate-admin": "3.0.0-alpha.6.3",
|
||||
"strapi-generate-api": "3.0.0-alpha.6.3",
|
||||
"strapi-generate-new": "3.0.0-alpha.6.3",
|
||||
"strapi-generate-policy": "3.0.0-alpha.6.3",
|
||||
"strapi-generate-service": "3.0.0-alpha.6.3",
|
||||
"strapi-utils": "3.0.0-alpha.6.3"
|
||||
"strapi-generate": "file:../strapi-generate",
|
||||
"strapi-generate-admin": "file:../strapi-generate-admin",
|
||||
"strapi-generate-api": "file:../strapi-generate-api",
|
||||
"strapi-generate-new": "file:../strapi-generate-new",
|
||||
"strapi-generate-policy": "file:../strapi-generate-policy",
|
||||
"strapi-generate-service": "file:../strapi-generate-service",
|
||||
"strapi-utils": "file:../strapi-utils"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
@ -85,4 +85,4 @@
|
||||
},
|
||||
"preferGlobal": true,
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user