añade proto back

This commit is contained in:
2025-08-07 16:32:59 +02:00
parent 9b373d1929
commit 11825d7be5
95 changed files with 786 additions and 62491 deletions

View File

@@ -0,0 +1,29 @@
using back.ApiService.models;
using Microsoft.EntityFrameworkCore;
namespace back.ApiService.context;
public class PhotoContext : DbContext
{
public DbSet<Photo> Photos { get; set; }
public PhotoContext(DbContextOptions<PhotoContext> options) : base(options)
{
// Ensure database is created
Database.EnsureCreated();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Photo>()
.Property(p => p.Tags)
.HasConversion(
v => string.Join(',', v),
v => v.Split(',', StringSplitOptions.RemoveEmptyEntries).ToList());
modelBuilder.Entity<Photo>()
.Property(p => p.PersonsIn)
.HasConversion(
v => string.Join(',', v),
v => v.Split(',', StringSplitOptions.RemoveEmptyEntries).ToList());
}
}