summaryrefslogtreecommitdiff
path: root/internal/database/repos/questions.go
diff options
context:
space:
mode:
authorGrail Finder (aider) <wohilas@gmail.com>2025-04-06 09:13:51 +0300
committerGrail Finder (aider) <wohilas@gmail.com>2025-04-06 09:13:51 +0300
commitb5343e90084f6bc8934065f16ef1167320791050 (patch)
tree6241594e28131be8f1fdd9698f10d71a90e5031e /internal/database/repos/questions.go
parentde9367030b8089a5cb0cc129e889b6012c668e19 (diff)
feat: implement DBGetMixedUbung method
Diffstat (limited to 'internal/database/repos/questions.go')
-rw-r--r--internal/database/repos/questions.go11
1 files changed, 10 insertions, 1 deletions
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) {