wa_strapi
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 line
704 B

  1. "use strict";
  2. /**
  3. * Cron config that gives you an opportunity
  4. * to run scheduled jobs.
  5. *
  6. * The cron format consists of:
  7. * [SECOND (optional)] [MINUTE] [HOUR] [DAY OF MONTH] [MONTH OF YEAR] [DAY OF WEEK]
  8. *
  9. * See more details here: https://strapi.io/documentation/developer-docs/latest/concepts/configurations.html#cron-tasks
  10. */
  11. module.exports = {
  12. "*/3 * * * * *": async () => {
  13. const draftArticleToPublish = await strapi.api.message.services.message.find(
  14. {
  15. _sort: "send_from:desc",
  16. state: "QUEUE",
  17. }
  18. );
  19. draftArticleToPublish.forEach(async (message) => {
  20. await strapi.api.message.services.message.update(
  21. { id: message.id },
  22. { state: "SENT" }
  23. );
  24. });
  25. },
  26. };