fix(vault): offset in sql query

This commit is contained in:
Denis Gukov 2024-01-28 17:18:07 +05:00
parent 0a31f76300
commit 84fdfa4623
2 changed files with 10 additions and 1 deletions

View File

@ -235,6 +235,14 @@ func (d *SqlDb) getObjects(projectID int, props db.ObjectProps, params db.Retrie
q = q.OrderBy("pe." + orderColumn + " " + orderDirection)
}
if params.Count > 0 {
q = q.Limit(uint64(params.Count))
}
if params.Offset > 0 {
q = q.Offset(uint64(params.Offset))
}
query, args, err := q.ToSql()
if err != nil {

View File

@ -2,6 +2,7 @@ package sql
import (
"database/sql"
"errors"
"github.com/ansible-semaphore/semaphore/db"
)
@ -115,7 +116,7 @@ func (d *SqlDb) RekeyAccessKeys(oldKey string) (err error) {
key.OverrideSecret = true
err = d.UpdateAccessKey(key)
if err != nil {
if err != nil && !errors.Is(err, db.ErrNotFound) {
return err
}
}