peerigon / peerigon/clockodo

Improve filter interface

Open
#84 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue
Dominant language
TypeScript
Stars
23
Forks
7
Avg merge
6h 22m
Merged PRs (30d)
8

Description

There are two issues with the current filter interface (that is used by getEntries for instance):

  • We need to maintain a separate query param mapping
  • The return type of a filtered response is not accurate. If I call getEntries() with a filter on customersId, I'd expect the returned filter property to only have customersId.

I'd like to have an interface like this:

const response = await clockodo.getEntries({
   filter: {
      customersId: 123
   }
});

// response is now a type that looks like this

type Response = {
    paging: Paging
    filter: {
        customersId: number
    },
    entries: Array<Entry>
}

This allows us to type the filter for each endpoint. This should be doable with generics.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at getEntries and the filter definitions for each endpoint. Trace how filter values become query parameters and how the response type is declared. Done when endpoint filters have separate query mappings and a filtered getEntries response narrows its filter property to the supplied fields.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.