Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 1ca5244

Browse files
authored
feat(enrollment): use strongly typed ids (#471)
- remove GraphQL from the Enrolling service - remove GraphQL federation - update to new stable Strawberry Shake library version - ProblemDetails to GraphQL error mapping - use mediatR sender
1 parent 4b26049 commit 1ca5244

60 files changed

Lines changed: 809 additions & 1257 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ csharp_preserve_single_line_blocks = true
176176
# SA1600: Elements should be documented
177177
dotnet_diagnostic.CS1591.severity = none
178178

179+
# CA1822: Mark members as static
180+
dotnet_diagnostic.CA1822.severity = suggestion
181+
179182
## Naming styles
180183

181184
dotnet_naming_style.pascal_case_style.capitalization = pascal_case

build/dotnet/eSchool.ruleset

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<RuleSet Name="eSchool" ToolsVersion="15.0">
33
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
44
<!-- File Must Have Header -->
@@ -32,4 +32,9 @@
3232
<!-- Missing XML comment for publicly visible type or member -->
3333
<Rule Id="CS1591" Action="None" />
3434
</Rules>
35+
36+
<Rules AnalyzerId="Microsoft.CodeQuality.Analyzers" RuleNamespace="Microsoft.CodeQuality.Analyzers">
37+
<!-- Identifiers should not match keywords -->
38+
<Rule Id="CA1716" Action="None" />
39+
</Rules>
3540
</RuleSet>

eSchool.sln

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CertificateProcessing", "Ce
4545
EndProject
4646
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CertificateProcessing.API", "src\Services\CertificateProcessing\CertificateProcessing.API\CertificateProcessing.API.csproj", "{7C7B638F-A1E9-4908-91DD-4060E45F2CE5}"
4747
EndProject
48+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FB7CE12E-52E3-4696-81F6-EC7CB478E45F}"
49+
ProjectSection(SolutionItems) = preProject
50+
.editorconfig = .editorconfig
51+
EndProjectSection
52+
EndProject
4853
Global
4954
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5055
Debug|Any CPU = Debug|Any CPU
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Threading;
4+
using System.Threading.Tasks;
5+
using HotChocolate;
6+
using HotChocolate.Types;
7+
using OpenCodeFoundation.ESchool.ApiGateways.ESchool.GraphQL.Enrolling;
8+
9+
namespace OpenCodeFoundation.ESchool.ApiGateways.ESchool.GraphQL.Enrollings
10+
{
11+
[ExtendObjectType(OperationTypeNames.Query)]
12+
public class EnrollingQueries
13+
{
14+
public async Task<ICollection<Enrollment>> GetEnrollmentsAsync(
15+
[Service] IEnrollingServiceClient client,
16+
CancellationToken cancellationToken = default)
17+
{
18+
if (client == null)
19+
{
20+
throw new ArgumentNullException(nameof(client));
21+
}
22+
23+
return await client.GetAllAsync(cancellationToken).ConfigureAwait(false);
24+
}
25+
26+
public async Task<Enrollment> GetEnrollmentAsync(
27+
Guid enrollmentId,
28+
[Service] IEnrollingServiceClient client,
29+
CancellationToken cancellationToken = default)
30+
{
31+
if (client == null)
32+
{
33+
throw new ArgumentNullException(nameof(client));
34+
}
35+
36+
return await client.GetByIdAsync(enrollmentId, cancellationToken)
37+
.ConfigureAwait(false);
38+
}
39+
}
40+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
using HotChocolate;
5+
using HotChocolate.Types;
6+
using OpenCodeFoundation.ESchool.ApiGateways.ESchool.GraphQL.Enrolling;
7+
8+
namespace OpenCodeFoundation.ESchool.ApiGateways.ESchool.GraphQL.Enrollings
9+
{
10+
[ExtendObjectType(OperationTypeNames.Mutation)]
11+
public class EnrollmentMutations
12+
{
13+
public async Task<Enrollment> CreateEnrollmentAsync(
14+
EnrollmentApplicationCommand enrollment,
15+
[Service] IEnrollingServiceClient client,
16+
CancellationToken cancellationToken = default)
17+
{
18+
if (client == null)
19+
{
20+
throw new ArgumentNullException(nameof(client));
21+
}
22+
23+
return await client.CreateAsync(enrollment, cancellationToken).ConfigureAwait(false);
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)