-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extend line filtering to support nfk (#261)
* Addeing query and endpoint to search after all lines whithin an given organization. * Adding useSWR to line-filter to only fetch lines from organization when needed. Also updated endpoint to map correctly between public code and number of lines. * Update troms.json and add lines() to assistant.test.tsx. * Remove exessive string around param. * Add cache to lines(). * Rewrite endpoint to return one object. Also, rewrite to using Map instead of Record * Fix logic to enable filtering on multiple line numbers. * Remove dependencies from dependencies array to avoid bug. * Rewrite back to using record insted of map. Also remove cache. * Move mapFilterStateToLineCodes() out of useEffect(). * Add cache-first cache policy to endpoint and update transaltions. * Add whitespace between line codes at refresh of page.
- Loading branch information
1 parent
be394b2
commit 4bd12d0
Showing
15 changed files
with
134 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/page-modules/assistant/server/journey-planner/journey-gql/lines.gql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
query Lines($authorities: [String]) { | ||
lines(authorities: $authorities) { | ||
...line | ||
} | ||
} | ||
|
||
fragment line on Line { | ||
id | ||
publicCode | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { tryResult } from '@atb/modules/api-server'; | ||
import { LinesApiReturnType } from '@atb/page-modules/assistant/client'; | ||
import { handlerWithAssistantClient } from '@atb/page-modules/assistant/server'; | ||
|
||
export default handlerWithAssistantClient<LinesApiReturnType>({ | ||
async GET(req, res, { client, ok }) { | ||
const { authorityId } = req.query; | ||
const authorities: string[] = []; | ||
|
||
if (typeof authorityId === 'string') { | ||
authorities.push(authorityId); | ||
} | ||
|
||
return tryResult(req, res, async () => { | ||
return ok( | ||
await client.lines({ | ||
authorities: authorities, | ||
}), | ||
); | ||
}); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters