fix: list activities

This commit is contained in:
Steven
2023-12-20 08:01:27 +08:00
parent d4c7de3916
commit bec2c15ac9
9 changed files with 126 additions and 127 deletions

View File

@ -2,6 +2,7 @@ package postgres
import (
"context"
"fmt"
"strings"
"github.com/yourselfhosted/slash/store"
@ -42,8 +43,8 @@ func (d *DB) ListActivities(ctx context.Context, find *store.FindActivity) ([]*s
if find.Level != "" {
where, args = append(where, "level = "+placeholder(len(args)+1)), append(args, find.Level.String())
}
if find.Where != nil {
where = append(where, find.Where...)
if find.PayloadShortcutID != nil {
where, args = append(where, fmt.Sprintf("CAST(payload as JSON)->>'shortcutId' = %s", placeholder(len(args)+1))), append(args, *find.PayloadShortcutID)
}
query := `