-
Notifications
You must be signed in to change notification settings - Fork 53
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
chore(performance): use subresources & uriTemplate property #4968
Changes from 9 commits
e70d5e2
b4a1a61
e84147a
2e3c80d
8c5cc9f
e82b462
1169043
58e2e4f
28e6169
ba4d615
56a6900
4133ff9
0d4f1b4
7e97257
ed8433d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,7 +45,7 @@ public function testGetSingleCampIsAllowedForGuest() { | |
/** @var Camp $camp */ | ||
$camp = static::getFixture('camp1'); | ||
$user = static::getFixture('user3guest'); | ||
static::createClientWithCredentials(['email' => $user->getEmail()])->request('GET', '/camps/'.$camp->getId()); | ||
$response = static::createClientWithCredentials(['email' => $user->getEmail()])->request('GET', '/camps/'.$camp->getId()); | ||
$this->assertResponseStatusCodeSame(200); | ||
$this->assertJsonContains([ | ||
'id' => $camp->getId(), | ||
|
@@ -67,6 +67,12 @@ public function testGetSingleCampIsAllowedForGuest() { | |
'categories' => ['href' => '/categories?camp=%2Fcamps%2F'.$camp->getId()], | ||
], | ||
]); | ||
|
||
$responseArray = $response->toArray(); | ||
$period1 = static::getFixture('period1'); | ||
$period2 = static::getFixture('period2'); | ||
$this->assertEquals("/periods/{$period2->getId()}/days", $responseArray['_embedded']['periods'][0]['_links']['days']['href']); | ||
$this->assertEquals("/periods/{$period1->getId()}/days", $responseArray['_embedded']['periods'][1]['_links']['days']['href']); | ||
Comment on lines
+74
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the order of these two periods in the response guaranteed? Or should you use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, should always be sorted by period start date: period2 starts before period1: |
||
} | ||
|
||
public function testGetSingleCampIsAllowedForMember() { | ||
|
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.
As far as I see, you added the new GetCollections, but also kept the old, unfiltered ones everywhere. Shouldn't we switch to the new endpoints completely where possible? I think performance-wise we also found out that it doesn't make sense to fetch e.g. all schedule entries across all accessible camps, so this would enable us to disallow fetching the unfiltered collection, no?
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'd agree, that eventually, we should remove the unfiltered GetCollection (if everyone else agrees as well).
However, some additional works is necessary.
DayResponsibles
is also linked fromScheduleEntry
is also linked fromDay
is not linked from any other entity in the backend, but in the frontend we use the/days
endpoint to load all days of a camp.Overall, I'd vote for keeping this PR limited to introducing subresources as a concept. And further down the road, as we introduce more subresources we can (carefully) start to remove the main GetCollection endpoints.