feat(admin): add potential fathers retrieval for character management
All checks were successful
Deploy to production / deploy (push) Successful in 2m47s
All checks were successful
Deploy to production / deploy (push) Successful in 2m47s
- Implemented a new method in AdminService to fetch potential fathers for a given character based on existing relationships. - Updated AdminController to expose this functionality via a new API endpoint. - Enhanced adminRouter to include the route for retrieving potential fathers. - Modified frontend components to allow selection of potential fathers during pregnancy and birth management. - Updated internationalization files to include new translation keys related to father selection.
This commit is contained in:
102
backend/scripts/extend-bisaya-course-phase5.js
Normal file
102
backend/scripts/extend-bisaya-course-phase5.js
Normal file
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* Erweitert bestehende Bisaya-Kurse um die Stabilisierungsphase.
|
||||
*
|
||||
* Verwendung:
|
||||
* node backend/scripts/extend-bisaya-course-phase5.js
|
||||
*/
|
||||
|
||||
import { sequelize } from '../utils/sequelize.js';
|
||||
import VocabCourse from '../models/community/vocab_course.js';
|
||||
import VocabCourseLesson from '../models/community/vocab_course_lesson.js';
|
||||
import { getBisayaLessonPedagogy } from './bisaya-course-phase2-pedagogy.js';
|
||||
import { BISAYA_PHASE5_DIDACTICS, BISAYA_PHASE5_LESSONS } from './bisaya-course-phase5-extension.js';
|
||||
|
||||
async function extendBisayaCoursePhase5() {
|
||||
await sequelize.authenticate();
|
||||
|
||||
const [bisayaLanguage] = await sequelize.query(
|
||||
`SELECT id FROM community.vocab_language WHERE name = 'Bisaya' LIMIT 1`,
|
||||
{ type: sequelize.QueryTypes.SELECT }
|
||||
);
|
||||
|
||||
if (!bisayaLanguage) {
|
||||
console.error('❌ Bisaya-Sprache nicht gefunden.');
|
||||
return;
|
||||
}
|
||||
|
||||
const courses = await VocabCourse.findAll({
|
||||
where: { languageId: bisayaLanguage.id }
|
||||
});
|
||||
|
||||
let addedLessons = 0;
|
||||
|
||||
for (const course of courses) {
|
||||
await course.update({
|
||||
title: 'Bisaya für Familien - Alltag & Stabilisierung',
|
||||
description: 'Lerne Bisaya (Cebuano) praxisnah für den Familienalltag. Der Pfad verbindet Schnellstart, Alltagsmodule und Stabilisierungsblöcke mit Spiralwiederholung, Fehlertraining und freier Produktion.'
|
||||
});
|
||||
|
||||
for (const lessonData of BISAYA_PHASE5_LESSONS) {
|
||||
const existing = await VocabCourseLesson.findOne({
|
||||
where: {
|
||||
courseId: course.id,
|
||||
lessonNumber: lessonData.num
|
||||
}
|
||||
});
|
||||
|
||||
if (existing) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const didactics = BISAYA_PHASE5_DIDACTICS[lessonData.title] || {};
|
||||
const pedagogy = getBisayaLessonPedagogy(lessonData.num) || {};
|
||||
|
||||
await VocabCourseLesson.create({
|
||||
courseId: course.id,
|
||||
chapterId: null,
|
||||
lessonNumber: lessonData.num,
|
||||
title: lessonData.title,
|
||||
description: lessonData.desc,
|
||||
weekNumber: lessonData.week,
|
||||
dayNumber: lessonData.day,
|
||||
lessonType: lessonData.type,
|
||||
culturalNotes: lessonData.cultural,
|
||||
learningGoals: didactics.learningGoals || [],
|
||||
corePatterns: didactics.corePatterns || [],
|
||||
grammarFocus: didactics.grammarFocus || [],
|
||||
speakingPrompts: didactics.speakingPrompts || [],
|
||||
practicalTasks: didactics.practicalTasks || [],
|
||||
targetMinutes: lessonData.targetMin,
|
||||
targetScorePercent: lessonData.targetScore,
|
||||
requiresReview: lessonData.review,
|
||||
didacticMode: pedagogy.didacticMode || null,
|
||||
phaseLabel: pedagogy.phaseLabel || null,
|
||||
blockNumber: pedagogy.blockNumber ?? null,
|
||||
difficultyWeight: pedagogy.difficultyWeight ?? null,
|
||||
newUnitTarget: pedagogy.newUnitTarget ?? null,
|
||||
reviewWeight: pedagogy.reviewWeight ?? null,
|
||||
isIntensiveReview: Boolean(pedagogy.isIntensiveReview)
|
||||
});
|
||||
|
||||
addedLessons++;
|
||||
console.log(`✅ Kurs ${course.id}: Lektion ${lessonData.num} - ${lessonData.title} ergänzt`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`\n🎉 Phase 5 vorbereitet.`);
|
||||
console.log(` Kurse: ${courses.length}`);
|
||||
console.log(` Neue Lektionen ergänzt: ${addedLessons}`);
|
||||
console.log(' Das Einspielen in die DB kann später gesammelt mit den übrigen Phasen erfolgen.');
|
||||
}
|
||||
|
||||
extendBisayaCoursePhase5()
|
||||
.then(() => {
|
||||
sequelize.close();
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('❌ Fehler:', error);
|
||||
sequelize.close();
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user