20-11
This commit is contained in:
parent
e1fc8d9d13
commit
d49ba5a8b1
|
|
@ -89,10 +89,6 @@ app.get("/download-file", (req, res) => {
|
|||
app.get('/varegister/:sf_token?', (req, res) => {
|
||||
const { sf_token } = req.params;
|
||||
|
||||
try {
|
||||
const decoded = jwt.verify(sf_token, process.env.JWT_SECRET_SF_TOKEN);
|
||||
const { sf_token } = req.params;
|
||||
|
||||
try {
|
||||
const decoded = jwt.verify(sf_token, process.env.JWT_SECRET_SF_TOKEN);
|
||||
|
||||
|
|
@ -158,36 +154,6 @@ app.get('/client/virtual-assistants', async (req, res) => {
|
|||
}
|
||||
});
|
||||
|
||||
// app.get('/client/timesheets', async (req, res) => {
|
||||
// try {
|
||||
// const timesheetData = await timesheetService.getClientTimesheets(req.user.id);
|
||||
// res.render('client/dashboard-timesheets', timesheetData);
|
||||
// } catch (error) {
|
||||
// console.error('Timesheets error:', error);
|
||||
// res.status(500).render('client/dashboard-timesheets', { error: 'Failed to load timesheets' });
|
||||
// }
|
||||
// });
|
||||
|
||||
// app.get('/client/invoices', async (req, res) => {
|
||||
// try {
|
||||
// const invoiceData = await invoiceService.getClientInvoices(req.user.id);
|
||||
// res.render('client/dashboard-invoices', invoiceData);
|
||||
// } catch (error) {
|
||||
// console.error('Invoices error:', error);
|
||||
// res.status(500).render('client/dashboard-invoices', { error: 'Failed to load invoices' });
|
||||
// }
|
||||
// });
|
||||
|
||||
// app.get('/client/referrals', async (req, res) => {
|
||||
// try {
|
||||
// const referralData = await referralService.getClientReferrals(req.user.id);
|
||||
// res.render('client/dashboard-referrals', referralData);
|
||||
// } catch (error) {
|
||||
// console.error('Referrals error:', error);
|
||||
// res.status(500).render('client/dashboard-referrals', { error: 'Failed to load referrals' });
|
||||
// }
|
||||
// });
|
||||
|
||||
app.get("/live/:projectId/:vaId", async (req, res) => {
|
||||
const { projectId, vaId } = req.params;
|
||||
|
||||
|
|
@ -209,6 +175,8 @@ app.get("/live/:projectId/:vaId", async (req, res) => {
|
|||
if (!clientId) return res.status(400).send({ "message": "Page not found" });
|
||||
|
||||
res.render("va_live_tracker", { title: "VA Live Tracker", projectId, vaId, clientId })
|
||||
})
|
||||
|
||||
app.get("/live/:projectId/:vaId", async (req, res) => {
|
||||
const { projectId, vaId } = req.params;
|
||||
|
||||
|
|
@ -234,8 +202,6 @@ app.get("/live/:projectId/:vaId", async (req, res) => {
|
|||
|
||||
// Handling Socket
|
||||
import { VAModel, ProjectModel, ClientModel } from './models/vaModel.js';
|
||||
import { ObjectId } from 'mongodb/lib/bson.js';
|
||||
|
||||
|
||||
const vaSocketRespectToClient = new Map();
|
||||
|
||||
|
|
@ -432,7 +398,7 @@ io.on("connection", (socket) => {
|
|||
clientSocket.data.role === "client" &&
|
||||
clientSocket.data.allowedVAs?.includes(vaId)
|
||||
) {
|
||||
clientSocket.emit("receiveVisibleApps", {apps, vaId});
|
||||
clientSocket.emit("receiveVisibleApps", { apps, vaId });
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
@ -446,39 +412,10 @@ io.on("connection", (socket) => {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// io.on('connection', (socket) => {
|
||||
|
||||
// socket.on("sendImage", (base64String) => {
|
||||
// io.emit("receiveImage", base64String);
|
||||
// });
|
||||
|
||||
|
||||
// socket.on('disconnect', () => {
|
||||
// console.log('a user Disconnected');
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
// Express App Listening
|
||||
// app.listen(PORT, () => {
|
||||
// mongoose
|
||||
// .connect(
|
||||
// process.env.MONGO_URI,
|
||||
// )
|
||||
// .then(() => console.log("mongodb connected"))
|
||||
// .catch((err) => {
|
||||
// console.log(err.message);
|
||||
// process.exit(1);
|
||||
// });
|
||||
// console.log(`Express started on http://localhost:${PORT}`);
|
||||
// });
|
||||
|
||||
app.use((req, res) => {
|
||||
res.status(404).render("not_found", {
|
||||
title: "404 - Page Not Found"
|
||||
});
|
||||
res.status(404).render("not_found", {
|
||||
title: "404 - Page Not Found"
|
||||
});
|
||||
});
|
||||
|
||||
server.listen(PORT, () => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue