From ad29977e1ad64439f2dd620849439e40c8b97860 Mon Sep 17 00:00:00 2001 From: "Grail Finder (aider)" Date: Sun, 6 Apr 2025 09:27:45 +0300 Subject: feat: add MixedUbung buttons to main page --- internal/database/repos/questions.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'internal/database/repos/questions.go') diff --git a/internal/database/repos/questions.go b/internal/database/repos/questions.go index ab5e093..daf7e16 100644 --- a/internal/database/repos/questions.go +++ b/internal/database/repos/questions.go @@ -5,6 +5,7 @@ import "demoon/internal/models" type QuestionsRepo interface { DBGetQuestion(id string) (*models.Question, error) DBGetMixedUbung(id uint32) (*models.MixedUbung, error) + DBGetFirst10MixedUbungs() ([]*models.MixedUbung, error) } func (p *Provider) DBGetMixedUbung(id uint32) (*models.MixedUbung, error) { @@ -16,6 +17,15 @@ func (p *Provider) DBGetMixedUbung(id uint32) (*models.MixedUbung, error) { return &ubung, nil } +func (p *Provider) DBGetFirst10MixedUbungs() ([]*models.MixedUbung, error) { + var ubungs []*models.MixedUbung + err := p.db.Select(&ubungs, "SELECT * FROM Table_Mixed ORDER BY MixedID LIMIT 10") + if err != nil { + return nil, err + } + return ubungs, nil +} + func (p *Provider) DBGetQuestion(id string) (*models.Question, error) { var question models.Question err := p.db.Get(&question, "SELECT * FROM questions WHERE id = ?", id) -- cgit v1.2.3