Skip to content

Commit

Permalink
Move versioned API DTOs into Core (#1702)
Browse files Browse the repository at this point in the history
  • Loading branch information
gunndabad authored Nov 25, 2024
1 parent 878da63 commit b413506
Show file tree
Hide file tree
Showing 99 changed files with 233 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public static void Main(string[] args)
services.Scan(scan =>
{
scan.FromAssemblyOf<Program>()
.AddClasses(filter => filter.InNamespaces("TeachingRecordSystem.Api.V3.Core.Operations").Where(type => type.Name.EndsWith("Handler")))
.AddClasses(filter => filter.InNamespaces("TeachingRecordSystem.Api.V3.Implementation.Operations").Where(type => type.Name.EndsWith("Handler")))
.AsSelf()
.WithTransientLifetime();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public record Alert
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public record AlertCategory
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public record AlertType
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Models;

namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public record EytsInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc;

namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public record FileDownloadInfo(Stream Contents, string Name, string ContentType)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using TeachingRecordSystem.Core.Dqt.Models;

namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public enum InductionStatus
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public record InductionStatusInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using TeachingRecordSystem.Core.Dqt.Models;

namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public enum IttOutcome
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.ComponentModel;
using TeachingRecordSystem.Core.Dqt.Models;

namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public enum IttProgrammeType
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public record NameInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TeachingRecordSystem.Api.V3.V20240101.ApiModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public enum NpqQualificationType
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public record QtlsResult
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Models;

namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public record QtsInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public record SanctionInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TeachingRecordSystem.Api.V3.Core.SharedModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public record TrnRequestInfo
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TeachingRecordSystem.Api.V3.V20240307.ApiModels;
namespace TeachingRecordSystem.Api.V3.Implementation.Dtos;

public enum TrnRequestStatus
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Queries;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record CreateDateOfBirthChangeRequestCommand
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Queries;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record CreateNameChangeRequestCommand
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using TeachingRecordSystem.Api.Infrastructure.Security;
using TeachingRecordSystem.Api.V3.Core.SharedModels;
using TeachingRecordSystem.Api.V3.Implementation.Dtos;
using TeachingRecordSystem.Api.Validation;
using TeachingRecordSystem.Core.DataStore.Postgres;
using TeachingRecordSystem.Core.Dqt;
Expand All @@ -10,7 +10,7 @@
using TeachingRecordSystem.Core.Services.NameSynonyms;
using TeachingRecordSystem.Core.Services.TrnGenerationApi;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record CreateTrnRequestCommand
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System.Collections.Immutable;
using Microsoft.Xrm.Sdk.Query;
using TeachingRecordSystem.Api.V3.Core.SharedModels;
using TeachingRecordSystem.Api.V3.Implementation.Dtos;
using TeachingRecordSystem.Core.DataStore.Postgres;
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Models;
using TeachingRecordSystem.Core.Dqt.Queries;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record FindPersonByLastNameAndDateOfBirthCommand(string LastName, DateOnly? DateOfBirth);

Expand Down Expand Up @@ -129,7 +129,7 @@ public async Task<FindPersonByLastNameAndDateOfBirthResult> HandleAsync(FindPers
LastName = name.LastName
})
.AsReadOnly(),
InductionStatus = r.dfeta_InductionStatus?.ConvertToInductionStatus() is SharedModels.InductionStatus inductionStatus ?
InductionStatus = r.dfeta_InductionStatus?.ConvertToInductionStatus() is Dtos.InductionStatus inductionStatus ?
new InductionStatusInfo()
{
Status = inductionStatus,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System.Collections.Immutable;
using Microsoft.Xrm.Sdk.Query;
using TeachingRecordSystem.Api.V3.Core.SharedModels;
using TeachingRecordSystem.Api.V3.Implementation.Dtos;
using TeachingRecordSystem.Core.DataStore.Postgres;
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Models;
using TeachingRecordSystem.Core.Dqt.Queries;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record FindPersonsByTrnAndDateOfBirthCommand(IEnumerable<(string Trn, DateOnly DateOfBirth)> Persons);

Expand Down Expand Up @@ -136,7 +136,7 @@ public async Task<FindPersonsByTrnAndDateOfBirthResult> HandleAsync(FindPersonsB
LastName = name.LastName
})
.AsReadOnly(),
InductionStatus = r.dfeta_InductionStatus?.ConvertToInductionStatus() is SharedModels.InductionStatus inductionStatus ?
InductionStatus = r.dfeta_InductionStatus?.ConvertToInductionStatus() is Dtos.InductionStatus inductionStatus ?
new InductionStatusInfo()
{
Status = inductionStatus,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Text;
using TeachingRecordSystem.Api.V3.Core.SharedModels;
using TeachingRecordSystem.Api.V3.Implementation.Dtos;
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Models;
using TeachingRecordSystem.Core.Services.Certificates;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record GetEytsCertificateCommand(string Trn);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Text;
using TeachingRecordSystem.Api.V3.Core.SharedModels;
using TeachingRecordSystem.Api.V3.Implementation.Dtos;
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Models;
using TeachingRecordSystem.Core.Services.Certificates;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record GetInductionCertificateCommand(string Trn);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Text;
using TeachingRecordSystem.Api.V3.Core.SharedModels;
using TeachingRecordSystem.Api.V3.Implementation.Dtos;
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Models;
using TeachingRecordSystem.Core.Services.Certificates;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record GetNpqCertificateCommand(string Trn, Guid QualificationId);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System.Text;
using Microsoft.Xrm.Sdk.Query;
using Optional;
using TeachingRecordSystem.Api.V3.Core.SharedModels;
using TeachingRecordSystem.Api.V3.Implementation.Dtos;
using TeachingRecordSystem.Core.DataStore.Postgres;
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Models;
using TeachingRecordSystem.Core.Dqt.Queries;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record GetPersonCommand(
string Trn,
Expand Down Expand Up @@ -60,7 +60,7 @@ public record GetPersonResultInduction
{
public required DateOnly? StartDate { get; init; }
public required DateOnly? EndDate { get; init; }
public required SharedModels.InductionStatus? Status { get; init; }
public required Dtos.InductionStatus? Status { get; init; }
public required string? StatusDescription { get; init; }
public required string? CertificateUrl { get; init; }
public required IReadOnlyCollection<GetPersonResultInductionPeriod> Periods { get; init; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Microsoft.Xrm.Sdk.Query;
using TeachingRecordSystem.Api.V3.Core.SharedModels;
using TeachingRecordSystem.Api.V3.Implementation.Dtos;
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Models;
using TeachingRecordSystem.Core.Dqt.Queries;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record GetQtlsCommand(string Trn);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Text;
using TeachingRecordSystem.Api.V3.Core.SharedModels;
using TeachingRecordSystem.Api.V3.Implementation.Dtos;
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Models;
using TeachingRecordSystem.Core.Services.Certificates;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record GetQtsCertificateCommand(string Trn);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using TeachingRecordSystem.Api.Infrastructure.Security;
using TeachingRecordSystem.Api.V3.Core.SharedModels;
using TeachingRecordSystem.Api.V3.Implementation.Dtos;
using TeachingRecordSystem.Core.Dqt;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record GetTrnRequestCommand(string RequestId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Queries;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record SetDeceasedCommand(string Trn, DateOnly DateOfDeath);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using Microsoft.Xrm.Sdk.Query;
using TeachingRecordSystem.Api.V3.Core.SharedModels;
using TeachingRecordSystem.Api.V3.Implementation.Dtos;
using TeachingRecordSystem.Api.Validation;
using TeachingRecordSystem.Core.DataStore.Postgres;
using TeachingRecordSystem.Core.Dqt;
using TeachingRecordSystem.Core.Dqt.Models;
using TeachingRecordSystem.Core.Dqt.Queries;

namespace TeachingRecordSystem.Api.V3.Core.Operations;
namespace TeachingRecordSystem.Api.V3.Implementation.Operations;

public record SetQtlsCommand(string Trn, DateOnly? QtsDate);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using TeachingRecordSystem.Api.Infrastructure.Security;
using TeachingRecordSystem.Api.V3.Core.Operations;
using TeachingRecordSystem.Api.V3.Implementation.Operations;

namespace TeachingRecordSystem.Api.V3.V20240101.Controllers;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Swashbuckle.AspNetCore.Annotations;
using TeachingRecordSystem.Api.Infrastructure.ModelBinding;
using TeachingRecordSystem.Api.Infrastructure.Security;
using TeachingRecordSystem.Api.V3.Core.Operations;
using TeachingRecordSystem.Api.V3.Implementation.Operations;
using TeachingRecordSystem.Api.V3.V20240101.Requests;
using TeachingRecordSystem.Api.V3.V20240101.Responses;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Swashbuckle.AspNetCore.Annotations;
using TeachingRecordSystem.Api.Infrastructure.ModelBinding;
using TeachingRecordSystem.Api.Infrastructure.Security;
using TeachingRecordSystem.Api.V3.Core.Operations;
using TeachingRecordSystem.Api.V3.Implementation.Operations;
using TeachingRecordSystem.Api.V3.V20240101.Requests;
using TeachingRecordSystem.Api.V3.V20240101.Responses;

Expand Down
Loading

0 comments on commit b413506

Please sign in to comment.