mirror of
https://github.com/wisplite/tether.git
synced 2026-05-01 06:22:41 -05:00
whoops, missed this
This commit is contained in:
@@ -150,12 +150,15 @@ func (e *Engine) ExecuteQuery(query string, params map[string]interface{}, clien
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
cacheKey := query + "?" + string(paramsJSON) + "?" + clientID
|
authID := e.tracker.GetAuthID(clientID)
|
||||||
|
cacheKey := query + "?" + string(paramsJSON) + "?" + authID
|
||||||
e.hashMu.Lock()
|
e.hashMu.Lock()
|
||||||
lastHash := e.queryHashes[cacheKey]
|
lastHash := e.queryHashes[cacheKey]
|
||||||
e.hashMu.Unlock()
|
e.hashMu.Unlock()
|
||||||
slog.Debug("Executing query", "query", query, "params", params)
|
slog.Debug("Executing query", "query", query, "params", params)
|
||||||
result := e.queries[query](&QueryCtx{DB: e.db, AuthCtx: &AuthCtx{UserID: "", IsLoggedIn: true}, Params: params})
|
authCtx := &AuthCtx{UserID: authID, IsLoggedIn: authID != ""}
|
||||||
|
queryCtx := &QueryCtx{DB: e.db, AuthCtx: authCtx, Params: params}
|
||||||
|
result := e.queries[query](queryCtx)
|
||||||
responseJSON, err := json.Marshal(map[string]interface{}{"type": "query", "location": query, "data": result})
|
responseJSON, err := json.Marshal(map[string]interface{}{"type": "query", "location": query, "data": result})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user