.
This commit is contained in:
@@ -7,12 +7,11 @@ using System.Threading.Tasks;
|
||||
using VizhTalk.Learning.Application;
|
||||
using VizhTalk.Learning.Domain.Entities;
|
||||
|
||||
namespace VizhTalk.Learning.Infrastructure.Configuration
|
||||
namespace VizhTalk.Learning.Infrastructure.Configuration;
|
||||
|
||||
public static class Assemblies
|
||||
{
|
||||
public static class Assemblies
|
||||
{
|
||||
public static Assembly Infrastructure = typeof(LearningStartup).Assembly;
|
||||
public static Assembly Application = typeof(ILearningModule).Assembly;
|
||||
public static Assembly Domain = typeof(Language).Assembly;
|
||||
}
|
||||
public static Assembly Infrastructure = typeof(LearningStartup).Assembly;
|
||||
public static Assembly Application = typeof(ILearningModule).Assembly;
|
||||
public static Assembly Domain = typeof(Language).Assembly;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using Vizhtalk.CDN.Presentation.Domain.Repositories;
|
||||
using VizhTalk.BuildingBlocks.Application;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Application
|
||||
{
|
||||
internal interface IUnitOfWork : IUnitOfWorkBase
|
||||
{
|
||||
IMediaRepository Media { get; }
|
||||
IClientRepository Client { get; }
|
||||
IMediaClientRepository MediaClient { get; }
|
||||
IMediaGroupRepository MediaGroup{ get; }
|
||||
IMediaGroupMediaRepository MediaGroupMedia { get; }
|
||||
|
||||
Task SaveChangeAsync(CancellationToken cancellationToken = default);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Vizhtalk.CDN.Presentation.TypeIds;
|
||||
using Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Controllers
|
||||
{
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
|
||||
public class Client : Entity<ClientId>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
using Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
using Vizhtalk.CDN.Presentation.Domain.ValueObjects;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
|
||||
public class Media : Entity<MediaId>
|
||||
{
|
||||
public ContentType ContentType { get; private set; }
|
||||
public int Size { get; set; }
|
||||
public string Path { get; private set; }
|
||||
public string Hash { get; set; }
|
||||
public List<MediaGroupMedia> MediaGroupMedias { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
using Vizhtalk.CDN.Presentation.Domain.ValueObjects;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
|
||||
public class MediaClient : Entity<MediaClientId>
|
||||
{
|
||||
public MediaClientName Name { get; set; }
|
||||
public MediaId MediaId { get; set; }
|
||||
public ClientId ClientId { get; set; }
|
||||
public MediaGroupMediaId MediaGroup { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
using Vizhtalk.CDN.Presentation.Domain.ValueObjects;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
|
||||
public class MediaGroup : Entity<MediaGroupId>
|
||||
{
|
||||
public bool IsSecure { get; set; }
|
||||
public MediaGroupTitle Title { get; set; }
|
||||
public string Key { get; set; }
|
||||
public List<MediaGroupMedia> MediaGroupMedias { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
|
||||
public class MediaGroupMedia : Entity<MediaGroupMediaId>
|
||||
{
|
||||
public MediaId MediaId { get; set; }
|
||||
public MediaGroupId MediaGroupId { get; set; }
|
||||
public List<MediaClient> MediaClients { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
using Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.Repositories;
|
||||
|
||||
public interface IClientRepository : IRepositoryBase<Client, ClientId>;
|
||||
@@ -0,0 +1,7 @@
|
||||
using Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
using Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.Repositories;
|
||||
|
||||
public interface IMediaClientRepository : IRepositoryBase<MediaClient, MediaClientId>;
|
||||
@@ -0,0 +1,7 @@
|
||||
using Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
using Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.Repositories;
|
||||
|
||||
public interface IMediaGroupMediaRepository : IRepositoryBase<MediaGroupMedia, MediaGroupMediaId>;
|
||||
@@ -0,0 +1,7 @@
|
||||
using Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
using Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.Repositories;
|
||||
|
||||
public interface IMediaGroupRepository : IRepositoryBase<MediaGroup, MediaGroupId>;
|
||||
@@ -0,0 +1,7 @@
|
||||
using Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
using Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.Repositories;
|
||||
|
||||
public interface IMediaRepository : IRepositoryBase<Media, MediaId>;
|
||||
@@ -0,0 +1,10 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
|
||||
public class ClientId : TypedIdValueBase<string>
|
||||
{
|
||||
public ClientId(string value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
|
||||
public class MediaClientId : TypedIdValueBase<long>
|
||||
{
|
||||
public MediaClientId(long value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
|
||||
public class MediaGroupId : TypedIdValueBase<long>
|
||||
{
|
||||
public MediaGroupId(long value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
|
||||
public class MediaGroupMediaId : TypedIdValueBase<Guid>
|
||||
{
|
||||
public MediaGroupMediaId(Guid value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.TypeIds;
|
||||
|
||||
public class MediaId : TypedIdValueBase<long>
|
||||
{
|
||||
public MediaId(long value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Vizhtalk.CDN.Presentation.Domain.ValueObjects.Rules;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.ValueObjects;
|
||||
|
||||
public class ContentType : ValueObject
|
||||
{
|
||||
public ContentType(string contentType, byte[] fileBytes)
|
||||
{
|
||||
CheckRule(new ValidContentTypeRule(contentType, fileBytes));
|
||||
|
||||
Value = contentType;
|
||||
}
|
||||
public string Value { get; set; }
|
||||
}
|
||||
+3
-3
@@ -1,14 +1,14 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
using VizhTalk.BuildingBlocks.Domain.Guards;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.ValueObjects
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.ValueObjects
|
||||
{
|
||||
public class MediaClientName : ValueObject
|
||||
{
|
||||
public MediaClientName(string value)
|
||||
{
|
||||
Guard.NullOrEmpty(value, nameof(MediaClientName));
|
||||
Guard.MaxLength(value, nameof(MediaClientName), 150);
|
||||
value.NullOrEmpty(nameof(MediaClientName));
|
||||
value.MaxLength(nameof(MediaClientName), 150);
|
||||
|
||||
Value = value;
|
||||
}
|
||||
+3
-3
@@ -1,14 +1,14 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
using VizhTalk.BuildingBlocks.Domain.Guards;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.ValueObjects;
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.ValueObjects;
|
||||
|
||||
public class MediaGroupTitle : ValueObject
|
||||
{
|
||||
public MediaGroupTitle(string value)
|
||||
{
|
||||
Guard.NullOrEmpty(value, nameof(MediaGroupTitle));
|
||||
Guard.MaxLength(value, nameof(MediaGroupTitle),150);
|
||||
value.NullOrEmpty(nameof(MediaGroupTitle));
|
||||
value.MaxLength(nameof(MediaGroupTitle),150);
|
||||
|
||||
Value = value;
|
||||
}
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
using System.Text;
|
||||
using VizhTalk.BuildingBlocks.Domain.Exceptions;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.ValueObjects.Rules;
|
||||
namespace Vizhtalk.CDN.Presentation.Domain.ValueObjects.Rules;
|
||||
|
||||
public class ValidContentTypeRule(string contentType, byte[] fileBytes) : IBusinessRule
|
||||
{
|
||||
@@ -81,7 +81,7 @@ public class ValidContentTypeRule(string contentType, byte[] fileBytes) : IBusin
|
||||
return true;
|
||||
|
||||
if (contentType == "audio/mpeg" && (fileBytes.Take(3).SequenceEqual(new byte[] { 0x49, 0x44, 0x33 }) // ID3
|
||||
|| (fileBytes[0] == 0xFF && (fileBytes[1] & 0xE0) == 0xE0))) // MPEG frame
|
||||
|| fileBytes[0] == 0xFF && (fileBytes[1] & 0xE0) == 0xE0)) // MPEG frame
|
||||
return true;
|
||||
|
||||
if (contentType == "image/svg+xml")
|
||||
@@ -1,10 +0,0 @@
|
||||
using Vizhtalk.CDN.Presentation.TypeIds;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Entities
|
||||
{
|
||||
public class Client : Entity<ClientId>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
using Vizhtalk.CDN.Presentation.TypeIds;
|
||||
using Vizhtalk.CDN.Presentation.ValueObjects;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Entities
|
||||
{
|
||||
public class Media : Entity<MediaId>
|
||||
{
|
||||
public ContentType ContentType { get; private set; }
|
||||
public int Size { get; set; }
|
||||
public string Path { get; private set; }
|
||||
public string Hash { get; set; }
|
||||
public List<MediaGroupMedia> MediaGroupMedias { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Vizhtalk.CDN.Presentation.TypeIds;
|
||||
using Vizhtalk.CDN.Presentation.ValueObjects;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Entities
|
||||
{
|
||||
public class MediaClient : Entity<MediaClientId>
|
||||
{
|
||||
public MediaClientName Name { get; set; }
|
||||
public MediaId MediaId { get; set; }
|
||||
public ClientId ClientId { get; set; }
|
||||
public MediaGroupMediaId MediaGroup { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using Vizhtalk.CDN.Presentation.TypeIds;
|
||||
using Vizhtalk.CDN.Presentation.ValueObjects;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Entities
|
||||
{
|
||||
public class MediaGroup : Entity<MediaGroupId>
|
||||
{
|
||||
public bool IsSecure { get; set; }
|
||||
public MediaGroupTitle Title { get; set; }
|
||||
public string Key { get; set; }
|
||||
public List<MediaGroupMedia> MediaGroupMedias { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using Vizhtalk.CDN.Presentation.TypeIds;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Entities
|
||||
{
|
||||
public class MediaGroupMedia : Entity<MediaGroupMediaId>
|
||||
{
|
||||
public MediaId MediaId { get; set; }
|
||||
public MediaGroupId MediaGroupId { get; set; }
|
||||
public List<MediaClient> MediaClients { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MongoDB.Driver;
|
||||
using Vizhtalk.CDN.Presentation.Application;
|
||||
using Vizhtalk.CDN.Presentation.Infrastructure.Configuration;
|
||||
using Vizhtalk.CDN.Presentation.Infrastructure.EF;
|
||||
using VizhTalk.BuildingBlocks.Application;
|
||||
using VizhTalk.BuildingBlocks.Application.Configuration.Commnad;
|
||||
using VizhTalk.BuildingBlocks.Application.Configuration.Query;
|
||||
using VizhTalk.BuildingBlocks.Application.Data;
|
||||
using VizhTalk.BuildingBlocks.Application.Events;
|
||||
using VizhTalk.BuildingBlocks.Application.Outbox;
|
||||
using VizhTalk.BuildingBlocks.Infrastructure;
|
||||
using VizhTalk.BuildingBlocks.Infrastructure.DomainEventsDispatching;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Infrastructure;
|
||||
|
||||
public static class CDNStartup
|
||||
{
|
||||
public static void Initialize(this IServiceCollection services, string connectionString)
|
||||
{
|
||||
var domainNotificationsMap = new BiDictionary<string, Type>();
|
||||
|
||||
services.AddDbContext<CDNDbContext>(op =>
|
||||
{
|
||||
op.UseMongoDB(connectionString);
|
||||
});
|
||||
services.AddScoped<DbContext>(sp => sp.GetService<CDNDbContext>());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void UseCDNModule(this IApplicationBuilder app)
|
||||
{
|
||||
using var scope = app.ApplicationServices.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<CDNDbContext>();
|
||||
db.Database.Migrate();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Reflection;
|
||||
using Vizhtalk.CDN.Presentation.Application;
|
||||
using Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Infrastructure.Configuration;
|
||||
|
||||
public static class Assemblies
|
||||
{
|
||||
public static Assembly Infrastructure = typeof(UnitOfWork).Assembly;
|
||||
public static Assembly Application = typeof(IUnitOfWork).Assembly;
|
||||
public static Assembly Domain = typeof(Media).Assembly;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Vizhtalk.CDN.Presentation.Infrastructure.Configuration;
|
||||
using VizhTalk.BuildingBlocks.Infrastructure.EF.Helpers;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Infrastructure.EF
|
||||
{
|
||||
public class CDNDbContext : DbContext
|
||||
{
|
||||
|
||||
public CDNDbContext(DbContextOptions<CDNDbContext> options) : base(options)
|
||||
{
|
||||
|
||||
}
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
modelBuilder.FindEntities(Assemblies.Domain)
|
||||
.ApplyConfigurationsFromAssembly(Assemblies.Infrastructure, x => x.FullName.Contains("EF.Configurations"))
|
||||
.PluralizeEntities();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Infrastructure.EF.Configurations;
|
||||
|
||||
public class ClientConfiguration : IEntityTypeConfiguration<Client>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Client> builder)
|
||||
{
|
||||
builder.ToTable(nameof(Client));
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.Id)
|
||||
.HasConversion(x => x.Value, x => new Domain.TypeIds.ClientId(x));
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Infrastructure.EF.Configurations;
|
||||
|
||||
public class MediaClientConfiguration : IEntityTypeConfiguration<MediaClient>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<MediaClient> builder)
|
||||
{
|
||||
builder.ToTable(nameof(MediaClient));
|
||||
builder.HasKey(x => x.Id);
|
||||
|
||||
builder.Property(x => x.Id)
|
||||
.HasConversion(x => x.Value, x => new Domain.TypeIds.MediaClientId(x));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Infrastructure.EF.Configurations;
|
||||
|
||||
public class MediaConfiguration : IEntityTypeConfiguration<Media>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Media> builder)
|
||||
{
|
||||
builder.ToTable(nameof(Media));
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.Id)
|
||||
.HasConversion(x => x.Value, x => new Domain.TypeIds.MediaId(x));
|
||||
|
||||
builder.HasIndex(x => x.Hash);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Infrastructure.EF.Configurations;
|
||||
|
||||
public class MediaGroupConfiguration : IEntityTypeConfiguration<MediaGroup>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<MediaGroup> builder)
|
||||
{
|
||||
builder.ToTable(nameof(MediaGroup));
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.Id)
|
||||
.HasConversion(x => x.Value, x => new Domain.TypeIds.MediaGroupId(x));
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using Vizhtalk.CDN.Presentation.Domain.Entities;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Infrastructure.EF.Configurations;
|
||||
|
||||
public class MediaGroupMediaConfiguration : IEntityTypeConfiguration<MediaGroupMedia>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<MediaGroupMedia> builder)
|
||||
{
|
||||
builder.ToTable(nameof(MediaGroupMedia));
|
||||
builder.HasKey(x => x.Id);
|
||||
builder.Property(x => x.Id)
|
||||
.HasConversion(x => x.Value, x => new Domain.TypeIds.MediaGroupMediaId(x));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Vizhtalk.CDN.Presentation.Application;
|
||||
using Vizhtalk.CDN.Presentation.Infrastructure.EF;
|
||||
using Vizhtalk.CDN.Presentation.Domain.Repositories;
|
||||
using VizhTalk.BuildingBlocks.Infrastructure;
|
||||
using VizhTalk.BuildingBlocks.Infrastructure.DomainEventsDispatching;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.Infrastructure
|
||||
{
|
||||
public class UnitOfWork(CDNDbContext cdnDbContext, IDomainEventsDispatcher domainEventsDispatcher)
|
||||
: UnitOfWorkBase(cdnDbContext, domainEventsDispatcher)
|
||||
{
|
||||
public IMediaRepository Media => throw new NotImplementedException();
|
||||
|
||||
public IClientRepository Client => throw new NotImplementedException();
|
||||
|
||||
public IMediaClientRepository MediaClient => throw new NotImplementedException();
|
||||
|
||||
public IMediaGroupRepository MediaGroup => throw new NotImplementedException();
|
||||
|
||||
public IMediaGroupMediaRepository MediaGroupMedia => throw new NotImplementedException();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,23 @@
|
||||
using MongoDB.Driver.Core.Configuration;
|
||||
using Vizhtalk.CDN.Presentation.Infrastructure;
|
||||
using Vizhtalk.CDN.Presentation.Services;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
var connectionString = builder.Configuration.GetConnectionString("VizhTalk.CDN")!;
|
||||
|
||||
|
||||
builder.Services.Initialize(connectionString);
|
||||
builder.Services.AddGrpc();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
|
||||
app.MapGet("/", () => "Hello World!");
|
||||
|
||||
app.MapGrpcService<CDNService>();
|
||||
|
||||
app.UseCDNModule();
|
||||
|
||||
app.Run();
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.TypeIds
|
||||
{
|
||||
public class ClientId : TypedIdValueBase<string>
|
||||
{
|
||||
public ClientId(string value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.TypeIds
|
||||
{
|
||||
public class MediaClientId : TypedIdValueBase<long>
|
||||
{
|
||||
public MediaClientId(long value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.TypeIds
|
||||
{
|
||||
public class MediaGroupId : TypedIdValueBase<long>
|
||||
{
|
||||
public MediaGroupId(long value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.TypeIds
|
||||
{
|
||||
public class MediaGroupMediaId : TypedIdValueBase<Guid>
|
||||
{
|
||||
public MediaGroupMediaId(Guid value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.TypeIds
|
||||
{
|
||||
public class MediaId : TypedIdValueBase<long>
|
||||
{
|
||||
public MediaId(long value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using Vizhtalk.CDN.Presentation.ValueObjects.Rules;
|
||||
using VizhTalk.BuildingBlocks.Domain;
|
||||
|
||||
namespace Vizhtalk.CDN.Presentation.ValueObjects
|
||||
{
|
||||
public class ContentType : ValueObject
|
||||
{
|
||||
public ContentType(string contentType, byte[] fileBytes)
|
||||
{
|
||||
CheckRule(new ValidContentTypeRule(contentType, fileBytes));
|
||||
|
||||
Value = contentType;
|
||||
}
|
||||
public string Value { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -8,13 +8,18 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Grpc.AspNetCore" Version="2.57.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.19">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MongoDB.EntityFrameworkCore" Version="8.3.1" />
|
||||
<ProjectReference Include="..\VizhTalk.BuildingBlocks.Infrastructure\VizhTalk.BuildingBlocks.Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\VizhTalk.Grpc.CDN\VizhTalk.Grpc.CDN.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Infrastructure\" />
|
||||
<Folder Include="Application\" />
|
||||
<Folder Include="Application\CommandHandlers\" />
|
||||
<Folder Include="Application\QueryHandlers\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
}
|
||||
},
|
||||
"ConnectionStrings": {
|
||||
"VizhTalk.CDN": "mongodb://localhost:27017/VizhTalk.CDN"
|
||||
"VizhTalk.CDN": "mongodb://localhost:27017/VizhTalk_CDN"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user