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:
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();
|
||||
Reference in New Issue
Block a user