fix HsHostingAssetRepository.findAllByCriteriaImpl query #69

Merged
hsh-michaelhoennig merged 1 commits from fix-find-hosting-assets-query into master 2024-07-03 10:36:30 +02:00
No description provided.
hsh-michaelhoennig added 1 commit 2024-07-02 13:06:34 +02:00
hsh-michaelhoennig reviewed 2024-07-02 13:08:43 +02:00
@ -16,4 +16,1 @@
@Query("""
SELECT asset FROM HsHostingAssetEntity asset
WHERE (:projectUuid IS NULL OR asset.bookingItem.project.uuid = :projectUuid)
Author
Member

This JPQL query did only work for hosting-assets which have a directly-assigned booking-item because "left" was missing for the joins.

When I tried to run a test with EMAIL_ALIAS, it returned no records at all.

This JPQL query did only work for hosting-assets which have a directly-assigned booking-item because "left" was missing for the joins. When I tried to run a test with EMAIL_ALIAS, it returned no records at all.
hsh-michaelhoennig reviewed 2024-07-02 13:09:32 +02:00
@ -7,13 +7,13 @@ get:
parameters:
- $ref: 'auth.yaml#/components/parameters/currentUser'
- $ref: 'auth.yaml#/components/parameters/assumedRoles'
- name: debitorUuid
Author
Member

This was a remnant from times before we had a project between debitor and asset. project makes more sense and the actual query was only implemented for project anyway.

This was a remnant from times before we had a project between debitor and asset. project makes more sense and the actual query was only implemented for project anyway.
hsh-michaelhoennig reviewed 2024-07-02 13:11:43 +02:00
@ -89,22 +89,10 @@ class HsHostingAssetControllerAcceptanceTest extends ContextBasedTestWithCleanup
.contentType("application/json")
.body("", lenientlyEquals("""
[
{
Author
Member

because of the mismatch of debitor+project, ?projectUuid=" + givenProject.getUuid() was ignored and too many rows were returned, now, where this is fixed, only the rows for "D-1000111 default project" get returned

because of the mismatch of debitor+project, `?projectUuid=" + givenProject.getUuid() ` was ignored and too many rows were returned, now, where this is fixed, only the rows for "D-1000111 default project" get returned
hsh-michaelhoennig reviewed 2024-07-02 13:12:39 +02:00
@ -206,3 +207,4 @@
.findAny().orElseThrow().getUuid();
// when
context("superuser-alex@hostsharing.net", "hs_hosting_asset#vm1012:AGENT");
Author
Member

the test name says "normalUser ..." but the superuser context without assumed role was still open, now assuming a normal users role

the test name says "normalUser ..." but the superuser context without assumed role was still open, now assuming a normal users role
hsh-michaelhoennig force-pushed fix-find-hosting-assets-query from 3021048c87 to 278467efac 2024-07-02 13:18:57 +02:00 Compare
hsh-michaelhoennig reviewed 2024-07-02 13:19:33 +02:00
@ -412,4 +413,2 @@
.containsExactlyInAnyOrder(serverNames);
}
void allTheseServersAreReturned(final List<HsHostingAssetEntity> actualResult, final String... serverNames) {
Author
Member

it's always better to test for exact returns then just for "contains", amended all calls, thus this methods is not needed anymore

it's always better to test for exact returns then just for "contains", amended all calls, thus this methods is not needed anymore
hsh-marcsandlus approved these changes 2024-07-03 10:36:02 +02:00
hsh-michaelhoennig merged commit c5722e494f into master 2024-07-03 10:36:30 +02:00
hsh-michaelhoennig deleted branch fix-find-hosting-assets-query 2024-07-03 10:36:30 +02:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: hostsharing/hs.hsadmin.ng#69
No description provided.