added in the user managment section. Need to also do some updates to the admin menue and whatnot however itll get figured.
This commit is contained in:
@@ -2,6 +2,26 @@ const express = require('express');
|
||||
const router = express.Router();
|
||||
const settingsController = require('../controllers/settingsController');
|
||||
|
||||
// Debug endpoint to check configuration
|
||||
router.get('/config-debug', (req, res) => {
|
||||
const config = require('../config');
|
||||
res.json({
|
||||
success: true,
|
||||
config: {
|
||||
nocodb: {
|
||||
apiUrl: config.nocodb.apiUrl,
|
||||
hasToken: !!config.nocodb.apiToken,
|
||||
projectId: config.nocodb.projectId,
|
||||
tableId: config.nocodb.tableId,
|
||||
loginSheetId: config.nocodb.loginSheetId,
|
||||
settingsSheetId: config.nocodb.settingsSheetId,
|
||||
shiftsSheetId: config.nocodb.shiftsSheetId,
|
||||
shiftSignupsSheetId: config.nocodb.shiftSignupsSheetId
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Start location management
|
||||
router.get('/start-location', settingsController.getStartLocation);
|
||||
router.post('/start-location', settingsController.updateStartLocation);
|
||||
|
||||
@@ -222,4 +222,43 @@ router.get('/walk-sheet-raw', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Add this route to check login table structure
|
||||
router.get('/login-structure', async (req, res) => {
|
||||
try {
|
||||
const loginSheetId = config.nocodb.loginSheetId;
|
||||
|
||||
if (!loginSheetId) {
|
||||
return res.status(400).json({
|
||||
success: false,
|
||||
error: 'Login sheet ID not configured'
|
||||
});
|
||||
}
|
||||
|
||||
// Get table structure
|
||||
const tableId = extractTableId(loginSheetId);
|
||||
const response = await nocodbService.api.get(`/db/meta/tables/${tableId}`);
|
||||
|
||||
const columns = response.data.columns.map(col => ({
|
||||
column_name: col.column_name,
|
||||
title: col.title,
|
||||
uidt: col.uidt,
|
||||
required: col.rqd
|
||||
}));
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
tableId,
|
||||
columns,
|
||||
columnNames: columns.map(c => c.column_name)
|
||||
});
|
||||
|
||||
} catch (error) {
|
||||
logger.error('Error fetching login table structure:', error);
|
||||
res.status(500).json({
|
||||
success: false,
|
||||
error: error.message
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
@@ -102,6 +102,11 @@ module.exports = (app) => {
|
||||
res.sendFile(path.join(__dirname, '../public', 'shifts.html'));
|
||||
});
|
||||
|
||||
// User profile page route
|
||||
app.get('/user.html', requireAuth, (req, res) => {
|
||||
res.sendFile(path.join(__dirname, '../public', 'user.html'));
|
||||
});
|
||||
|
||||
// Catch all - redirect to login
|
||||
app.get('*', (req, res) => {
|
||||
res.redirect('/login.html');
|
||||
|
||||
Reference in New Issue
Block a user