update bug json
This commit is contained in:
parent
23dbfff014
commit
a9cd2a6018
|
|
@ -44,4 +44,8 @@ cd Jucundus
|
||||||
docker Compose up -d
|
docker Compose up -d
|
||||||
|
|
||||||
Dashboard Agendash
|
Dashboard Agendash
|
||||||
https://jucundus-api.saucisse.ninja/dash/
|
https://jucundus-api.saucisse.ninja/dash/
|
||||||
|
|
||||||
|
# Prod Update
|
||||||
|
git stash
|
||||||
|
git pull origin main
|
||||||
|
|
@ -6,10 +6,10 @@ exports.save = asyncHandler(async (req, res, next) => {
|
||||||
try{
|
try{
|
||||||
let result = await save(req.body);
|
let result = await save(req.body);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
res.status(204).send({message: "Favorite created"});
|
res.status(204).json({message: "Favorite created"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -19,9 +19,9 @@ exports.getAll = asyncHandler(async (req, res, next) => {
|
||||||
try{
|
try{
|
||||||
let result = await getAll();
|
let result = await getAll();
|
||||||
console.log(result);
|
console.log(result);
|
||||||
res.status(200).send(result);
|
res.status(200).json(result);
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -33,7 +33,7 @@ exports.getInfos = asyncHandler(async (req, res, next) => {
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return res.status(500).send({error: error});
|
return res.status(500).json({error: error});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ exports.getPictures = asyncHandler(async (req, res, next) => {
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return res.status(500).send({error: error});
|
return res.status(500).json({error: error});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -75,7 +75,7 @@ exports.getLotsBySale = asyncHandler(async (req, res, next) => {
|
||||||
const Sale = await saleDb.get(id);
|
const Sale = await saleDb.get(id);
|
||||||
if(!Sale){
|
if(!Sale){
|
||||||
console.error("Sale not found");
|
console.error("Sale not found");
|
||||||
return res.status(404).send({error: "Sale not found"});
|
return res.status(404).json({error: "Sale not found"});
|
||||||
}
|
}
|
||||||
|
|
||||||
Lots = await lotDb.getBySaleId(Sale._id.toString(),Sale.platform);
|
Lots = await lotDb.getBySaleId(Sale._id.toString(),Sale.platform);
|
||||||
|
|
@ -91,7 +91,7 @@ exports.NextItem = asyncHandler(async (req, res, next) => {
|
||||||
Sale = await saleDb.getByIDPlatform(req.body.idSalePlatform, req.body.platform);
|
Sale = await saleDb.getByIDPlatform(req.body.idSalePlatform, req.body.platform);
|
||||||
if(!Sale){
|
if(!Sale){
|
||||||
console.error("Sale not found");
|
console.error("Sale not found");
|
||||||
return res.status(404).send({error: "Sale not found"});
|
return res.status(404).json({error: "Sale not found"});
|
||||||
}
|
}
|
||||||
|
|
||||||
let Lot = await lotDb.getByIDPlatform(req.body.idPlatform, req.body.platform);
|
let Lot = await lotDb.getByIDPlatform(req.body.idPlatform, req.body.platform);
|
||||||
|
|
@ -127,10 +127,10 @@ exports.NextItem = asyncHandler(async (req, res, next) => {
|
||||||
await lotDb.put(Lot._id, Lot);
|
await lotDb.put(Lot._id, Lot);
|
||||||
}
|
}
|
||||||
|
|
||||||
res.status(204).send({message: "Lot updated"});
|
res.status(204).json({message: "Lot updated"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -157,13 +157,13 @@ exports.Bid = asyncHandler(async (req, res, next) => {
|
||||||
await lotDb.put(Lot._id, Lot);
|
await lotDb.put(Lot._id, Lot);
|
||||||
}else{
|
}else{
|
||||||
console.error("Lot not found");
|
console.error("Lot not found");
|
||||||
return res.status(404).send({error: "Lot not found"});
|
return res.status(404).json({error: "Lot not found"});
|
||||||
}
|
}
|
||||||
|
|
||||||
res.status(204).send({message: "Lot updated"});
|
res.status(204).json({message: "Lot updated"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -189,13 +189,13 @@ exports.AuctionedItem = asyncHandler(async (req, res, next) => {
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
console.error("Lot not found");
|
console.error("Lot not found");
|
||||||
return res.status(404).send({error: "Lot not found"});
|
return res.status(404).json({error: "Lot not found"});
|
||||||
}
|
}
|
||||||
|
|
||||||
res.status(204).send({message: "Lot updated"});
|
res.status(204).json({message: "Lot updated"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -205,10 +205,10 @@ exports.get = asyncHandler(async (req, res, next) => {
|
||||||
try{
|
try{
|
||||||
const id = req.params.id;
|
const id = req.params.id;
|
||||||
let result = await lotDb.get(id);
|
let result = await lotDb.get(id);
|
||||||
res.status(200).send(result);
|
res.status(200).json(result);
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -219,15 +219,15 @@ exports.post = asyncHandler(async (req, res, next) => {
|
||||||
// check if double
|
// check if double
|
||||||
let Lot = await lotDb.getByIDPlatform(req.body.idPlatform, req.body.platform);
|
let Lot = await lotDb.getByIDPlatform(req.body.idPlatform, req.body.platform);
|
||||||
if(Sale){
|
if(Sale){
|
||||||
return res.status(500).send({ error: "Lot already exists"});
|
return res.status(500).json({ error: "Lot already exists"});
|
||||||
}
|
}
|
||||||
|
|
||||||
let createLot = await lotDb.post(req.body);
|
let createLot = await lotDb.post(req.body);
|
||||||
|
|
||||||
res.status(204).send({message: "Lot created"});
|
res.status(204).json({message: "Lot created"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -241,10 +241,10 @@ exports.put = asyncHandler(async (req, res, next) => {
|
||||||
console.log(updatedDocument);
|
console.log(updatedDocument);
|
||||||
let result = await lotDb.put(id, updatedDocument);
|
let result = await lotDb.put(id, updatedDocument);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
res.status(200).send(result);
|
res.status(200).json(result);
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -256,10 +256,10 @@ exports.delete = asyncHandler(async (req, res, next) => {
|
||||||
// Remove the lot
|
// Remove the lot
|
||||||
await lotDb.remove(id);
|
await lotDb.remove(id);
|
||||||
|
|
||||||
res.status(200).send({"message": "Lots deleted"});
|
res.status(200).json({"message": "Lots deleted"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -18,7 +18,7 @@ exports.getSaleInfos = asyncHandler(async (req, res, next) => {
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return res.status(500).send({error: error});
|
return res.status(500).json({error: error});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -33,11 +33,11 @@ exports.prepareSale = asyncHandler(async (req, res, next) => {
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return res.status(500).send({error: error});
|
return res.status(500).json({error: error});
|
||||||
});
|
});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -48,15 +48,15 @@ exports.followSale = asyncHandler(async (req, res, next) => {
|
||||||
|
|
||||||
agent.followSale(id)
|
agent.followSale(id)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
res.status(200).send(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return res.status(500).send({error: error});
|
return res.status(500).json({error: error});
|
||||||
});
|
});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -67,10 +67,10 @@ exports.get = asyncHandler(async (req, res, next) => {
|
||||||
try{
|
try{
|
||||||
const id = req.params.id;
|
const id = req.params.id;
|
||||||
let result = await saleDb.get(id);
|
let result = await saleDb.get(id);
|
||||||
res.status(200).send(result);
|
res.status(200).json(result);
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -81,7 +81,7 @@ exports.post = asyncHandler(async (req, res, next) => {
|
||||||
// check if double
|
// check if double
|
||||||
let Sale = await saleDb.getByIDPlatform(req.body.idPlatform, req.body.platform);
|
let Sale = await saleDb.getByIDPlatform(req.body.idPlatform, req.body.platform);
|
||||||
if(Sale){
|
if(Sale){
|
||||||
return res.status(500).send({error: "Sale already exists"});
|
return res.status(500).json({error: "Sale already exists"});
|
||||||
}
|
}
|
||||||
|
|
||||||
let createData = await saleDb.post(req.body);
|
let createData = await saleDb.post(req.body);
|
||||||
|
|
@ -105,10 +105,10 @@ exports.post = asyncHandler(async (req, res, next) => {
|
||||||
await jobFollow.save();
|
await jobFollow.save();
|
||||||
}else{ console.log("Sale is in the past, no Follow Job");}
|
}else{ console.log("Sale is in the past, no Follow Job");}
|
||||||
|
|
||||||
res.status(204).send({"message": "Sale created"});
|
res.status(204).json({"message": "Sale created"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -122,10 +122,10 @@ exports.put = asyncHandler(async (req, res, next) => {
|
||||||
console.log(updatedDocument);
|
console.log(updatedDocument);
|
||||||
let result = await saleDb.put(id, updatedDocument);
|
let result = await saleDb.put(id, updatedDocument);
|
||||||
//console.log(result);
|
//console.log(result);
|
||||||
res.status(200).send(result);
|
res.status(200).json(result);
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -147,10 +147,10 @@ exports.delete = asyncHandler(async (req, res, next) => {
|
||||||
await job.remove();
|
await job.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
res.status(200).send({"message": "Sale and Lots deleted"});
|
res.status(200).json({"message": "Sale and Lots deleted"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -160,10 +160,10 @@ exports.delete = asyncHandler(async (req, res, next) => {
|
||||||
exports.getAll = asyncHandler(async (req, res, next) => {
|
exports.getAll = asyncHandler(async (req, res, next) => {
|
||||||
try{
|
try{
|
||||||
let result = await saleDb.getAll();
|
let result = await saleDb.getAll();
|
||||||
res.status(200).send(result);
|
res.status(200).json(result);
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -174,10 +174,10 @@ exports.getByUrl = asyncHandler(async (req, res, next) => {
|
||||||
|
|
||||||
let result = await saleDb.getByUrl(url);
|
let result = await saleDb.getByUrl(url);
|
||||||
//console.log(result);
|
//console.log(result);
|
||||||
res.status(200).send(result);
|
res.status(200).json(result);
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -185,10 +185,10 @@ exports.postProcessing = asyncHandler(async (req, res, next) => {
|
||||||
try{
|
try{
|
||||||
const id = req.params.id;
|
const id = req.params.id;
|
||||||
await saleDb.processStats(id);
|
await saleDb.processStats(id);
|
||||||
res.status(200).send({"message": "Post Processing done"});
|
res.status(200).json({"message": "Post Processing done"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -200,7 +200,7 @@ exports.SaleStatXsl = asyncHandler(async (req, res, next) => {
|
||||||
Sale = await saleDb.get(id);
|
Sale = await saleDb.get(id);
|
||||||
if(!Sale){
|
if(!Sale){
|
||||||
console.error("Sale not found");
|
console.error("Sale not found");
|
||||||
return res.status(404).send({error: "Sale not found"});
|
return res.status(404).json({error: "Sale not found"});
|
||||||
}
|
}
|
||||||
|
|
||||||
Lots = await lotDb.getBySaleId(Sale._id.toString(),Sale.platform);
|
Lots = await lotDb.getBySaleId(Sale._id.toString(),Sale.platform);
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,13 @@ exports.get = asyncHandler(async (req, res, next) => {
|
||||||
const id = req.params.id;
|
const id = req.params.id;
|
||||||
let result = await userDb.get(id);
|
let result = await userDb.get(id);
|
||||||
if (req.user.isAdmin){
|
if (req.user.isAdmin){
|
||||||
res.status(200).send(ClearUserDataForAdmin(result));
|
res.status(200).json(ClearUserDataForAdmin(result));
|
||||||
}else{
|
}else{
|
||||||
res.status(200).send(ClearUserData(result));
|
res.status(200).json(ClearUserData(result));
|
||||||
}
|
}
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -46,24 +46,24 @@ exports.post = asyncHandler(async (req, res, next) => {
|
||||||
// check if double
|
// check if double
|
||||||
let User = await userDb.getByEmail(req.body.email);
|
let User = await userDb.getByEmail(req.body.email);
|
||||||
if(User){
|
if(User){
|
||||||
return res.status(500).send({error: "User already exists"});
|
return res.status(500).json({error: "User already exists"});
|
||||||
}
|
}
|
||||||
|
|
||||||
// check password
|
// check password
|
||||||
if(!req.body.password){
|
if(!req.body.password){
|
||||||
return res.status(500).send({error: "Password not set"});
|
return res.status(500).json({error: "Password not set"});
|
||||||
}
|
}
|
||||||
if(req.body.password != req.body.confirmPassword){
|
if(req.body.password != req.body.confirmPassword){
|
||||||
return res.status(500).send({error: "Passwords do not match"});
|
return res.status(500).json({error: "Passwords do not match"});
|
||||||
}
|
}
|
||||||
if(req.body.password.length < 8){
|
if(req.body.password.length < 8){
|
||||||
return res.status(500).send({error: "Password too short"});
|
return res.status(500).json({error: "Password too short"});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(req.body.isAdmin){
|
if(req.body.isAdmin){
|
||||||
if(req.user){
|
if(req.user){
|
||||||
if(!req.user.isAdmin){
|
if(!req.user.isAdmin){
|
||||||
return res.status(500).send({error: "You are not allowed to create an admin user"});
|
return res.status(500).json({error: "You are not allowed to create an admin user"});
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
req.body.isAdmin = false
|
req.body.isAdmin = false
|
||||||
|
|
@ -73,7 +73,7 @@ exports.post = asyncHandler(async (req, res, next) => {
|
||||||
if(req.body.isAgent){
|
if(req.body.isAgent){
|
||||||
if(req.user){
|
if(req.user){
|
||||||
if(!req.user.isAgent){
|
if(!req.user.isAgent){
|
||||||
return res.status(500).send({error: "You are not allowed to create an agent user"});
|
return res.status(500).json({error: "You are not allowed to create an agent user"});
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
req.body.isAgent = false
|
req.body.isAgent = false
|
||||||
|
|
@ -92,10 +92,10 @@ exports.post = asyncHandler(async (req, res, next) => {
|
||||||
|
|
||||||
let createData = await userDb.post(user);
|
let createData = await userDb.post(user);
|
||||||
|
|
||||||
res.status(204).send({message: "User created"});
|
res.status(204).json({message: "User created"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -108,7 +108,7 @@ exports.put = asyncHandler(async (req, res, next) => {
|
||||||
|
|
||||||
const User = await userDb.get(id);
|
const User = await userDb.get(id);
|
||||||
if(!User){
|
if(!User){
|
||||||
return res.status(500).send({error:"User not found"});
|
return res.status(500).json({error:"User not found"});
|
||||||
}
|
}
|
||||||
|
|
||||||
// check password
|
// check password
|
||||||
|
|
@ -116,10 +116,10 @@ exports.put = asyncHandler(async (req, res, next) => {
|
||||||
let salt = "";
|
let salt = "";
|
||||||
if(req.body.password){
|
if(req.body.password){
|
||||||
if(req.body.password != req.body.confirmPassword){
|
if(req.body.password != req.body.confirmPassword){
|
||||||
return res.status(500).send({error:"Passwords do not match"});
|
return res.status(500).json({error:"Passwords do not match"});
|
||||||
}
|
}
|
||||||
if(req.body.password.length < 8){
|
if(req.body.password.length < 8){
|
||||||
return res.status(500).send({error:"Password too short"});
|
return res.status(500).json({error:"Password too short"});
|
||||||
}
|
}
|
||||||
salt = crypto.randomBytes(16).toString('hex');
|
salt = crypto.randomBytes(16).toString('hex');
|
||||||
hashed_password = crypto.pbkdf2Sync(req.body.password, salt, 310000, 32, 'sha256').toString('hex');
|
hashed_password = crypto.pbkdf2Sync(req.body.password, salt, 310000, 32, 'sha256').toString('hex');
|
||||||
|
|
@ -130,12 +130,12 @@ exports.put = asyncHandler(async (req, res, next) => {
|
||||||
|
|
||||||
if(req.body.isAdmin){
|
if(req.body.isAdmin){
|
||||||
if(!req.user.isAdmin){
|
if(!req.user.isAdmin){
|
||||||
return res.status(500).send({error:"You are not allowed to create an admin user"});
|
return res.status(500).json({error:"You are not allowed to create an admin user"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(req.body.isAgent){
|
if(req.body.isAgent){
|
||||||
if(!req.user.isAdmin){
|
if(!req.user.isAdmin){
|
||||||
return res.status(500).send({error:"You are not allowed to create an agent user"});
|
return res.status(500).json({error:"You are not allowed to create an agent user"});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -150,10 +150,10 @@ exports.put = asyncHandler(async (req, res, next) => {
|
||||||
|
|
||||||
let result = await userDb.put(id, user);
|
let result = await userDb.put(id, user);
|
||||||
console.log(result);
|
console.log(result);
|
||||||
res.status(200).send(result);
|
res.status(200).json(result);
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -166,10 +166,10 @@ exports.delete = asyncHandler(async (req, res, next) => {
|
||||||
// Remove the sale
|
// Remove the sale
|
||||||
await userDb.remove(id);
|
await userDb.remove(id);
|
||||||
|
|
||||||
res.status(200).send({"message": "User deleted"});
|
res.status(200).json({"message": "User deleted"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -178,10 +178,10 @@ exports.delete = asyncHandler(async (req, res, next) => {
|
||||||
exports.current = asyncHandler(async (req, res, next) => {
|
exports.current = asyncHandler(async (req, res, next) => {
|
||||||
try{
|
try{
|
||||||
const user = ClearUserData(req.user);
|
const user = ClearUserData(req.user);
|
||||||
res.status(200).send(user);
|
res.status(200).json(user);
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -189,10 +189,10 @@ exports.current = asyncHandler(async (req, res, next) => {
|
||||||
|
|
||||||
exports.agentConnected = asyncHandler(async (req, res, next) => {
|
exports.agentConnected = asyncHandler(async (req, res, next) => {
|
||||||
try{
|
try{
|
||||||
res.status(200).send({message: "Agent connected"});
|
res.status(200).json({message: "Agent connected"});
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -201,10 +201,10 @@ exports.getAllUsers = asyncHandler(async (req, res, next) => {
|
||||||
const userDb = await UserDb.init();
|
const userDb = await UserDb.init();
|
||||||
let result = await userDb.getAll();
|
let result = await userDb.getAll();
|
||||||
result = result.map(user => ClearUserDataForAdmin(user));
|
result = result.map(user => ClearUserDataForAdmin(user));
|
||||||
res.status(200).send(result);
|
res.status(200).json(result);
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return res.status(500).send({error: err});
|
return res.status(500).json({error: err});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
@ -15,6 +15,7 @@ const Agent = class
|
||||||
}
|
}
|
||||||
|
|
||||||
async request(url, method){
|
async request(url, method){
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
fetch(url,{
|
fetch(url,{
|
||||||
method: method,
|
method: method,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,19 @@
|
||||||
.example-card {
|
.example-card {
|
||||||
|
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
.description-item {
|
||||||
|
height: auto !important;
|
||||||
|
min-height: 48px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.description-container {
|
||||||
|
max-height: 150px;
|
||||||
|
overflow-y: auto;
|
||||||
|
/* padding: 8px 0; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.description-text {
|
||||||
|
white-space: pre-wrap !important;
|
||||||
|
word-wrap: break-word;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,31 @@
|
||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-card-header>
|
<mat-card-header>
|
||||||
<mat-card-title>Lot</mat-card-title>
|
<mat-card-title>Lot</mat-card-title>
|
||||||
<mat-card-subtitle>Lot informations</mat-card-subtitle>
|
|
||||||
</mat-card-header>
|
</mat-card-header>
|
||||||
|
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
<div fxLayout="row" fxLayoutGap="5px">
|
<div fxLayout="row" fxLayoutGap="5px">
|
||||||
<mat-list>
|
<div fxLayout="column" fxLayoutGap="2px">
|
||||||
<mat-list-item>
|
<p><b>#</b> {{Lot.lotNumber}}</p>
|
||||||
<span matListItemTitle>#</span>
|
</div>
|
||||||
<span matListItemLine>{{Lot.lotNumber}}</span>
|
<div fxLayout="column" fxLayoutGap="2px">
|
||||||
</mat-list-item>
|
<p><b>Title</b> {{Lot.title}}</p>
|
||||||
<mat-list-item>
|
</div>
|
||||||
<span matListItemTitle>Title</span>
|
</div>
|
||||||
<span matListItemLine>{{Lot.title}}</span>
|
<div fxLayout="row" fxLayoutGap="5px">
|
||||||
</mat-list-item>
|
<div fxLayout="column" fxLayoutGap="2px">
|
||||||
<mat-list-item>
|
<p><b>Estimate</b> [{{Lot.EstimateLow}} - {{Lot.EstimateHigh}}]</p>
|
||||||
<span matListItemTitle>Description</span>
|
</div>
|
||||||
<span matListItemLine [innerHTML]="getSafeDescription()"></span>
|
</div>
|
||||||
</mat-list-item>
|
<div fxLayout="row" fxLayoutGap="5px">
|
||||||
<mat-list-item>
|
<mat-list>
|
||||||
<span matListItemTitle>Estimate</span>
|
<mat-list-item class="description-item">
|
||||||
<span matListItemLine>Low: {{Lot.EstimateLow}} | High: {{Lot.EstimateHigh}} </span>
|
<span matListItemTitle>Description</span>
|
||||||
</mat-list-item>
|
<div class="description-container">
|
||||||
</mat-list>
|
<span matListItemLine class="description-text" [innerHTML]="getSafeDescription()"></span>
|
||||||
|
</div>
|
||||||
|
</mat-list-item>
|
||||||
|
</mat-list>
|
||||||
</div>
|
</div>
|
||||||
<div fxLayout="row" fxLayoutGap="5px">
|
<div fxLayout="row" fxLayoutGap="5px">
|
||||||
<table mat-table [dataSource]="bids" class="mat-elevation-z8">
|
<table mat-table [dataSource]="bids" class="mat-elevation-z8">
|
||||||
|
|
|
||||||
|
|
@ -78,24 +78,23 @@ export class SaleDetailPageComponent implements OnInit, AfterViewInit {
|
||||||
this.route.paramMap.subscribe(params => {
|
this.route.paramMap.subscribe(params => {
|
||||||
this.id = params.get('id');
|
this.id = params.get('id');
|
||||||
|
|
||||||
this.getSale();
|
this.refresh();
|
||||||
this.getLotList();
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(): void {
|
ngAfterViewInit(): void {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
refresh(): void {
|
||||||
|
this.getSale();
|
||||||
|
this.getLotList();
|
||||||
|
}
|
||||||
|
|
||||||
getSale(){
|
getSale(){
|
||||||
this.apiSaleService.getSale(this.id).subscribe((sale: Sale) => {
|
this.apiSaleService.getSale(this.id).subscribe((sale: Sale) => {
|
||||||
this.Sale = sale;
|
this.Sale = sale;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh(): void {
|
|
||||||
this.getLotList();
|
|
||||||
}
|
|
||||||
|
|
||||||
getLotList(){
|
getLotList(){
|
||||||
this.apiLotService.getLotsBySale(this.id).subscribe((lotList: Lot[]) => {
|
this.apiLotService.getLotsBySale(this.id).subscribe((lotList: Lot[]) => {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ const config = {
|
||||||
audience: "yoursite",
|
audience: "yoursite",
|
||||||
},
|
},
|
||||||
agent :{
|
agent :{
|
||||||
ApiAgentURL: 'jucundus-agent1.saucisse.ninja/api',
|
ApiAgentURL: 'https://jucundus-agent1.saucisse.ninja/api',
|
||||||
token: '861v48gr4YTHJTUre0reg40g8e6r8r64eggv1r4e6g4r81PKREVJ8g6reg46r8eg416reST6ger84g14er86e',
|
token: '861v48gr4YTHJTUre0reg40g8e6r8r64eggv1r4e6g4r81PKREVJ8g6reg46r8eg416reST6ger84g14er86e',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue