Fix register store image error

development
Visoth 8 months ago
parent 9d0b59ac06
commit 3a57cd0a0e
  1. 23
      Controller/Authentication.js
  2. 3
      Model/StoreModel.js
  3. 2
      routes/authentication.js
  4. 2
      routes/store.js
  5. BIN
      uploads/store_image/4309.jpg

@ -10,6 +10,27 @@ const UserModel = require("../Model/User");
const sequelize = require("sequelize");
const { log } = require("winston");
// Get Connection
exports.getconnection = asyncHandler(async (req, res, next) => {
try {
db.authenticate()
.then(() => {
res
.send({
success: "true",
description: "Connection established",
})
.status(200);
})
.catch((err) => {
return next(new ErrorResponse("Connection Falied", 500));
});
} catch (ex) {
return next(new ErrorResponse("Connection Falied", 500));
}
})
// Login User
exports.login = asyncHandler(async (req, res, next) => {
const { username, password, DB_CODE, APP_CODE = 'POS', CUST_CODE } = req.body
@ -220,7 +241,7 @@ exports.checkUsername = asyncHandler(async (req, res, next) => {
}
// // check user type
if (user.USER_TYPE == "S" || user.USER_TYPE == "C") {
if (user.USER_TYPE == "S" || user.USER_TYPE == "C" || user.USER_TYPE == "A") {
var userPresets = await DataModel.findAll({
where: {
DATA_CODE: app.PRESET,

@ -46,6 +46,9 @@ const StoreModel = db.define(
},
MAP: {
type: sequelize.STRING
},
DB_LOC: {
type: sequelize.STRING
}
},

@ -31,4 +31,6 @@ route.route("/register").post(upload.single("user_image"), controller.register,)
route.route("/checkExistUsername").get(protectAtlogin, controller.checkExistingUsername);
route.route("/getconnction").get(protect, controller.getconnection);
module.exports = route;

@ -8,7 +8,7 @@ const moment = require('moment')
var storage = multer.diskStorage({
destination: function (req, file, cb) {
if (file.fieldname == "store_image") cb(null, "upload/store/tmp_post");
if (file.fieldname == "store_image") cb(null, "uploads/store/tmp_post");
},
filename: function (req, file, cb) {
cb(

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Loading…
Cancel
Save