This commit is contained in:
sriramv 2022-06-08 12:20:51 +05:30
parent 674aa3dd60
commit bd8f138011
3 changed files with 8 additions and 45 deletions

View File

@ -12,8 +12,6 @@ exports.createNotes = async (req, res) =>
notes = JSON.stringify(value); notes = JSON.stringify(value);
data = { data = {
losid: req.body.losid, losid: req.body.losid,
module_name: req.body.module_name,
entity_reference: req.body.entity_reference,
notes: notes, notes: notes,
sheet_no : value.index + 1, sheet_no : value.index + 1,
user_id: req.body.user_id, user_id: req.body.user_id,
@ -46,7 +44,7 @@ exports.updateNotes = async (req, res) =>
for (const value of req.body.notes) for (const value of req.body.notes)
{ {
sheet_no = value.index + 1; sheet_no = value.index + 1;
notesData = await Workingnotes.findOne({where :{losid : req.body.losid , module_name : req.body.module_name, sheet_no : sheet_no , is_active:1}}); notesData = await Workingnotes.findOne({where :{losid : req.body.losid , sheet_no : sheet_no , is_active:1}});
if(notesData != undefined) if(notesData != undefined)
{ {
@ -62,8 +60,6 @@ exports.updateNotes = async (req, res) =>
notes = JSON.stringify(value); notes = JSON.stringify(value);
data = { data = {
losid: req.body.losid, losid: req.body.losid,
module_name: req.body.module_name,
entity_reference: req.body.entity_reference,
notes: notes, notes: notes,
sheet_no : value.index + 1, sheet_no : value.index + 1,
user_id: req.body.user_id, user_id: req.body.user_id,
@ -95,18 +91,9 @@ exports.notesList = async (req, res) =>
{ {
try try
{ {
notesData = await Workingnotes.findAll({where :{losid : req.query.losid, is_active:1}}).catch(err=>{console.log(err);});
if(req.query.entity_reference == undefined)
{
notesData = await Workingnotes.findAll({where :{losid : req.query.losid , module_name : req.query.module_name , is_active:1}})
.catch(err=>{console.log(err);});
res.send({'status':200 , message:"Success." ,'data': notesData}); res.send({'status':200 , message:"Success." ,'data': notesData});
}else{
notesData = await Workingnotes.findAll({where :{losid : req.query.losid , module_name : req.query.module_name , entity_reference : req.query.entity_reference, is_active:1}});
res.send({'status':200 , message:"Success." ,'data': notesData});
}
} catch(err) { } catch(err) {
res.status(500).send({'status':404, res.status(500).send({'status':404,

View File

@ -17,8 +17,6 @@ module.exports = (sequelize, DataTypes) => {
Workingnotes.init( Workingnotes.init(
{ {
losid: { type: DataTypes.STRING }, losid: { type: DataTypes.STRING },
module_name: { type: DataTypes.STRING },
entity_reference: { type: DataTypes.STRING },
notes: { type: DataTypes.STRING }, notes: { type: DataTypes.STRING },
sheet_no: { type: DataTypes.STRING }, sheet_no: { type: DataTypes.STRING },
user_id: { type: DataTypes.INTEGER }, user_id: { type: DataTypes.INTEGER },

View File

@ -33,16 +33,6 @@ module.exports = app => {
* schema: * schema:
* type: string * type: string
* required: true * required: true
* - in: query
* name: module_name
* schema:
* type: string
* required: true
* - in: query
* name: entity_reference
* schema:
* type: string
* required: false
* example: * example:
* responses: * responses:
* 200: * 200:
@ -59,14 +49,6 @@ module.exports = app => {
* type: string * type: string
* description: losid * description: losid
* example: MW112233 * example: MW112233
* module_name:
* type: string
* description: gst (module_name)
* example: gst
* entity_reference:
* type: string
* description: (gst_no/cin_no)->entity_reference key
* example: cin756kjbjh76
* notes: * notes:
* type: array * type: array
* description: * description:
@ -109,14 +91,6 @@ module.exports = app => {
* type: string * type: string
* description: losid * description: losid
* example: MW112233 * example: MW112233
* module_name:
* type: string
* description: gst (module_name)
* example: gst
* entity_reference:
* type: string
* description: (gst_no/cin_no)->entity_reference key
* example: cin756kjbjh76
* notes: * notes:
* type: array * type: array
* description: * description:
@ -129,6 +103,10 @@ module.exports = app => {
* type: integer * type: integer
* description: * description:
* example: 1 * example: 1
* createdby:
* type: integer
* description:
* example: 1
*/ */
/** /**
* @swagger * @swagger