|
|
|
@ -1,8 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
using Yavsc.Models.Haircut;
|
|
|
|
using Yavsc.Models.Haircut;
|
|
|
|
using Yavsc.Models.IT.Evolution;
|
|
|
|
using Yavsc.Models.IT.Evolution;
|
|
|
|
using Yavsc.Models.IT.Fixing;
|
|
|
|
using Yavsc.Models.IT.Fixing;
|
|
|
|
@ -10,7 +6,6 @@ using Yavsc.Server.Models.EMailing;
|
|
|
|
using Yavsc.Server.Models.IT.SourceCode;
|
|
|
|
using Yavsc.Server.Models.IT.SourceCode;
|
|
|
|
using Yavsc.Server.Models.IT;
|
|
|
|
using Yavsc.Server.Models.IT;
|
|
|
|
using Yavsc.Models.Streaming;
|
|
|
|
using Yavsc.Models.Streaming;
|
|
|
|
using Yavsc.Models.Musical;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Yavsc.Models
|
|
|
|
namespace Yavsc.Models
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -32,7 +27,6 @@ namespace Yavsc.Models
|
|
|
|
using Attributes;
|
|
|
|
using Attributes;
|
|
|
|
using Bank;
|
|
|
|
using Bank;
|
|
|
|
using Payment;
|
|
|
|
using Payment;
|
|
|
|
using Calendar;
|
|
|
|
|
|
|
|
using Blog;
|
|
|
|
using Blog;
|
|
|
|
using Yavsc.Abstract.Identity;
|
|
|
|
using Yavsc.Abstract.Identity;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
@ -41,6 +35,7 @@ namespace Yavsc.Models
|
|
|
|
|
|
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
|
|
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
|
|
|
using Yavsc.Abstract.Models.Messaging;
|
|
|
|
using Yavsc.Abstract.Models.Messaging;
|
|
|
|
|
|
|
|
using Org.BouncyCastle.Asn1.Crmf;
|
|
|
|
|
|
|
|
|
|
|
|
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
|
|
|
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -81,7 +76,7 @@ namespace Yavsc.Models
|
|
|
|
builder.Entity<Models.Cratie.Option>().HasKey(o => new { o.Code, o.CodeScrutin });
|
|
|
|
builder.Entity<Models.Cratie.Option>().HasKey(o => new { o.Code, o.CodeScrutin });
|
|
|
|
builder.Entity<Notification>().Property(n => n.icon).HasDefaultValue("exclam");
|
|
|
|
builder.Entity<Notification>().Property(n => n.icon).HasDefaultValue("exclam");
|
|
|
|
builder.Entity<ChatRoomAccess>().HasKey(p => new { room = p.ChannelName, user = p.UserId });
|
|
|
|
builder.Entity<ChatRoomAccess>().HasKey(p => new { room = p.ChannelName, user = p.UserId });
|
|
|
|
builder.Entity<InstrumentRating>().HasAlternateKey(i => new { Instrument= i.InstrumentId, owner = i.OwnerId });
|
|
|
|
builder.Entity<InstrumentRating>().HasAlternateKey(i => new { Instrument = i.InstrumentId, owner = i.OwnerId });
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var et in builder.Model.GetEntityTypes())
|
|
|
|
foreach (var et in builder.Model.GetEntityTypes())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -89,7 +84,7 @@ namespace Yavsc.Models
|
|
|
|
et.FindProperty("DateCreated").SetAfterSaveBehavior(Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Ignore);
|
|
|
|
et.FindProperty("DateCreated").SetAfterSaveBehavior(Microsoft.EntityFrameworkCore.Metadata.PropertySaveBehavior.Ignore);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
builder.Entity<Activity>().Property(a=>a.ParentCode).IsRequired(false);
|
|
|
|
builder.Entity<Activity>().Property(a => a.ParentCode).IsRequired(false);
|
|
|
|
//builder.Entity<BlogPost>().HasOne(p => p.Author).WithMany(a => a.Posts);
|
|
|
|
//builder.Entity<BlogPost>().HasOne(p => p.Author).WithMany(a => a.Posts);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -98,14 +93,14 @@ namespace Yavsc.Models
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var appSetup = (string) AppDomain.CurrentDomain.GetData(Constants.YavscConnectionStringEnvName);
|
|
|
|
var appSetup = (string)AppDomain.CurrentDomain.GetData(Constants.YavscConnectionStringEnvName);
|
|
|
|
if (!string.IsNullOrWhiteSpace(appSetup))
|
|
|
|
if (!string.IsNullOrWhiteSpace(appSetup))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
optionsBuilder.UseNpgsql(appSetup);
|
|
|
|
optionsBuilder.UseNpgsql(appSetup);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var envSetup = Environment.GetEnvironmentVariable(Constants.YavscConnectionStringEnvName);
|
|
|
|
var envSetup = Environment.GetEnvironmentVariable(Constants.YavscConnectionStringEnvName);
|
|
|
|
if (envSetup!=null)
|
|
|
|
if (envSetup != null)
|
|
|
|
optionsBuilder.UseNpgsql(envSetup);
|
|
|
|
optionsBuilder.UseNpgsql(envSetup);
|
|
|
|
else optionsBuilder.UseNpgsql();
|
|
|
|
else optionsBuilder.UseNpgsql();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -125,7 +120,7 @@ namespace Yavsc.Models
|
|
|
|
/// Users posts
|
|
|
|
/// Users posts
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public DbSet<Blog.BlogPost> BlogSpot { get; set; }
|
|
|
|
public DbSet<BlogPost> BlogSpot { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Skills powered by this site
|
|
|
|
/// Skills powered by this site
|
|
|
|
@ -305,5 +300,7 @@ namespace Yavsc.Models
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<Scope> Scopes { get; set; }
|
|
|
|
public DbSet<Scope> Scopes { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DbSet<BlogspotPublication> blogspotPublications{ get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|