Merge pull request #148 from pluginpal/feature/document-service
refactor: replace the entity service with the document servicepull/149/head 2.0.0
commit
79a4a0b41c
|
@ -1,7 +1,7 @@
|
||||||
const queryFallBack = {
|
const queryFallBack = {
|
||||||
create: async (queryString, options) => {
|
create: async (queryString, options) => {
|
||||||
try {
|
try {
|
||||||
const newEntity = await strapi.entityService.create(queryString, options);
|
const newEntity = await strapi.documents(queryString).create(options);
|
||||||
|
|
||||||
return newEntity;
|
return newEntity;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -11,7 +11,10 @@ const queryFallBack = {
|
||||||
update: async (queryString, options) => {
|
update: async (queryString, options) => {
|
||||||
try {
|
try {
|
||||||
const entity = await strapi.query(queryString).findOne(options);
|
const entity = await strapi.query(queryString).findOne(options);
|
||||||
const updatedEntity = await strapi.entityService.update(queryString, entity.id, options);
|
const updatedEntity = await strapi.documents(queryString).update({
|
||||||
|
documentId: entity.documentId,
|
||||||
|
...options,
|
||||||
|
});
|
||||||
|
|
||||||
return updatedEntity;
|
return updatedEntity;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -21,7 +24,9 @@ const queryFallBack = {
|
||||||
delete: async (queryString, options) => {
|
delete: async (queryString, options) => {
|
||||||
try {
|
try {
|
||||||
const entity = await strapi.query(queryString).findOne(options);
|
const entity = await strapi.query(queryString).findOne(options);
|
||||||
await strapi.entityService.delete(queryString, entity.id);
|
await strapi.documents(queryString).delete({
|
||||||
|
documentId: entity.documentId,
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await strapi.query(queryString).delete(options);
|
await strapi.query(queryString).delete(options);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue