api/graph/model: Fix Tracker.QueryWithCursor

master 0.72.5
Adnan Maolood 2 months ago committed by Drew DeVault
parent c116c0db22
commit 268dacdc07
  1. 5
      api/graph/model/tracker.go

@ -91,7 +91,7 @@ func (t *Tracker) QueryWithCursor(ctx context.Context, runner sq.BaseRunner,
q = q.
OrderBy(database.WithAlias(t.alias, "id")+" DESC").
Limit(uint64(cur.Count+1)).
LeftJoin(`user_access tr_ua ON tr_ua.tracker_id = tr.id`).
LeftJoin(`user_access tr_ua ON tr_ua.tracker_id = tr.id AND tr_ua.user_id = ?`, auser.UserID).
Column(`COALESCE(
tr_ua.permissions,
CASE WHEN tr.owner_id = ?
@ -99,8 +99,7 @@ func (t *Tracker) QueryWithCursor(ctx context.Context, runner sq.BaseRunner,
ELSE tr.default_access
END)`,
auser.UserID, ACCESS_ALL).
Column(`tr_ua.id`).
Where(`COALESCE(tr_ua.user_id, ?) = ?`, auser.UserID, auser.UserID)
Column(`tr_ua.id`)
if rows, err = q.RunWith(runner).QueryContext(ctx); err != nil {
panic(err)

Loading…
Cancel
Save