chore: fix order by pinned

This commit is contained in:
Steven
2023-11-19 09:42:59 +08:00
parent 94c71cb834
commit ec2995d64a
4 changed files with 26 additions and 18 deletions

View File

@@ -96,7 +96,10 @@ func (d *DB) ListMemos(ctx context.Context, find *store.FindMemo) ([]*store.Memo
}
where = append(where, fmt.Sprintf("`memo`.`visibility` in (%s)", strings.Join(list, ",")))
}
orders := []string{"`pinned` DESC"}
orders := []string{}
if find.OrderByPinned {
orders = append(orders, "`pinned` DESC")
}
if find.OrderByUpdatedTs {
orders = append(orders, "`updated_ts` DESC")
} else {