diff options
| -rw-r--r-- | internal/database/repos/questions.go | 11 | 
1 files changed, 10 insertions, 1 deletions
| diff --git a/internal/database/repos/questions.go b/internal/database/repos/questions.go index 4e8ea1e..9d0396e 100644 --- a/internal/database/repos/questions.go +++ b/internal/database/repos/questions.go @@ -9,7 +9,7 @@ type QuestionsRepo interface {  	DBGetQuestion(id string) (*models.Question, error)  	DBGetMixedUbung(id uint32) (*models.MixedUbung, error)  	DBListMixed(limit uint32) ([]models.MixedUbung, error) -	DBGetQuestionsByMixedID(id string) ([]models.Question, error) // implement; ai! +	DBGetQuestionsByMixedID(id string) ([]models.Question, error)  }  func (p *Provider) DBGetMixedUbung(id uint32) (*models.MixedUbung, error) { @@ -34,6 +34,15 @@ func (p *Provider) DBListMixed(limit uint32) ([]models.MixedUbung, error) {  	return ubungs, nil  } +func (p *Provider) DBGetQuestionsByMixedID(id string) ([]models.Question, error) { +	var questions []models.Question +	err := p.db.Select(&questions, "SELECT * FROM questions WHERE mixed_id = ? ORDER BY id", id) +	if err != nil { +		return nil, err +	} +	return questions, 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) | 
