-
Notifications
You must be signed in to change notification settings - Fork 106
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
Package search #259
Package search #259
Conversation
Response::isNotModified() doesn't need to be wrapped in the if statement, as it'll remove the content (even for a StreamedResponse)
* repman-io/master: Create CODE_OF_CONDUCT.md (#258) Release 0.6.0 (#254) Update dependencies (symfony to 5.1.5) (#257) Add queue for downloader to limit concurrent requests (#253) Add missing config for doctrine migrations 3.0 (#252) Update Symfony to 5.1 (#250) Set ulimit -n for system user (#251) Implement command for clearing old private distributions files (#244) Fix Proxy response caching (#247)
Signed-off-by: Joshua Gigg <giggsey@gmail.com>
Hey @giggsey, looks like a good idea. final class Filter
{
private int $offset;
private int $limit;
public function __construct()
{
$this->offset = 0;
$this->limit = 20;
}
public function setOffset(int $offset): self
{
$this->offset = $offset;
return $this;
}
public function setLimit(int $limit): self
{
$this->limit = $limit;
return $this;
}
public function limit(): int
{
return $this->limit;
}
public function offset(): int
{
return $this->offset;
}
} (you can add And then add it to count and found methods in query: interface PackageQuery
{
public function findAll(Filter $filter): array;
public function count(Filter $filter): int;
} |
@akondas Sounds good - I'll continue over the next few days. |
@akondas Tests are failing because the test data is inserting NULL name & description. I don't use Postgres, and I'm not sure if there is a trick to include NULLs when the Filter searchTerm is empty. |
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.
I left some comments, the rest looks fine 👏
Codecov Report
@@ Coverage Diff @@
## master #259 +/- ##
=========================================
Coverage 99.81% 99.82%
- Complexity 1522 1539 +17
=========================================
Files 251 252 +1
Lines 4434 4479 +45
=========================================
+ Hits 4426 4471 +45
Misses 8 8
Continue to review full report at Codecov.
|
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.
Nice 👍
Do you want to try to write a functional test for this functionality? (you can check OrganizationControllerTest::testPackages
should be very similar, also in test you can use $this->fixtures->syncPackageWithData
to populate package with given name)
Sure, I'll look at adding the tests. |
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.
Thanks 🍻 @giggsey, this will also fix error with negative offset 😉
@akondas There are other places that use pagination, but are still doing it manually. Want me to convert them over to Filter (no need to add search to them) |
Whenever you have the opportunity, I would like to. I'm just wondering if I should make a separate filter then so that this search term is not confusing. In the sense, if a particular query does not implement a search, let it use a filter without that capability. If so, I would suggest to do a separate filter in the namespace of
|
* Package List Search Signed-off-by: Joshua Gigg <giggsey@gmail.com> * Replace all pagination with Filter classes Continuation of #259 * Fix code style * Fix suggestions & PHPStan * Import Filter as an Alias Co-authored-by: Arkadiusz Kondas <arkadiusz.kondas@gmail.com>
Just want a bit of feedback/advice before I continue on this:
PackageQuery
class - to avoid having to add search functionality for each, could a paginator bundle be used instead? (I come from a Laravel background where it's a core part of the framework)