mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-11-30 22:45:46 +01:00
fixed backend port for shifts
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
-- Add employee fields
|
||||
ALTER TABLE users ADD COLUMN employee_type TEXT CHECK(employee_type IN ('chef', 'neuling', 'erfahren'));
|
||||
ALTER TABLE users ADD COLUMN is_sufficiently_independent BOOLEAN DEFAULT FALSE;
|
||||
ALTER TABLE users ADD COLUMN is_sufficiently_independent BOOLEAN DEFAULT FALSE;
|
||||
ALTER TABLE users ADD COLUMN last_login TEXT DEFAULT NULL;
|
||||
@@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS users (
|
||||
is_sufficiently_independent BOOLEAN DEFAULT FALSE,
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
last_login DATETIME
|
||||
last_login TEXT || NULL
|
||||
);
|
||||
|
||||
-- Tabelle für Schichtvorlagen
|
||||
|
||||
28
backend/src/scripts/checkTemplates.ts
Normal file
28
backend/src/scripts/checkTemplates.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { db } from '../services/databaseService.js';
|
||||
import { ShiftTemplate } from '../models/ShiftTemplate.js';
|
||||
|
||||
async function checkTemplates() {
|
||||
try {
|
||||
const templates = await db.all<ShiftTemplate>(
|
||||
`SELECT st.*, u.name as created_by_name
|
||||
FROM shift_templates st
|
||||
LEFT JOIN users u ON st.created_by = u.id`
|
||||
);
|
||||
|
||||
console.log('Templates:', templates);
|
||||
|
||||
for (const template of templates) {
|
||||
const shifts = await db.all<any>(
|
||||
`SELECT * FROM template_shifts WHERE template_id = ?`,
|
||||
[template.id]
|
||||
);
|
||||
console.log(`Shifts for template ${template.id}:`, shifts);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
} finally {
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
|
||||
checkTemplates();
|
||||
@@ -15,10 +15,7 @@ const app = express();
|
||||
const PORT = 3002;
|
||||
|
||||
// CORS und Middleware
|
||||
app.use(cors({
|
||||
origin: 'http://localhost:3000',
|
||||
credentials: true
|
||||
}));
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
// API Routes
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"ignoreDeprecations": "6.0",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"allowJs": true,
|
||||
|
||||
Reference in New Issue
Block a user