Compare commits

...
3 Commits
Author SHA1 Message Date
cyril a9cd2a6018 update bug json 2025-02-04 10:38:59 +01:00
cyril 23dbfff014 repare login
add search in sale detail
add refresh button in sale detail
2024-11-26 15:10:38 +01:00
cyril 848fc4909e déplacement .Keys et config 2024-10-16 09:30:41 +02:00
51 changed files with 407 additions and 265 deletions
+1 -1
View File
@@ -1,10 +1,10 @@
backend/node_modules backend/node_modules
backend/.Keys.js
client/.angular client/.angular
client/node_modules client/node_modules
client/.vscode client/.vscode
.Keys.js
.vscode .vscode
data/ data/
vendor/ vendor/
+8 -1
View File
@@ -40,5 +40,12 @@ GET http://localhost:3000/api/favorite/getAll
# Prod # Prod
git clone https://gitlab.cyro-technology.com/cyril/Jucundus git clone https://gitlab.cyro-technology.com/cyril/Jucundus
cd Jucundus
docker Compose up -d
npm run start Dashboard Agendash
https://jucundus-api.saucisse.ninja/dash/
# Prod Update
git stash
git pull origin main
Regular → Executable
-29
View File
@@ -1,29 +0,0 @@
const config = {
db: {
connectionString: "mongodb://db:27017",
dbName: "jucundus",
},
session: {
sessionCollection: "Session",
sessionConfig: {
name: "jucundus.sid",
cookie: {
maxAge: 1000 * 60 * 60 * 24 * 30, // 30 days
httpOnly: true, // only accessible by the server
secure: true,
},
resave: false, // don't save session if unmodified
saveUninitialized: true,
}
},
jwtOptions: {
issuer: "jucundus.com",
audience: "yoursite",
},
agent :{
ApiAgentURL: 'http://host.docker.internal:3020/api',
token: '861v48gr4YTHJTUre0reg40g8e6r8r64eggv1r4e6g4r81PKREVJ8g6reg46r8eg416reST6ger84g14er86e',
}
};
module.exports = { config };
+4 -4
View File
@@ -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});
} }
}); });
+60 -32
View File
@@ -4,50 +4,78 @@ const { LotDb } = require("../services/lotDb");
const lotDb = new LotDb(); const lotDb = new LotDb();
const { SaleDb } = require("../services/saleDb"); const { SaleDb } = require("../services/saleDb");
const saleDb = new SaleDb(); const saleDb = new SaleDb();
const {Agent} = require('../services/agent');
const agent = new Agent();
const ApiURL = "http://host.docker.internal:3020/api";
// scrapping // scrapping
// exports.getInfos = asyncHandler(async (req, res, next) => {
// let url = req.params.url
// url = encodeURIComponent(url);
// fetch(ApiURL+'/lot/getInfos/'+url)
// .then(response => response.json())
// .then(data => {
// res.json(data);
// })
// .catch(error => {
// console.error(error);
// res.json({error: error});
// });
// });
exports.getInfos = asyncHandler(async (req, res, next) => { exports.getInfos = asyncHandler(async (req, res, next) => {
let url = req.params.url let url = req.params.url
url = encodeURIComponent(url); url = encodeURIComponent(url);
agent.getLotInfos(url)
fetch(ApiURL+'/lot/getInfos/'+url)
.then(response => response.json())
.then(data => { .then(data => {
res.json(data); return res.status(200).json(data);
}) })
.catch(error => { .catch(error => {
console.error(error); console.error(error);
res.json({error: error}); return res.status(500).json({error: error});
});
});
}); // exports.getPictures = asyncHandler(async (req, res, next) => {
}); // let url = req.params.url
// url = encodeURIComponent(url);
// fetch(ApiURL+'/lot/getPictures/'+url)
// .then(response => response.json())
// .then(data => {
// res.json(data);
// })
// .catch(error => {
// console.error(error);
// res.json({error: error});
// });
// });
exports.getPictures = asyncHandler(async (req, res, next) => { exports.getPictures = asyncHandler(async (req, res, next) => {
let url = req.params.url let url = req.params.url
url = encodeURIComponent(url); url = encodeURIComponent(url);
fetch(ApiURL+'/lot/getPictures/'+url) agent.getPictures(url)
.then(response => response.json())
.then(data => { .then(data => {
res.json(data); return res.status(200).json(data);
}) })
.catch(error => { .catch(error => {
console.error(error); console.error(error);
res.json({error: error}); return res.status(500).json({error: error});
}); });
}); });
exports.getLotsBySale = asyncHandler(async (req, res, next) => { exports.getLotsBySale = asyncHandler(async (req, res, next) => {
let id = req.params.id let id = req.params.id
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);
@@ -63,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);
@@ -99,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});
} }
}); });
@@ -129,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});
} }
}); });
@@ -161,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});
} }
}); });
@@ -177,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});
} }
}); });
@@ -191,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});
} }
}); });
@@ -213,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});
} }
}); });
@@ -228,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});
} }
}); });
+22 -22
View File
@@ -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);
+26 -26
View File
@@ -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});
} }
}); });
-1
View File
@@ -40,7 +40,6 @@ app.use(session({
const passport = require('passport'); const passport = require('passport');
app.use(passport.initialize()); app.use(passport.initialize());
app.use(passport.session()); app.use(passport.session());
app.use('/', require('./routes/auth')); app.use('/', require('./routes/auth'));
+28
View File
@@ -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,
@@ -99,6 +100,33 @@ const Agent = class
}); });
} }
async getLotInfos(url){
return new Promise((resolve, reject) => {
url = encodeURIComponent(url);
this.request(this.ApiAgentURL+'/lot/getInfos/'+url, 'GET')
.then(data => {
resolve(data);
})
.catch(error => {
reject(error);
});
});
}
async getPictures(url){
return new Promise((resolve, reject) => {
url = encodeURIComponent(url);
this.request(this.ApiAgentURL+'/lot/getPictures/'+url, 'GET')
.then(data => {
resolve(data);
})
.catch(error => {
reject(error);
});
});
}
} }
module.exports = {Agent}; module.exports = {Agent};
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -169,31 +169,6 @@ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
ngx-logger
MIT
The MIT License
Copyright (c) 2018 David Fannin
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
primeng primeng
MIT MIT
@@ -418,17 +393,6 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
vlq
MIT
Copyright (c) 2017 [these people](https://github.com/Rich-Harris/vlq/graphs/contributors)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
zone.js zone.js
MIT MIT
The MIT License The MIT License
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
(()=>{"use strict";var e,g={},_={};function r(e){var n=_[e];if(void 0!==n)return n.exports;var t=_[e]={id:e,loaded:!1,exports:{}};return g[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=g,e=[],r.O=(n,t,f,o)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,o]=e[i],u=!0,c=0;c<t.length;c++)(!1&o||a>=o)&&Object.keys(r.O).every(b=>r.O[b](t[c]))?t.splice(c--,1):(u=!1,o<a&&(a=o));if(u){e.splice(i--,1);var l=f();void 0!==l&&(n=l)}}return n}o=o||0;for(var i=e.length;i>0&&e[i-1][2]>o;i--)e[i]=e[i-1];e[i]=[t,f,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},(()=>{var n,e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__;r.t=function(t,f){if(1&f&&(t=this(t)),8&f||"object"==typeof t&&t&&(4&f&&t.__esModule||16&f&&"function"==typeof t.then))return t;var o=Object.create(null);r.r(o);var i={};n=n||[null,e({}),e([]),e(e)];for(var a=2&f&&t;"object"==typeof a&&!~n.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(u=>i[u]=()=>t[u]);return i.default=()=>t,r.d(o,i),o}})(),r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>e+"."+{40:"830a305ce078c093",136:"7ec3fccbaab9da95",168:"23cd0d474d0816c1",180:"2cd83d3a045b34ec",184:"76d8d415636f0a06",206:"df318e426aa62a63",228:"09b3735f8b2791e2",556:"23addb1698bab6ce",640:"ea69207168bc4f5e",852:"38e77b9083937542",968:"71f956b042a479cb",982:"b8ef64041e16e14b"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="angular-material-template:";r.l=(t,f,o,i)=>{if(e[t])e[t].push(f);else{var a,u;if(void 0!==o)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var d=c[l];if(d.getAttribute("src")==t||d.getAttribute("data-webpack")==n+o){a=d;break}}a||(u=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+o),a.src=r.tu(t)),e[t]=[f];var s=(v,b)=>{a.onerror=a.onload=null,clearTimeout(p);var m=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),m&&m.forEach(h=>h(b)),v)return v(b)},p=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),u&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={688:0};r.f.j=(f,o)=>{var i=r.o(e,f)?e[f]:void 0;if(0!==i)if(i)o.push(i[2]);else if(688!=f){var a=new Promise((d,s)=>i=e[f]=[d,s]);o.push(i[2]=a);var u=r.p+r.u(f),c=new Error;r.l(u,d=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var s=d&&("load"===d.type?"missing":d.type),p=d&&d.target&&d.target.src;c.message="Loading chunk "+f+" failed.\n("+s+": "+p+")",c.name="ChunkLoadError",c.type=s,c.request=p,i[1](c)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,o)=>{var c,l,[i,a,u]=o,d=0;if(i.some(p=>0!==e[p])){for(c in a)r.o(a,c)&&(r.m[c]=a[c]);if(u)var s=u(r)}for(f&&f(o);d<i.length;d++)r.o(e,l=i[d])&&e[l]&&e[l][0](),e[l]=0;return r.O(s)},t=self.webpackChunkangular_material_template=self.webpackChunkangular_material_template||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})(); (()=>{"use strict";var e,g={},_={};function r(e){var n=_[e];if(void 0!==n)return n.exports;var t=_[e]={id:e,loaded:!1,exports:{}};return g[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=g,e=[],r.O=(n,t,f,o)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,o]=e[i],u=!0,d=0;d<t.length;d++)(!1&o||a>=o)&&Object.keys(r.O).every(p=>r.O[p](t[d]))?t.splice(d--,1):(u=!1,o<a&&(a=o));if(u){e.splice(i--,1);var l=f();void 0!==l&&(n=l)}}return n}o=o||0;for(var i=e.length;i>0&&e[i-1][2]>o;i--)e[i]=e[i-1];e[i]=[t,f,o]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},(()=>{var n,e=Object.getPrototypeOf?t=>Object.getPrototypeOf(t):t=>t.__proto__;r.t=function(t,f){if(1&f&&(t=this(t)),8&f||"object"==typeof t&&t&&(4&f&&t.__esModule||16&f&&"function"==typeof t.then))return t;var o=Object.create(null);r.r(o);var i={};n=n||[null,e({}),e([]),e(e)];for(var a=2&f&&t;"object"==typeof a&&!~n.indexOf(a);a=e(a))Object.getOwnPropertyNames(a).forEach(u=>i[u]=()=>t[u]);return i.default=()=>t,r.d(o,i),o}})(),r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>e+"."+{40:"0e13af05d78d5691",136:"8c914bf99cf12c1c",168:"b2b470dd58e8115f",180:"a8c46ad68cf84c5c",184:"f2561c662a3b6776",206:"908b4ebd758170f6",228:"d6e857ac56777d70",556:"4884683b51327f64",640:"f5afe46ed7b82502",852:"e5b8d93dc01c8a44",968:"ea5d530378b38ab9",982:"1532e6ce0fb7b57a"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="angular-material-template:";r.l=(t,f,o,i)=>{if(e[t])e[t].push(f);else{var a,u;if(void 0!==o)for(var d=document.getElementsByTagName("script"),l=0;l<d.length;l++){var c=d[l];if(c.getAttribute("src")==t||c.getAttribute("data-webpack")==n+o){a=c;break}}a||(u=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+o),a.src=r.tu(t)),e[t]=[f];var s=(v,p)=>{a.onerror=a.onload=null,clearTimeout(b);var m=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),m&&m.forEach(h=>h(p)),v)return v(p)},b=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),u&&document.head.appendChild(a)}}})(),r.r=e=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},typeof trustedTypes<"u"&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={688:0};r.f.j=(f,o)=>{var i=r.o(e,f)?e[f]:void 0;if(0!==i)if(i)o.push(i[2]);else if(688!=f){var a=new Promise((c,s)=>i=e[f]=[c,s]);o.push(i[2]=a);var u=r.p+r.u(f),d=new Error;r.l(u,c=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var s=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;d.message="Loading chunk "+f+" failed.\n("+s+": "+b+")",d.name="ChunkLoadError",d.type=s,d.request=b,i[1](d)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,o)=>{var d,l,[i,a,u]=o,c=0;if(i.some(b=>0!==e[b])){for(d in a)r.o(a,d)&&(r.m[d]=a[d]);if(u)var s=u(r)}for(f&&f(o);c<i.length;c++)r.o(e,l=i[c])&&e[l]&&e[l][0](),e[l]=0;return r.O(s)},t=self.webpackChunkangular_material_template=self.webpackChunkangular_material_template||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})();
+34 -3
View File
@@ -1,10 +1,41 @@
server { server {
listen 80; listen 80;
server_name jucundus.saucisse.ninja;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;
client_max_body_size 5M;
proxy_read_timeout 200s;
index index.html;
location / { location / {
include /etc/nginx/mime.types;
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html; add_header Cache-Control "public, max-age=1M";
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html =404;
}
location /api {
proxy_pass https://jucundus-api.saucisse.ninja;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'Origin, Content-Type, Accept, Authorization';
}
location /healthcheck {
access_log off;
add_header 'Content-Type' 'text/plain';
return 200 "Healthy\n";
} }
} }
+6 -6
View File
@@ -7,7 +7,7 @@ import { CoreModule } from './core/core.module';
import { SharedModule } from './shared/shared.module'; import { SharedModule } from './shared/shared.module';
import { CustomMaterialModule } from './custom-material/custom-material.module'; import { CustomMaterialModule } from './custom-material/custom-material.module';
import { AppRoutingModule } from './app-routing.module'; import { AppRoutingModule } from './app-routing.module';
import { LoggerModule } from 'ngx-logger'; //import { LoggerModule } from 'ngx-logger';
import { environment } from '../environments/environment'; import { environment } from '../environments/environment';
@NgModule({ @NgModule({
@@ -21,11 +21,11 @@ import { environment } from '../environments/environment';
SharedModule, SharedModule,
CustomMaterialModule.forRoot(), CustomMaterialModule.forRoot(),
AppRoutingModule, AppRoutingModule,
LoggerModule.forRoot({ // LoggerModule.forRoot({
serverLoggingUrl: `http://my-api/logs`, // serverLoggingUrl: `http://my-api/logs`,
level: environment.logLevel, // level: environment.logLevel,
serverLogLevel: environment.serverLogLevel // serverLogLevel: environment.serverLogLevel
}) // })
], ],
bootstrap: [AppComponent] bootstrap: [AppComponent]
}) })
+2 -2
View File
@@ -2,7 +2,7 @@ import { NgModule, Optional, SkipSelf, ErrorHandler } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http'; import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { MediaMatcher } from '@angular/cdk/layout'; import { MediaMatcher } from '@angular/cdk/layout';
import { NGXLogger } from 'ngx-logger'; //import { NGXLogger } from 'ngx-logger';
import { AuthInterceptor } from './interceptors/auth.interceptor'; import { AuthInterceptor } from './interceptors/auth.interceptor';
import { SpinnerInterceptor } from './interceptors/spinner.interceptor'; import { SpinnerInterceptor } from './interceptors/spinner.interceptor';
@@ -36,7 +36,7 @@ import { AdminGuard } from './guards/admin.guard';
provide: ErrorHandler, provide: ErrorHandler,
useClass: GlobalErrorHandler useClass: GlobalErrorHandler
}, },
{ provide: NGXLogger, useClass: NGXLogger }, //{ provide: NGXLogger, useClass: NGXLogger },
{ provide: 'LOCALSTORAGE', useValue: window.localStorage } { provide: 'LOCALSTORAGE', useValue: window.localStorage }
], ],
exports: [ exports: [
@@ -1,5 +1,5 @@
import { ErrorHandler, Injectable, Injector } from '@angular/core'; import { ErrorHandler, Injectable, Injector } from '@angular/core';
import { NGXLogger } from 'ngx-logger'; //import { NGXLogger } from 'ngx-logger';
@Injectable() @Injectable()
export class GlobalErrorHandler implements ErrorHandler { export class GlobalErrorHandler implements ErrorHandler {
@@ -11,7 +11,7 @@ export class GlobalErrorHandler implements ErrorHandler {
// Obtain dependencies at the time of the error // Obtain dependencies at the time of the error
// This is because the GlobalErrorHandler is registered first // This is because the GlobalErrorHandler is registered first
// which prevents constructor dependency injection // which prevents constructor dependency injection
const logger = this.injector.get(NGXLogger); //const logger = this.injector.get(NGXLogger);
const err = { const err = {
message: error.message ? error.message : error.toString(), message: error.message ? error.message : error.toString(),
@@ -19,7 +19,7 @@ export class GlobalErrorHandler implements ErrorHandler {
}; };
// Log the error // Log the error
logger.error(err); //logger.error(err);
// Re-throw the error // Re-throw the error
throw error; throw error;
@@ -1,6 +1,6 @@
import { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms'; import { UntypedFormGroup, UntypedFormControl, Validators } from '@angular/forms';
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { NGXLogger } from 'ngx-logger'; //import { NGXLogger } from 'ngx-logger';
import { AuthenticationService } from 'src/app/core/services/auth.service'; import { AuthenticationService } from 'src/app/core/services/auth.service';
import { NotificationService } from 'src/app/core/services/notification.service'; import { NotificationService } from 'src/app/core/services/notification.service';
import { SpinnerService } from 'src/app/core/services/spinner.service'; import { SpinnerService } from 'src/app/core/services/spinner.service';
@@ -22,7 +22,7 @@ export class ChangePasswordComponent implements OnInit {
disableSubmit!: boolean; disableSubmit!: boolean;
constructor(private authService: AuthenticationService, constructor(private authService: AuthenticationService,
private logger: NGXLogger, //private logger: NGXLogger,
private spinnerService: SpinnerService, private spinnerService: SpinnerService,
private notificationService: NotificationService) { private notificationService: NotificationService) {
@@ -63,7 +63,7 @@ export class ChangePasswordComponent implements OnInit {
this.authService.changePassword(email, this.currentPassword, this.newPassword) this.authService.changePassword(email, this.currentPassword, this.newPassword)
.subscribe( .subscribe(
data => { data => {
this.logger.info(`User ${email} changed password.`); //this.logger.info(`User ${email} changed password.`);
this.form.reset(); this.form.reset();
this.notificationService.openSnackBar('Your password has been changed.'); this.notificationService.openSnackBar('Your password has been changed.');
}, },
@@ -1,4 +1,6 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { tap, catchError } from 'rxjs/operators';
import { of } from 'rxjs';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { UntypedFormControl, Validators, UntypedFormGroup } from '@angular/forms'; import { UntypedFormControl, Validators, UntypedFormGroup } from '@angular/forms';
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
@@ -15,7 +17,8 @@ export class LoginComponent implements OnInit {
loginForm!: UntypedFormGroup; loginForm!: UntypedFormGroup;
loading!: boolean; loading!: boolean;
constructor(private router: Router, constructor(
private router: Router,
private titleService: Title, private titleService: Title,
private notificationService: NotificationService, private notificationService: NotificationService,
private authenticationService: AuthenticationService) { private authenticationService: AuthenticationService) {
@@ -45,21 +48,24 @@ export class LoginComponent implements OnInit {
this.loading = true; this.loading = true;
this.authenticationService this.authenticationService
.login(email.toLowerCase(), password) .login(email.toLowerCase(), password)
.subscribe( .pipe(
data => { tap(data => {
if (rememberMe) { if (rememberMe) {
localStorage.setItem('savedUserEmail', email); localStorage.setItem('savedUserEmail', email);
} else { } else {
localStorage.removeItem('savedUserEmail'); localStorage.removeItem('savedUserEmail');
} }
this.router.navigate(['dashboard']); setTimeout(() => {
}, this.router.navigate(['sales'])
error => { },100);
}),
catchError(error => {
this.notificationService.openSnackBar(error.error.message); this.notificationService.openSnackBar(error.error.message);
this.loading = false; this.loading = false;
} return of(null); // Return an observable to complete the stream
); })
)
.subscribe();
} }
resetPassword() { resetPassword() {
@@ -1,7 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { MatSort } from '@angular/material/sort'; import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table'; import { MatTableDataSource } from '@angular/material/table';
import { NGXLogger } from 'ngx-logger'; //import { NGXLogger } from 'ngx-logger';
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
import { NotificationService } from 'src/app/core/services/notification.service'; import { NotificationService } from 'src/app/core/services/notification.service';
@@ -38,14 +38,14 @@ export class CustomerListComponent implements OnInit {
sort: MatSort = new MatSort; sort: MatSort = new MatSort;
constructor( constructor(
private logger: NGXLogger, //private logger: NGXLogger,
private notificationService: NotificationService, private notificationService: NotificationService,
private titleService: Title private titleService: Title
) { } ) { }
ngOnInit() { ngOnInit() {
this.titleService.setTitle('Jucundus - Customers'); this.titleService.setTitle('Jucundus - Customers');
this.logger.log('Customers loaded'); //this.logger.log('Customers loaded');
this.notificationService.openSnackBar('Customers loaded'); this.notificationService.openSnackBar('Customers loaded');
this.dataSource.sort = this.sort; this.dataSource.sort = this.sort;
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { NotificationService } from 'src/app/core/services/notification.service'; import { NotificationService } from 'src/app/core/services/notification.service';
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
import { NGXLogger } from 'ngx-logger'; //import { NGXLogger } from 'ngx-logger';
import { AuthenticationService } from 'src/app/core/services/auth.service'; import { AuthenticationService } from 'src/app/core/services/auth.service';
@Component({ @Component({
@@ -15,13 +15,14 @@ export class DashboardHomeComponent implements OnInit {
constructor(private notificationService: NotificationService, constructor(private notificationService: NotificationService,
private authService: AuthenticationService, private authService: AuthenticationService,
private titleService: Title, private titleService: Title,
private logger: NGXLogger) { //private logger: NGXLogger
) {
} }
ngOnInit() { ngOnInit() {
this.currentUser = this.authService.getCurrentUser(); this.currentUser = this.authService.getCurrentUser();
this.titleService.setTitle('Jucundus - Dashboard'); this.titleService.setTitle('Jucundus - Dashboard');
this.logger.log('Dashboard loaded'); //this.logger.log('Dashboard loaded');
setTimeout(() => { setTimeout(() => {
this.notificationService.openSnackBar('Welcome!'); this.notificationService.openSnackBar('Welcome!');
@@ -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,27 +1,29 @@
<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="column" fxLayoutGap="2px">
<p><b>#</b> {{Lot.lotNumber}}</p>
</div>
<div fxLayout="column" fxLayoutGap="2px">
<p><b>Title</b> {{Lot.title}}</p>
</div>
</div>
<div fxLayout="row" fxLayoutGap="5px">
<div fxLayout="column" fxLayoutGap="2px">
<p><b>Estimate</b> [{{Lot.EstimateLow}} - {{Lot.EstimateHigh}}]</p>
</div>
</div>
<div fxLayout="row" fxLayoutGap="5px"> <div fxLayout="row" fxLayoutGap="5px">
<mat-list> <mat-list>
<mat-list-item> <mat-list-item class="description-item">
<span matListItemTitle>#</span>
<span matListItemLine>{{Lot.lotNumber}}</span>
</mat-list-item>
<mat-list-item>
<span matListItemTitle>Title</span>
<span matListItemLine>{{Lot.title}}</span>
</mat-list-item>
<mat-list-item>
<span matListItemTitle>Description</span> <span matListItemTitle>Description</span>
<span matListItemLine [innerHTML]="getSafeDescription()"></span> <div class="description-container">
</mat-list-item> <span matListItemLine class="description-text" [innerHTML]="getSafeDescription()"></span>
<mat-list-item> </div>
<span matListItemTitle>Estimate</span>
<span matListItemLine>Low: {{Lot.EstimateLow}} | High: {{Lot.EstimateHigh}} </span>
</mat-list-item> </mat-list-item>
</mat-list> </mat-list>
</div> </div>
@@ -32,6 +32,7 @@
</div> </div>
</div> </div>
<div fxLayout="row" fxLayoutGap="2px"> <div fxLayout="row" fxLayoutGap="2px">
<button mat-raised-button color="primary" (click)="refresh()">Refresh</button>
<button mat-raised-button color="primary" (click)="downloadExcelStatsFile(id)">Excel</button> <button mat-raised-button color="primary" (click)="downloadExcelStatsFile(id)">Excel</button>
</div> </div>
</mat-card-content> </mat-card-content>
@@ -48,6 +49,13 @@
Lots Lots
</ng-template> </ng-template>
<div fxLayout="row" fxLayoutGap="5px"> <div fxLayout="row" fxLayoutGap="5px">
<mat-form-field>
<mat-label>Search</mat-label>
<input matInput placeholder="Search..." maxlength="255" st [(ngModel)]="searchText" (input)="filterLots()" >
</mat-form-field>
</div>
<div fxLayout="row" fxLayoutGap="5px">
<table mat-table [dataSource]="lotList" matSort class="mat-elevation-z8"> <table mat-table [dataSource]="lotList" matSort class="mat-elevation-z8">
<!--- Note that these columns can be defined in any order. <!--- Note that these columns can be defined in any order.
@@ -28,9 +28,14 @@ export class SaleDetailPageComponent implements OnInit, AfterViewInit {
id: any = ''; id: any = '';
Sale: Sale; Sale: Sale;
searchText: string = '';
originalLots: Lot[] = [];
lotList: MatTableDataSource<Lot> = new MatTableDataSource<Lot>();
displayedColumns: string[] = ['lotNum', 'picture', 'title', 'estimateLow', 'estimateHigh', 'price', 'nbrBids', 'duration', 'percentageAboveUnderLow', 'percentageAboveUnderHigh']; displayedColumns: string[] = ['lotNum', 'picture', 'title', 'estimateLow', 'estimateHigh', 'price', 'nbrBids', 'duration', 'percentageAboveUnderLow', 'percentageAboveUnderHigh'];
lotList: MatTableDataSource<Lot> = new MatTableDataSource<Lot>();
@ViewChild(MatPaginator) paginator?: MatPaginator; @ViewChild(MatPaginator) paginator?: MatPaginator;
@ViewChild(MatSort) sort?: MatSort; @ViewChild(MatSort) sort?: MatSort;
@@ -73,14 +78,17 @@ 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) => {
@@ -134,6 +142,7 @@ export class SaleDetailPageComponent implements OnInit, AfterViewInit {
}); });
console.log(lotList); console.log(lotList);
this.originalLots = lotList;
this.lotList = new MatTableDataSource(lotList); this.lotList = new MatTableDataSource(lotList);
this.lotList.paginator = this.paginator ?? null; this.lotList.paginator = this.paginator ?? null;
this.lotList.sort = this.sort ?? null; this.lotList.sort = this.sort ?? null;
@@ -169,6 +178,14 @@ export class SaleDetailPageComponent implements OnInit, AfterViewInit {
return `${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}`; return `${h.toString().padStart(2, '0')}:${m.toString().padStart(2, '0')}`;
} }
filterLots(): void {
const filteredData = this.originalLots.filter(lot =>
lot.title?.toLowerCase().includes(this.searchText.toLowerCase()) ||
lot.description?.toLowerCase().includes(this.searchText.toLowerCase())
);
this.lotList.data = filteredData;
}
openDetailLot(idLot: string): void { openDetailLot(idLot: string): void {
this.dialog.open(LotDetailDialogComponent, { this.dialog.open(LotDetailDialogComponent, {
width: '80%', width: '80%',
@@ -1,7 +1,7 @@
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Title } from '@angular/platform-browser'; import { Title } from '@angular/platform-browser';
import { NGXLogger } from 'ngx-logger'; //import { NGXLogger } from 'ngx-logger';
import { NotificationService } from 'src/app/core/services/notification.service'; import { NotificationService } from 'src/app/core/services/notification.service';
import { MatPaginator } from '@angular/material/paginator'; import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort'; import { MatSort } from '@angular/material/sort';
@@ -23,7 +23,7 @@ export class UserListComponent implements OnInit {
@ViewChild(MatSort) sort?: MatSort; @ViewChild(MatSort) sort?: MatSort;
constructor( constructor(
private logger: NGXLogger, //private logger: NGXLogger,
private notificationService: NotificationService, private notificationService: NotificationService,
private titleService: Title, private titleService: Title,
private router: Router, private router: Router,
@@ -32,7 +32,7 @@ export class UserListComponent implements OnInit {
ngOnInit() { ngOnInit() {
this.titleService.setTitle('Jucundus - Users'); this.titleService.setTitle('Jucundus - Users');
this.logger.log('Users loaded'); //this.logger.log('Users loaded');
this.refreshUsers() this.refreshUsers()
} }
+5 -4
View File
@@ -1,8 +1,9 @@
import { NgxLoggerLevel } from 'ngx-logger'; //import { NgxLoggerLevel } from 'ngx-logger';
export const environment = { export const environment = {
production: true, production: true,
logLevel: NgxLoggerLevel.OFF, //logLevel: NgxLoggerLevel.OFF,
serverLogLevel: NgxLoggerLevel.ERROR, //serverLogLevel: NgxLoggerLevel.ERROR,
ServeurURL: "https://jucundus.saucisse.ninja:3000/backend" //ServeurURL: "https://jucundus.saucisse.ninja"
ServeurURL: "https://jucundus-api.saucisse.ninja"
}; };
+3 -3
View File
@@ -1,4 +1,4 @@
import { NgxLoggerLevel } from 'ngx-logger'; //import { NgxLoggerLevel } from 'ngx-logger';
// The file contents for the current environment will overwrite these during build. // The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do // The build system defaults to the dev environment which uses `environment.ts`, but if you do
@@ -7,7 +7,7 @@ import { NgxLoggerLevel } from 'ngx-logger';
export const environment = { export const environment = {
production: false, production: false,
logLevel: NgxLoggerLevel.TRACE, //logLevel: NgxLoggerLevel.TRACE,
serverLogLevel: NgxLoggerLevel.OFF, //serverLogLevel: NgxLoggerLevel.OFF,
ServeurURL: "http://localhost:3000" ServeurURL: "http://localhost:3000"
}; };
+29
View File
@@ -0,0 +1,29 @@
const config = {
db: {
connectionString: "mongodb://db:27017",
dbName: "jucundus",
},
session: {
sessionCollection: "Session",
sessionConfig: {
name: "jucundus.sid",
cookie: {
maxAge: 1000 * 60 * 60 * 24 * 30, // 30 days
httpOnly: true, // only accessible by the server
secure: true,
},
resave: false, // don't save session if unmodified
saveUninitialized: true,
}
},
jwtOptions: {
issuer: "jucundus.com",
audience: "yoursite",
},
agent :{
ApiAgentURL: 'http://host.docker.internal:3020/api',
token: '861v48gr4YTHJTUre0reg40g8e6r8r64eggv1r4e6g4r81PKREVJ8g6reg46r8eg416reST6ger84g14er86e',
}
};
module.exports = { config };
+29
View File
@@ -0,0 +1,29 @@
const config = {
db: {
connectionString: "mongodb://db:27017",
dbName: "jucundus",
},
session: {
sessionCollection: "Session",
sessionConfig: {
name: "jucundus.sid",
cookie: {
maxAge: 1000 * 60 * 60 * 24 * 30, // 30 days
httpOnly: true, // only accessible by the server
secure: true,
},
resave: false, // don't save session if unmodified
saveUninitialized: true,
}
},
jwtOptions: {
issuer: "jucundus.com",
audience: "yoursite",
},
agent :{
ApiAgentURL: 'https://jucundus-agent1.saucisse.ninja/api',
token: '861v48gr4YTHJTUre0reg40g8e6r8r64eggv1r4e6g4r81PKREVJ8g6reg46r8eg416reST6ger84g14er86e',
}
};
module.exports = { config };
+2
View File
@@ -14,6 +14,8 @@ services:
working_dir: /backend working_dir: /backend
volumes: volumes:
- ./backend:/backend - ./backend:/backend
- ./.Keys.js:/backend/.Keys.js
- ./config-dev.js:/backend/config.js
ports: ports:
- "3000:3000" - "3000:3000"
- "9228:9229" - "9228:9229"
+10 -6
View File
@@ -11,9 +11,13 @@ services:
backend: backend:
image: node:20 image: node:20
restart: always
hostname: jucundus-api.saucisse.ninja
working_dir: /backend working_dir: /backend
volumes: volumes:
- ./backend:/backend - ./backend:/backend
- ./.Keys.js:/backend/.Keys.js
- ./config.js:/backend/config.js
ports: ports:
- "3000" - "3000"
command: ["sh", "-c", "npm install && npm run start"] command: ["sh", "-c", "npm install && npm run start"]
@@ -23,11 +27,11 @@ services:
- backend-network - backend-network
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.backend.rule=Host(`jucundus.saucisse.ninja`) && PathPrefix(`/backend`)" - "traefik.http.routers.jucundus-api.rule=Host(`jucundus-api.saucisse.ninja`)"
- "traefik.http.routers.backend.entrypoints=websecure" - "traefik.http.routers.jucundus-api.entrypoints=websecure"
- "traefik.http.routers.backend.tls=true" - "traefik.http.routers.jucundus-api.tls=true"
- "traefik.http.routers.backend.tls.certresolver=myresolver" - "traefik.http.routers.jucundus-api.tls.certresolver=myresolver"
- "traefik.http.services.backend.loadbalancer.server.port=3000" - "traefik.http.services.jucundus-api.loadbalancer.server.port=3000"
client: client:
image: nginx:latest image: nginx:latest
@@ -52,7 +56,7 @@ services:
- "traefik.http.routers.jucundus.tls=true" - "traefik.http.routers.jucundus.tls=true"
- "traefik.http.routers.jucundus.tls.certresolver=myresolver" - "traefik.http.routers.jucundus.tls.certresolver=myresolver"
- "traefik.http.routers.jucundus.tls.domains[0].main=jucundus.saucisse.ninja" - "traefik.http.routers.jucundus.tls.domains[0].main=jucundus.saucisse.ninja"
- "traefik.http.services.scrapper.loadbalancer.server.port=80" - "traefik.http.services.jucundus.loadbalancer.server.port=80"
networks: networks:
backend-network: backend-network: