summaryrefslogtreecommitdiff
path: root/internal/database
diff options
context:
space:
mode:
authorGrail Finder (aider) <wohilas@gmail.com>2025-04-06 09:27:45 +0300
committerGrail Finder (aider) <wohilas@gmail.com>2025-04-06 09:27:45 +0300
commitad29977e1ad64439f2dd620849439e40c8b97860 (patch)
tree2dce8be52b2446f95188549e8b42f9e57f1da17f /internal/database
parent42018ec3137dd2af5c84567e7b603f0eaf055048 (diff)
feat: add MixedUbung buttons to main page
Diffstat (limited to 'internal/database')
-rw-r--r--internal/database/repos/questions.go10
1 files changed, 10 insertions, 0 deletions
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)