-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix #272: cherry pick api and helpers implemented #273
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.
code looks very good, but please limnit the use of static classes and use dependency injection
/// <summary> | ||
/// Gets or sets a collection of <see cref="Category"/>s shortname to used during the cherry picking request | ||
/// </summary> | ||
IEnumerable<string> CategoriesShortName { get; set; } |
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 doubt using shortnames wil work, they cannot be guaranteed to be unique accross the chain of RDLs. Please refactor to use Guids, feel free to use shortguids
return invalidRequest.WithStatusCode(HttpStatusCode.BadRequest); | ||
} | ||
|
||
var cherryPickedThings = CherryPickHelper.CherryPick(resourceResponse, this.RequestUtils.QueryParameters.ClassKinds, this.RequestUtils.QueryParameters.CategoriesShortName) |
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 needs to be refactored to use the injected interface and will help when doing unit testing, it can then be mocked
/// <summary> | ||
/// Helper for the cherry picking features | ||
/// </summary> | ||
public static class CherryPickHelper |
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.
please refactor to an injectable service.
/// <summary> | ||
/// Helper class that provide capabilities on retrieving contained <see cref="Thing"/> or container <see cref="Thing"/> | ||
/// </summary> | ||
public static class ContainmentHelper |
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.
please refactor to injectable service
{ | ||
Logger.Info(this.ConstructLog($"{requestToken} started")); | ||
HttpRequestHelper.ValidateSupportedQueryParameter(this.Request, this.RequestUtils, SupportedGetQueryParameters); | ||
|
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 think that we should verify that the caller has permissions to request the classkind before we process the request. If the classkind does not have at leas READ, we should exit here and return a 404 not allowed. I want to make sure we do not create a backdoor here.
please add unit tests to keep coverage to at least the current value or better. Core product, cannot accept code without coverage |
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 agree with Sam's comments. The rest looks good to me.
@samatrhea Included your change requests and created unit tests for Services. |
Prerequisites
Description
Fix #272