wa_strapi
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

33 righe
940 B

  1. const messageModel = require("../../../model/messageModel");
  2. ("use strict");
  3. /**
  4. * Read the documentation (https://strapi.io/documentation/developer-docs/latest/concepts/models.html#lifecycle-hooks)
  5. * to customize this model
  6. */
  7. module.exports = {
  8. // lifecycles: {
  9. // async beforeCreate(data) {
  10. // var checkData = await strapi
  11. // .query("chats")
  12. // .find({
  13. // session_key: data.session_key,
  14. // phoneNumber: data.phoneNumber,
  15. // });
  16. // if (checkData) {
  17. // throw strapi.errors.badRequest("Chats already exist");
  18. // }
  19. // var data = await messageModel
  20. // .asyncLoadClient(data.session_key)
  21. // .catch((message) => {
  22. // throw strapi.errors.badRequest(`error loading clients ${message}`);
  23. // });
  24. // if (data["TYPE"] == "READY") {
  25. // } else if (data["TYPE"] == "AUTH_FAILURE") {
  26. // throw strapi.errors.badRequest(`error loading clients ${message}`);
  27. // }
  28. // },
  29. // },
  30. };