Übersetzungskataloge, getrennte Sprachpräferenzen und einen versionierten Aufgabenpilot ergänzen. Historische Aufgaben und Bewertungen bleiben erhalten; äquivalente Ansichten teilen Nachweise. Lokal mit Race-Tests und PostgreSQL, Vet, Web-Build, Bank-Audits und Browser-Fixtures geprüft. Dieser Stand dient als Ausgangspunkt für die anschließend beauftragte Zusammenführung zur Muttersprache.
284 lines
10 KiB
Go
284 lines
10 KiB
Go
package domain
|
|
|
|
import "time"
|
|
|
|
type User struct {
|
|
ID string `json:"id"`
|
|
Email string `json:"email"`
|
|
UILanguage string `json:"ui_language"`
|
|
InstructionLanguage string `json:"instruction_language"`
|
|
Role string `json:"role"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
// ExplanationLanguage preserves compatibility with callers that construct users
|
|
// without the additive field; persisted accounts always have an explicit value.
|
|
func (u User) ExplanationLanguage() string {
|
|
if u.InstructionLanguage != "" {
|
|
return u.InstructionLanguage
|
|
}
|
|
if u.UILanguage != "" {
|
|
return u.UILanguage
|
|
}
|
|
return "de-DE"
|
|
}
|
|
|
|
func SupportedUILanguage(language string) bool {
|
|
return language == "de-DE" || language == "en-US"
|
|
}
|
|
|
|
type AdminOverview struct {
|
|
UsersTotal int `json:"users_total"`
|
|
UsersActive7Days int `json:"users_active_7_days"`
|
|
AttemptsTotal int `json:"attempts_total"`
|
|
ExercisesGenerated int `json:"exercises_generated"`
|
|
AverageScore float64 `json:"average_score"`
|
|
}
|
|
|
|
type AdminUser struct {
|
|
ID string `json:"id"`
|
|
Email string `json:"email"`
|
|
Role string `json:"role"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
Attempts int `json:"attempts"`
|
|
AverageScore float64 `json:"average_score"`
|
|
LastAttempt *time.Time `json:"last_attempt,omitempty"`
|
|
}
|
|
|
|
type AdminUserPage struct {
|
|
Users []AdminUser `json:"users"`
|
|
Total int `json:"total"`
|
|
Page int `json:"page"`
|
|
}
|
|
|
|
type LearnerProfile struct {
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
TargetLanguage string `json:"target_language"`
|
|
CEFRLevel string `json:"cefr_level"`
|
|
DailyGoalMinutes int `json:"daily_goal_minutes"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type LanguageProfile struct {
|
|
Code string `json:"code"`
|
|
DisplayName string `json:"display_name"`
|
|
AzureLocale string `json:"azure_locale"`
|
|
DefaultTTSVoice string `json:"default_tts_voice"`
|
|
Voices []string `json:"voices"`
|
|
SupportsPronunciationAssessment bool `json:"supports_pronunciation_assessment"`
|
|
SupportsProsody bool `json:"supports_prosody"`
|
|
}
|
|
|
|
type Lesson struct {
|
|
ID string `json:"id"`
|
|
TargetLanguage string `json:"target_language"`
|
|
CEFRLevel string `json:"cefr_level"`
|
|
Topic string `json:"topic"`
|
|
Title string `json:"title"`
|
|
}
|
|
|
|
type Exercise struct {
|
|
TrainingReason string `json:"training_reason,omitempty"`
|
|
TrainingCategory string `json:"training_category,omitempty"`
|
|
ID string `json:"id"`
|
|
LessonID string `json:"lesson_id"`
|
|
TargetLanguage string `json:"target_language"`
|
|
CEFRLevel string `json:"cefr_level"`
|
|
Type string `json:"type"`
|
|
PromptText string `json:"prompt_text"`
|
|
TargetText string `json:"target_text"`
|
|
Difficulty int `json:"difficulty"`
|
|
Source string `json:"source,omitempty"`
|
|
}
|
|
|
|
type WordScore struct {
|
|
AccuracyMeasured *bool `json:"accuracy_measured,omitempty"`
|
|
Word string `json:"word"`
|
|
Accuracy float64 `json:"accuracy"`
|
|
ErrorType string `json:"error_type,omitempty"`
|
|
Phonemes []string `json:"phonemes,omitempty"`
|
|
PhonemeScores []PhonemeScore `json:"phoneme_scores,omitempty"`
|
|
Highlight string `json:"highlight"`
|
|
}
|
|
|
|
type PhonemeScore struct {
|
|
Position *int `json:"position,omitempty"`
|
|
Phoneme string `json:"phoneme"`
|
|
Accuracy float64 `json:"accuracy"`
|
|
Highlight string `json:"highlight"`
|
|
}
|
|
|
|
type WeakPhoneme struct {
|
|
Word string `json:"word"`
|
|
Phoneme string `json:"phoneme"`
|
|
Accuracy float64 `json:"accuracy"`
|
|
}
|
|
|
|
type PronunciationResult struct {
|
|
Locale string `json:"locale,omitempty"`
|
|
Alphabet string `json:"alphabet,omitempty"`
|
|
Method string `json:"method,omitempty"`
|
|
MeasurementVersion string `json:"measurement_version,omitempty"`
|
|
RecognizedText string `json:"recognized_text"`
|
|
OverallScore float64 `json:"overall_score"`
|
|
AccuracyScore float64 `json:"accuracy_score"`
|
|
FluencyScore float64 `json:"fluency_score"`
|
|
CompletenessScore float64 `json:"completeness_score"`
|
|
ProsodyScore float64 `json:"prosody_score"`
|
|
WordScores []WordScore `json:"word_scores"`
|
|
Provider string `json:"provider"`
|
|
}
|
|
|
|
type Attempt struct {
|
|
Provider string `json:"provider,omitempty"`
|
|
Measurement *PronunciationResult `json:"-"`
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
ExerciseID string `json:"exercise_id"`
|
|
TargetLanguage string `json:"target_language"`
|
|
RecognizedText string `json:"recognized_text"`
|
|
OverallScore float64 `json:"overall_score"`
|
|
AccuracyScore float64 `json:"accuracy_score"`
|
|
FluencyScore float64 `json:"fluency_score"`
|
|
CompletenessScore float64 `json:"completeness_score"`
|
|
ProsodyScore float64 `json:"prosody_score"`
|
|
WordScores []WordScore `json:"word_scores"`
|
|
TeacherFeedback string `json:"teacher_feedback"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type ProgressSummary struct {
|
|
TotalAttempts int `json:"total_attempts"`
|
|
AverageScore float64 `json:"average_score"`
|
|
WeakWords []WordScore `json:"weak_words"`
|
|
WeakPhonemes []WeakPhoneme `json:"weak_phonemes"`
|
|
RecentAttempts []Attempt `json:"recent_attempts"`
|
|
DailyGoalMinutes int `json:"daily_goal_minutes"`
|
|
}
|
|
|
|
type GeneratedExerciseRequest struct {
|
|
TrainingPlan *PronunciationPlan `json:"training_plan,omitempty"`
|
|
UserID string `json:"user_id"`
|
|
Profile LearnerProfile `json:"profile"`
|
|
Progress ProgressSummary `json:"progress"`
|
|
TargetLanguage string `json:"target_language"`
|
|
CEFRLevel string `json:"cefr_level"`
|
|
UILanguage string `json:"ui_language"`
|
|
SessionID string `json:"session_id"`
|
|
RecentWeakWords []WordScore `json:"recent_weak_words"`
|
|
PreferredType string `json:"preferred_type"`
|
|
AvoidReferenceText string `json:"avoid_reference_text,omitempty"`
|
|
AvoidReferenceTexts []string `json:"avoid_reference_texts,omitempty"`
|
|
}
|
|
|
|
type GeneratedExercise struct {
|
|
TrainingPlan *PronunciationPlan `json:"-"`
|
|
CandidateWord string `json:"candidate_word,omitempty"`
|
|
ID string `json:"exercise_id"`
|
|
ExerciseType string `json:"exercise_type"`
|
|
TargetLanguage string `json:"target_language"`
|
|
CEFRLevel string `json:"cefr_level"`
|
|
ReferenceText string `json:"reference_text"`
|
|
DisplayPrompt string `json:"display_prompt"`
|
|
TTSText string `json:"tts_text"`
|
|
FocusPoints []string `json:"focus_points"`
|
|
SuccessCriteria []string `json:"success_criteria"`
|
|
ReasonForChoice string `json:"reason_for_choice"`
|
|
Source string `json:"source"`
|
|
}
|
|
|
|
type Dashboard struct {
|
|
User User `json:"user"`
|
|
Profile LearnerProfile `json:"profile"`
|
|
Progress ProgressSummary `json:"progress"`
|
|
NextLesson Lesson `json:"next_lesson"`
|
|
NextExercise Exercise `json:"next_exercise"`
|
|
}
|
|
|
|
type ConversationSession struct {
|
|
ID string `json:"id"`
|
|
UserID string `json:"user_id"`
|
|
TargetLanguage string `json:"target_language"`
|
|
CEFRLevel string `json:"cefr_level"`
|
|
Status string `json:"status"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type ConversationTurn struct {
|
|
ID string `json:"id"`
|
|
SessionID string `json:"session_id"`
|
|
Speaker string `json:"speaker"`
|
|
Text string `json:"text"`
|
|
AttemptID string `json:"attempt_id,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type TeacherResponse struct {
|
|
ExerciseType string `json:"exercise_type"`
|
|
TargetText string `json:"target_text"`
|
|
TeacherFeedback string `json:"teacher_feedback"`
|
|
TTSText string `json:"tts_text"`
|
|
SSML string `json:"ssml"`
|
|
NextRecommendation string `json:"next_recommendation"`
|
|
}
|
|
|
|
type DebugDBStatus struct {
|
|
OK bool `json:"ok"`
|
|
Counts map[string]int `json:"counts"`
|
|
SeedLanguageCount int `json:"seed_language_count"`
|
|
SeedExerciseCount int `json:"seed_exercise_count"`
|
|
Error string `json:"error,omitempty"`
|
|
}
|
|
|
|
type CourseModule struct {
|
|
ID string `json:"id"`
|
|
Title string `json:"title"`
|
|
Description string `json:"description"`
|
|
TargetLanguage string `json:"target_language"`
|
|
CEFRLevel string `json:"cefr_level"`
|
|
Version int `json:"version"`
|
|
TaskCount int `json:"task_count"`
|
|
AttemptedCount int `json:"attempted_count"`
|
|
CorrectCount int `json:"correct_count"`
|
|
}
|
|
|
|
type CourseTask struct {
|
|
Source string `json:"source,omitempty"`
|
|
ID string `json:"id"`
|
|
ModuleID string `json:"module_id"`
|
|
Skill string `json:"skill"`
|
|
Kind string `json:"kind"`
|
|
Prompt string `json:"prompt"`
|
|
Passage string `json:"passage,omitempty"`
|
|
Options []string `json:"options,omitempty"`
|
|
PronunciationExercise *Exercise `json:"pronunciation_exercise,omitempty"`
|
|
Attempted bool `json:"attempted"`
|
|
Correct bool `json:"correct"`
|
|
}
|
|
|
|
type CourseModuleDetail struct {
|
|
Module CourseModule `json:"module"`
|
|
Tasks []CourseTask `json:"tasks"`
|
|
}
|
|
|
|
type CourseTaskKey struct {
|
|
ID string
|
|
ModuleID string
|
|
Skill string
|
|
Kind string
|
|
AudioText string
|
|
AcceptedAnswers []string
|
|
Solution string
|
|
Explanation string
|
|
}
|
|
|
|
type CourseAttemptResult struct {
|
|
ID string `json:"id"`
|
|
TaskID string `json:"task_id"`
|
|
Correct bool `json:"correct"`
|
|
Solution string `json:"solution"`
|
|
Explanation string `json:"explanation"`
|
|
Transcript string `json:"transcript,omitempty"`
|
|
}
|