Compare commits

...

5 Commits

  1. 3
      .gitignore
  2. 6
      Config/config.env
  3. 12
      Config/relation.js
  4. 2
      Config/upload.js
  5. 106
      Controller/Authentication.js
  6. 239
      Controller/Category.js
  7. 1
      Controller/Database.js
  8. 142
      Controller/Inventory_Movement.js
  9. 213
      Controller/Items.js
  10. 145
      Controller/Store.js
  11. 50
      Controller/Subscriptions.js
  12. 112
      Controller/Supplier.js
  13. 0
      Controller/User.js
  14. 58
      Controller/Warehouse.js
  15. 14
      Middleware/auth.js
  16. 43
      Model/CategoryDetailModel.js
  17. 45
      Model/CategoryModel.js
  18. 140
      Model/Inventory_Movement_Model.js
  19. 15
      Model/ItemModel.js
  20. 10
      Model/StoreModel.js
  21. 31
      Model/SupplierItemModel.js
  22. 86
      Model/SupplierModel.js
  23. 0
      Model/TD_DATA.js
  24. 61
      Model/WarehouseModel.js
  25. 16
      app.js
  26. 718
      package-lock.json
  27. 2
      package.json
  28. 8
      routes/authentication.js
  29. 29
      routes/category.js
  30. 27
      routes/inventory_movement.js
  31. 23
      routes/item.js
  32. 21
      routes/store.js
  33. 9
      routes/subscription.js
  34. 27
      routes/supplier.js
  35. 27
      routes/warehouse.js
  36. BIN
      upload/user/tmp_post/2024-07-12_15-58-19_MB-POS.png
  37. BIN
      upload/user/tmp_post/2024-07-12_15-59-39_MB-POS.png
  38. BIN
      upload/user/tmp_post/2024-07-12_16-00-54_MB-POS.png
  39. BIN
      upload/user/tmp_post/2024-07-12_16-01-04_MB-POS.png
  40. BIN
      upload/user/tmp_post/2024-07-12_16-01-19_MB-POS.png
  41. BIN
      upload/user/tmp_post/2024-07-12_16-02-50_MB-POS.png
  42. BIN
      upload/user/tmp_post/2024-07-12_16-03-11_MB-POS.png
  43. BIN
      upload/user/tmp_post/2024-07-12_16-03-39_MB-POS.png
  44. BIN
      upload/user/tmp_post/2024-07-12_16-03-48_MB-POS.png
  45. BIN
      upload/user/tmp_post/2024-07-12_16-04-01_MB-POS.png
  46. BIN
      uploads/store_image/4308.jpg
  47. BIN
      uploads/store_image/4309.jpg
  48. BIN
      uploads/user_image/4308.jpg

3
.gitignore vendored

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

@ -7,6 +7,12 @@ JWT_COOKIE_EXPIRE=30
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/
SUPPLIER_IMAGE_LOCATION = uploads/supplier/
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'
});
}

@ -1,7 +1,7 @@
const multer = require("multer");
var storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, "uploads");
cb(null, "upload");
},
filename: function (req, file, cb) {
cb(null, Date.now() + "-" + file.originalname);

@ -5,17 +5,14 @@ const AppModel = require("../Model/AppModel");
const ErrorResponse = require("../utils/errorResponse");
const dbInfo = require("../Model/Database")
const StoreInfo = require("../Model/StoreModel")
const DataModel = require("../Model/BC_Data");
const multer = require("multer");
var storage = multer.diskStorage({
destination: function (req, file, cb) {
if (file.fieldname == "photo") cb(null, "upload/user/tmp_post")
}
})
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)
@ -80,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"
@ -105,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"
@ -147,7 +137,10 @@ exports.register = asyncHandler(async (req, res, next) => {
try {
var data = JSON.parse(req.body.data)
console.log("DATA ", data)
const photo = req.files.photo
const { testing } = data
console.log("TESTING ", testing);
// const { username, password, email, phone, userType, appCode, dbCode, custCode } = req.body
res.status(200).send({
success: true,
@ -199,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 {
@ -210,26 +200,26 @@ 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] = []
}
// // check user type
log("USER TYPE ", user.USER_TYPE)
if (user.USER_TYPE == "S" || user.USER_TYPE == "C") {
var userPresets = await DataModel.findAll({
where: {
@ -240,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)
@ -250,8 +241,41 @@ exports.checkUsername = asyncHandler(async (req, res, next) => {
return next(new ErrorResponse("Username is not available", 404))
}
} catch (e) {
if (req.files && req.files.store_image) {
const filePath = req.files.store_image[0].path;
fs.unlink(filePath, err => {
if (err) console.error("Error removing file", err);
});
}
throw new ErrorResponse(e, 400)
}
})
exports.checkExistingUsername = asyncHandler(async (req, res, next) => {
const { username } = req.query
try {
const existingUsername = await UserModel.findOne({
where: {
USER_NAME: sequelize.where(
sequelize.fn("LOWER", sequelize.col("USER_NAME")),
" = ", username.toLowerCase()
)
},
order: [["USER_ID"]]
})
if (existingUsername) {
return res.status(200).send({
success: true,
data: true
})
}
return res.status(200).send({
success: true,
data: false
})
} catch (err) {
console.log("ERROR CHECK EXISTING USERNAME", err)
return next(new ErrorResponse(err, 400));
}
})

@ -0,0 +1,239 @@
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.getAllBrand = 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;
});
const categoriesWithDetails = await Promise.all(categories.map(async (category) => {
const categoryDetails = await CategoryDetailModel.findAll({
where: {
STATUS: 1,
CATE_ID: category.ID
}
});
console.log("CATEGORY DETAIL ", categoryDetails);
// Return a new object merging the category data with its details
return {
...category.get({ plain: true }), // This assumes you're using Sequelize
CATEGORY_DETAIL: categoryDetails.map(detail => detail.get({ plain: true }))
};
}));
res.status(200).json({
success: true,
data: categoriesWithDetails
});
} catch (e) {
console.log("ERROR : ", e)
return next(new ErrorResponse(e, 500));
}
})
exports.createBrand = 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)
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";
if (req.files.photo) {
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)
if (req.files.photo) {
fs.unlinkSync(req.files.photo[0].path);
}
return next(new ErrorResponse(`Server Error ${e}`, 500));
}
})
exports.getCategoryDetailByID = asyncHandler(async (req, res, next) => {
try {
const { CATE_ID } = req.body;
if (!CATE_ID) return next(new ErrorResponse("Please provide brand information", 400));
var categoryDetails = await CategoryDetailModel.findAll({
where: {
STATUS: 1,
CATE_ID: CATE_ID
}
})
if (categoryDetails.length == 0) return next(new ErrorResponse("No data found", 400));
const categoryDetailData = categoryDetails.map(categoryDetail => {
let categoryDetailObject = categoryDetail.get({ plain: true });
categoryDetailObject.image = `${Detail_Location}${req.user.DB_CODE}_${categoryDetail.ID}.jpg`;
return categoryDetailObject;
});
res.status(200).json({
success: true,
data: categoryDetailData
})
} catch (e) {
console.log("ERROR : ", e)
return next(new ErrorResponse(e, 500));
}
})
exports.getAllCategory = asyncHandler(async (req, res, next) => {
try {
const categories = await CategoryModel.findAll({
where: {
DB_CODE: req.user.DB_CODE
}
});
if (!categories || categories.length === 0) {
return next(new ErrorResponse("No data found", 400));
}
// Process each category to attach details with additional brand description
const categoriesWithDetails = await Promise.all(categories.map(async (category) => {
const categoryDetails = await CategoryDetailModel.findAll({
where: {
STATUS: 1,
CATE_ID: category.ID
}
});
console.log("CATEGORY DETAIL ", categoryDetails);
// Map each detail to include the brand's English description
const detailedCategory = categoryDetails.map(detail => {
return {
...detail.get({ plain: true }), // Get plain detail object
BRAND_DESC_EN: category.get({ plain: true }).DESC_EN // Add brand description from the parent category
};
});
return detailedCategory; // Return an array of detailed categories
}));
// Flatten the array of arrays to a single array of all details
const flatDetails = categoriesWithDetails.flat();
res.status(200).json({
success: true,
data: flatDetails
});
} catch (e) {
console.log("ERROR : ", e);
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 {
// check whether CATE_ID is exist or not
const category = await CategoryModel.findOne({
where: {
ID: data.CATE_ID
}
})
if (!category) {
return next(new ErrorResponse("Brand not found", 404));
}
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";
// chcek if req file pass some value
if (req.files.photo) {
fs.copyFileSync(req.files.photo[0].path, fileName);
fs.unlinkSync(req.files)
}
// if (req.files || req.files.photo) {
// 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)
if (req.files.photo) {
fs.unlinkSync(req.files.photo[0].path);
}
return next(new ErrorResponse(e, 500));
}
})

@ -1,7 +1,6 @@
const asyncHandler = require("../Middleware/async");
const sequelize = require('sequelize')
const DBInfo = require("../Model/Database");
const { log } = require("winston");
exports.getDBInfo = asyncHandler(async (req, res, next) => {
console.log("GET DB INFO EXEC ")

@ -0,0 +1,142 @@
const asyncHandler = require("../Middleware/async");
const sequelize = require('sequelize')
const db = require("../Config/db");
const ErrorResponse = require("../utils/errorResponse");
const { getInventoryMovementTable } = require("../Model/Inventory_Movement_Model");
const ItemModel = require("../Model/ItemModel");
exports.getAllStock = asyncHandler(async (req, res, next) => {
try {
const userDBCode = req.user.DB_CODE;
if (!userDBCode) {
return next(new ErrorResponse("Store Code not found or disabled", 400));
}
const InventoryModel = getInventoryMovementTable(`${userDBCode}TDINVMOV`);
let allInventory = await InventoryModel.findAll({
raw: true
});
// Map over all inventory items and fetch associated item details
const inventoryWithDetails = await Promise.all(allInventory.map(async (inv) => {
const item = await ItemModel.findOne({
where: {
ITEM_CODE: inv.ITEM_CODE,
DB_CODE: userDBCode
},
attributes: ['ITEM_BCODE', 'ITEM_DESC', 'ITEM_COST1', 'ITEM_PRICE1', 'CAT_CODE'], // specify only the necessary fields to fetch
raw: true
});
// Merge item details with inventory data
return {
...inv,
ITEM_NAME: item ? item.ITEM_DESC : null,
ITEM_IMAGE: item ? item.ITEM_IMG : null,
ITEM_COST1: item ? item.ITEM_COST1 : null,
ITEM_PRICE1: item ? item.ITEM_PRICE1 : null,
};
}));
return res.status(200).json({
success: true,
data: inventoryWithDetails
});
} catch (err) {
console.log("ERROR GET ALL STORE", err);
return next(new ErrorResponse("Failed to retrieve stock", 400)); // More specific error message
}
});
exports.createStock = asyncHandler(async (req, res, next) => {
const t = await db.transaction()
try {
const userDBCode = req.user.DB_CODE
if (!userDBCode) {
return next(new ErrorResponse("Store Code not found or disabled", 400));
}
const InventoryModel = getInventoryMovementTable(`${userDBCode}TDINVMOV`)
const maxSequenceQty = await db.query(`SELECT MAX(SEQUENCE)+1 AS MAX FROM ${userDBCode}TDINVMOV`,
{
transaction: t,
type: sequelize.QueryTypes.SELECT
}).catch((err) => {
throw `Cannot query max sequence ${err}`;
})
// check whether ITEM_CODE exists in the database
const itemCode = await ItemModel.findOne({
where: {
ITEM_CODE: req.body.ITEM_CODE,
DB_CODE: userDBCode
}
})
if (!itemCode) {
return next(new ErrorResponse("Item Code not found", 400));
}
const { MOV_PRD, MOV_REF, MOV_LINE, LOCATION, ITEM_CODE, MOV_DATE, STATUS, IR_STAT, BATCH_NO, BATCH_LINE, LINE_REF, QUANTITY, COST, TOTAL } = req.body
const newInventory = await InventoryModel.create({
SEQUENCE: maxSequenceQty[0]?.MAX || 1,
ID_ALLOC: req.user.USER_ID,
REC_TYPE: "T",
MOV_UNITS: "1",
MOV_TYPE: "OB",
UPDTE_PHYS: "",
UPDTE_ORDR: "",
ALLOC_REF: req.user.DB_CODE + generateTimestampBasedAllocRef(),
ACCNT_CODE: "",
ASSET_CODE: req.body.ASSET_CODE || "",
ANAL_M0: req.body.ANAL_M0 || "",
ANAL_M1: req.body.ANAL_M1 || "",
ANAL_M2: req.body.ANAL_M2 || "",
ANAL_M3: req.body.ANAL_M3 || "",
ANAL_M4: req.body.ANAL_M4 || "",
ANAL_M5: req.body.ANAL_M5 || "",
ANAL_M6: req.body.ANAL_M6 || "",
ANAL_M7: req.body.ANAL_M7 || "",
ANAL_M8: req.body.ANAL_M8 || "",
ANAL_M9: req.body.ANAL_M9 || "",
ORIG_LINE_NO: req.body.ORIG_LINE_NO || "",
PO_VALUE: req.body.PO_VALUE || 0,
ID_ENTERED: req.user.USER_NAME,
ID_ALLOC: req.user.USER_NAME,
MOV_PRD, MOV_REF, MOV_LINE, LOCATION, ITEM_CODE, MOV_DATE, STATUS, IR_STAT, BATCH_NO, BATCH_LINE, LINE_REF, QUANTITY, COST, TOTAL,
})
// const allInventory = await InventoryModel.findAll()
return res.status(200).json({
success: true,
data: newInventory
})
} catch (err) {
console.log("ERROR GET ALL STORE", err)
await t.rollback()
return next(new ErrorResponse(err, 400));
}
})
function generateTimestampBasedAllocRef() {
const now = new Date();
const year = now.getFullYear();
const month = (now.getMonth() + 1).toString().padStart(2, '0'); // Month is zero-indexed, add 1 and pad it to ensure two digits
const day = now.getDate().toString().padStart(2, '0');
const hours = now.getHours().toString().padStart(2, '0');
const minutes = now.getMinutes().toString().padStart(2, '0');
const seconds = now.getSeconds().toString().padStart(2, '0');
const milliseconds = now.getMilliseconds().toString().padStart(3, '0');
const allocRef = `-${year}${month}${day}${hours}${minutes}`;
console.log("ALLOC REF", allocRef)
return allocRef;
}

@ -2,24 +2,217 @@ const asyncHandler = require("../Middleware/async");
const sequelize = require('sequelize')
const DBInfo = require("../Model/Database");
const ItemModel = require("../Model/ItemModel");
const ErrorResponse = require("../utils/errorResponse");
const CategoryModel = require("../Model/CategoryModel");
const SupplierItemModel = require("../Model/SupplierItemModel");
const ErrorResponse = require("../utils/ErrorResponse");
const SuccessResponse = require("../utils/SuccessResponse");
const fs = require('fs')
const dateFormat = require("dateformat");
const path = require('path');
const { log } = require("console");
const CategoryDetail = require("../Model/CategoryDetailModel");
exports.getAllItems = asyncHandler(async (req, res, next) => {
console.log("GET ITEM INFO EXEC ")
exports.getAllItemsByStore = asyncHandler(async (req, res, next) => {
try {
let items = await ItemModel.findAll()
console.log("ITEMS ", items)
if (!items) {
return next(new ErrorResponse("No item found", 400));
}
let items = await ItemModel.findAll({
where: {
DB_CODE: req.user.DB_CODE
}
});
console.log("DB CODE ", req.user.DB_CODE);
const folderPath = path.join(process.env.ITEM_IMAGE_LOCATION, req.user.DB_CODE);
// Use Promise.all to wait for all promises to resolve
items = await Promise.all(items.map(async (item) => {
let itemObject = item.get({ plain: true });
try {
// Get category name
var category = await CategoryDetail.findOne({
where: {
ID: item.CAT_CODE,
// DB_CODE: req.user.DB_CODE
}
});
if (category) {
itemObject.CAT_DESC_EN = category.DESC_EN;
itemObject.CAT_DESC_KH = category.DESC_KH;
itemObject.CAT_DESC_CN = category.DESC_CN;
}
} catch (catErr) {
console.error("Error fetching category", catErr);
// Optionally handle specific category fetch error
}
// Check existence of the image file
const imagePath = path.join(folderPath, `${item.ITEM_CODE}.jpg`);
itemObject.ITEM_IMG = fs.existsSync(imagePath) ? imagePath : "";
return itemObject;
}));
res.status(200).send({
success: true,
data: items
});
} catch (err) {
console.error("ERROR GET ALL ITEMS", err);
return next(new ErrorResponse(err.message, 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['CATE_CODE']; // CAT_CODE -> CAT_DETAIL_ID
const supplierCode = items['SUPP_CODE'];
const itemCost1 = items['ITEM_COST1'];
const itemPrice1 = items['ITEM_PRICE1'];
if (!itemBarCode || !itemDes || !catCode || !itemCost1 || !itemPrice1) {
throw ("Please provide all required fields");
}
// var itemCode = await generateNextItemCode();
const existingItem = await ItemModel.findOne({
where: {
ITEM_CODE: itemCode,
DB_CODE: req.user.DB_CODE
}
});
if (existingItem) {
throw (`ITEM_CODE ${itemCode} already exists`);
}
await ItemModel.sequelize.transaction(async (t) => {
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_NAME,
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,
})
// add to TDITEMSP table
await SupplierItemModel.create({
ITEM_CODE: itemCode,
DB_CODE: req.user.DB_CODE,
SUPP_CODE: supplierCode,
SUPP_COST: itemCost1,
SUPP_UNIT: "1"
})
let folderPath = process.env.ITEM_IMAGE_LOCATION + "/" + req.user.DB_CODE + "/"
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, {
recursive: true,
})
log("ITEM CODE ", item.ITEM_CODE)
fs.writeFileSync(folderPath + item.ITEM_CODE + '.jpg', imageData)
fs.unlinkSync(req.file.path)
res.send(new SuccessResponse("Operation Successful"));
})
} 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 GET ALL ITEMS", err)
console.log("ERROR CHECK ITEM", err)
return next(new ErrorResponse(err, 400));
}
}
)
async function generateNextItemCode() {
try {
})
const lastItem = await ItemModel.findOne({
order: [['ITEM_CODE', 'DESC']]
});
console.log("LAST ITEM ", lastItem)
if (!lastItem) {
return '0001'; // Starting point if no suppliers are present
}
console.log("LAST ITEM CODE ", lastItem.ITEM_CODE)
let nextCode = parseInt(lastItem.ITEM_CODE, 10) + 1;
console.log("NEXT CODE ", nextCode)
// Check if the number is less than 10000 for zero-padding
if (nextCode < 10000) {
return nextCode.toString().padStart(4, '0');
} else {
// If it's 10000 or more, just return the number
return nextCode.toString();
}
}
catch (e) {
console.log("CATCH ERROR IN GENERATE ITEM CODE ", e)
}
}

@ -1,9 +1,13 @@
const asyncHandler = require("../Middleware/async");
const sequelize = require('sequelize')
const StoreModel = require("../Model/StoreModel");
const UserModel = require("../Model/User");
const DataModel = require("../Model/TD_DATA");
const AppModel = require("../Model/AppModel");
const db = require("../Config/db");
const ErrorResponse = require("../utils/errorResponse");
const SuccessResponse = require("../utils/successResponse");
const fs = require('fs');
const dateFormat = require("dateformat");
@ -26,25 +30,61 @@ exports.getStoreInfo = asyncHandler(async (req, res, next) => {
})
exports.registerStore = asyncHandler(async (req, res, next) => {
const { store_name } = req.body
var data = JSON.parse(req.body.data)
console.log("REQUEST DATA ", data)
var photo = req.file.path
let imageData = fs.readFileSync(req.file.path)
console.log("PHOTO ", photo)
const { store_name, username, password, first_name, last_name, phone_number, plan_id, map } = data
const t = await db.transaction()
try {
const t = await db.transaction()
if (!username || !password || !first_name || !last_name || !store_name || !phone_number) {
throw ("Please provide information!")
}
if (!plan_id) {
throw "Please provide subscription plan"
}
if (!photo) {
throw "Please provide store image!"
}
// check whether store name is existing
const existingStore = await StoreModel.findOne({
where: { ST_NAME: store_name }
where: { DB_NAME: store_name }
})
if (existingStore) {
return next(new ErrorResponse("Store name already exists", 400));
throw "Store name already exists"
// return next(new ErrorResponse("Store name already exists", 400));
}
const existingUsername = await UserModel.findOne({
where: {
USER_NAME: sequelize.where(
sequelize.fn("LOWER", sequelize.col("USER_NAME")),
" = ", username.toLowerCase()
)
},
order: [["USER_ID"]]
})
if (existingUsername) {
throw "Username already exists"
// return next(new ErrorResponse("Username already exists", 400));
}
var date = dateFormat(new Date(), "mm/dd/yyyy");
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",
@ -53,29 +93,86 @@ exports.registerStore = asyncHandler(async (req, res, next) => {
SB_DECICMA: '2',
DEC_SEP: '.',
THO_SEP: ',',
USER_CREA: req.user.USER_NAME,
USER_CREA: "",
USER_UPDT: '',
MAP: map
}, { transaction: t }
)
await createStoreTables(nextStoreCode, t);
// GET last user id
let lastUserID = await UserModel.findOne({
order: [['USER_ID', 'DESC']]
});
var newUserID = lastUserID.USER_ID + 1
let user = await UserModel.create({
USER_ID: newUserID,
USER_CODE: newUserID,
USER_CPAS: 0,
APPROVED: 1,
APPROVED_BY: "",
USER_NAME: username,
USER_PASS: UserModel.encryptPass(password),
FIRST_NAME: first_name,
LAST_NAME: last_name,
USER_DESC: last_name + " " + first_name,
USER_TYPE: 'A', // A for Admin in POS
USER_STATUS: '1',
USER_CREDATE: date,
FIELD_1: 'ADMIN',
FIELD_3: "ADMIN",
ROLE_TYPE: "ADMIN",
USER_LOG: ""
}, { transaction: t }
)
let subscriptionPlan = await DataModel.findOne({
where: { DATA_TYPE: 'POS_PLAN', ID: plan_id }
})
console.log("PLAN ID ", subscriptionPlan)
if (!subscriptionPlan || !subscriptionPlan.DATA_CODE) {
throw 'Please provide valid subscription plan'
}
delete user.dataValues.USER_PASS
let folderPath = process.env.STORE_IMAGE_LOCATION
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, {
recursive: true,
})
fs.writeFileSync(folderPath + newUserID + '.jpg', imageData)
fs.unlinkSync(req.file.path)
// INSERT INTO TDMSAPP
let app = AppModel.create({
USER_ID: newUserID,
APP_CODE: 'POS',
DB_CODE: nextStoreCode,
PRESET: subscriptionPlan.DATA_CODE,
CREATE_DATE: date
})
// await createStoreTables(nextStoreCode, t);
await t.commit();
res.status(201).json({
success: true,
data: store
data: store,
app: app
})
} catch (err) {
fs.unlinkSync(req.file.path)
await t.rollback();
return next(new ErrorResponse(err, 400));
}
})
async function generateNextStoreCode() {
const lastStore = await StoreModel.findOne({
order: [['ST_CODE', 'DESC']]
order: [['DB_CODE', 'DESC']]
});
if (!lastStore) {
@ -83,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);
@ -318,5 +415,27 @@ async function createStoreTables(storeCode, transaction) {
}
}
async function createUser(username, password, storeCode, first_name, last_name,) {
var date = dateFormat(new Date(), "mm/dd/yyyy");
try {
user = await UserModel.create({
USER_NAME: username,
USER_PASS: UserModel.encryptPass(password),
first_name: first_name,
last_name: last_name,
description: last_name + " " + first_name,
USER_TYPE: 'A', // A for Admin in POS
USER_STATUS: '1',
USER_CREDATE: date,
FIELD_1: 'ADMIN',
FIELD_3: "ADMIN",
ROLE_TYPE: "ADMIN",
})
} catch (e) {
console.error('Error creating user:', e);
throw new Error('Failed to create user.');
}
}

@ -0,0 +1,50 @@
const asyncHandler = require("../Middleware/async");
const sequelize = require('sequelize')
const DataModel = require("../Model/TD_DATA");
exports.getAllSubscriptions = asyncHandler(async (req, res, next) => {
DataModel.findAll({
where: {
DATA_TYPE: "POS_PLAN"
},
order: [
[sequelize.literal('CAST([FIELD_2] AS FLOAT)'), 'ASC'] // Sort by FIELD_2(Price) as integer
]
}).then((data) => {
return res.status(200).send(JSON.stringify(
{
success: true,
data
}
));
});
})
exports.getSubscriptionByID = asyncHandler(async (req, res, next) => {
const { id } = req.query;
console.log("PLAN ID :", id)
DataModel.findOne({
where: {
ID: id,
DATA_TYPE: "POS_PLAN"
},
order: [
[sequelize.literal('CAST([FIELD_2] AS FLOAT)'), 'ASC'] // Sort by FIELD_2(Price) as integer
]
}).then((data) => {
console.log("GET SUBSCRIPTION BY ID", data.DATA_CODE)
return res.status(200).send(JSON.stringify(
{
success: true,
data
}
));
});
})

@ -0,0 +1,112 @@
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 SuccessResponse = require('../utils/SuccessResponse');
const dateFormat = require('dateformat');
exports.getAllSupplier = asyncHandler(async (req, res, next) => {
try {
const bodySizeInBytes = Buffer.byteLength(JSON.stringify(req.body), 'utf8');
console.log(`Body size: ${bodySizeInBytes} bytes`);
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) => {
var date = dateFormat(new Date(), "yyyy-mm-dd")
const data = JSON.parse(req.body.data)
// const data = (req.body);
console.log("DATA", data)
if (!data.ADD_NAME || !data.phoneNumber) {
throw new ErrorResponse('Please provide all required fields', 400)
}
var photos = req.files;
console.log("PHOTOS ", photos)
try {
// increaset the last supplier code by 1
let newSupplierCode = await generateNextSupplierCode()
console.log("NEW SUPPLIER CODE : ", newSupplierCode)
const supplier = await SupplierModel.create({
DB_CODE: req.user.DB_CODE,
USER_CODE: req.user.USER_NAME,
ADD_NAME: data.ADD_NAME,
ADD_CODE: newSupplierCode,
ADD_LINE_1: data.addressLine1,
ADD_LINE_2: data.addressLine2 ?? "",
ADD_LINE_3: data.addressLine3 ?? "",
ADD_LINE_4: data.addressLine4 ?? "",
ADD_LINE_5: data.addressLine5 ?? "",
ADD_TEL: data.phoneNumber,
ADD_FAX: data.faxNumber ?? "",
ADD_CONT: data.contactPerson ?? "",
ADD_COM_1: data.company1 ?? "",
ADD_COM_2: data.company2 ?? "",
ADD_STAT: "A",
ADD_TYPE: "1",// NOT SURE WHAT THIS IS
TRANS_PRES: "N",
USER_CREA: date,
USER_UPDT: date,
ADD_LOOKUP: "",
ADD_EMAIL: data.email ?? "",
ADD_WEB: data.website ?? "",
})
if (photos) {
let folderPath = process.env.SUPPLIER_IMAGE_LOCATION + "/" + supplier.ADD_CODE + "/"
let imageData = fs.readFileSync(req.file.path)
if (!fs.existsSync(folderPath)) fs.mkdirSync(folderPath, {
recursive: true,
})
fs.writeFileSync(folderPath + supplier.ADD_CODE + '.jpg', imageData)
fs.unlinkSync(req.file.path)
}
res.send(new SuccessResponse("Operation Successful"));
} catch (e) {
throw new ErrorResponse(e, 400)
}
})
async function generateNextSupplierCode() {
const lastSupplier = await SupplierModel.findOne({
order: [[sequelize.cast(sequelize.col('ADD_CODE'), 'integer'), 'DESC']]
});
if (!lastSupplier) {
return '0001'; // Starting point if no suppliers are present
}
console.log("LAST SUPPLIER CODE ", lastSupplier.ADD_CODE)
let nextCode = parseInt(lastSupplier.ADD_CODE, 10) + 1;
// Check if the number is less than 10000 for zero-padding
if (nextCode < 10000) {
return nextCode.toString().padStart(4, '0');
} else {
// If it's 10000 or more, just return the number
return nextCode.toString();
}
}

@ -0,0 +1,58 @@
const asyncHandler = require("../Middleware/async");
const sequelize = require('sequelize')
const db = require('../Config/db')
const WarehouseModel = require('../Model/WarehouseModel')
const ErrorResponse = require('../utils/ErrorResponse')
const fs = require('fs');
const SuccessResponse = require('../utils/SuccessResponse');
const dateFormat = require('dateformat')
exports.getAllWarehouse = asyncHandler(async (req, res, next) => {
try {
const warehouse = await WarehouseModel.findAll({
where:
{
DB_CODE: req.user.DB_CODE,
WAR_STAT: 'A'
}
})
if (!warehouse) {
return next(new ErrorResponse("Warehouse not found", 404))
}
res.status(200).json(new SuccessResponse(200, warehouse))
} catch (e) {
return next(new ErrorResponse(e, 500))
}
})
exports.createWarehouse = asyncHandler(async (req, res, next) => {
try {
var date = dateFormat(new Date(), "yyyy-mm-dd HH:mm:ss")
await db.transaction(async (t) => {
const warehouse = await WarehouseModel.create({
DB_CODE: req.user.DB_CODE,
WAR_CODE: req.body.WAR_CODE,
WAR_NAME: req.body.WAR_NAME,
WAR_DESC: req.body.WAR_DESC ?? "",
WAR_ADD1: req.body.WAR_ADDRESS ?? "",
WAR_ADD2: req.body.WAR_ADD2 ?? "",
WAR_ADD3: req.body.WAR_ADD3 ?? "",
WAR_TEL1: req.body.WAR_TEL1 ?? "",
WAR_TEL2: req.body.WAR_TEL2 ?? "",
WAR_FAX: req.body.WAR_FAX ?? "",
WAR_COM1: req.body.WAR_COM1 ?? "",
WAR_COM2: req.body.WAR_COM2 ?? "",
WAR_CREA: date,
USER_CODE: req.user.USER_CODE,
WAR_STAT: 'A'
}, { transaction: t })
res.status(200).json(new SuccessResponse("Operation Successful", warehouse))
})
} catch (e) {
console.log("ERROR CREATING WAREHOUSE ", e)
return next(new ErrorResponse(`Something when wrong ${e}`, 500));
}
})

@ -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;

@ -0,0 +1,140 @@
const db = require("../Config/db");
const sequelize = require("sequelize");
const modelCache = {};
function getInventoryMovementTable(tableName) {
console.log("MODEL CACHE ", modelCache);
if (!modelCache[tableName]) {
const model = db.define(
tableName,
{
SEQUENCE: {
type: sequelize.INTEGER
},
REC_TYPE: {
type: sequelize.STRING
},
MOV_PRD: {
type: sequelize.INTEGER
},
MOV_REF: {
primaryKey: true,
type: sequelize.STRING
},
MOV_LINE: {
primaryKey: true,
type: sequelize.STRING
},
LOCATION: {
type: sequelize.STRING
},
ITEM_CODE: {
type: sequelize.STRING
},
MOV_DATE: {
type: sequelize.STRING
},
STATUS: {
type: sequelize.STRING
},
IR_STAT: {
type: sequelize.STRING
},
BATCH_NO: {
type: sequelize.INTEGER
},
BATCH_LINE: {
type: sequelize.STRING
},
LINE_REF: {
type: sequelize.STRING
},
QUANTITY: {
type: sequelize.FLOAT
},
COST: {
type: sequelize.FLOAT
},
TOTAL: {
type: sequelize.FLOAT
},
MOV_UNITS: {
type: sequelize.STRING
},
MOV_TYPE: {
type: sequelize.STRING
},
UPDTE_PHYS: {
type: sequelize.STRING
},
UPDTE_ORDR: {
type: sequelize.STRING
},
ALLOC_REF: {
type: sequelize.STRING
},
ACCNT_CODE: {
type: sequelize.STRING
},
ASSET_CODE: {
type: sequelize.STRING
},
ANAL_M0: {
type: sequelize.STRING
},
ANAL_M1: {
type: sequelize.STRING
},
ANAL_M2: {
type: sequelize.STRING
},
ANAL_M3: {
type: sequelize.STRING
},
ANAL_M4: {
type: sequelize.STRING
},
ANAL_M5: {
type: sequelize.STRING
},
ANAL_M6: {
type: sequelize.STRING
},
ANAL_M7: {
type: sequelize.STRING
},
ANAL_M8: {
type: sequelize.STRING
},
ANAL_M9: {
type: sequelize.STRING
},
ORIG_LINE_NO: {
type: sequelize.STRING
},
PO_VALUE: {
type: sequelize.FLOAT
},
ID_ENTERED: {
type: sequelize.STRING
},
ID_ALLOC: {
type: sequelize.STRING
}
},
{
timestamps: false,
freezeTableName: true
}
);
model.removeAttribute('id');
modelCache[tableName] = model;
}
return modelCache[tableName];
}
module.exports = { getInventoryMovementTable };

@ -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: {
@ -43,7 +43,11 @@ const StoreModel = db.define(
},
DATE_UPDT: {
type: sequelize.STRING
},
MAP: {
type: sequelize.STRING
}
},
{
timestamps: false,

@ -0,0 +1,31 @@
const sequelize = require("sequelize")
const db = require("../Config/db");
const SupplierItem = db.define(
'TDITEMSP',
{
ITEM_CODE: {
type: sequelize.STRING,
},
DB_CODE: {
type: sequelize.STRING
},
SUPP_CODE: {
type: sequelize.STRING
},
SUPP_COST: {
type: sequelize.NUMERIC
},
SUPP_UNIT: {
type: sequelize.STRING
}
},
{
timestamps: false,
freezeTableName: true,
}
)
SupplierItem.removeAttribute('id')
module.exports = SupplierItem;

@ -0,0 +1,86 @@
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
},
DB_CODE: {
type: sequelize.STRING
}
},
{
timestamps: false,
freezeTableName: true,
}
)
SupplierModel.removeAttribute('id')
module.exports = SupplierModel;

@ -0,0 +1,61 @@
const sequelize = require('sequelize')
const db = require('../Config/db')
const WarehouseModel = db.define(
'TDWAREH',
{
DB_CODE: {
type: sequelize.STRING,
},
WAR_CODE: {
type: sequelize.STRING,
},
WAR_NAME: {
type: sequelize.STRING,
},
WAR_DESC: {
type: sequelize.STRING,
},
WAR_ADD1: {
type: sequelize.STRING,
},
WAR_ADD2: {
type: sequelize.STRING,
},
WAR_ADD3: {
type: sequelize.STRING,
},
WAR_TEL1: {
type: sequelize.STRING,
},
WAR_TEL2: {
type: sequelize.STRING,
},
WAR_FAX: {
type: sequelize.STRING,
},
WAR_COM1: {
type: sequelize.STRING,
},
WAR_COM2: {
type: sequelize.STRING,
},
WAR_STAT: {
type: sequelize.STRING,
},
USER_CODE: {
type: sequelize.STRING,
},
WAR_CREA: {
type: sequelize.STRING,
},
},
{
timestamps: false,
freezeTableName: true,
}
)
WarehouseModel.removeAttribute('id')
module.exports = WarehouseModel;

@ -7,10 +7,13 @@ var dotenv = require("dotenv")
var app = express();
dotenv.config({
path: "./Config/config.env",
})
require("./Config/relation")();
// //Route Files
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
@ -18,6 +21,11 @@ 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')
var inventoryRouter = require('./routes/inventory_movement')
var wareouseRouter = require('./routes/warehouse')
//CORS
@ -30,6 +38,7 @@ app.use(express.urlencoded({
extended: true
}))
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
@ -39,7 +48,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("uploads"));
app.use("/uploads", express.static("uploads"));
app.use('/', indexRouter);
app.use('/users', usersRouter);
@ -49,6 +58,11 @@ app.use("/api/v1/authentication", cors(), authenticationRouter);
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)
app.use("/api/v1/inventory", inventoryRouter)
app.use('/api/v1/warehouse', wareouseRouter)

718
package-lock.json generated

@ -9,12 +9,14 @@
"version": "0.0.0",
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.20.2",
"cookie-parser": "~1.4.4",
"cors": "^2.8.5",
"dateformat": "^3.0.3",
"debug": "~2.6.9",
"dotenv": "^16.4.5",
"express": "~4.16.1",
"faker": "^6.6.6",
"http-errors": "~1.6.3",
"jade": "~1.11.0",
"jsonwebtoken": "^9.0.2",
@ -578,21 +580,99 @@
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/body-parser": {
"version": "1.18.3",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
"integrity": "sha512-YQyoqQG3sO8iCmf8+hyVpgHHOv0/hCEFiS4zTGUwTA1HjAFX66wRcNQrVCeJq9pgESMRvUAOvSil5MJlmccuKQ==",
"version": "1.20.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
"integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==",
"dependencies": {
"bytes": "3.0.0",
"content-type": "~1.0.4",
"bytes": "3.1.2",
"content-type": "~1.0.5",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "~1.6.3",
"iconv-lite": "0.4.23",
"on-finished": "~2.3.0",
"qs": "6.5.2",
"raw-body": "2.3.3",
"type-is": "~1.6.16"
"depd": "2.0.0",
"destroy": "1.2.0",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"on-finished": "2.4.1",
"qs": "6.11.0",
"raw-body": "2.5.2",
"type-is": "~1.6.18",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/body-parser/node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/body-parser/node_modules/destroy": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
"engines": {
"node": ">= 0.8",
"npm": "1.2.8000 || >= 1.4.16"
}
},
"node_modules/body-parser/node_modules/http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
"dependencies": {
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/body-parser/node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/body-parser/node_modules/on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/body-parser/node_modules/qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"dependencies": {
"side-channel": "^1.0.4"
},
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/body-parser/node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"node_modules/body-parser/node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
"engines": {
"node": ">= 0.8"
}
@ -662,13 +742,31 @@
}
},
"node_modules/bytes": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
"integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==",
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/call-bind": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
"integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
"dependencies": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.4",
"set-function-length": "^1.2.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/camelcase": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
@ -952,6 +1050,22 @@
"node": ">=0.10.0"
}
},
"node_modules/define-data-property": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
"dependencies": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
"gopd": "^1.0.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/define-lazy-prop": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
@ -1015,6 +1129,25 @@
"node": ">= 0.8"
}
},
"node_modules/es-define-property": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
"dependencies": {
"get-intrinsic": "^1.2.4"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@ -1084,6 +1217,34 @@
"node": ">= 0.10.0"
}
},
"node_modules/express/node_modules/body-parser": {
"version": "1.18.3",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
"integrity": "sha512-YQyoqQG3sO8iCmf8+hyVpgHHOv0/hCEFiS4zTGUwTA1HjAFX66wRcNQrVCeJq9pgESMRvUAOvSil5MJlmccuKQ==",
"dependencies": {
"bytes": "3.0.0",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "~1.6.3",
"iconv-lite": "0.4.23",
"on-finished": "~2.3.0",
"qs": "6.5.2",
"raw-body": "2.3.3",
"type-is": "~1.6.16"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/express/node_modules/bytes": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
"integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/express/node_modules/cookie": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
@ -1092,6 +1253,36 @@
"node": ">= 0.6"
}
},
"node_modules/express/node_modules/iconv-lite": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/express/node_modules/raw-body": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz",
"integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
"dependencies": {
"bytes": "3.0.0",
"http-errors": "1.6.3",
"iconv-lite": "0.4.23",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/faker": {
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/faker/-/faker-6.6.6.tgz",
"integrity": "sha512-9tCqYEDHI5RYFQigXFwF1hnCwcWCOJl/hmll0lr5D2Ljjb0o4wphb69wikeJDz5qCEzXCoPvG6ss5SDP6IfOdg=="
},
"node_modules/fecha": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz",
@ -1159,6 +1350,32 @@
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-intrinsic": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"has-proto": "^1.0.1",
"has-symbols": "^1.0.3",
"hasown": "^2.0.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
@ -1170,6 +1387,17 @@
"node": ">= 6"
}
},
"node_modules/gopd": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
"dependencies": {
"get-intrinsic": "^1.1.3"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/graceful-readlink": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
@ -1183,6 +1411,50 @@
"node": ">=4"
}
},
"node_modules/has-property-descriptors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
"dependencies": {
"es-define-property": "^1.0.0"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-proto": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz",
"integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/http-errors": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
@ -1264,9 +1536,9 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/iconv-lite": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
@ -1797,6 +2069,17 @@
"node": ">=0.10.0"
}
},
"node_modules/object-inspect": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz",
"integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
@ -1932,19 +2215,60 @@
}
},
"node_modules/raw-body": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz",
"integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
"integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
"dependencies": {
"bytes": "3.0.0",
"http-errors": "1.6.3",
"iconv-lite": "0.4.23",
"bytes": "3.1.2",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/raw-body/node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/raw-body/node_modules/http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
"dependencies": {
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/raw-body/node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"node_modules/raw-body/node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"node_modules/raw-body/node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
"engines": {
"node": ">= 0.8"
}
},
"node_modules/readable-stream": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz",
@ -2151,11 +2475,44 @@
"node": ">= 0.8.0"
}
},
"node_modules/set-function-length": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
"dependencies": {
"define-data-property": "^1.1.4",
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.4",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/setprototypeof": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
},
"node_modules/side-channel": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
"integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==",
"dependencies": {
"call-bind": "^1.0.7",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.4",
"object-inspect": "^1.13.1"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/simple-swizzle": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
@ -2308,6 +2665,14 @@
"node": ">=8.0"
}
},
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
"engines": {
"node": ">=0.6"
}
},
"node_modules/toposort-class": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toposort-class/-/toposort-class-1.0.1.tgz",
@ -3069,20 +3434,77 @@
}
},
"body-parser": {
"version": "1.18.3",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
"integrity": "sha512-YQyoqQG3sO8iCmf8+hyVpgHHOv0/hCEFiS4zTGUwTA1HjAFX66wRcNQrVCeJq9pgESMRvUAOvSil5MJlmccuKQ==",
"version": "1.20.2",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz",
"integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==",
"requires": {
"bytes": "3.0.0",
"content-type": "~1.0.4",
"bytes": "3.1.2",
"content-type": "~1.0.5",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "~1.6.3",
"iconv-lite": "0.4.23",
"on-finished": "~2.3.0",
"qs": "6.5.2",
"raw-body": "2.3.3",
"type-is": "~1.6.16"
"depd": "2.0.0",
"destroy": "1.2.0",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"on-finished": "2.4.1",
"qs": "6.11.0",
"raw-body": "2.5.2",
"type-is": "~1.6.18",
"unpipe": "1.0.0"
},
"dependencies": {
"depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
},
"destroy": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="
},
"http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
"requires": {
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"on-finished": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
"integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
"requires": {
"ee-first": "1.1.1"
}
},
"qs": {
"version": "6.11.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz",
"integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==",
"requires": {
"side-channel": "^1.0.4"
}
},
"setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="
}
}
},
"brace-expansion": {
@ -3130,9 +3552,21 @@
}
},
"bytes": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
"integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw=="
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="
},
"call-bind": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",
"integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==",
"requires": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.4",
"set-function-length": "^1.2.1"
}
},
"camelcase": {
"version": "1.2.1",
@ -3370,6 +3804,16 @@
"resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",
"integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA=="
},
"define-data-property": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
"requires": {
"es-define-property": "^1.0.0",
"es-errors": "^1.3.0",
"gopd": "^1.0.1"
}
},
"define-lazy-prop": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
@ -3418,6 +3862,19 @@
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w=="
},
"es-define-property": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
"requires": {
"get-intrinsic": "^1.2.4"
}
},
"es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="
},
"escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@ -3475,13 +3932,59 @@
"vary": "~1.1.2"
},
"dependencies": {
"body-parser": {
"version": "1.18.3",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.18.3.tgz",
"integrity": "sha512-YQyoqQG3sO8iCmf8+hyVpgHHOv0/hCEFiS4zTGUwTA1HjAFX66wRcNQrVCeJq9pgESMRvUAOvSil5MJlmccuKQ==",
"requires": {
"bytes": "3.0.0",
"content-type": "~1.0.4",
"debug": "2.6.9",
"depd": "~1.1.2",
"http-errors": "~1.6.3",
"iconv-lite": "0.4.23",
"on-finished": "~2.3.0",
"qs": "6.5.2",
"raw-body": "2.3.3",
"type-is": "~1.6.16"
}
},
"bytes": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz",
"integrity": "sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw=="
},
"cookie": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
"integrity": "sha512-+IJOX0OqlHCszo2mBUq+SrEbCj6w7Kpffqx60zYbPTFaO4+yYgRjHwcZNpWvaTylDHaV7PPmBHzSecZiMhtPgw=="
},
"iconv-lite": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
},
"raw-body": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz",
"integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
"requires": {
"bytes": "3.0.0",
"http-errors": "1.6.3",
"iconv-lite": "0.4.23",
"unpipe": "1.0.0"
}
}
}
},
"faker": {
"version": "6.6.6",
"resolved": "https://registry.npmjs.org/faker/-/faker-6.6.6.tgz",
"integrity": "sha512-9tCqYEDHI5RYFQigXFwF1hnCwcWCOJl/hmll0lr5D2Ljjb0o4wphb69wikeJDz5qCEzXCoPvG6ss5SDP6IfOdg=="
},
"fecha": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz",
@ -3530,6 +4033,23 @@
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"optional": true
},
"function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="
},
"get-intrinsic": {
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
"requires": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"has-proto": "^1.0.1",
"has-symbols": "^1.0.3",
"hasown": "^2.0.0"
}
},
"glob-parent": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
@ -3538,6 +4058,14 @@
"is-glob": "^4.0.1"
}
},
"gopd": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
"requires": {
"get-intrinsic": "^1.1.3"
}
},
"graceful-readlink": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
@ -3548,6 +4076,32 @@
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw=="
},
"has-property-descriptors": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
"requires": {
"es-define-property": "^1.0.0"
}
},
"has-proto": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz",
"integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q=="
},
"has-symbols": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A=="
},
"hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"requires": {
"function-bind": "^1.1.2"
}
},
"http-errors": {
"version": "1.6.3",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
@ -3608,9 +4162,9 @@
}
},
"iconv-lite": {
"version": "0.4.23",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz",
"integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==",
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"requires": {
"safer-buffer": ">= 2.1.2 < 3"
}
@ -4011,6 +4565,11 @@
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="
},
"object-inspect": {
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz",
"integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g=="
},
"on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
@ -4113,14 +4672,48 @@
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
},
"raw-body": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.3.3.tgz",
"integrity": "sha512-9esiElv1BrZoI3rCDuOuKCBRbuApGGaDPQfjSflGxdy4oyzqghxu6klEkkVIvBje+FF0BX9coEv8KqW6X/7njw==",
"version": "2.5.2",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.2.tgz",
"integrity": "sha512-8zGqypfENjCIqGhgXToC8aB2r7YrBX+AQAfIPs/Mlk+BtPTztOvTS01NRW/3Eh60J+a48lt8qsCzirQ6loCVfA==",
"requires": {
"bytes": "3.0.0",
"http-errors": "1.6.3",
"iconv-lite": "0.4.23",
"bytes": "3.1.2",
"http-errors": "2.0.0",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
},
"dependencies": {
"depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="
},
"http-errors": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
"integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
"requires": {
"depd": "2.0.0",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": "2.0.1",
"toidentifier": "1.0.1"
}
},
"inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
"integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="
}
}
},
"readable-stream": {
@ -4255,11 +4848,35 @@
"send": "0.16.2"
}
},
"set-function-length": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
"requires": {
"define-data-property": "^1.1.4",
"es-errors": "^1.3.0",
"function-bind": "^1.1.2",
"get-intrinsic": "^1.2.4",
"gopd": "^1.0.1",
"has-property-descriptors": "^1.0.2"
}
},
"setprototypeof": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz",
"integrity": "sha512-BvE/TwpZX4FXExxOxZyRGQQv651MSwmWKZGqvmPcRIjDqWub67kTKuIMx43cZZrS/cBBzwBcNDWoFxt2XEFIpQ=="
},
"side-channel": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
"integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==",
"requires": {
"call-bind": "^1.0.7",
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.4",
"object-inspect": "^1.13.1"
}
},
"simple-swizzle": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz",
@ -4371,6 +4988,11 @@
"is-number": "^7.0.0"
}
},
"toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="
},
"toposort-class": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toposort-class/-/toposort-class-1.0.1.tgz",

@ -7,12 +7,14 @@
},
"dependencies": {
"bcryptjs": "^2.4.3",
"body-parser": "^1.20.2",
"cookie-parser": "~1.4.4",
"cors": "^2.8.5",
"dateformat": "^3.0.3",
"debug": "~2.6.9",
"dotenv": "^16.4.5",
"express": "~4.16.1",
"faker": "^6.6.6",
"http-errors": "~1.6.3",
"jade": "~1.11.0",
"jsonwebtoken": "^9.0.2",

@ -27,10 +27,8 @@ route.route("/appversion").get(appVersion.getAppVersion);
route.route("/checkusername").get(protectAtlogin, controller.checkUsername);
route.route("/register").post(upload.fields([
{
name: 'photo'
}
]), controller.register,);
route.route("/register").post(upload.single("user_image"), controller.register,);
route.route("/checkExistUsername").get(protectAtlogin, controller.checkExistingUsername);
module.exports = route;

@ -0,0 +1,29 @@
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.getAllBrand);
route.route("/").post(protect, upload.fields([{ name: "photo", maxCount: 1 }]), controller.createBrand);
route.route("/category_detail").get(protect, controller.getAllCategory);
route.route("/category_detail").post(protect, upload.fields([{ name: "photo", maxCount: 1 }]), controller.createCategoryDetail);
module.exports = route;

@ -0,0 +1,27 @@
const express = require('express')
const route = express.Router()
const controller = require("../Controller/Inventory_Movement")
const { protect, protectAtlogin } = require("../Middleware/auth")
// const multer = require('multer')
// const moment = require('moment')
// var storage = multer.diskStorage({
// destination: function (req, file, cb) {
// if (file.fieldname == "store_image") cb(null, "upload/store/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("/add_stock").post(protect, controller.createStock)
route.route("/get_all_stock").get(protect, controller.getAllStock)
// route.route("/register").post(upload.single("store_image"), protectAtlogin, controller.registerStore)
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;

@ -1,9 +1,26 @@
const express = require('express')
const route = express.Router()
const controller = require("../Controller/Store")
const { protect } = require("../Middleware/auth")
const { protect, protectAtlogin } = require("../Middleware/auth")
const multer = require('multer')
const moment = require('moment')
var storage = multer.diskStorage({
destination: function (req, file, cb) {
if (file.fieldname == "store_image") cb(null, "upload/store/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.getStoreInfo)
route.route("/register").post(protect, controller.registerStore)
route.route("/register").post(upload.single("store_image"), protectAtlogin, controller.registerStore)
module.exports = route;

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

@ -0,0 +1,27 @@
const express = require("express");
const route = express.Router();
const controller = require("../Controller/Supplier");
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 == "supplier_image") cb(null, "uploads/supplier/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.getAllSupplier)
route.route('/').post(upload.single("supplier_image"), protect, controller.createSupplier)
module.exports = route;

@ -0,0 +1,27 @@
const express = require("express");
const route = express.Router();
const controller = require("../Controller/Warehouse");
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 == "supplier_image") cb(null, "uploads/supplier/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.getAllWarehouse)
route.route('/').post(protect, controller.createWarehouse)
module.exports = route;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 KiB

Loading…
Cancel
Save