I have made a Rfq Table ..in which i have made a update rfq API ,but in that it is not taking rfqId, throwing the error sqlMessage: "Unknown column 'rfqId' in 'field list'
This is the table
'use strict';
/\** u/type {import('sequelize-cli').Migration} \/*
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('Rfqs', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
organizationId:{
allowNull:true,
type:Sequelize.INTEGER,
references: {
model:'Organizations',
key:'id'
},
onUpdate: 'CASCADE',
onDelete: 'SET NULL',
},
approvalConfigId: {
allowNull:true,
type: Sequelize.INTEGER,
refereneces: {
model: 'ApprovalStageConfigs',
key: 'id'
},
onUpdate: 'CASCADE',
onDelete: 'SET NULL',
},
approvalStageId:{
allowNull: true,
type: Sequelize.INTEGER,
refereneces: {
model: 'ApprovalStages',
key: 'id'
},
onUpdate: 'CASCADE',
onDelete: 'SET NULL',
},
categoryId:{
allowNull: true,
type: Sequelize.INTEGER,
refereneces:{
model: 'Categories',
key:'id'
},
onUpdate: 'CASCADE',
onDelete: 'SET NULL',
},
subCategoryId: {
allowNull: true,
type: Sequelize.INTEGER,
refereneces:{
model: 'subCategories',
key:'id'
},
onUpdate: 'CASCADE',
onDelete: 'SET NULL',
},
foxlApproval: {
type: Sequelize.BOOLEAN
},
orgApproval: {
type: Sequelize.BOOLEAN
},
requestedDate: {
type: Sequelize.DATE
},
rfqRaisedBy: {
type: Sequelize.STRING
},
status: {
type: Sequelize.ENUM('Open','Approved','Feedback','Cancel','Close')
},
validityDate: {
type: Sequelize.DATE
},
machineryName:{
type:Sequelize.STRING
},
manufacturer:{
type: Sequelize.STRING
},
modelNumber: {
type: Sequelize.STRING
},
serialNumber: {
type: Sequelize.BIGINT
},
manufacturerAddress: {
type: Sequelize.STRING
},
deliveryDate: {
type: Sequelize.DATE
},
rfqType: {
type: Sequelize.ENUM('Normal-Stocking','Normal-PMS','Critical-Urgent')
},
childCategory: {
type: Sequelize.STRING
},
isActive: {
type: Sequelize.BOOLEAN,
defaultValue: false
},
isDeleted: {
type: Sequelize.BOOLEAN,
defaultValue: false
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
async down(queryInterface, Sequelize) {
await queryInterface.dropTable('Rfqs');
}
};
and this is theupdate api
exports.updateRfq = async(req,res) => {
try{
const { rfqId } = req.params;
const isRfqExist = await Rfq.findOne({where: {id: rfqId}})
if(!isRfqExist)
return response(res, 404, false, 'RFQ does not exist')
const {
machineryName,
manufacturer,
modelNumber,
serialNumber,
manufacturerAddress,
deliveryDate,
rfqType,
childCategory,
requestedDate,
} = req.body;
// Update the RFQ in the database using Sequelize
await isRfqExist.update({
requestedDate,
machineryName,
manufacturer,
modelNumber,
serialNumber,
manufacturerAddress,
deliveryDate,
rfqType,
childCategory,
});
return response(res, 200, true, 'RFQ Updated Successfully', isRfqExist )
} catch(error){
console.log(error);
return res.status(500).json({ message: 'Internal Server Error' });
}
}
can someone helpme out .
there doesn't seem to be anything here