-
Notifications
You must be signed in to change notification settings - Fork 10
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
feat: enhance GET credential endpoint with filters #297
Conversation
tests/database/SsiCredentialIssuer.DbAccess.Tests/CompanySsiDetailsRepositoryTests.cs
Fixed
Show fixed
Hide fixed
tests/database/SsiCredentialIssuer.DbAccess.Tests/CompanySsiDetailsRepositoryTests.cs
Fixed
Show fixed
Hide fixed
business perspective sounds reasonable . |
@@ -0,0 +1,8 @@ | |||
namespace Org.Eclipse.TractusX.SsiCredentialIssuer.DBAccess.Models; |
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 add a licence header
@@ -26,7 +26,7 @@ namespace Org.Eclipse.TractusX.SsiCredentialIssuer.Service.BusinessLogic; | |||
|
|||
public interface IIssuerBusinessLogic | |||
{ | |||
IAsyncEnumerable<UseCaseParticipationData> GetUseCaseParticipationAsync(); | |||
IAsyncEnumerable<UseCaseParticipationData> GetUseCaseParticipationAsync(string? status); |
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.
You can directly user StatusType?
IAsyncEnumerable<UseCaseParticipationData> GetUseCaseParticipationAsync(string? status); | |
IAsyncEnumerable<UseCaseParticipationData> GetUseCaseParticipationAsync(StatusType? status); |
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.
Here the StatusType was not used because the error messages we have to throw to the user. They are customized and with the use of the object it self it would not be possible.
public IAsyncEnumerable<UseCaseParticipationData> GetUseCaseParticipationAsync(string? status) | ||
{ | ||
StatusType? statusTypeResult = null; | ||
if (!string.IsNullOrEmpty(status)) | ||
{ | ||
if (!(Enum.TryParse<StatusType>(status, ignoreCase: true, out var statusType) || !Enum.IsDefined(typeof(StatusType), statusType))) | ||
{ | ||
throw new ArgumentException($"Status value {status} is not valid; please use Active, Expired or All"); | ||
} | ||
statusTypeResult = statusType; | ||
} |
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.
You can directly use StatusType, than the conversion isn't needed
public IAsyncEnumerable<UseCaseParticipationData> GetUseCaseParticipationAsync(string? status) | |
{ | |
StatusType? statusTypeResult = null; | |
if (!string.IsNullOrEmpty(status)) | |
{ | |
if (!(Enum.TryParse<StatusType>(status, ignoreCase: true, out var statusType) || !Enum.IsDefined(typeof(StatusType), statusType))) | |
{ | |
throw new ArgumentException($"Status value {status} is not valid; please use Active, Expired or All"); | |
} | |
statusTypeResult = statusType; | |
} | |
public IAsyncEnumerable<UseCaseParticipationData> GetUseCaseParticipationAsync(StatusType? status) | |
{ | |
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.
Here is the same. When I use the type object I cannot have a customized message. At least I could not find a way to do that. I would be grateful to have a support here
@@ -42,16 +42,18 @@ public static RouteGroupBuilder MapIssuerApi(this RouteGroupBuilder group) | |||
{ | |||
var issuer = group.MapGroup("/issuer"); | |||
|
|||
issuer.MapGet("useCaseParticipation", (IIssuerBusinessLogic logic) => logic.GetUseCaseParticipationAsync()) | |||
issuer.MapGet("useCaseParticipation", (IIssuerBusinessLogic logic, | |||
[FromQuery(Name = "status")] string? status) => logic.GetUseCaseParticipationAsync(status)) |
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.
Can be changed to StatusType as well
[FromQuery(Name = "status")] string? status) => logic.GetUseCaseParticipationAsync(status)) | |
[FromQuery(Name = "status")] StatusType? status) => logic.GetUseCaseParticipationAsync(status)) |
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.
The same here, it is just to have a customized error message.
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.
@leandro-cavalcante helm install fails see, this could suggest that the service doesn't start successfully, could you please confirm that that's not the case?
I have Sync the PR and now it is working fine. |
@evegufy This is the correct PR. |
@leandro-cavalcante there are now 17 unrelated commits show in the PR |
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 remove all commits that don't belong to this change
f98bfec
to
9d3ac69
Compare
Internal issuer component enhance get credential endpoint by supporting filters
Description
The purpose of this feature is to enhance the functionality of the existing GET /api/issuer/useCaseParticipation endpoint in the Issuer Component. The enhancement involves the ability to filter the returned list of use case participations by the status of the credentials (Active, Expired, or All).
Why
Instead of always returning all use case credentials it gives the customer the power of retrieving it by status.
Issue
NA
Checklist
Please delete options that are not relevant.