fixed backend port for shifts

This commit is contained in:
2025-10-10 18:58:48 +02:00
parent 27eea33efc
commit 541af0afee
7 changed files with 34 additions and 9 deletions

View File

@@ -1,3 +1,4 @@
-- Add employee fields -- Add employee fields
ALTER TABLE users ADD COLUMN employee_type TEXT CHECK(employee_type IN ('chef', 'neuling', 'erfahren')); 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;

View File

@@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS users (
is_sufficiently_independent BOOLEAN DEFAULT FALSE, is_sufficiently_independent BOOLEAN DEFAULT FALSE,
is_active BOOLEAN DEFAULT TRUE, is_active BOOLEAN DEFAULT TRUE,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP, created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
last_login DATETIME last_login TEXT || NULL
); );
-- Tabelle für Schichtvorlagen -- Tabelle für Schichtvorlagen

View 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();

View File

@@ -15,10 +15,7 @@ const app = express();
const PORT = 3002; const PORT = 3002;
// CORS und Middleware // CORS und Middleware
app.use(cors({ app.use(cors());
origin: 'http://localhost:3000',
credentials: true
}));
app.use(express.json()); app.use(express.json());
// API Routes // API Routes

View File

@@ -4,7 +4,6 @@
"target": "ES2022", "target": "ES2022",
"module": "NodeNext", "module": "NodeNext",
"moduleResolution": "NodeNext", "moduleResolution": "NodeNext",
"ignoreDeprecations": "6.0",
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"esModuleInterop": true, "esModuleInterop": true,
"allowJs": true, "allowJs": true,

View File

@@ -1,7 +1,7 @@
// frontend/src/services/shiftPlanService.ts // frontend/src/services/shiftPlanService.ts
import { authService } from './authService'; import { authService } from './authService';
const API_BASE = 'http://localhost:3001/api/shift-plans'; const API_BASE = 'http://localhost:3002/api/shift-plans';
export interface CreateShiftPlanRequest { export interface CreateShiftPlanRequest {
name: string; name: string;

View File

@@ -2,7 +2,7 @@
import { ShiftTemplate, TemplateShift } from '../types/shiftTemplate'; import { ShiftTemplate, TemplateShift } from '../types/shiftTemplate';
import { authService } from './authService'; import { authService } from './authService';
const API_BASE = 'http://localhost:3001/api/shift-templates'; const API_BASE = 'http://localhost:3002/api/shift-templates';
export const shiftTemplateService = { export const shiftTemplateService = {
async getTemplates(): Promise<ShiftTemplate[]> { async getTemplates(): Promise<ShiftTemplate[]> {