add new tmpl copy method to quiz repo
This commit is contained in:
parent
a3bce771c9
commit
2846994480
@ -412,12 +412,12 @@ func (r *QuizRepository) UpdateQuiz(ctx context.Context, accountId string, recor
|
||||
|
||||
params = append(params, record.GroupId, record.Version, record.Id, accountId)
|
||||
var placeholders []any
|
||||
for i:=1;i<=len(params);i++ {
|
||||
for i := 1; i <= len(params); i++ {
|
||||
placeholders = append(placeholders, i)
|
||||
}
|
||||
|
||||
query = fmt.Sprintf(query, placeholders...)
|
||||
|
||||
|
||||
_, err := r.pool.ExecContext(ctx, query, params...)
|
||||
return err
|
||||
}
|
||||
@ -631,3 +631,23 @@ func (r *QuizRepository) GetStartedQuizzesID(ctx context.Context, accountID stri
|
||||
|
||||
return ids, nil
|
||||
}
|
||||
|
||||
func (r *QuizRepository) TemplateCopy(ctx context.Context, accountID, qID string) error {
|
||||
qUUID, err := uuid.Parse(qID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
qNullUUID := uuid.NullUUID{UUID: qUUID, Valid: true}
|
||||
|
||||
err = r.queries.TemplateCopy(ctx, sqlcgen.TemplateCopyParams{
|
||||
Accountid: accountID,
|
||||
Qid: qNullUUID,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user