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.
41 lines
1.8 KiB
C#
41 lines
1.8 KiB
C#
using System.Text.RegularExpressions;
|
|
using Govor.Core.Models;
|
|
using Govor.Data.Configurations;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Govor.Data;
|
|
|
|
public class GovorDbContext(DbContextOptions<GovorDbContext> options) : DbContext(options)
|
|
{
|
|
public virtual DbSet<User> Users { get; set; }
|
|
public virtual DbSet<Friendship> Friendships { get; set; }
|
|
public virtual DbSet<PrivateChat> PrivateChats { get; set; }
|
|
public virtual DbSet<Admin> Admins { get; set; }
|
|
|
|
public virtual DbSet<Invitation> Invitations { get; set; }
|
|
|
|
public virtual DbSet<Message> Messages { get; set; }
|
|
public virtual DbSet<MessageView> MessageViews { get; set; }
|
|
public virtual DbSet<MessageReaction> MessageReactions { get; set; }
|
|
public virtual DbSet<MediaAttachments> MediaAttachments { get; set; }
|
|
public virtual DbSet<MediaFile> MediaFiles { get; set; }
|
|
|
|
public virtual DbSet<ChatGroup> ChatGroups { get; set; }
|
|
public virtual DbSet<GroupMembership> GroupMemberships { get; set; }
|
|
public virtual DbSet<GroupAdmins> GroupAdmins { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.ApplyConfiguration(new FriendshipConfiguration());
|
|
modelBuilder.ApplyConfiguration(new UserConfiguration());
|
|
modelBuilder.ApplyConfiguration(new InvitationConfiguration());
|
|
modelBuilder.ApplyConfiguration(new AdminConfiguration());
|
|
modelBuilder.ApplyConfiguration(new MessagesConfiguration());
|
|
modelBuilder.ApplyConfiguration(new MessageReactionConfiguration());
|
|
modelBuilder.ApplyConfiguration(new MediaAttachmentsConfiguration());
|
|
modelBuilder.ApplyConfiguration(new MessageViewConfiguration());
|
|
modelBuilder.ApplyConfiguration(new MediaFileConfiguration());
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
}
|
|
} |