This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
1,428 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
backend/src/Logitar.Master.Application/Caching/ICacheService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Logitar.EventSourcing; | ||
using Logitar.Master.Contracts.Actors; | ||
|
||
namespace Logitar.Master.Application.Caching; | ||
|
||
public interface ICacheService | ||
{ | ||
Actor? GetActor(ActorId id); | ||
void RemoveActor(ActorId id); | ||
void SetActor(Actor actor); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 4 additions & 1 deletion
5
backend/src/Logitar.Master.Domain/Projects/UniqueKeyValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
using FluentValidation; | ||
using Logitar.Master.Domain.Shared; | ||
|
||
namespace Logitar.Master.Domain.Projects; | ||
|
||
public class UniqueKeyValidator : AbstractValidator<string> | ||
{ | ||
private const string AllowedCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; | ||
|
||
public UniqueKeyValidator() | ||
{ | ||
RuleFor(x => x).NotEmpty().MaximumLength(UniqueKeyUnit.MaximumLength); // TODO(fpion): AllowedCharacters | ||
RuleFor(x => x).NotEmpty().MaximumLength(UniqueKeyUnit.MaximumLength).SetValidator(new AllowedCharactersValidator(AllowedCharacters)); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
backend/src/Logitar.Master.Domain/Shared/AllowedCharactersValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using FluentValidation; | ||
|
||
namespace Logitar.Master.Domain.Shared; | ||
|
||
public class AllowedCharactersValidator : AbstractValidator<string> | ||
{ | ||
public AllowedCharactersValidator(string? allowedCharacters) | ||
{ | ||
if (allowedCharacters != null) | ||
{ | ||
RuleFor(x => x).Must(x => x.All(allowedCharacters.Contains)).WithErrorCode(nameof(AllowedCharactersValidator)) | ||
.WithMessage($"'{{PropertyName}}' may only contain the following characters: '{allowedCharacters}'."); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
backend/src/Logitar.Master.EntityFrameworkCore.SqlServer/DependencyInjectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Logitar.EventSourcing.EntityFrameworkCore.SqlServer; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Logitar.Master.EntityFrameworkCore.SqlServer; | ||
|
||
public static class DependencyInjectionExtensions | ||
{ | ||
private const string ConfigurationKey = "SQLCONNSTR_Master"; | ||
|
||
public static IServiceCollection AddLogitarMasterWithEntityFrameworkCoreSqlServer(this IServiceCollection services, IConfiguration configuration) | ||
{ | ||
string? connectionString = Environment.GetEnvironmentVariable(ConfigurationKey); | ||
if (string.IsNullOrWhiteSpace(connectionString)) | ||
{ | ||
connectionString = configuration.GetValue<string>(ConfigurationKey); | ||
} | ||
if (string.IsNullOrWhiteSpace(connectionString)) | ||
{ | ||
throw new ArgumentException($"The configuration '{ConfigurationKey}' could not be found.", nameof(configuration)); | ||
} | ||
return services.AddLogitarMasterWithEntityFrameworkCoreSqlServer(connectionString.Trim()); | ||
} | ||
public static IServiceCollection AddLogitarMasterWithEntityFrameworkCoreSqlServer(this IServiceCollection services, string connectionString) | ||
{ | ||
return services | ||
.AddDbContext<MasterContext>(options => options.UseSqlServer(connectionString, b => b.MigrationsAssembly("Logitar.Master.EntityFrameworkCore.SqlServer"))) | ||
.AddLogitarEventSourcingWithEntityFrameworkCoreSqlServer(connectionString) | ||
.AddLogitarMasterWithEntityFrameworkCore() | ||
.AddSingleton<ISqlHelper, SqlServerHelper>(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
....Master.EntityFrameworkCore.SqlServer/Logitar.Master.EntityFrameworkCore.SqlServer.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Logitar.Data.SqlServer" Version="3.0.0" /> | ||
<PackageReference Include="Logitar.EventSourcing.EntityFrameworkCore.SqlServer" Version="5.0.2" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Logitar.Master.EntityFrameworkCore\Logitar.Master.EntityFrameworkCore.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
153 changes: 153 additions & 0 deletions
153
...ityFrameworkCore.SqlServer/Migrations/20240426044351_CreateActorProjectTables.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.