Skip to content
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

Stories/ecer 3208 #618

Merged
merged 43 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b845b08
WIP public lookup search form completed
Oct 7, 2024
ae5c74b
Merge remote-tracking branch 'origin/master' into tasks/ecer-3224
Oct 7, 2024
85b08a0
WIP lookup certification prior to vuetify upgrade
Oct 8, 2024
ca1cec8
BE: Create certification record query
qsl-deepak Oct 8, 2024
7106d48
Merge branch 'master' into tasks/ecer-3223
qsl-deepak Oct 8, 2024
a4c8ecf
upgrade vuetify and applied v-label opacity fix. Adjusted lookup to u…
Oct 9, 2024
529eed5
lintfix needed to include new rule tofix v-slot directive does not su…
Oct 9, 2024
cb19d7b
ECER-3223: Mapped certificate conditions, Fixed Automated tests
qsl-deepak Oct 9, 2024
3e70305
ECER-3223: Adjusted naming for "registration number" in lookup object
qsl-deepak Oct 9, 2024
02106e8
ECER-3223: Added Certification Levels array to response object
qsl-deepak Oct 10, 2024
7023a95
WIP lookup certification waiting for backend integration. Added ackno…
Oct 10, 2024
1b310bf
ECER-3223: Nested Object Join fixed in Query expression builder
farzadnadiri Oct 10, 2024
eecf9ba
ECER-3223: Clean Up Join2QueryExpression Builder, Fix/Cleanup Automat…
qsl-deepak Oct 10, 2024
74eae3c
ECER-3223: Added Pagination in B.E + Updated Automated tests
qsl-deepak Oct 11, 2024
a3e7f2c
ECER-3223: corrected Filter by Last Name query
qsl-deepak Oct 11, 2024
23f3757
Merge pull request #563 from bcgov/tasks/ecer-3223
qsl-deepak Oct 15, 2024
5351e0f
Merge remote-tracking branch 'origin/stories/ecer-3208' into tasks/ec…
Oct 15, 2024
a6257c8
Updated "filtering by certificate number" condition
qsl-deepak Oct 15, 2024
2e3c01f
Merge branch 'master' into stories/ecer-3208
qsl-deepak Oct 15, 2024
f31720f
fix merge with master
Oct 15, 2024
62d84c5
running npm install again after merge conflict with master
Oct 15, 2024
2b8eab4
fix git stash pop merge changes
Oct 15, 2024
fa386e2
Update CertificationRepository.cs
qsl-deepak Oct 16, 2024
4a39b5f
fix typo
qsl-deepak Oct 16, 2024
a55bfdd
added comment for GroupBy()
qsl-deepak Oct 16, 2024
78dbb20
added Page Size check for pagination
qsl-deepak Oct 16, 2024
9af4adb
adding types to certifications lookup call. Added loader when request…
SoLetsDev Oct 16, 2024
d9b53b7
Merge remote-tracking branch 'origin/master' into stories/ecer-3208
Oct 16, 2024
6b77379
Merge remote-tracking branch 'origin/stories/ecer-3208' into tasks/ec…
Oct 16, 2024
07583a0
Merge branch 'stories/ecer-3208' into fixes/refactor-cert-repo-query
qsl-deepak Oct 16, 2024
7a826d4
quick fixes for unused test code + comments
Oct 16, 2024
aa84e0a
removing .sdlintrc.cjs that was removed during upgrade
Oct 16, 2024
54e02a0
running gen-api
Oct 16, 2024
42d078b
Merge pull request #606 from bcgov/tasks/ecer-3224
SoLetsDev Oct 16, 2024
cac369c
Merge branch 'stories/ecer-3208' into fixes/refactor-cert-repo-query
qsl-deepak Oct 17, 2024
e12073a
Merge pull request #603 from bcgov/fixes/refactor-cert-repo-query
qsl-deepak Oct 17, 2024
dc08bf3
ECER-3210: Display registrant details with terms and conditions
qsl-deepak Oct 18, 2024
8aa5e64
Update LookupCertificationRecord.vue
qsl-deepak Oct 18, 2024
58518c7
Merge pull request #610 from bcgov/tasks/ecer-3210
qsl-deepak Oct 18, 2024
737e28b
Merge remote-tracking branch 'origin/master' into stories/ecer-3208
Oct 21, 2024
1252136
reusing function to generate certificate name
Oct 21, 2024
796b02e
Merge branch 'master' into stories/ecer-3208
qsl-deepak Oct 22, 2024
0c721a8
npm run gen-api
qsl-deepak Oct 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ public CertificationMapper()
CreateMap<Managers.Registry.Contract.Certifications.Certification, Certification>().ReverseMap();
CreateMap<Managers.Registry.Contract.Certifications.CertificationLevel, CertificationLevel>().ReverseMap();
CreateMap<Managers.Registry.Contract.Certifications.CertificationFile, CertificationFile>().ReverseMap();
CreateMap<Managers.Registry.Contract.Certifications.Certification, CertificationLookupResponse>()
.ForCtorParam(nameof(CertificationLookupResponse.Id),
opt => opt.MapFrom(s => s.Id))
.ForMember(d => d.Name, opts => opts.MapFrom(s => s.Name))
.ForMember(d => d.RegistrationNumber, opts => opts.MapFrom(s => s.Number))
.ForMember(d => d.StatusCode, opts => opts.MapFrom(s => s.StatusCode))
.ForMember(d => d.LevelName, opts => opts.MapFrom(s => s.LevelName))
.ForMember(d => d.ExpiryDate, opts => opts.MapFrom(s => s.ExpiryDate))
.ForMember(d => d.HasConditions, opts => opts.MapFrom(s => s.HasConditions))
.ForMember(d => d.CertificateConditions, opts => opts.MapFrom(s => s.CertificateConditions))
.ForMember(d => d.Levels, opts => opts.MapFrom(s => s.Levels));

CreateMap<Managers.Registry.Contract.Certifications.CertificateCondition, CertificateCondition>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using ECER.Utilities.Hosting;
using ECER.Utilities.Security;
using MediatR;
using Microsoft.AspNetCore.Http.HttpResults;
using Microsoft.AspNetCore.Mvc;

namespace ECER.Clients.RegistryPortal.Server.Certifications;

Expand All @@ -24,13 +26,43 @@ public void Register(IEndpointRouteBuilder endpointRouteBuilder)
return TypedResults.Ok(mapper.Map<IEnumerable<Certification>>(results.Items));
})
.WithOpenApi("Handles certification queries", string.Empty, "certification_get")
.RequireAuthorization()
.RequireAuthorization()
.WithParameterValidation();

endpointRouteBuilder.MapPost("/api/certifications/lookup", async Task<Results<Ok<IEnumerable<CertificationLookupResponse>>, BadRequest<ProblemDetails>, NotFound>> (CertificationLookupRequest request, HttpContext httpContext, CancellationToken ct, IMediator messageBus, IMapper mapper) =>
{
var recaptchaResult = await messageBus.Send(new Managers.Registry.Contract.Recaptcha.VerifyRecaptchaCommand(request.RecaptchaToken), ct);

if (!recaptchaResult.Success)
{
var problemDetails = new ProblemDetails
{
Status = StatusCodes.Status400BadRequest,
Detail = "Invalid recaptcha token",
Extensions = { ["errors"] = recaptchaResult.ErrorCodes }
};
return TypedResults.BadRequest(problemDetails);
}

var query = new UserCertificationQuery
{
ByCertificateNumber = request.RegistrationNumber,
ByFirstName = request.FirstName,
ByLastName = request.LastName,
PageNumber = request.PageNumber,
PageSize = request.PageSize
};
var results = await messageBus.Send(query, ct);
return TypedResults.Ok(mapper.Map<IEnumerable<CertificationLookupResponse>>(results.Items));
})
.WithOpenApi("Handles certifications lookup queries", string.Empty, "certifications_lookup_post")
.WithParameterValidation();
}
}

public record Certification(string Id)
{
public string? Name { get; set; }
public string? Number { get; set; }
public DateTime? ExpiryDate { get; set; }
public DateTime? EffectiveDate { get; set; }
Expand All @@ -42,8 +74,41 @@ public record Certification(string Id)
public YesNoNull? IneligibleReference { get; set; }
public IEnumerable<CertificationLevel> Levels { get; set; } = Array.Empty<CertificationLevel>();
public IEnumerable<CertificationFile> Files { get; set; } = Array.Empty<CertificationFile>();
public IEnumerable<CertificateCondition> CertificateConditions { get; set; } = Array.Empty<CertificateCondition>();
}

public record CertificationLookupResponse(string Id)
{
public string? Name { get; set; }
public string? RegistrationNumber { get; set; }
public CertificateStatusCode? StatusCode { get; set; }
public string? LevelName { get; set; }
public DateTime? ExpiryDate { get; set; }
public bool? HasConditions { get; set; }
public IEnumerable<CertificationLevel> Levels { get; set; } = Array.Empty<CertificationLevel>();
public IEnumerable<CertificateCondition> CertificateConditions { get; set; } = Array.Empty<CertificateCondition>();
}

public record CertificationLookupRequest(string RecaptchaToken)
{
public string? FirstName { get; set; }
public string? LastName { get; set; }
public string? RegistrationNumber { get; set; }
public int PageSize { get; set; }
public int PageNumber { get; set; }
public string? SortField { get; set; }
public string? SortDirection { get; set; }
}

public record CertificateCondition
{
public string? Id { get; set; }
public string? Name { get; set; }
public string? Details { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public int DisplayOrder { get; set; }
}
public record CertificationLevel(string Id)
{
public string? Type { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"recommendations": ["Vue.volar", "dbaeumer.vscode-eslint"]
}
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}

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
Expand Up @@ -25,7 +25,7 @@
"uuid": "^10.0.0",
"vue": "^3.5.12",
"vue-router": "^4.4.5",
"vuetify": "^3.4.6"
"vuetify": "^3.6.13"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,11 @@ const getCertificateFileById = async (id: string): Promise<ApiResponse<any>> =>
return apiResultHandler.execute<any>({ request: client.files_certificate_get({ certificateId: id }, null, config) });
};

export { getCertificateFileById, getCertifications };
const postLookupCertificate = async (
body: Components.Schemas.CertificationLookupRequest,
): Promise<ApiResponse<Components.Schemas.CertificationLookupResponse[]>> => {
const client = await getClient();
return apiResultHandler.execute({ request: client.certifications_lookup_post(null, body), key: "certifications_lookup_post" });
};

export { getCertificateFileById, getCertifications, postLookupCertificate };
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ export default defineComponent({
},
acceptedPaths(): boolean {
const routeName = this.route.name?.toString() || "";
return ["login", "dashboard", "invalid-reference", "reference-submitted", "verify"].includes(routeName);
return ["login", "dashboard", "invalid-reference", "reference-submitted", "verify", "lookup-certification", "lookup-certification-record"].includes(
routeName,
);
},
},
});
Expand Down
Loading