diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index 99091e23b..b893fc46a 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -37,7 +37,7 @@
-
+
@@ -62,4 +62,4 @@
-
+
\ No newline at end of file
diff --git a/src/config/EdFi.DmsConfigurationService.sln b/src/config/EdFi.DmsConfigurationService.sln
index 82b65d1a4..a5050a213 100644
--- a/src/config/EdFi.DmsConfigurationService.sln
+++ b/src/config/EdFi.DmsConfigurationService.sln
@@ -22,9 +22,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdFi.DmsConfigurationServic
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "datamodel", "datamodel", "{F90FF019-91D3-462E-94A4-96B52681DB16}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdFi.DmsConfigurationService.DataModel", "datamodel\EdFi.DmsConfigurationService.DataModel\EdFi.DmsConfigurationService.DataModel.csproj", "{E97DCC9F-C27F-497D-94FE-3DD39038C38B}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdFi.DmsConfigurationService.DataModel", "datamodel\EdFi.DmsConfigurationService.DataModel\EdFi.DmsConfigurationService.DataModel.csproj", "{E97DCC9F-C27F-497D-94FE-3DD39038C38B}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration", "backend\EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration\EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration.csproj", "{EE23DFFB-C61D-48FE-B821-2442D67D7AF9}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration", "backend\EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration\EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration.csproj", "{EE23DFFB-C61D-48FE-B821-2442D67D7AF9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration/ApplicationTests.cs b/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration/ApplicationTests.cs
index 9226261df..4bf98dd46 100644
--- a/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration/ApplicationTests.cs
+++ b/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration/ApplicationTests.cs
@@ -6,8 +6,8 @@
using EdFi.DmsConfigurationService.Backend.Postgresql.Repositories;
using EdFi.DmsConfigurationService.Backend.Repositories;
using EdFi.DmsConfigurationService.DataModel;
-using EdFi.DmsConfigurationService.DataModel.Application;
-using EdFi.DmsConfigurationService.DataModel.Vendor;
+using EdFi.DmsConfigurationService.DataModel.Model.Application;
+using EdFi.DmsConfigurationService.DataModel.Model.Vendor;
using FluentAssertions;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration/VendorTests.cs b/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration/VendorTests.cs
index 9c5e5aa5f..7c20d53a5 100644
--- a/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration/VendorTests.cs
+++ b/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql.Test.Integration/VendorTests.cs
@@ -6,7 +6,7 @@
using EdFi.DmsConfigurationService.Backend.Postgresql.Repositories;
using EdFi.DmsConfigurationService.Backend.Repositories;
using EdFi.DmsConfigurationService.DataModel;
-using EdFi.DmsConfigurationService.DataModel.Vendor;
+using EdFi.DmsConfigurationService.DataModel.Model.Vendor;
using FluentAssertions;
using Microsoft.Extensions.Logging.Abstractions;
diff --git a/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql/Repositories/ApplicationRepository.cs b/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql/Repositories/ApplicationRepository.cs
index 45c7fd7ac..9b81d1238 100644
--- a/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql/Repositories/ApplicationRepository.cs
+++ b/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql/Repositories/ApplicationRepository.cs
@@ -6,7 +6,7 @@
using Dapper;
using EdFi.DmsConfigurationService.Backend.Repositories;
using EdFi.DmsConfigurationService.DataModel;
-using EdFi.DmsConfigurationService.DataModel.Application;
+using EdFi.DmsConfigurationService.DataModel.Model.Application;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Npgsql;
diff --git a/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql/Repositories/VendorRepository.cs b/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql/Repositories/VendorRepository.cs
index 598116d75..5d3e99300 100644
--- a/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql/Repositories/VendorRepository.cs
+++ b/src/config/backend/EdFi.DmsConfigurationService.Backend.Postgresql/Repositories/VendorRepository.cs
@@ -6,8 +6,8 @@
using Dapper;
using EdFi.DmsConfigurationService.Backend.Repositories;
using EdFi.DmsConfigurationService.DataModel;
-using EdFi.DmsConfigurationService.DataModel.Application;
-using EdFi.DmsConfigurationService.DataModel.Vendor;
+using EdFi.DmsConfigurationService.DataModel.Model.Application;
+using EdFi.DmsConfigurationService.DataModel.Model.Vendor;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Npgsql;
diff --git a/src/config/backend/EdFi.DmsConfigurationService.Backend/Repositories/IApplicationRepository.cs b/src/config/backend/EdFi.DmsConfigurationService.Backend/Repositories/IApplicationRepository.cs
index 98cf87a60..3c7a1b37d 100644
--- a/src/config/backend/EdFi.DmsConfigurationService.Backend/Repositories/IApplicationRepository.cs
+++ b/src/config/backend/EdFi.DmsConfigurationService.Backend/Repositories/IApplicationRepository.cs
@@ -4,7 +4,7 @@
// See the LICENSE and NOTICES files in the project root for more information.
using EdFi.DmsConfigurationService.DataModel;
-using EdFi.DmsConfigurationService.DataModel.Application;
+using EdFi.DmsConfigurationService.DataModel.Model.Application;
namespace EdFi.DmsConfigurationService.Backend.Repositories;
diff --git a/src/config/backend/EdFi.DmsConfigurationService.Backend/Repositories/IVendorRepository.cs b/src/config/backend/EdFi.DmsConfigurationService.Backend/Repositories/IVendorRepository.cs
index e66eddf8d..2256cb2e8 100644
--- a/src/config/backend/EdFi.DmsConfigurationService.Backend/Repositories/IVendorRepository.cs
+++ b/src/config/backend/EdFi.DmsConfigurationService.Backend/Repositories/IVendorRepository.cs
@@ -4,8 +4,8 @@
// See the LICENSE and NOTICES files in the project root for more information.
using EdFi.DmsConfigurationService.DataModel;
-using EdFi.DmsConfigurationService.DataModel.Application;
-using EdFi.DmsConfigurationService.DataModel.Vendor;
+using EdFi.DmsConfigurationService.DataModel.Model.Application;
+using EdFi.DmsConfigurationService.DataModel.Model.Vendor;
namespace EdFi.DmsConfigurationService.Backend.Repositories;
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/EdFi.DmsConfigurationService.DataModel.csproj b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/EdFi.DmsConfigurationService.DataModel.csproj
index 30402ac0e..571eae9d8 100644
--- a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/EdFi.DmsConfigurationService.DataModel.csproj
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/EdFi.DmsConfigurationService.DataModel.csproj
@@ -6,4 +6,8 @@
enable
+
+
+
+
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/FailureResponse.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Infrastructure/FailureResponse.cs
similarity index 98%
rename from src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/FailureResponse.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Infrastructure/FailureResponse.cs
index d4f0c91ea..3699965f1 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/FailureResponse.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Infrastructure/FailureResponse.cs
@@ -3,16 +3,14 @@
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
-using System.Diagnostics;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Nodes;
using FluentValidation.Results;
-using Npgsql.Internal;
namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
-internal static class FailureResponse
+public static class FailureResponse
{
private static readonly JsonSerializerOptions _serializerOptions =
new() { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping };
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/ValidatorExtensions.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Infrastructure/ValidatorExtensions.cs
similarity index 89%
rename from src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/ValidatorExtensions.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Infrastructure/ValidatorExtensions.cs
index 2a46bc25f..cf2e2fa81 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/ValidatorExtensions.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Infrastructure/ValidatorExtensions.cs
@@ -5,7 +5,7 @@
using FluentValidation;
-namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
+namespace EdFi.DmsConfigurationService.DataModel.Infrastructure;
public static class ValidatorExtensions
{
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/ActionResponse.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Action/ActionResponse.cs
similarity index 90%
rename from src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/ActionResponse.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Action/ActionResponse.cs
index 42f7f6825..f3fc1911c 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/ActionResponse.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Action/ActionResponse.cs
@@ -5,7 +5,7 @@
using System.Text.Json.Serialization;
-namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Model;
+namespace EdFi.DmsConfigurationService.DataModel.Model.Action;
public class AdminAction
{
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApiClientInsertCommand.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApiClientInsertCommand.cs
similarity index 85%
rename from src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApiClientInsertCommand.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApiClientInsertCommand.cs
index 51c74aaaf..bfe2721cb 100644
--- a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApiClientInsertCommand.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApiClientInsertCommand.cs
@@ -3,7 +3,7 @@
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
-namespace EdFi.DmsConfigurationService.DataModel.Application;
+namespace EdFi.DmsConfigurationService.DataModel.Model.Application;
public class ApiClientInsertCommand
{
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationCredentialsResponse.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationCredentialsResponse.cs
similarity index 86%
rename from src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationCredentialsResponse.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationCredentialsResponse.cs
index ff488c1ce..7de75d7f7 100644
--- a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationCredentialsResponse.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationCredentialsResponse.cs
@@ -3,7 +3,7 @@
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
-namespace EdFi.DmsConfigurationService.DataModel.Application;
+namespace EdFi.DmsConfigurationService.DataModel.Model.Application;
public class ApplicationCredentialsResponse
{
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationInsertCommand.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationInsertCommand.cs
similarity index 53%
rename from src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationInsertCommand.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationInsertCommand.cs
index 2d0d38a91..d05b0aec4 100644
--- a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationInsertCommand.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationInsertCommand.cs
@@ -3,7 +3,9 @@
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
-namespace EdFi.DmsConfigurationService.DataModel.Application;
+using FluentValidation;
+
+namespace EdFi.DmsConfigurationService.DataModel.Model.Application;
public class ApplicationInsertCommand
{
@@ -11,4 +13,14 @@ public class ApplicationInsertCommand
public long VendorId { get; set; }
public string ClaimSetName { get; set; } = "";
public long[] EducationOrganizationIds { get; set; } = [];
+
+ public class Validator : AbstractValidator
+ {
+ public Validator()
+ {
+ RuleFor(a => a.ApplicationName).NotEmpty().MaximumLength(256);
+ RuleFor(a => a.ClaimSetName).NotEmpty().MaximumLength(256);
+ RuleForEach(a => a.EducationOrganizationIds).NotNull().GreaterThan(0);
+ }
+ }
}
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationResponse.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationResponse.cs
similarity index 89%
rename from src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationResponse.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationResponse.cs
index 275815bb2..47a7aa3f7 100644
--- a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationResponse.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationResponse.cs
@@ -3,7 +3,7 @@
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
-namespace EdFi.DmsConfigurationService.DataModel.Application;
+namespace EdFi.DmsConfigurationService.DataModel.Model.Application;
public class ApplicationResponse
{
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationUpdateCommand.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationUpdateCommand.cs
similarity index 52%
rename from src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationUpdateCommand.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationUpdateCommand.cs
index 31fd9cb1a..7d5138ee9 100644
--- a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Application/ApplicationUpdateCommand.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Application/ApplicationUpdateCommand.cs
@@ -3,7 +3,9 @@
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
-namespace EdFi.DmsConfigurationService.DataModel.Application;
+using FluentValidation;
+
+namespace EdFi.DmsConfigurationService.DataModel.Model.Application;
public class ApplicationUpdateCommand
{
@@ -12,4 +14,15 @@ public class ApplicationUpdateCommand
public long VendorId { get; set; }
public required string ClaimSetName { get; set; }
public long[] EducationOrganizationIds { get; set; } = [];
+
+ public class Validator : AbstractValidator
+ {
+ public Validator()
+ {
+ RuleFor(a => a.Id).GreaterThan(0);
+ RuleFor(a => a.ApplicationName).NotEmpty().MaximumLength(256);
+ RuleFor(a => a.ClaimSetName).NotEmpty().MaximumLength(256);
+ RuleForEach(a => a.EducationOrganizationIds).NotNull().GreaterThan(0);
+ }
+ }
}
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/PagingQuery.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/PagingQuery.cs
similarity index 100%
rename from src/config/datamodel/EdFi.DmsConfigurationService.DataModel/PagingQuery.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/PagingQuery.cs
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/RegisterRequest.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Register/RegisterRequest.cs
similarity index 79%
rename from src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/RegisterRequest.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Register/RegisterRequest.cs
index 006203ba0..d84f98f9d 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/RegisterRequest.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Register/RegisterRequest.cs
@@ -4,10 +4,9 @@
// See the LICENSE and NOTICES files in the project root for more information.
using System.Text.RegularExpressions;
-using EdFi.DmsConfigurationService.Backend.Repositories;
using FluentValidation;
-namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Model;
+namespace EdFi.DmsConfigurationService.DataModel.Model.Register;
public class RegisterRequest
{
@@ -17,12 +16,8 @@ public class RegisterRequest
public class Validator : AbstractValidator
{
- private readonly IClientRepository _clientRepository;
-
- public Validator(IClientRepository clientRepository)
+ public Validator()
{
- _clientRepository = clientRepository;
-
RuleFor(m => m.ClientId).NotEmpty();
RuleFor(m => m.ClientSecret).NotEmpty();
RuleFor(m => m.ClientSecret)
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/TokenRequest.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Token/TokenRequest.cs
similarity index 92%
rename from src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/TokenRequest.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Token/TokenRequest.cs
index e89fbf33e..5155c05d2 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/TokenRequest.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Token/TokenRequest.cs
@@ -5,7 +5,7 @@
using FluentValidation;
-namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Model;
+namespace EdFi.DmsConfigurationService.DataModel.Model.Token;
public class TokenRequest
{
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/TokenResponse.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Token/TokenResponse.cs
similarity index 89%
rename from src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/TokenResponse.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Token/TokenResponse.cs
index b33d1cc91..5ed28c894 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/TokenResponse.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Token/TokenResponse.cs
@@ -5,7 +5,7 @@
using System.Text.Json.Serialization;
-namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Model;
+namespace EdFi.DmsConfigurationService.DataModel.Model.Token;
public class TokenResponse
{
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Vendor/VendorInsertCommand.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Vendor/VendorInsertCommand.cs
new file mode 100644
index 000000000..fe12d2541
--- /dev/null
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Vendor/VendorInsertCommand.cs
@@ -0,0 +1,37 @@
+// SPDX-License-Identifier: Apache-2.0
+// Licensed to the Ed-Fi Alliance under one or more agreements.
+// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
+// See the LICENSE and NOTICES files in the project root for more information.
+
+using FluentValidation;
+
+namespace EdFi.DmsConfigurationService.DataModel.Model.Vendor;
+
+public class VendorInsertCommand
+{
+ public string Company { get; set; } = "";
+ public string ContactName { get; set; } = "";
+ public string ContactEmailAddress { get; set; } = "";
+ public string NamespacePrefixes { get; set; } = "";
+
+ public class Validator : AbstractValidator
+ {
+ public Validator()
+ {
+ RuleFor(v => v.Company).NotEmpty().MaximumLength(256);
+ RuleFor(v => v.ContactName).NotEmpty().MaximumLength(128);
+ RuleFor(v => v.ContactEmailAddress).NotEmpty().EmailAddress().MaximumLength(320);
+ RuleFor(v => v.NamespacePrefixes)
+ .NotEmpty()
+ .Must(s =>
+ {
+ var split = s?.Split(
+ ',',
+ StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries
+ );
+ return split != null && !split.Any(x => x.Length >= 128);
+ })
+ .WithMessage("Each NamespacePrefix length must be 128 characters or fewer.");
+ }
+ }
+}
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Vendor/VendorResponse.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Vendor/VendorResponse.cs
similarity index 89%
rename from src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Vendor/VendorResponse.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Vendor/VendorResponse.cs
index aad5a5ac5..2525449e3 100644
--- a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Vendor/VendorResponse.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Vendor/VendorResponse.cs
@@ -3,7 +3,7 @@
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
-namespace EdFi.DmsConfigurationService.DataModel.Vendor;
+namespace EdFi.DmsConfigurationService.DataModel.Model.Vendor;
public class VendorResponse
{
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Vendor/VendorUpdateCommand.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Vendor/VendorUpdateCommand.cs
new file mode 100644
index 000000000..60817a37b
--- /dev/null
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Model/Vendor/VendorUpdateCommand.cs
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: Apache-2.0
+// Licensed to the Ed-Fi Alliance under one or more agreements.
+// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
+// See the LICENSE and NOTICES files in the project root for more information.
+
+using FluentValidation;
+
+namespace EdFi.DmsConfigurationService.DataModel.Model.Vendor;
+
+public class VendorUpdateCommand : VendorInsertCommand
+{
+ public long Id { get; set; }
+
+ public new class Validator : AbstractValidator
+ {
+ public Validator()
+ {
+ RuleFor(v => v.Company).NotEmpty().MaximumLength(256);
+ RuleFor(v => v.ContactName).MaximumLength(128);
+ RuleFor(v => v.ContactEmailAddress).EmailAddress().MaximumLength(320);
+ RuleFor(v => v.NamespacePrefixes)
+ .NotEmpty()
+ .Must(s =>
+ {
+ var split = s?.Split(
+ ',',
+ StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries
+ );
+ return split != null && !split.Any(x => x.Length >= 128);
+ })
+ .WithMessage("Each NamespacePrefix length must be 128 characters or fewer.");
+ }
+ }
+}
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/SecurityConstants.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/SecurityConstants.cs
similarity index 83%
rename from src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/SecurityConstants.cs
rename to src/config/datamodel/EdFi.DmsConfigurationService.DataModel/SecurityConstants.cs
index ccec07b56..883565fba 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/SecurityConstants.cs
+++ b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/SecurityConstants.cs
@@ -3,7 +3,7 @@
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
-namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
+namespace EdFi.DmsConfigurationService.DataModel;
public static class SecurityConstants
{
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Vendor/VendorInsertCommand.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Vendor/VendorInsertCommand.cs
deleted file mode 100644
index a4ad7948c..000000000
--- a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Vendor/VendorInsertCommand.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// Licensed to the Ed-Fi Alliance under one or more agreements.
-// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-// See the LICENSE and NOTICES files in the project root for more information.
-
-namespace EdFi.DmsConfigurationService.DataModel.Vendor;
-
-public class VendorInsertCommand
-{
- public string Company { get; set; } = "";
- public string ContactName { get; set; } = "";
- public string ContactEmailAddress { get; set; } = "";
- public string NamespacePrefixes { get; set; } = "";
-}
diff --git a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Vendor/VendorUpdateCommand.cs b/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Vendor/VendorUpdateCommand.cs
deleted file mode 100644
index 74babd12c..000000000
--- a/src/config/datamodel/EdFi.DmsConfigurationService.DataModel/Vendor/VendorUpdateCommand.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// Licensed to the Ed-Fi Alliance under one or more agreements.
-// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-// See the LICENSE and NOTICES files in the project root for more information.
-
-namespace EdFi.DmsConfigurationService.DataModel.Vendor;
-
-public class VendorUpdateCommand : VendorInsertCommand
-{
- public long Id { get; set; }
-}
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/ActionModuleTests.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/ActionModuleTests.cs
index 92c37ba53..f73de8590 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/ActionModuleTests.cs
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/ActionModuleTests.cs
@@ -4,15 +4,16 @@
// See the LICENSE and NOTICES files in the project root for more information.
using System.Net;
+using System.Security.Claims;
+using System.Text.Json;
+using EdFi.DmsConfigurationService.DataModel;
+using EdFi.DmsConfigurationService.DataModel.Model.Action;
using EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
-using EdFi.DmsConfigurationService.Frontend.AspNetCore.Model;
using FluentAssertions;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
-using System.Security.Claims;
-using System.Text.Json;
using NUnit.Framework;
namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit.Modules;
@@ -28,11 +29,32 @@ public class When_Making_Action_Request
[SetUp]
public void Setup()
{
- _mockActionResponse = [
- new AdminAction { Id = 1, Name = "Create", Uri = "uri://ed-fi.org/api/actions/create" },
- new AdminAction { Id = 2, Name = "Read", Uri = "uri://ed-fi.org/api/actions/read" },
- new AdminAction { Id = 3, Name = "Update", Uri = "uri://ed-fi.org/api/actions/update" },
- new AdminAction { Id = 4, Name = "Delete", Uri = "uri://ed-fi.org/api/actions/delete" }
+ _mockActionResponse =
+ [
+ new AdminAction
+ {
+ Id = 1,
+ Name = "Create",
+ Uri = "uri://ed-fi.org/api/actions/create",
+ },
+ new AdminAction
+ {
+ Id = 2,
+ Name = "Read",
+ Uri = "uri://ed-fi.org/api/actions/read",
+ },
+ new AdminAction
+ {
+ Id = 3,
+ Name = "Update",
+ Uri = "uri://ed-fi.org/api/actions/update",
+ },
+ new AdminAction
+ {
+ Id = 4,
+ Name = "Delete",
+ Uri = "uri://ed-fi.org/api/actions/delete",
+ },
];
}
@@ -46,11 +68,19 @@ public async Task Given_valid_token_and_role()
builder.ConfigureServices(
(collection) =>
{
- collection.AddAuthentication(AuthenticationConstants.AuthenticationSchema)
- .AddScheme(AuthenticationConstants.AuthenticationSchema, _ => { });
-
- collection.AddAuthorization(options => options.AddPolicy(SecurityConstants.ServicePolicy,
- policy => policy.RequireClaim(ClaimTypes.Role, AuthenticationConstants.Role)));
+ collection
+ .AddAuthentication(AuthenticationConstants.AuthenticationSchema)
+ .AddScheme(
+ AuthenticationConstants.AuthenticationSchema,
+ _ => { }
+ );
+
+ collection.AddAuthorization(options =>
+ options.AddPolicy(
+ SecurityConstants.ServicePolicy,
+ policy => policy.RequireClaim(ClaimTypes.Role, AuthenticationConstants.Role)
+ )
+ );
}
);
});
@@ -94,11 +124,19 @@ public async Task Given_invalid_client_secret()
builder.ConfigureServices(
(collection) =>
{
- collection.AddAuthentication(AuthenticationConstants.AuthenticationSchema)
- .AddScheme(AuthenticationConstants.AuthenticationSchema, _ => { });
-
- collection.AddAuthorization(options => options.AddPolicy(SecurityConstants.ServicePolicy,
- policy => policy.RequireClaim(ClaimTypes.Role, "invalid-role")));
+ collection
+ .AddAuthentication(AuthenticationConstants.AuthenticationSchema)
+ .AddScheme(
+ AuthenticationConstants.AuthenticationSchema,
+ _ => { }
+ );
+
+ collection.AddAuthorization(options =>
+ options.AddPolicy(
+ SecurityConstants.ServicePolicy,
+ policy => policy.RequireClaim(ClaimTypes.Role, "invalid-role")
+ )
+ );
}
);
});
@@ -117,6 +155,4 @@ public void TearDown()
_response!.Dispose();
}
}
-
};
-
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/ApplicationModuleTests.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/ApplicationModuleTests.cs
index e3a727e1e..61e2e02f1 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/ApplicationModuleTests.cs
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/ApplicationModuleTests.cs
@@ -9,8 +9,8 @@
using System.Text.Json.Nodes;
using EdFi.DmsConfigurationService.Backend.Repositories;
using EdFi.DmsConfigurationService.DataModel;
-using EdFi.DmsConfigurationService.DataModel.Application;
-using EdFi.DmsConfigurationService.DataModel.Vendor;
+using EdFi.DmsConfigurationService.DataModel.Model.Application;
+using EdFi.DmsConfigurationService.DataModel.Model.Vendor;
using EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
using FakeItEasy;
using FluentAssertions;
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/IdentityModuleTests.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/IdentityModuleTests.cs
index ed9a767df..42034cb08 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/IdentityModuleTests.cs
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/IdentityModuleTests.cs
@@ -8,8 +8,9 @@
using System.Text.Json.Nodes;
using EdFi.DmsConfigurationService.Backend;
using EdFi.DmsConfigurationService.Backend.Repositories;
+using EdFi.DmsConfigurationService.DataModel.Model.Register;
+using EdFi.DmsConfigurationService.DataModel.Model.Token;
using EdFi.DmsConfigurationService.Frontend.AspNetCore.Configuration;
-using EdFi.DmsConfigurationService.Frontend.AspNetCore.Model;
using FakeItEasy;
using FluentAssertions;
using Microsoft.AspNetCore.Hosting;
@@ -52,7 +53,7 @@ public async Task Given_valid_client_details()
builder.ConfigureServices(
(collection) =>
{
- collection.AddTransient((_) => new RegisterRequest.Validator(_clientRepository!));
+ collection.AddTransient((_) => new RegisterRequest.Validator());
collection.AddTransient((_) => _clientRepository!);
}
);
@@ -84,7 +85,7 @@ public async Task Given_empty_client_details()
builder.ConfigureServices(
(collection) =>
{
- collection.AddTransient((_) => new RegisterRequest.Validator(_clientRepository!));
+ collection.AddTransient((_) => new RegisterRequest.Validator());
collection.AddTransient((_) => _clientRepository!);
}
);
@@ -125,7 +126,7 @@ public async Task Given_invalid_client_secret(string secret)
builder.ConfigureServices(
(collection) =>
{
- collection.AddTransient((_) => new RegisterRequest.Validator(_clientRepository!));
+ collection.AddTransient((_) => new RegisterRequest.Validator());
collection.AddTransient((_) => _clientRepository!);
}
);
@@ -168,7 +169,7 @@ public async Task When_provider_has_bad_credentials()
builder.ConfigureServices(
(collection) =>
{
- collection.AddTransient((_) => new RegisterRequest.Validator(_clientRepository!));
+ collection.AddTransient((_) => new RegisterRequest.Validator());
collection.AddTransient((_) => _clientRepository!);
}
);
@@ -207,7 +208,7 @@ public async Task When_provider_has_not_real_admin_role()
builder.ConfigureServices(
(collection) =>
{
- collection.AddTransient((_) => new RegisterRequest.Validator(_clientRepository!));
+ collection.AddTransient((_) => new RegisterRequest.Validator());
collection.AddTransient((_) => _clientRepository!);
}
);
@@ -246,7 +247,7 @@ public async Task When_provider_has_invalid_real()
builder.ConfigureServices(
(collection) =>
{
- collection.AddTransient((_) => new RegisterRequest.Validator(_clientRepository!));
+ collection.AddTransient((_) => new RegisterRequest.Validator());
collection.AddTransient((_) => _clientRepository!);
}
);
@@ -284,7 +285,7 @@ public async Task Given_client_with_existing_client_id()
builder.ConfigureServices(
(collection) =>
{
- collection.AddTransient((_) => new RegisterRequest.Validator(_clientRepository!));
+ collection.AddTransient((_) => new RegisterRequest.Validator());
collection.AddTransient((_) => _clientRepository!);
}
);
@@ -322,7 +323,7 @@ public async Task When_allow_registration_is_disabled()
{
opts.AllowRegistration = false;
});
- collection.AddTransient((_) => new RegisterRequest.Validator(_clientRepository!));
+ collection.AddTransient((_) => new RegisterRequest.Validator());
collection.AddTransient((_) => _clientRepository!);
}
);
@@ -361,7 +362,7 @@ public async Task When_provider_is_unreachable()
builder.ConfigureServices(
(collection) =>
{
- collection.AddTransient((_) => new RegisterRequest.Validator(_clientRepository!));
+ collection.AddTransient((_) => new RegisterRequest.Validator());
collection.AddTransient((_) => _clientRepository!);
}
);
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/SecuredModuleTests.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/SecuredModuleTests.cs
index d5e62cf63..0689cac4e 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/SecuredModuleTests.cs
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/SecuredModuleTests.cs
@@ -4,14 +4,15 @@
// See the LICENSE and NOTICES files in the project root for more information.
using System.Net;
-using Microsoft.AspNetCore.Mvc.Testing;
-using NUnit.Framework;
-using FluentAssertions;
using System.Security.Claims;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.DependencyInjection;
+using EdFi.DmsConfigurationService.DataModel;
using EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
+using FluentAssertions;
using Microsoft.AspNetCore.Authentication;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Mvc.Testing;
+using Microsoft.Extensions.DependencyInjection;
+using NUnit.Framework;
namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit.Modules;
@@ -28,12 +29,19 @@ public async Task Given_a_client_with_valid_role()
builder.ConfigureServices(
(collection) =>
{
- collection.AddAuthentication(AuthenticationConstants.AuthenticationSchema)
- .AddScheme(AuthenticationConstants.AuthenticationSchema, options => { });
-
- collection.AddAuthorization(options => options.AddPolicy(SecurityConstants.ServicePolicy,
- policy => policy.RequireClaim(ClaimTypes.Role, AuthenticationConstants.Role)));
+ collection
+ .AddAuthentication(AuthenticationConstants.AuthenticationSchema)
+ .AddScheme(
+ AuthenticationConstants.AuthenticationSchema,
+ options => { }
+ );
+ collection.AddAuthorization(options =>
+ options.AddPolicy(
+ SecurityConstants.ServicePolicy,
+ policy => policy.RequireClaim(ClaimTypes.Role, AuthenticationConstants.Role)
+ )
+ );
}
);
});
@@ -58,12 +66,19 @@ public async Task Given_a_client_with_invalid_role()
builder.ConfigureServices(
(collection) =>
{
- collection.AddAuthentication(AuthenticationConstants.AuthenticationSchema)
- .AddScheme(AuthenticationConstants.AuthenticationSchema, options => { });
-
- collection.AddAuthorization(options => options.AddPolicy(SecurityConstants.ServicePolicy,
- policy => policy.RequireClaim(ClaimTypes.Role, "invalid-role")));
+ collection
+ .AddAuthentication(AuthenticationConstants.AuthenticationSchema)
+ .AddScheme(
+ AuthenticationConstants.AuthenticationSchema,
+ options => { }
+ );
+ collection.AddAuthorization(options =>
+ options.AddPolicy(
+ SecurityConstants.ServicePolicy,
+ policy => policy.RequireClaim(ClaimTypes.Role, "invalid-role")
+ )
+ );
}
);
});
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/VendorModuleTests.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/VendorModuleTests.cs
index 79af89dea..41dbc9fb1 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/VendorModuleTests.cs
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore.Tests.Unit/Modules/VendorModuleTests.cs
@@ -9,8 +9,8 @@
using System.Text.Json.Nodes;
using EdFi.DmsConfigurationService.Backend.Repositories;
using EdFi.DmsConfigurationService.DataModel;
-using EdFi.DmsConfigurationService.DataModel.Application;
-using EdFi.DmsConfigurationService.DataModel.Vendor;
+using EdFi.DmsConfigurationService.DataModel.Model.Application;
+using EdFi.DmsConfigurationService.DataModel.Model.Vendor;
using EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
using FakeItEasy;
using FluentAssertions;
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/EdFi.DmsConfigurationService.Frontend.AspNetCore.csproj b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/EdFi.DmsConfigurationService.Frontend.AspNetCore.csproj
index 8e4f477cb..5b6b151d8 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/EdFi.DmsConfigurationService.Frontend.AspNetCore.csproj
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/EdFi.DmsConfigurationService.Frontend.AspNetCore.csproj
@@ -1,4 +1,4 @@
-
+
net8.0
@@ -11,7 +11,6 @@
-
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/PolicyExtension.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/PolicyExtension.cs
index 2056d06ff..50d7be664 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/PolicyExtension.cs
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/PolicyExtension.cs
@@ -3,6 +3,8 @@
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
+using EdFi.DmsConfigurationService.DataModel;
+
namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
public static class PolicyExtension
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/WebApplicationBuilderExtensions.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/WebApplicationBuilderExtensions.cs
index 33f77054e..d63b3f149 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/WebApplicationBuilderExtensions.cs
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Infrastructure/WebApplicationBuilderExtensions.cs
@@ -11,6 +11,7 @@
using EdFi.DmsConfigurationService.Backend.Postgresql;
using EdFi.DmsConfigurationService.Backend.Postgresql.Repositories;
using EdFi.DmsConfigurationService.Backend.Repositories;
+using EdFi.DmsConfigurationService.DataModel;
using EdFi.DmsConfigurationService.Frontend.AspNetCore.Configuration;
using FluentValidation;
using FluentValidation.AspNetCore;
@@ -34,6 +35,10 @@ public static void AddServices(this WebApplicationBuilder webApplicationBuilder)
webApplicationBuilder
.Services.AddExceptionHandler()
.AddValidatorsFromAssembly(executingAssembly)
+ .AddValidatorsFromAssembly(
+ Assembly.Load("Edfi.DmsConfigurationService.DataModel"),
+ ServiceLifetime.Transient
+ )
.AddFluentValidationAutoValidation();
ValidatorOptions.Global.DisplayNameResolver = (type, memberInfo, expression) =>
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/ApplicationInsertCommandValidator.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/ApplicationInsertCommandValidator.cs
deleted file mode 100644
index 6c1612cbc..000000000
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/ApplicationInsertCommandValidator.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// Licensed to the Ed-Fi Alliance under one or more agreements.
-// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-// See the LICENSE and NOTICES files in the project root for more information.
-
-using EdFi.DmsConfigurationService.DataModel.Application;
-using FluentValidation;
-
-namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Model.Validator;
-
-public class ApplicationInsertCommandValidator : AbstractValidator
-{
- public ApplicationInsertCommandValidator()
- {
- RuleFor(a => a.ApplicationName).NotEmpty().MaximumLength(256);
- RuleFor(a => a.ClaimSetName).NotEmpty().MaximumLength(256);
- RuleForEach(a => a.EducationOrganizationIds).NotNull().GreaterThan(0);
- }
-}
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/ApplicationUpdateCommandValidator.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/ApplicationUpdateCommandValidator.cs
deleted file mode 100644
index 642398a72..000000000
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/ApplicationUpdateCommandValidator.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// Licensed to the Ed-Fi Alliance under one or more agreements.
-// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-// See the LICENSE and NOTICES files in the project root for more information.
-
-using EdFi.DmsConfigurationService.DataModel.Application;
-using FluentValidation;
-
-namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Model.Validator;
-
-public class ApplicationUpdateCommandValidator : AbstractValidator
-{
- public ApplicationUpdateCommandValidator()
- {
- RuleFor(a => a.Id).GreaterThan(0);
- RuleFor(a => a.ApplicationName).NotEmpty().MaximumLength(256);
- RuleFor(a => a.ClaimSetName).NotEmpty().MaximumLength(256);
- RuleForEach(a => a.EducationOrganizationIds).NotNull().GreaterThan(0);
- }
-}
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/VendorInsertCommandValidator.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/VendorInsertCommandValidator.cs
deleted file mode 100644
index 9ef4a94c1..000000000
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/VendorInsertCommandValidator.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// Licensed to the Ed-Fi Alliance under one or more agreements.
-// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-// See the LICENSE and NOTICES files in the project root for more information.
-
-using EdFi.DmsConfigurationService.DataModel.Vendor;
-using FluentValidation;
-
-namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Model.Validator;
-
-public class VendorInsertCommandValidator : AbstractValidator
-{
- public VendorInsertCommandValidator()
- {
- RuleFor(v => v.Company).NotEmpty().MaximumLength(256);
- RuleFor(v => v.ContactName).NotEmpty().MaximumLength(128);
- RuleFor(v => v.ContactEmailAddress).NotEmpty().EmailAddress().MaximumLength(320);
- RuleFor(v => v.NamespacePrefixes)
- .NotEmpty()
- .Must(s =>
- {
- var split = s?.Split(
- ',',
- StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries
- );
- return split != null && !split.Any(x => x.Length >= 128);
- })
- .WithMessage("Each NamespacePrefix length must be 128 characters or fewer.");
- }
-}
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/VendorUpdateCommandValidator.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/VendorUpdateCommandValidator.cs
deleted file mode 100644
index 24a780f72..000000000
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Model/Validator/VendorUpdateCommandValidator.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0
-// Licensed to the Ed-Fi Alliance under one or more agreements.
-// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
-// See the LICENSE and NOTICES files in the project root for more information.
-
-using EdFi.DmsConfigurationService.DataModel.Vendor;
-using FluentValidation;
-
-namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Model.Validator;
-
-public class VendorUpdateCommandValidator : AbstractValidator
-{
- public VendorUpdateCommandValidator()
- {
- RuleFor(v => v.Company).NotEmpty().MaximumLength(256);
- RuleFor(v => v.ContactName).MaximumLength(128);
- RuleFor(v => v.ContactEmailAddress).EmailAddress().MaximumLength(320);
- RuleFor(v => v.NamespacePrefixes)
- .NotEmpty()
- .Must(s =>
- {
- var split = s?.Split(
- ',',
- StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries
- );
- return split != null && !split.Any(x => x.Length >= 128);
- })
- .WithMessage("Each NamespacePrefix length must be 128 characters or fewer.");
- }
-}
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/ActionsModule.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/ActionsModule.cs
index 0487e2f19..de35b82ea 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/ActionsModule.cs
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/ActionsModule.cs
@@ -3,8 +3,8 @@
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0.
// See the LICENSE and NOTICES files in the project root for more information.
+using EdFi.DmsConfigurationService.DataModel.Model.Action;
using EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
-using EdFi.DmsConfigurationService.Frontend.AspNetCore.Model;
namespace EdFi.DmsConfigurationService.Frontend.AspNetCore.Modules;
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/ApplicationModule.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/ApplicationModule.cs
index 988d0e223..108243464 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/ApplicationModule.cs
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/ApplicationModule.cs
@@ -6,9 +6,9 @@
using System.Security.Cryptography;
using EdFi.DmsConfigurationService.Backend.Repositories;
using EdFi.DmsConfigurationService.DataModel;
-using EdFi.DmsConfigurationService.DataModel.Application;
+using EdFi.DmsConfigurationService.DataModel.Infrastructure;
+using EdFi.DmsConfigurationService.DataModel.Model.Application;
using EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
-using EdFi.DmsConfigurationService.Frontend.AspNetCore.Model.Validator;
using FluentValidation;
using FluentValidation.Results;
@@ -29,8 +29,8 @@ public void MapEndpoints(IEndpointRouteBuilder endpoints)
}
private async Task InsertApplication(
- ApplicationInsertCommandValidator validator,
ApplicationInsertCommand command,
+ ApplicationInsertCommand.Validator validator,
HttpContext httpContext,
IApplicationRepository applicationRepository,
IClientRepository clientRepository,
@@ -141,7 +141,7 @@ ILogger logger
private static async Task Update(
long id,
- ApplicationUpdateCommandValidator validator,
+ ApplicationUpdateCommand.Validator validator,
ApplicationUpdateCommand command,
HttpContext httpContext,
IApplicationRepository repository
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/IdentityModule.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/IdentityModule.cs
index 4af139c79..4c4b93f42 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/IdentityModule.cs
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/IdentityModule.cs
@@ -6,9 +6,11 @@
using System.Text.Json;
using EdFi.DmsConfigurationService.Backend;
using EdFi.DmsConfigurationService.Backend.Repositories;
+using EdFi.DmsConfigurationService.DataModel.Infrastructure;
+using EdFi.DmsConfigurationService.DataModel.Model.Register;
+using EdFi.DmsConfigurationService.DataModel.Model.Token;
using EdFi.DmsConfigurationService.Frontend.AspNetCore.Configuration;
using EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
-using EdFi.DmsConfigurationService.Frontend.AspNetCore.Model;
using FluentValidation;
using FluentValidation.Results;
using Microsoft.AspNetCore.Mvc;
diff --git a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/VendorModule.cs b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/VendorModule.cs
index da8871f29..79271d675 100644
--- a/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/VendorModule.cs
+++ b/src/config/frontend/EdFi.DmsConfigurationService.Frontend.AspNetCore/Modules/VendorModule.cs
@@ -6,9 +6,9 @@
using System.Net;
using EdFi.DmsConfigurationService.Backend.Repositories;
using EdFi.DmsConfigurationService.DataModel;
-using EdFi.DmsConfigurationService.DataModel.Vendor;
+using EdFi.DmsConfigurationService.DataModel.Infrastructure;
+using EdFi.DmsConfigurationService.DataModel.Model.Vendor;
using EdFi.DmsConfigurationService.Frontend.AspNetCore.Infrastructure;
-using EdFi.DmsConfigurationService.Frontend.AspNetCore.Model.Validator;
using FluentValidation;
using FluentValidation.Results;
@@ -29,8 +29,8 @@ public void MapEndpoints(IEndpointRouteBuilder endpoints)
}
private static async Task InsertVendor(
- VendorInsertCommandValidator validator,
VendorInsertCommand entity,
+ VendorInsertCommand.Validator validator,
HttpContext httpContext,
IVendorRepository repository
)
@@ -87,8 +87,8 @@ ILogger logger
private static async Task Update(
long id,
- VendorUpdateCommandValidator validator,
VendorUpdateCommand command,
+ VendorUpdateCommand.Validator validator,
HttpContext httpContext,
IVendorRepository repository
)