const sequelize = require("../config/dbconnection");
const Sequelize = require("sequelize");
const Admin = require("../models/admin");
const { empty, getAgoString } = require("../Helpers/Common");


const TaskMessage=sequelize.define('staff_task_messages',{
  ID:{ type: Sequelize.INTEGER, allowNull: false, primaryKey: true, autoIncrement: true },
  taskid:{type:Sequelize.INTEGER,allowNull:false,defaultValue:null},
  userid:{type:Sequelize.INTEGER,allowNull:false},
  message:{type:Sequelize.TEXT,allowNull:true,defaultValue:null},
  timestamp:{type:Sequelize.INTEGER,allowNull:false,defaultValue:null},
  sent_from_installation_id: {
    type: Sequelize.INTEGER,
    allowNull: true,
    defaultValue: null,
  },
},{timestamps:false})


const addMessages=async(data)=>{
    try {
         let result = await TaskMessage.create(data)
        if(!empty(result)){
            return true
        }else{
            return false
        }

    } catch (error) {
        console.log("errorrrrrrrrrrrrrrrrrrrrr"+error);
    }
}
module.exports={
    addMessages,
}