|
- const messageModel = require("../../../model/messageModel");
- ("use strict");
-
- /**
- * Read the documentation (https://strapi.io/documentation/developer-docs/latest/concepts/models.html#lifecycle-hooks)
- * to customize this model
- */
-
- module.exports = {
- // lifecycles: {
- // async beforeCreate(data) {
- // var checkData = await strapi
- // .query("chats")
- // .find({
- // session_key: data.session_key,
- // phoneNumber: data.phoneNumber,
- // });
- // if (checkData) {
- // throw strapi.errors.badRequest("Chats already exist");
- // }
- // var data = await messageModel
- // .asyncLoadClient(data.session_key)
- // .catch((message) => {
- // throw strapi.errors.badRequest(`error loading clients ${message}`);
- // });
- // if (data["TYPE"] == "READY") {
- // } else if (data["TYPE"] == "AUTH_FAILURE") {
- // throw strapi.errors.badRequest(`error loading clients ${message}`);
- // }
- // },
- // },
- };
|