Skip to content

Commit

Permalink
add LanguageResource model
Browse files Browse the repository at this point in the history
  • Loading branch information
emrecoskun705 committed Sep 19, 2023
1 parent 9aa92a4 commit 2102ab1
Show file tree
Hide file tree
Showing 8 changed files with 282 additions and 74 deletions.
78 changes: 5 additions & 73 deletions Unitagram.Application/Unitagram.Application.csproj
Original file line number Diff line number Diff line change
@@ -1,85 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<UserSecretsId>33D56772-14E9-426F-9754-5334A96CF6D3</UserSecretsId>
</PropertyGroup>


<ItemGroup>
<ProjectReference Include="..\Unitagram.Domain\Unitagram.Domain.csproj" />
<ProjectReference Include="..\Unitagram.Domain\Unitagram.Domain.csproj"/>
</ItemGroup>




<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.7.1" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.7.1" />
<PackageReference Include="LanguageExt.Core" Version="4.4.3" />








<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.1.0" />




































<PackageReference Include="FluentValidation" Version="11.7.1"/>
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.7.1"/>
<PackageReference Include="LanguageExt.Core" Version="4.4.3"/>
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.1.0"/>
</ItemGroup>

















</Project>
17 changes: 17 additions & 0 deletions Unitagram.Domain/LanguageResource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Unitagram.Domain.Common;
using Unitagram.Domain.Primitives;

namespace Unitagram.Domain;

public class LanguageResource : BaseEntity, IAuditableEntity
{
public int Id { get; set; }
public string Language { get; set; } = string.Empty;
public string Source { get; set; } = string.Empty;
public string SourceKey { get; set; } = string.Empty;
public string Value { get; set; } = string.Empty;
public string? ModifiedBy { get; set; }
public string? CreatedBy { get; set; }
public DateTime CreatedOnUtc { get; set; }
public DateTime? ModifiedOnUtc { get; set; }
}
4 changes: 4 additions & 0 deletions Unitagram.Infrastructure/Unitagram.Infrastructure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@
</ItemGroup>


<ItemGroup>
<Folder Include="LocalizationCache\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Unitagram.Domain;

namespace Unitagram.Persistence.Configurations;

public class LanguageResourceConfiguration : IEntityTypeConfiguration<LanguageResource>
{
public void Configure(EntityTypeBuilder<LanguageResource> builder)
{
builder.HasKey(u => new {u.Id, u.Language, u.Source, u.SourceKey});

builder.Property(u => u.Language)
.HasMaxLength(5);

builder.Property(u => u.Source)
.HasMaxLength(20);

builder.Property(u => u.SourceKey)
.HasMaxLength(50);

builder.Property(u => u.ModifiedBy)
.HasMaxLength(15);

builder.Property(u => u.CreatedBy)
.HasMaxLength(15);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Microsoft.EntityFrameworkCore;
using Unitagram.Domain;
using Unitagram.Domain.Common;
using Unitagram.Domain.Primitives;

namespace Unitagram.Persistence.DatabaseContext;
Expand All @@ -18,6 +17,7 @@ protected UnitagramDatabaseContext()
public DbSet<University> University { get; set; }
public DbSet<UniversityUser> UniversityUser { get; set; }
public DbSet<OtpConfirmation> OtpConfirmation { get; set; }
public DbSet<LanguageResource> LanguageResource { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Unitagram.Persistence.Migrations
{
/// <inheritdoc />
public partial class AddLanguageResource : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "LanguageResource",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false),
Language = table.Column<string>(type: "nvarchar(5)", maxLength: 5, nullable: false),
Source = table.Column<string>(type: "nvarchar(20)", maxLength: 20, nullable: false),
SourceKey = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
Value = table.Column<string>(type: "nvarchar(max)", nullable: false),
ModifiedBy = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true),
CreatedBy = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: true),
CreatedOnUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedOnUtc = table.Column<DateTime>(type: "datetime2", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_LanguageResource", x => new { x.Id, x.Language, x.Source, x.SourceKey });
});
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "LanguageResource");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,46 @@ protected override void BuildModel(ModelBuilder modelBuilder)

SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);

modelBuilder.Entity("Unitagram.Domain.LanguageResource", b =>
{
b.Property<int>("Id")
.HasColumnType("int");

b.Property<string>("Language")
.HasMaxLength(5)
.HasColumnType("nvarchar(5)");

b.Property<string>("Source")
.HasMaxLength(20)
.HasColumnType("nvarchar(20)");

b.Property<string>("SourceKey")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");

b.Property<string>("CreatedBy")
.HasMaxLength(15)
.HasColumnType("nvarchar(15)");

b.Property<DateTime>("CreatedOnUtc")
.HasColumnType("datetime2");

b.Property<string>("ModifiedBy")
.HasMaxLength(15)
.HasColumnType("nvarchar(15)");

b.Property<DateTime?>("ModifiedOnUtc")
.HasColumnType("datetime2");

b.Property<string>("Value")
.IsRequired()
.HasColumnType("nvarchar(max)");

b.HasKey("Id", "Language", "Source", "SourceKey");

b.ToTable("LanguageResource");
});

modelBuilder.Entity("Unitagram.Domain.OtpConfirmation", b =>
{
b.Property<Guid>("UserId")
Expand Down

0 comments on commit 2102ab1

Please sign in to comment.