-
Notifications
You must be signed in to change notification settings - Fork 16
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
Implement Harvester API handlers #154
Implement Harvester API handlers #154
Conversation
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.
Very straightforward. There are some similarities with my PR. We may need to align some approaches.
See the comments bellow.
00e4342
to
7bfa3c1
Compare
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.
All good.
Just some minor comments.
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.
couple more comments. lemme know what you think.
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
Signed-off-by: Max Lambrecht <[email protected]>
2df9473
to
a004a68
Compare
Signed-off-by: Max Lambrecht <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
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.
🚲
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.
Thank you Max for all your work. This looks great! A left a couple of comments.
} | ||
|
||
// PatchRelationshipsRelationshipID accept/denied relationships requests - (PATCH /relationships/{relationshipID}) | ||
func (h *HarvesterAPIHandlers) PatchRelationshipsRelationshipID(ctx echo.Context, relationshipID api.UUID) error { | ||
// PatchRelationship accept/denies relationships requests - (PATCH /relationships/{relationshipID}) |
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.
nit picky
// PatchRelationship accepts/denies relationships requests - (PATCH /relationships/{relationshipID}
} | ||
|
||
// update the relationship consent status for the authenticated trust domain | ||
if relationship.TrustDomainAID == authTD.ID.UUID { |
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.
Shouldn't we check explicitly that the relationship.TrustDomainB == authTD.ID.UUID instead of having the else statement? Could we have a case that relationship.TrustdomainA or B does not match authTD.ID.UUID? Should we return an error if the authenticated trust domain does not match A or B in the relationship?
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.
There is a validation above preventing that case:
if relationship.TrustDomainAID != authTD.ID.UUID && relationship.TrustDomainBID != authTD.ID.UUID {
err := fmt.Errorf("relationship doesn't belong to the authenticated trust domain")
return h.handleErrorAndLog(err, err.Error(), http.StatusUnauthorized)
}
return h.handleErrorAndLog(err, msg, http.StatusInternalServerError) | ||
} | ||
|
||
return echoCtx.JSON(http.StatusOK, newToken) | ||
return chttp.WriteResponse(echoCtx, newToken) | ||
} | ||
|
||
// BundleSync synchronize the status of trust bundles between server and harvester - (POST /trust-domain/{trustDomainName}/bundles/sync) |
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.
Nit picky
// BundleSync synchronizes the status of trust bundles between server and harvester - (POST /trust-domain/{trustDomainName}/bundles/sync)
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.
We should have a grammar checker 😀
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 am using spelling check in the Visual Studio.
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.
My IDE has a checker, but IDK why it doesn't detect that error.
Pull request check list
Affected functionality
Add Harvester API handlers for:
GET /relationships
PATCH /relationships
POST /bundle
POST /bundles/sync
Description of change
Implementation of the GET relationships handler.
Implementatiojn of the POST bundle handler.
Implementatiojn of the POST bundle/sync handler.
Implementation of the PATCH relationships handler.
Redefinition of the
ConsentStatus
to make it consistent across all the layers (API, business, datastore), as an enum of three possible values:pending
,accepted
,denied
.Change the data model to reflect the
ConsentStatus
properly.Which issue this pull requests fixes
Part of the work of GLCP-39469