/
githubmirror
/
strapi
Обзор
Документация
Войти
/
githubmirror
/
strapi
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
examples/plugins/todo-example/server/src/services/tasks.js
32 строки
749 B
Alexandre Bodin
chore: improve admin panel DX & add more advance plugin example
09 сен 2024, 12:11
09 сен 2024, 12:11
bceb8fa
Код
Авторство
О чём код?
'use strict'; module.exports = ({ strapi }) => ({ async createTask(data) { return strapi.documents('plugin::todo.task').create({ data }); }, async updateTask({ documentId, data }) { return strapi.documents('plugin::todo.task').update({ documentId, data, }); }, async deleteTask(documentId) { return strapi.documents('plugin::todo.task').delete({ documentId, }); }, async listRelatedTasks({ documentId, slug }) { return strapi.db.query('plugin::todo.task').findMany({ where: { // Only pass the related ID if it's pointing to a collection type ...(documentId !== '' && { target_id: documentId, }), target_type: slug, }, }); }, });