Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions api/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ csharp_style_prefer_pattern_matching = true:silent
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
csharp_style_prefer_primary_constructors = true:suggestion
csharp_prefer_system_threading_lock = true:suggestion

# C# or VB files
[*.{cs,vb}]
Expand Down
104 changes: 104 additions & 0 deletions api/Vote.Monitor.Ingestor.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36310.24
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vote.Monitor.Ingestor.Core", "src\Vote.Monitor.Ingestor.Core\Vote.Monitor.Ingestor.Core.csproj", "{79AB5114-0915-17CE-0242-EA62DB5B8CA5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{0E5E03C8-4D32-4739-814D-8FE9429C9B48}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{56C0C5FD-101A-474B-B6BC-9BEDA8BB9EEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vote.Monitor.Domain", "src\Vote.Monitor.Domain\Vote.Monitor.Domain.csproj", "{6B9F50DD-275A-3271-8ABA-CDA6810807F4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vote.Monitor.Ingestor.Api", "src\Vote.Monitor.Ingestor.Api\Vote.Monitor.Ingestor.Api.csproj", "{81BC5DC5-5670-42AE-8A47-217A913BCF87}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vote.Monitor.Ingestor.Core.UnitTests", "tests\Vote.Monitor.Ingestor.Core.UnitTests\Vote.Monitor.Ingestor.Core.UnitTests.csproj", "{781679E9-0733-9CBE-CDFC-48312F4187A3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authorization.Policies", "src\Authorization.Policies\Authorization.Policies.csproj", "{90976F7F-0DF4-DEC5-F418-C7C1EB13B6B7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Module.Answers", "src\Module.Answers\Module.Answers.csproj", "{723225B2-3DAF-662C-8E0F-181BCED49C1B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Feature.Auth", "src\Feature.Auth\Feature.Auth.csproj", "{ACC84E43-FD92-B72C-3859-1FF41C12C070}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vote.Monitor.Core", "src\Vote.Monitor.Core\Vote.Monitor.Core.csproj", "{C0A7C75B-FAF8-E938-0738-A9CC7F010721}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Feature.Form.Submission.SMS", "src\Feature.Form.Submission.SMS\Feature.Form.Submission.SMS.csproj", "{982CFDB2-C1EC-22B1-BC80-720B31D8EAC8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Feature.Form.Submission.SMS.UnitTests", "tests\Feature.Form.Submission.SMS.UnitTests\Feature.Form.Submission.SMS.UnitTests.csproj", "{B5FD0884-6C63-4113-8D91-6031E00B979B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vote.Monitor.TestUtils", "tests\Vote.Monitor.TestUtils\Vote.Monitor.TestUtils.csproj", "{E7E2E54A-3DBB-1A18-13A9-4C8E8C5DDD58}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{79AB5114-0915-17CE-0242-EA62DB5B8CA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{79AB5114-0915-17CE-0242-EA62DB5B8CA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79AB5114-0915-17CE-0242-EA62DB5B8CA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79AB5114-0915-17CE-0242-EA62DB5B8CA5}.Release|Any CPU.Build.0 = Release|Any CPU
{6B9F50DD-275A-3271-8ABA-CDA6810807F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B9F50DD-275A-3271-8ABA-CDA6810807F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B9F50DD-275A-3271-8ABA-CDA6810807F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B9F50DD-275A-3271-8ABA-CDA6810807F4}.Release|Any CPU.Build.0 = Release|Any CPU
{81BC5DC5-5670-42AE-8A47-217A913BCF87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{81BC5DC5-5670-42AE-8A47-217A913BCF87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{81BC5DC5-5670-42AE-8A47-217A913BCF87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{81BC5DC5-5670-42AE-8A47-217A913BCF87}.Release|Any CPU.Build.0 = Release|Any CPU
{781679E9-0733-9CBE-CDFC-48312F4187A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{781679E9-0733-9CBE-CDFC-48312F4187A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{781679E9-0733-9CBE-CDFC-48312F4187A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{781679E9-0733-9CBE-CDFC-48312F4187A3}.Release|Any CPU.Build.0 = Release|Any CPU
{90976F7F-0DF4-DEC5-F418-C7C1EB13B6B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{90976F7F-0DF4-DEC5-F418-C7C1EB13B6B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{90976F7F-0DF4-DEC5-F418-C7C1EB13B6B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{90976F7F-0DF4-DEC5-F418-C7C1EB13B6B7}.Release|Any CPU.Build.0 = Release|Any CPU
{723225B2-3DAF-662C-8E0F-181BCED49C1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{723225B2-3DAF-662C-8E0F-181BCED49C1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{723225B2-3DAF-662C-8E0F-181BCED49C1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{723225B2-3DAF-662C-8E0F-181BCED49C1B}.Release|Any CPU.Build.0 = Release|Any CPU
{ACC84E43-FD92-B72C-3859-1FF41C12C070}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ACC84E43-FD92-B72C-3859-1FF41C12C070}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ACC84E43-FD92-B72C-3859-1FF41C12C070}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ACC84E43-FD92-B72C-3859-1FF41C12C070}.Release|Any CPU.Build.0 = Release|Any CPU
{C0A7C75B-FAF8-E938-0738-A9CC7F010721}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C0A7C75B-FAF8-E938-0738-A9CC7F010721}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C0A7C75B-FAF8-E938-0738-A9CC7F010721}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C0A7C75B-FAF8-E938-0738-A9CC7F010721}.Release|Any CPU.Build.0 = Release|Any CPU
{982CFDB2-C1EC-22B1-BC80-720B31D8EAC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{982CFDB2-C1EC-22B1-BC80-720B31D8EAC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{982CFDB2-C1EC-22B1-BC80-720B31D8EAC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{982CFDB2-C1EC-22B1-BC80-720B31D8EAC8}.Release|Any CPU.Build.0 = Release|Any CPU
{B5FD0884-6C63-4113-8D91-6031E00B979B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B5FD0884-6C63-4113-8D91-6031E00B979B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B5FD0884-6C63-4113-8D91-6031E00B979B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B5FD0884-6C63-4113-8D91-6031E00B979B}.Release|Any CPU.Build.0 = Release|Any CPU
{E7E2E54A-3DBB-1A18-13A9-4C8E8C5DDD58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E7E2E54A-3DBB-1A18-13A9-4C8E8C5DDD58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E7E2E54A-3DBB-1A18-13A9-4C8E8C5DDD58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E7E2E54A-3DBB-1A18-13A9-4C8E8C5DDD58}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{79AB5114-0915-17CE-0242-EA62DB5B8CA5} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{6B9F50DD-275A-3271-8ABA-CDA6810807F4} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{81BC5DC5-5670-42AE-8A47-217A913BCF87} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{781679E9-0733-9CBE-CDFC-48312F4187A3} = {0E5E03C8-4D32-4739-814D-8FE9429C9B48}
{90976F7F-0DF4-DEC5-F418-C7C1EB13B6B7} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{723225B2-3DAF-662C-8E0F-181BCED49C1B} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{ACC84E43-FD92-B72C-3859-1FF41C12C070} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{C0A7C75B-FAF8-E938-0738-A9CC7F010721} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{982CFDB2-C1EC-22B1-BC80-720B31D8EAC8} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
{B5FD0884-6C63-4113-8D91-6031E00B979B} = {0E5E03C8-4D32-4739-814D-8FE9429C9B48}
{E7E2E54A-3DBB-1A18-13A9-4C8E8C5DDD58} = {0E5E03C8-4D32-4739-814D-8FE9429C9B48}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D19E1043-BFA3-44D0-B12F-CFB706EC6754}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Ardalis.SmartEnum.Dapper" />
<PackageReference Include="Ardalis.SmartEnum.SystemTextJson" />
<PackageReference Include="FastEndpoints" />
<PackageReference Include="FastEndpoints.Security" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Authorization.Policies\Authorization.Policies.csproj" />
<ProjectReference Include="..\Module.Answers\Module.Answers.csproj" />
<ProjectReference Include="..\Vote.Monitor.Ingestor.Core\Vote.Monitor.Ingestor.Core.csproj" />
</ItemGroup>
</Project>
27 changes: 27 additions & 0 deletions api/src/Feature.Form.Submission.SMS/FormSubmissionModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Module.Answers.Mappers;
using Module.Answers.Models;
using Vote.Monitor.Domain.Entities.FormSubmissionAggregate;

namespace Feature.Form.Submission.SMS;

public record FormSubmissionModel
{
public required Guid Id { get; init; }
public required Guid FormId { get; init; }
public required Guid PollingStationId { get; init; }
public SubmissionFollowUpStatus FollowUpStatus { get; init; }
public IReadOnlyList<BaseAnswerModel> Answers { get; init; }
public bool IsCompleted { get; init; }

public static FormSubmissionModel FromEntity(FormSubmission entity) => new()
{
Id = entity.Id,
PollingStationId = entity.PollingStationId,
FormId = entity.FormId,
Answers = entity.Answers
.Select(AnswerMapper.ToModel)
.ToList(),
FollowUpStatus = entity.FollowUpStatus,
IsCompleted = entity.IsCompleted
};
}
3 changes: 3 additions & 0 deletions api/src/Feature.Form.Submission.SMS/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
global using FormAggregate = Vote.Monitor.Domain.Entities.FormAggregate.Form;
global using MonitoringObserverAggregate = Vote.Monitor.Domain.Entities.MonitoringObserverAggregate.MonitoringObserver;
global using PollingStationAggregate = Vote.Monitor.Domain.Entities.PollingStationAggregate.PollingStation;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Ardalis.Specification;

namespace Feature.Form.Submission.SMS.Specifications;
public class GetFormSpecification : SingleResultSpecification<FormAggregate>
{
public GetFormSpecification(string formCode, Guid electionRoundId, Guid monitoringNgoId)
{
Query.Where(f => f.Code == formCode && f.ElectionRoundId == electionRoundId && f.MonitoringNgoId == monitoringNgoId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Ardalis.Specification;
using Vote.Monitor.Domain.Entities.MonitoringObserverAggregate;

namespace Feature.Form.Submission.SMS.Specifications;
public class GetMonitoringObserver : SingleResultSpecification<MonitoringObserver>
{
public GetMonitoringObserver(string phoneNumber, Guid monitoringNgoId, Guid electionRoundId)
{
Query.Where(mo => mo.PhoneNumber == phoneNumber && mo.MonitoringNgoId == monitoringNgoId && mo.ElectionRoundId == electionRoundId);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Ardalis.Specification;
using Vote.Monitor.Domain.Entities.MonitoringObserverAggregate;
using Vote.Monitor.Domain.Entities.PollingStationAggregate;

namespace Feature.Form.Submission.SMS.Specifications;
public class GetPollingStation : SingleResultSpecification<PollingStation>
{
public GetPollingStation(string pollingStationCode, Guid electionRoundId)
{
Query.Where(ps => ps.SecondaryId == pollingStationCode && ps.ElectionRoundId == electionRoundId);
}
}
Loading