mirror of
https://github.com/Govor-team/Govor.git
synced 2026-07-21 19:54:55 +00:00
66819a015a
This commit introduces the MediaFile entity and updates the media attachments model, repositories, and related logic to reference MediaFile instead of storing file metadata directly in MediaAttachments. Controller, service, and SignalR request/response contracts are updated to support the new structure. Database configurations and validators are also adjusted accordingly. This refactor improves media management and normalization in the data model.
27 lines
743 B
C#
27 lines
743 B
C#
using Govor.Core.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace Govor.Data.Configurations;
|
|
|
|
public class MediaFileConfiguration : IEntityTypeConfiguration<MediaFile>
|
|
{
|
|
public void Configure(EntityTypeBuilder<MediaFile> builder)
|
|
{
|
|
builder.HasKey(ma => ma.Id);
|
|
|
|
builder.Property(mf => mf.Url)
|
|
.IsRequired();
|
|
|
|
builder.Property(mf => mf.MediaType)
|
|
.HasConversion<string>() // enum as string (e.g., "Image")
|
|
.IsRequired();
|
|
|
|
builder.Property(ma => ma.MineType)
|
|
.HasMaxLength(128)
|
|
.IsRequired();
|
|
|
|
builder.Property(mf => mf.DateCreated)
|
|
.IsRequired();
|
|
}
|
|
} |