mirror of
https://github.com/donpat1to/Schichtenplaner.git
synced 2025-12-01 06:55:45 +01:00
fixed backend port for shifts
This commit is contained in:
@@ -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;
|
||||||
@@ -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
|
||||||
|
|||||||
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;
|
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
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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[]> {
|
||||||
|
|||||||
Reference in New Issue
Block a user