-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1351 Preview #1359
Merged
Merged
1351 Preview #1359
Changes from 31 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
266f2b4
updates pull request template
seanmalbert 54189a9
Merge remote-tracking branch 'remotes/upstream/master'
seanmalbert 499db89
Merge remote-tracking branch 'remotes/upstream/master'
seanmalbert 925e4d3
Merge remote-tracking branch 'remotes/upstream/master'
seanmalbert c890e67
removes BACKEND_API_BASE from netlify.toml
seanmalbert 935a1ad
Merge remote-tracking branch 'remotes/upstream/master'
seanmalbert cf599f4
Merge remote-tracking branch 'remotes/upstream/master'
seanmalbert d296da6
updates for partners translation locale overrides
seanmalbert 86e3db0
Merge remote-tracking branch 'remotes/upstream/master'
seanmalbert 19f667d
resolve issue with out of sync lock and package files
seanmalbert db718d2
removes package-lock
seanmalbert 13c3a81
updates Layout path
seanmalbert 3b73e6a
Merge remote-tracking branch 'remotes/upstream/master'
seanmalbert 8f6173f
removes gtm key for production, since it should be coming from netlif…
seanmalbert 5963597
Merge remote-tracking branch 'remotes/upstream/master'
seanmalbert 70bcb2f
Merge remote-tracking branch 'remotes/upstream/master' into 1351-preview
seanmalbert d7ed076
Merge remote-tracking branch 'remotes/upstream/master' into 1351-preview
seanmalbert b6f9a4f
adds simple filter capability to listings and implements
seanmalbert 8e00194
regenerated swagger
seanmalbert 8978f6f
changelog entry
seanmalbert 77bfa51
Brings dev up-to-date with master (#1360)
seanmalbert a1eed1e
Merge remote-tracking branch 'remotes/upstream/dev' into 1351-preview
seanmalbert f366c82
update dev branch with master (#1373)
emilyjablonski 68ce8ee
Merge remote-tracking branch 'remotes/upstream/master' into 1351-preview
seanmalbert dfa96e5
addresses issues from review
seanmalbert 1ade8f7
Merge remote-tracking branch 'remotes/upstream/dev' into 1351-preview
seanmalbert 7b507f3
updates filter implementation
seanmalbert 2751d2c
completely changed filtering for listings
seanmalbert ace7f3d
=merge upstream
seanmalbert 1adf530
updates to handle multiple values for the same key
seanmalbert 248e1e5
=merge latest upstream dev
seanmalbert 831ceba
aside cleanup and log removal
seanmalbert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ApiProperty } from "@nestjs/swagger" | ||
import { Expose } from "class-transformer" | ||
|
||
// Add other comparisons as needed (>, <, etc) | ||
export enum Compare { | ||
"=" = "=", | ||
"<>" = "<>", | ||
} | ||
|
||
export class BaseFilter { | ||
@Expose() | ||
@ApiProperty({ | ||
enum: Object.keys(Compare), | ||
example: "=", | ||
default: Compare["="], | ||
}) | ||
$comparison: Compare | ||
} |
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,49 @@ | ||
import { WhereExpression } from "typeorm" | ||
|
||
/** | ||
* | ||
* @param filter | ||
* @param schema | ||
* @param qb | ||
*/ | ||
/** | ||
* This is super simple right now, but we can expand to include complex filter with ands, ors, more than one schema, etc | ||
*/ | ||
export function addFilter<Filter>(filter: Filter[], schema: string, qb: WhereExpression): void { | ||
const operator = "andWhere" | ||
/** | ||
* By specifying that the filter is an array, it keeps the keys in order, so we can iterate like below | ||
*/ | ||
let comparisons: unknown[], | ||
comparisonCount = 0 | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-for-in-array | ||
for (const key in filter) { | ||
const value = filter[key] | ||
if (key === "$comparison") { | ||
if (Array.isArray(value)) { | ||
comparisons = value | ||
} else { | ||
comparisons = [value] | ||
} | ||
} else { | ||
if (value !== undefined) { | ||
let values | ||
// handle multiple values for the same key | ||
if (Array.isArray(value)) { | ||
values = value | ||
} else { | ||
values = [value] | ||
} | ||
|
||
values.forEach((val: unknown) => { | ||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions | ||
qb[operator](`${schema}.${key} ${comparisons[comparisonCount]} :${key}`, { | ||
[key]: val, | ||
}) | ||
comparisonCount++ | ||
}) | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already defined in the monorepo in the top level package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this is the top level package.json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, my bad. :)