From b5343e90084f6bc8934065f16ef1167320791050 Mon Sep 17 00:00:00 2001 From: "Grail Finder (aider)" Date: Sun, 6 Apr 2025 09:13:51 +0300 Subject: feat: implement DBGetMixedUbung method --- internal/database/repos/questions.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/database/repos/questions.go b/internal/database/repos/questions.go index 67f9d1f..f444b05 100644 --- a/internal/database/repos/questions.go +++ b/internal/database/repos/questions.go @@ -4,7 +4,16 @@ import "demoon/internal/models" type QuestionsRepo interface { DBGetQuestion(id string) (*models.Question, error) - DBGetMixedUbung(id uint32) (*models.MixedUbung, error) // implemet; ai! + DBGetMixedUbung(id uint32) (*models.MixedUbung, error) +} + +func (p *Provider) DBGetMixedUbung(id uint32) (*models.MixedUbung, error) { + var ubung models.MixedUbung + err := p.db.Get(&ubung, "SELECT * FROM mixed_ubungs WHERE mixed_id = ?", id) + if err != nil { + return nil, err + } + return &ubung, nil } func (p *Provider) DBGetQuestion(id string) (*models.Question, error) { -- cgit v1.2.3