carbonplan / offsets-db-api

accounting of voluntary and compliance offset programs
https://carbonplan.org/research/offsets-db
MIT License
1 stars 0 forks source link

Consistent handling of "unexpected" filtering #46

Closed katamartin closed 1 year ago

katamartin commented 1 year ago

It's currently possible to deselect all category values by using an arbitrary category filter ('none', 'foo', etc.). This allows us to show a nice "filtered out" empty state when deselecting all categories on the frontend.

CleanShot 2023-10-30 at 10 30 07@2x

using filter like: http://offsets-db.fly.dev/projects/?category=none

However, the same is not supported for registry (See https://offsets-db.fly.dev/projects/?registry=none). Is it possible to consistently either (a) support unexpected filter values by simply not returning results if nothing matches or (b) support specific a filter value that can be used for deselection like none ?

andersy005 commented 1 year ago

@katamartin, this should be fixed

❯ http 'https://offsets-db.fly.dev/projects/?registry=none'                                                                                                               ─╯
HTTP/1.1 200 OK
content-encoding: gzip
content-type: application/json
date: Tue, 31 Oct 2023 14:38:12 GMT
fly-request-id: 01HE32QCR66XBEKANBQZR939BF-lax
server: Fly/7328d5b5 (2023-10-27)
transfer-encoding: chunked
via: 1.1 fly.io

{
    "data": [],
    "pagination": {
        "current_page": 1,
        "next_page": null,
        "total_entries": 0,
        "total_pages": 0
    }
}