Working on add item and add supplier

development
Visoth 9 months ago
parent 89477bb0c2
commit cad8ce36af
  1. 3
      .gitignore
  2. 3
      Config/config.env
  3. 12
      Config/relation.js
  4. 59
      Controller/Authentication.js
  5. 117
      Controller/Category.js
  6. 124
      Controller/Items.js
  7. 12
      Controller/Store.js
  8. 52
      Controller/Supplier.js
  9. 0
      Controller/User.js
  10. 14
      Middleware/auth.js
  11. 43
      Model/CategoryDetailModel.js
  12. 45
      Model/CategoryModel.js
  13. 15
      Model/ItemModel.js
  14. 6
      Model/StoreModel.js
  15. 83
      Model/SupplierModel.js
  16. 8
      app.js
  17. 27
      routes/category.js
  18. 23
      routes/item.js
  19. 9
      routes/supplier.js
  20. BIN
      upload/store/tmp_post/2024-07-16_09-24-43_Artboard 2.png

3
.gitignore vendored

@ -1 +1,2 @@
node_modules
node_modules
uploads

@ -9,6 +9,9 @@ APP_CODE=POS
STORE_IMAGE_LOCATION = uploads/store_image/
USER_IMAGE_LOCATION = uploads/user_image/
ITEM_CATEGORY_LOCATION=uploads/item_category/
ITEM_CATEGORY_DETAIL_LOCATION = uploads/item_category/category_detail/
ITEM_IMAGE_LOCATION = uploads/item/
ADMIN_USERNAME=bcsa
ADMIN_PASS=Bc@dmin

@ -0,0 +1,12 @@
const CATEGORY = require('../Model/CategoryModel');
const CATEGORY_DETAIL = require('../Model/CategoryDetailModel');
module.exports = async () => {
CATEGORY.hasMany(CATEGORY_DETAIL, {
foreignKey: 'CATE_ID'
});
CATEGORY_DETAIL.belongsTo(CATEGORY_DETAIL, {
foreignKey: 'CATE_ID'
});
}

@ -8,10 +8,11 @@ const StoreInfo = require("../Model/StoreModel")
const DataModel = require("../Model/TD_DATA");
const UserModel = require("../Model/User");
const sequelize = require("sequelize");
const { log } = require("winston");
// Login User
exports.login = asyncHandler(async (req, res, next) => {
const { username, password, DB_CODE, APP_CODE = 'MBN', CUST_CODE } = req.body
const { username, password, DB_CODE, APP_CODE = 'POS', CUST_CODE } = req.body
console.log("USERNAME ", username)
console.log("PASSWORD ", password)
console.log("DB CODE ", DB_CODE)
@ -76,11 +77,15 @@ exports.login = asyncHandler(async (req, res, next) => {
var app = await AppModel.findOne({
where: {
APP_CODE: process.env.APP_CODE,
USER_ID: user.USER_ID
USER_ID: user.USER_ID,
DB_CODE: DB_CODE
},
order: [['USER_ID']],
})
console.log("APP ", app)
console.log(">>>>>>> APP : ", app)
console.log(">>>>>>> APP : ", process.env.APP_CODE)
console.log(">>>>>>> APP : ", user.USER_ID)
console.log(">>>>>>> APP : ", DB_CODE)
if (!app) {
throw "You're not allowed to use this app"
@ -101,29 +106,18 @@ exports.login = asyncHandler(async (req, res, next) => {
)
}
// var customer;
// if (user.USER_TYPE == "C") {
// customer = await Customer.findOne({
// attributes: {
// exclude: ['PICTURE'],
// },
// where: {
// ADD_CODE: user.FIELD_0
// },
// include: [
// {
// attributes: {
// exclude: ["IMAGE"],
// },
// model: Market,
// },
// {
// model: CustomerAnalysis
// },
// ],
// })
// }
var store = await StoreInfo.findOne({
where: {
DB_CODE: app.DB_CODE,
DB_STAT: "A"
},
raw: true
})
console.log("STORE ", store)
if (!store) {
throw "Store not found or disabled"
}
if (!token) {
throw "Something Went Wrong"
@ -198,9 +192,6 @@ exports.checkUsername = asyncHandler(async (req, res, next) => {
console.log("IS ALLOWED ", isAllowed)
// updated : 2021-09-15
// for POS the table TDMSAPP DB_CODE = ST_CODE
if (isAllowed.length == 0) {
return next(new ErrorResponse("User is not allowed to use this app", 403))
} else {
@ -209,20 +200,21 @@ exports.checkUsername = asyncHandler(async (req, res, next) => {
user.PRESETS = {}
// GET Store Name from SDSTINFO by using ST_CODE from APP_MODEL
// GET Store Name from SDSTINFO by using DB_CODe from APP_MODEL
await Promise.all(isAllowed.map(async (app) => {
console.log((">>>>>>> APP DB CODE", app))
const { ST_NAME } = await StoreInfo.findOne({
const { DB_NAME } = await StoreInfo.findOne({
where: {
ST_CODE: app.DB_CODE
DB_CODE: app.DB_CODE,
DB_STAT: "A"
},
raw: true
})
const DBName = app.DB_CODE + ' - ' + ST_NAME
const DBName = app.DB_CODE + ' - ' + DB_NAME
if (!user.PRESETS[DBName]) {
user.PRESETS[DBName] = []
}
@ -238,6 +230,7 @@ exports.checkUsername = asyncHandler(async (req, res, next) => {
user.PRESETS[DBName].push(userPresets)
}
}))
user.profile_image = "uploads/store_image/" + user.USER_ID + ".jpg"
res.status(200).send(
JSON.stringify(user)

@ -0,0 +1,117 @@
const asyncHandler = require("../Middleware/async");
const sequelize = require('sequelize')
const CategoryModel = require("../Model/CategoryModel");
const CategoryDetailModel = require("../Model/CategoryDetailModel");
const ErrorResponse = require("../utils/errorResponse");
const SuccessResponse = require("../utils/successResponse");
const db = require("../Config/db")
const fs = require('fs')
const dotenv = require('dotenv')
const dateFormat = require("dateformat");
const Location = process.env.ITEM_CATEGORY_LOCATION;
const Detail_Location = process.env.ITEM_CATEGORY_DETAIL_LOCATION;
exports.getAllCategoryOfStore = asyncHandler(async (req, res, next) => {
try {
var categories = await CategoryModel.findAll({
where: {
DB_CODE: req.user.DB_CODE
}
})
const categoryData = categories.map(category => {
let categoryObject = category.get({ plain: true });
categoryObject.image = `${Location}${req.user.DB_CODE}_${category.ID}.jpg`;
return categoryObject;
});
res.status(200).json({
success: true,
data: categoryData
})
} catch (e) {
console.log("ERROR : ", e)
return next(new ErrorResponse(e, 500));
}
})
exports.createCategory = asyncHandler(async (req, res, next) => {
if (!req.files) {
return next(new ErrorResponse("Please upload a file", 400))
}
if (!req.body.data) {
return next(new ErrorResponse("Please provide data", 400))
}
var data = JSON.parse(req.body.data)
console.log("DATA : ", data)
var date = dateFormat(new Date(), "yyyy-mm-dd")
if (!data.DESC_KH || !data.DESC_EN) {
return next(new ErrorResponse("Please provide all required fields", 400))
}
try {
const category = await CategoryModel.create({
DB_CODE: req.user.DB_CODE,
ANALYSIS_ID: "",
DESC_KH: data.DESC_KH,
DESC_EN: data.DESC_EN,
DESC_CN: data.DESC_CN,
CREATED_DATE: date,
CREATED_BY: req.user.USER_ID,
STATUS: 1
})
const fileName = Location + req.user.DB_CODE + "_" + category.ID + ".jpg";
fs.copyFileSync(req.files.photo[0].path, fileName);
fs.unlinkSync(req.files.photo[0].path);
res.send(new SuccessResponse("Operation Successful"));
} catch (e) {
console.log("ERROR : ", e)
fs.unlinkSync(req.files.photo[0].path);
return next(new ErrorResponse("Server Error", 500));
}
})
exports.createCategoryDetail = asyncHandler(async (req, res, next) => {
if (!req.files || !req.files.photo)
return next(new ErrorResponse("Please input photo file", 403));
if (!req.body.data)
return next(new ErrorResponse("Please input data json", 403));
var data = JSON.parse(req.body.data);
var date = dateFormat(new Date(), "yyyy-mm-dd HH:MM:ss");
try {
const cateDetail = await CategoryDetailModel.create(
{
DB_CODE: req.user.DB_CODE,
CATE_ID: data.CATE_ID,
ANALYSIS_ID: "",
DESC_KH: data.DESC_KH,
DESC_EN: data.DESC_EN,
DESC_CN: data.DESC_CN,
CREATED_DATE: date,
CREATED_BY: req.user.USER_ID,
STATUS: 1
}
);
const fileName = Detail_Location + req.user.DB_CODE + "_" + cateDetail.ID + ".jpg";
fs.copyFileSync(req.files.photo[0].path, fileName);
fs.unlinkSync(req.files.photo[0].path);
res.send(new SuccessResponse("Operation Successful"));
} catch (e) {
console.log("ERROR : ", e)
fs.unlinkSync(req.files.photo[0].path);
return next(new ErrorResponse(e, 500));
}
})

@ -3,11 +3,17 @@ const sequelize = require('sequelize')
const DBInfo = require("../Model/Database");
const ItemModel = require("../Model/ItemModel");
const ErrorResponse = require("../utils/errorResponse");
const fs = require('fs')
const dateFormat = require("dateformat");
exports.getAllItemsByStore = asyncHandler(async (req, res, next) => {
exports.getAllItems = asyncHandler(async (req, res, next) => {
console.log("GET ITEM INFO EXEC ")
try {
let items = await ItemModel.findAll()
let items = await ItemModel.findAll({
where: {
DB_CODE: req.user.DB_CODE
}
})
console.log("ITEMS ", items)
if (!items) {
return next(new ErrorResponse("No item found", 400));
@ -21,5 +27,115 @@ exports.getAllItems = asyncHandler(async (req, res, next) => {
return next(new ErrorResponse(err, 400));
}
})
exports.createItemByStore = asyncHandler(async (req, res, next) => {
try {
var date = dateFormat(new Date(), "yyyy-mm-dd HH:mm:ss")
const data = JSON.parse(req.body['data']);
const items = data['items'];
var photo = req.file.path
let imageData = fs.readFileSync(req.file.path)
const itemCode = items['ITEM_CODE'];
const itemBarCode = items['ITEM_BCODE']
const itemDes = items['ITEM_DESC'];
const unitStock = items['UNIT_STOCK'] ?? '1';
const unitSale = items['UNIT_SALE'] ?? '1';
const catCode = items['CAT_CODE']; // CAT_CODE -> CAT_DETAIL_ID
const itemCost1 = items['ITEM_COST1'];
const itemPrice1 = items['ITEM_PRICE1'];
if (!itemCode || !itemBarCode || !itemDes || !unitStock || !unitSale || !catCode || !itemCost1 || !itemPrice1) {
throw ("Please provide all required fields");
}
const existingItem = await ItemModel.findOne({
where: {
ITEM_CODE: itemCode,
DB_CODE: req.user.DB_CODE
}
});
if (existingItem) {
throw (`ITEM_CODE ${itemCode} already exists`);
}
console.log("DATE : ", date)
const item = await ItemModel.create({
ITEM_CODE: itemCode,
ITEM_BCODE: itemBarCode,
ITEM_DESC: itemDes,
DB_CODE: req.user.DB_CODE,
UNIT_STOCK: unitStock,
UNIT_SALE: unitSale,
CAT_CODE: catCode,
ITEM_STAT: "A",
USER_CREA: req.user.USER_ID,
DATE_CREA: date.toString(),
ITEM_TYPE: "S", // S -> Kit Stock N -> Min Kit Stock I-> ដរករទ
ITEM_PRICE1: itemPrice1,
ITEM_COST1: itemCost1,
ITEM_COST2: 0,
ITEM_PRICE2: 0,
ITEM_CUS1: "",
ITEM_CUS2: "",
ITEM_CUS3: "",
ITEM_CUS4: "",
ITEM_CUS5: "",
ITEM_CUS6: "",
ITEM_CUS7: "",
ITEM_CUS8: "",
ITEM_CUS9_KH: "",
ITEM_CUS10_KH: "",
USER_UPDT: req.user.USER_NAME,
DATE_UPDT: date,
})
let folderPath = process.env.ITEM_IMAGE_LOCATION + "/" + req.user.DB_CODE + "/"
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, {
recursive: true,
})
fs.writeFileSync(folderPath + item.ITEM_CODE + '.jpg', imageData)
fs.unlinkSync(req.file.path)
res.status(200).send({
success: true,
data: item
})
} catch (err) {
console.log("ERROR CREATE ITEM", err)
fs.unlinkSync(req.file.path)
return next(new ErrorResponse(err, 400));
}
})
})
exports.checkIfItemExist = asyncHandler(async (req, res, next) => {
try {
const item = await ItemModel.findOne({
where: {
ITEM_CODE: req.params.item_code,
DB_CODE: req.user.DB_CODE
}
})
if (!item) {
return next(new ErrorResponse("Item not found", 400));
}
res.status(200).send({
success: true,
data: item
})
} catch (err) {
console.log("ERROR CHECK ITEM", err)
return next(new ErrorResponse(err, 400));
}
}
)

@ -54,7 +54,7 @@ exports.registerStore = asyncHandler(async (req, res, next) => {
// check whether store name is existing
const existingStore = await StoreModel.findOne({
where: { ST_NAME: store_name }
where: { DB_NAME: store_name }
})
if (existingStore) {
@ -82,9 +82,9 @@ exports.registerStore = asyncHandler(async (req, res, next) => {
const nextStoreCode = await generateNextStoreCode()
let store = await StoreModel.create(
{
ST_CODE: nextStoreCode,
ST_NAME: store_name,
ST_STAT: 'A',
DB_CODE: nextStoreCode,
DB_NAME: store_name,
DB_STAT: 'A',
DATE_CREA: date,
DATE_UPDT: date,
DATE_FORMAT: "MM/dd/yyyy",
@ -172,7 +172,7 @@ exports.registerStore = asyncHandler(async (req, res, next) => {
async function generateNextStoreCode() {
const lastStore = await StoreModel.findOne({
order: [['ST_CODE', 'DESC']]
order: [['DB_CODE', 'DESC']]
});
if (!lastStore) {
@ -180,7 +180,7 @@ async function generateNextStoreCode() {
}
// use regex to separate letters and numbers
let [letters, numbers] = lastStore.ST_CODE.match(/[A-Z]+|\d+/g);
let [letters, numbers] = lastStore.DB_CODE.match(/[A-Z]+|\d+/g);
// letters -> AA , numbers -> 001
numbers = parseInt(numbers);

@ -0,0 +1,52 @@
const asyncHandler = require("../Middleware/async");
const sequelize = require('sequelize')
const db = require('../Config/db')
const SupplierModel = require('../Model/SupplierModel')
const ErrorResponse = require('../utils/ErrorResponse')
const fs = require('fs');
const dateFormat = require('dateformat');
exports.getAllSupplier = asyncHandler(async (req, res, next) => {
try {
const supplier = await SupplierModel.findAll({
where: {
DB_CODE: req.user.DB_CODE
}
}
)
res.status(200).send({
success: true,
data: supplier
})
} catch (e) {
throw new ErrorResponse(e, 400)
}
})
exports.createSupplier = asyncHandler(async (req, res, next) => {
const data = JSON.parse(req.body.data)
if (!data.ADD_NAME || !data.ADD_CODE || !data.phoneNumber) {
throw new ErrorResponse('Please provide all required fields', 400)
}
try {
data.DB_CODE = req.user.DB_CODE
const supplier = await SupplierModel.create({
DB_CODE: req.user.DB_CODE,
USER_CODE: req.user.USER_NAME,
ADD_NAME: data.ADD_NAME,
ADD_CODE: data.ADD_CODE,
ADD_LINE_1: data.addressLine1,
})
res.status(200).send({
success: true,
data: supplier
})
} catch (e) {
throw new ErrorResponse(e, 400)
}
})

@ -3,6 +3,7 @@ const asyncHandler = require('./async')
const ErrorResponse = require("../utils/errorResponse")
const dotenv = require("dotenv")
const UserModel = require("../Model/User")
const StoreModel = require("../Model/StoreModel")
const { raw } = require('express')
//Require Dotenv
@ -21,6 +22,7 @@ exports.protect = asyncHandler(async (req, res, next) => {
}
try {
console.log("TOKEN ", token)
const decoded = jwt.verify(token, process.env.JWT_SECRET)
console.log("decode : ", decoded)
@ -74,11 +76,23 @@ exports.protect = asyncHandler(async (req, res, next) => {
return next(new ErrorResponse("User disabled", 400));
}
let store = await StoreModel.findOne({
where: {
DB_CODE: decoded.dbCode,
DB_STAT: 'A'
}
})
if (!store) {
return next(new ErrorResponse("Store not found or disabled. Please try again", 400))
}
let preset = null
let typeId = ""
let saleType = ""
let warehouse = ""
console.log("USER ", req.user)
req.user.DB_CODE = decoded.dbCode
next()
} catch (err) {

@ -0,0 +1,43 @@
const sequelize = require('sequelize')
const db = require("../Config/db")
const CategoryDetail = db.define(
"TD_CATEGORY_DETAIL",
{
ID: {
type: sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
},
CATE_ID: {
type: sequelize.INTEGER,
},
ANALYSIS_ID: {
type: sequelize.STRING,
},
DESC_KH: {
type: sequelize.STRING,
},
DESC_EN: {
type: sequelize.STRING,
},
DESC_CN: {
type: sequelize.STRING,
},
CREATED_DATE: {
type: sequelize.STRING,
},
CREATED_BY: {
type: sequelize.STRING,
},
STATUS: {
type: sequelize.STRING,
},
},
{
timestamps: false,
freezeTableName: true,
}
);
CategoryDetail.removeAttribute("id");
module.exports = CategoryDetail;

@ -0,0 +1,45 @@
const sequelize = require('sequelize')
const db = require("../Config/db")
const Category = db.define(
"TD_CATEGORY",
{
ID: {
type: sequelize.INTEGER,
primaryKey: true,
autoIncrement: true
},
DB_CODE: {
type: sequelize.STRING
},
ANALYSIS_ID: {
type: sequelize.STRING
},
DESC_KH: {
type: sequelize.STRING
},
DESC_EN: {
type: sequelize.STRING
},
DESC_CN: {
type: sequelize.STRING
},
CREATED_DATE: {
type: sequelize.STRING
},
CREATED_BY: {
type: sequelize.STRING
},
STATUS: {
type: sequelize.INTEGER
}
}, {
timestamps: false,
freezeTableName: true,
}
);
Category.removeAttribute('id');
module.exports = Category;

@ -8,6 +8,9 @@ const ItemModel = db.define(
type: sequelize.STRING,
primaryKey: true
},
DB_CODE: {
type: sequelize.STRING
},
ITEM_BCODE: {
type: sequelize.STRING
},
@ -24,21 +27,21 @@ const ItemModel = db.define(
},
ITEM_COST1: {
type: sequelize.INTEGER
type: sequelize.NUMERIC
},
ITEM_PRICE1: {
type: sequelize.INTEGER
type: sequelize.NUMERIC
},
UNIT_SALE: {
type: sequelize.STRING
},
ITEM_COST2: {
type: sequelize.INTEGER
type: sequelize.NUMERIC
},
ITEM_PRICE2: {
type: sequelize.INTEGER
type: sequelize.NUMERIC
},
CAT_CODE: {
@ -82,13 +85,13 @@ const ItemModel = db.define(
type: sequelize.STRING
},
DATE_CREA: {
type: sequelize.DATE
type: sequelize.STRING
},
USER_UPDT: {
type: sequelize.STRING
},
DATE_UPDT: {
type: sequelize.DATE
type: sequelize.STRING
},
ITEM_IMG: {
type: sequelize.BLOB,

@ -4,11 +4,11 @@ const db = require('../Config/db')
const StoreModel = db.define(
'TDSTINFO',
{
ST_CODE: {
DB_CODE: {
type: sequelize.STRING,
primaryKey: true
},
ST_NAME: {
DB_NAME: {
type: sequelize.STRING
},
DATE_DEFAULT: {
@ -29,7 +29,7 @@ const StoreModel = db.define(
THO_SEP: {
type: sequelize.CHAR
},
ST_STAT: {
DB_STAT: {
type: sequelize.CHAR
},
USER_CREA: {

@ -0,0 +1,83 @@
const sequelize = require('sequelize')
const db = require('../Config/db')
const SupplierModel = db.define(
'TDADDR',
{
ADD_CODE: {
type: sequelize.STRING,
primaryKey: true
},
ADD_LOOKUP: {
type: sequelize.STRING
},
ADD_NAME: {
type: sequelize.STRING
},
ADD_LINE_1: {
type: sequelize.STRING
},
ADD_LINE_2: {
type: sequelize.STRING
},
ADD_LINE_3: {
type: sequelize.STRING
},
ADD_LINE_4: {
type: sequelize.STRING
},
ADD_LINE_5: {
type: sequelize.STRING
},
ADD_TEL: {
type: sequelize.STRING
},
ADD_FAX: {
type: sequelize.STRING
},
ADD_EMAIL: {
type: sequelize.STRING
},
ADD_WEB: {
type: sequelize.STRING
},
ADD_CONT: {
type: sequelize.STRING
},
ADD_COM_1: {
type: sequelize.STRING
},
ADD_COM_2: {
type: sequelize.STRING
},
ADD_STAT: {
type: sequelize.CHAR
},
ADD_TYPE: {
type: sequelize.CHAR
},
TRANS_PRES: {
type: sequelize.CHAR
},
USER_CREA: {
type: sequelize.STRING
},
USER_UPDT: {
type: sequelize.STRING
},
USER_CODE: {
type: sequelize.STRING
},
},
{
timestamps: false,
freezeTableName: true,
}
)
SupplierModel.removeAttribute('id')
module.exports = SupplierModel;

@ -11,6 +11,8 @@ dotenv.config({
path: "./Config/config.env",
})
require("./Config/relation")();
// //Route Files
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
@ -18,7 +20,9 @@ var authenticationRouter = require('./routes/authentication')
var dbInfoRouter = require('./routes/db')
var itemRouter = require('./routes/item')
var storeRouter = require('./routes/store')
var categoryRouter = require('./routes/category')
var subscriptionRouter = require('./routes/subscription')
var supplierRouter = require('./routes/supplier')
//CORS
@ -40,7 +44,7 @@ app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use("/upload", express.static("upload"));
app.use("/uploads", express.static("uploads"));
app.use('/', indexRouter);
app.use('/users', usersRouter);
@ -51,6 +55,8 @@ app.use("/api/v1/database", dbInfoRouter)
app.use("/api/v1/item", itemRouter)
app.use("/api/v1/store", storeRouter)
app.use("/api/v1/subscriptions", subscriptionRouter)
app.use("/api/v1/category", categoryRouter)
app.use("/api/v1/supplier", supplierRouter)

@ -0,0 +1,27 @@
const express = require("express");
const route = express.Router();
const controller = require("../Controller/Category");
const { protect } = require("../Middleware/auth");
const multer = require("multer");
const moment = require("moment");
var storage = multer.diskStorage({
destination: function (req, file, cb) {
if (file.fieldname == "photo") cb(null, "uploads/item_category/tmp_post");
},
filename: function (req, file, cb) {
cb(
null,
moment(Date.now()).format("YYYY-MM-DD_HH-mm-ss_") + file.originalname
);
},
});
var upload = multer({ storage: storage });
route.route("/").get(protect, controller.getAllCategoryOfStore);
route.route("/").post(protect, upload.fields([{ name: "photo", maxCount: 1 }]), controller.createCategory);
route.route("/category_detail").post(protect, upload.fields([{ name: "photo", maxCount: 1 }]), controller.createCategoryDetail);
module.exports = route;

@ -3,6 +3,27 @@ const route = express.Router()
const controller = require("../Controller/Items")
const { protect } = require("../Middleware/auth")
route.route("/").get(protect, controller.getAllItems)
const multer = require("multer");
const moment = require("moment");
var storage = multer.diskStorage({
destination: function (req, file, cb) {
if (file.fieldname == "item_image") cb(null, "uploads/item/tmp_post");
},
filename: function (req, file, cb) {
cb(
null,
moment(Date.now()).format("YYYY-MM-DD_HH-mm-ss_") + file.originalname
);
},
});
var upload = multer({ storage: storage });
route.route("/").get(protect, controller.getAllItemsByStore)
route.route("/").post(upload.single("item_image"), protect, controller.createItemByStore)
route.route("/checkExistItem").post(protect, controller.checkIfItemExist)
module.exports = route;

@ -0,0 +1,9 @@
const express = require("express");
const route = express.Router();
const controller = require("../Controller/Supplier");
const { protectAtlogin, protect } = require("../Middleware/auth");
route.route('/').get(protect, controller.getAllSupplier)
// route.route('/id').post(protect, controller.getSubscriptionByID)
module.exports = route;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 102 KiB

Loading…
Cancel
Save