Update MD2
This commit is contained in:
parent
eea11029e9
commit
ed89de631b
@ -12,8 +12,9 @@ using System.Reflection;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF
|
||||
namespace Church.Net.DAL.EFCoreDBF.Core
|
||||
{
|
||||
public class CrudDALCBase1<T> : ICrudDAL<T> where T : class, IEntity, new()
|
||||
{
|
||||
@ -21,7 +22,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
|
||||
public CrudDALCBase1(DatabaseOptions databaseOptions)
|
||||
{
|
||||
this.dbContext = databaseOptions.GetDbContext();
|
||||
dbContext = databaseOptions.GetDbContext();
|
||||
InitKeyProperty();
|
||||
}
|
||||
public IQueryable<T> GetDbSet()
|
||||
@ -39,7 +40,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
|
||||
public virtual T GetById(string Id)
|
||||
{
|
||||
return this.GetQuery(new string[] { Id }).FirstOrDefault();
|
||||
return GetQuery(new string[] { Id }).FirstOrDefault();
|
||||
}
|
||||
|
||||
//public virtual T GetByRefndx(string refndx)
|
||||
@ -58,16 +59,16 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
|
||||
public virtual int Create(T entity)
|
||||
{
|
||||
this.CheckKeyIsEmpty(entity);
|
||||
this.ConvertUTCTime(entity);
|
||||
CheckKeyIsEmpty(entity);
|
||||
ConvertUTCTime(entity);
|
||||
dbContext.Add(entity);
|
||||
|
||||
return dbContext.SaveChanges();
|
||||
}
|
||||
public virtual Task<int> CreateAsync(T entity)
|
||||
{
|
||||
this.CheckKeyIsEmpty(entity);
|
||||
this.ConvertUTCTime(entity);
|
||||
CheckKeyIsEmpty(entity);
|
||||
ConvertUTCTime(entity);
|
||||
dbContext.Add(entity);
|
||||
|
||||
//CreateDone(entity, newDbObj);
|
||||
@ -78,14 +79,14 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
public int CreateOrUpdate(T entity)
|
||||
{
|
||||
int result = 0;
|
||||
this.ConvertUTCTime(entity);
|
||||
ConvertUTCTime(entity);
|
||||
if (CheckExist(entity))
|
||||
{
|
||||
result = this.Update(entity);
|
||||
result = Update(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = this.Create(entity);
|
||||
result = Create(entity);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -97,7 +98,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
//{
|
||||
// throw new ArgumentNullException("the Id is not exist.");
|
||||
//}
|
||||
this.ConvertUTCTime(entity);
|
||||
ConvertUTCTime(entity);
|
||||
|
||||
dbContext.Update(entity);
|
||||
|
||||
@ -12,10 +12,11 @@ using System.Reflection;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Internal;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF
|
||||
namespace Church.Net.DAL.EFCoreDBF.Core
|
||||
{
|
||||
public class CombinedKeyCrudDALCBase<T> : ICombinedKeyCrudDAL<T> where T : class, Church.Net.Entity.Interface.ICombinedKeyEntity, new()
|
||||
public class CombinedKeyCrudDALCBase<T> : ICombinedKeyCrudDAL<T> where T : class, ICombinedKeyEntity, new()
|
||||
{
|
||||
private readonly DatabaseOptions databaseOptions;
|
||||
|
||||
@ -49,7 +50,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
|
||||
public virtual T GetById(IEnumerable<string> Ids)
|
||||
{
|
||||
return this.GetQuery(Ids).FirstOrDefault();
|
||||
return GetQuery(Ids).FirstOrDefault();
|
||||
}
|
||||
|
||||
//public virtual T GetByRefndx(string refndx)
|
||||
@ -71,13 +72,13 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
|
||||
//IEnumerable<T> list = GetDbSet().Where(filter ?? (s => true)).ToList();
|
||||
|
||||
return GetDbSet().AsNoTracking().Where(filter ?? (s => true)).AsQueryable<T>();
|
||||
return GetDbSet().AsNoTracking().Where(filter ?? (s => true)).AsQueryable();
|
||||
}
|
||||
|
||||
public virtual int Create(T entity)
|
||||
{
|
||||
this.CheckCombinedKeyIsEmpty(entity);
|
||||
this.ConvertUTCTime(entity);
|
||||
CheckCombinedKeyIsEmpty(entity);
|
||||
ConvertUTCTime(entity);
|
||||
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
@ -88,8 +89,8 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
}
|
||||
public virtual Task<int> CreateAsync(T entity)
|
||||
{
|
||||
this.CheckCombinedKeyIsEmpty(entity);
|
||||
this.ConvertUTCTime(entity);
|
||||
CheckCombinedKeyIsEmpty(entity);
|
||||
ConvertUTCTime(entity);
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
dbContext.Add(entity);
|
||||
@ -103,14 +104,14 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
public int CreateOrUpdate(T entity)
|
||||
{
|
||||
int result = 0;
|
||||
this.ConvertUTCTime(entity);
|
||||
ConvertUTCTime(entity);
|
||||
if (CheckExist(entity))
|
||||
{
|
||||
result = this.Update(entity);
|
||||
result = Update(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = this.Create(entity);
|
||||
result = Create(entity);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -122,7 +123,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
//{
|
||||
// throw new ArgumentNullException("the Id is not exist.");
|
||||
//}
|
||||
this.ConvertUTCTime(entity);
|
||||
ConvertUTCTime(entity);
|
||||
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
@ -163,8 +164,8 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
|
||||
public virtual int Delete(IEnumerable<string> combinedKeyIds)
|
||||
{
|
||||
var obj = this.GetById(combinedKeyIds);
|
||||
return obj == null ? this.Delete(obj) : 0;
|
||||
var obj = GetById(combinedKeyIds);
|
||||
return obj == null ? Delete(obj) : 0;
|
||||
}
|
||||
|
||||
public int Delete(Func<T, bool> filter)
|
||||
@ -7,10 +7,11 @@ using System.Linq;
|
||||
using Church.Net.Utility;
|
||||
using System.Threading.Tasks;
|
||||
using Church.Net.Entity.Interface;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF
|
||||
namespace Church.Net.DAL.EFCoreDBF.Core
|
||||
{
|
||||
public class CrudDALCBase<T> : ICrudDAL<T> where T : class, Church.Net.Entity.Interface.IEntity, new()
|
||||
public class CrudDALCBase<T> : ICrudDAL<T> where T : class, IEntity, new()
|
||||
{
|
||||
private readonly DatabaseOptions databaseOptions;
|
||||
|
||||
@ -21,6 +22,10 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
this.databaseOptions = databaseOptions;
|
||||
//this.dbContext = databaseOptions.GetDbContext();
|
||||
}
|
||||
public virtual IQueryable<T> InitQuery(ChurchNetContext dbContext)
|
||||
{
|
||||
return dbContext.Set<T>();
|
||||
}
|
||||
public ChurchNetContext GetDbContext()
|
||||
{
|
||||
//var result = (DbSet<T>)typeof(ChurchNetContext).GetMethod("Set").MakeGenericMethod(typeof(T)).Invoke(dbContext, null);
|
||||
@ -33,7 +38,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
{
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
return dbContext.Set<T>().Where(filter ?? (s => true)).FirstOrDefault();
|
||||
return InitQuery(dbContext).Where(filter ?? (s => true)).FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,7 +46,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
{
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
return dbContext.Set<T>().FirstOrDefault(e => e.Id == Id);
|
||||
return InitQuery(dbContext).FirstOrDefault(e => e.Id == Id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +59,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
{
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
return dbContext.Set<T>().Where(filter ?? (s => true)).ToList();
|
||||
return InitQuery(dbContext).Where(filter ?? (s => true)).ToList();
|
||||
}
|
||||
//var dbObjs = GetDbContext().ToArray();
|
||||
|
||||
@ -72,7 +77,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
|
||||
//var list = new List<T>();
|
||||
|
||||
return dbContext.Set<T>().Where(e => RowIds.Any(id => id == e.Id)).ToArray();
|
||||
return InitQuery(dbContext).Where(e => RowIds.Any(id => id == e.Id)).ToArray();
|
||||
}
|
||||
}
|
||||
private bool needGenId(T entity)
|
||||
@ -88,7 +93,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
entity.Id = StringHelper.Get33BaseGuid();
|
||||
}
|
||||
|
||||
this.ConvertUTCTime(entity);
|
||||
ConvertUTCTime(entity);
|
||||
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
@ -100,7 +105,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
public virtual Task<int> CreateAsync(T entity)
|
||||
{
|
||||
int result = 0;
|
||||
this.ConvertUTCTime(entity);
|
||||
ConvertUTCTime(entity);
|
||||
if (needGenId(entity))
|
||||
{
|
||||
entity.Id = StringHelper.Get33BaseGuid();
|
||||
@ -122,7 +127,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
}
|
||||
public virtual string CreateReturnId(T entity)
|
||||
{
|
||||
this.ConvertUTCTime(entity);
|
||||
ConvertUTCTime(entity);
|
||||
if (Create(entity) > 0)
|
||||
{
|
||||
return entity.Id;
|
||||
@ -135,7 +140,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
|
||||
public int CreateOrUpdate(T entity)
|
||||
{
|
||||
this.ConvertUTCTime(entity);
|
||||
ConvertUTCTime(entity);
|
||||
|
||||
|
||||
using (var dbContext = GetDbContext())
|
||||
@ -161,12 +166,12 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
{
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
//var dbObj = dbContext.Set<T>().Any(e => e.Id == entity.Id);
|
||||
if (!dbContext.Set<T>().Any(e => e.Id == entity.Id))
|
||||
//var dbObj = this.InitQuery(dbContext).Any(e => e.Id == entity.Id);
|
||||
if (!InitQuery(dbContext).Any(e => e.Id == entity.Id))
|
||||
{
|
||||
throw new ArgumentNullException("the Id is not exist.");
|
||||
}
|
||||
this.ConvertUTCTime(entity);
|
||||
ConvertUTCTime(entity);
|
||||
|
||||
dbContext.Update(entity);
|
||||
|
||||
@ -187,7 +192,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
{
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
this.ConvertUTCTime(entity);
|
||||
ConvertUTCTime(entity);
|
||||
}
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
@ -201,7 +206,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
{
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
dbContext.Remove(dbContext.Set<T>().FirstOrDefault(e => e.Id == obj.Id.ToString()));
|
||||
dbContext.Remove(InitQuery(dbContext).FirstOrDefault(e => e.Id == obj.Id.ToString()));
|
||||
return dbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
@ -211,7 +216,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
|
||||
var list = dbContext.Set<T>().Where(filter).ToList();
|
||||
var list = InitQuery(dbContext).Where(filter).ToList();
|
||||
if (list.Count > 0)
|
||||
{
|
||||
dbContext.RemoveRange(list);
|
||||
@ -225,7 +230,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
{
|
||||
using (var dbContext = GetDbContext())
|
||||
{
|
||||
return dbContext.Set<T>().Any(e => e.Id == obj.Id);
|
||||
return InitQuery(dbContext).Any(e => e.Id == obj.Id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -238,7 +243,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
if (prop.PropertyType == typeof(DateTime))
|
||||
{
|
||||
//do stuff like prop.SetValue(t, DateTime.Now, null);
|
||||
DateTime localTime = ((DateTime)prop.GetValue(entity));
|
||||
DateTime localTime = (DateTime)prop.GetValue(entity);
|
||||
if (localTime.Kind != DateTimeKind.Utc)
|
||||
{
|
||||
localTime = new DateTime(localTime.Year, localTime.Month, localTime.Day,
|
||||
@ -253,7 +258,7 @@ namespace Church.Net.DAL.EFCoreDBF
|
||||
}
|
||||
else if (prop.PropertyType == typeof(DateTime?))
|
||||
{
|
||||
DateTime? localTime = ((DateTime?)prop.GetValue(entity));
|
||||
DateTime? localTime = (DateTime?)prop.GetValue(entity);
|
||||
if (localTime.HasValue)
|
||||
{
|
||||
if (localTime.Value.Kind != DateTimeKind.Utc)
|
||||
@ -5,7 +5,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF
|
||||
namespace Church.Net.DAL.EFCoreDBF.Core
|
||||
{
|
||||
public class DatabaseOptions
|
||||
{
|
||||
@ -3,7 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Entity.Games.MD2;
|
||||
using Church.Net.Entity.Messenger;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Options;
|
||||
@ -98,13 +100,33 @@ namespace Church.Net.DAL.EF
|
||||
.HasOne(tt => tt.PastoralDomain)
|
||||
.WithMany(t => t.AutoReplyItemRelations)
|
||||
.HasForeignKey(tt => tt.PastoralDomainCommunityAppId);
|
||||
//.HasPrincipalKey(tt => tt.L);
|
||||
//.HasPrincipalKey(tt => tt.L);
|
||||
|
||||
//modelBuilder.Entity<PastoralDomainMembers>()
|
||||
// .HasOne(t => t.PastoralDomain)
|
||||
// .WithMany(tt => tt.FamilyMember)
|
||||
// .HasForeignKey(f => f.ParentId);
|
||||
modelBuilder.Entity<MD2DiceSet>().Property(x => x.Id).HasDefaultValueSql("uuid_generate_v4()");
|
||||
|
||||
modelBuilder.Entity<MobInfo>(entity =>
|
||||
{
|
||||
entity.Property(x => x.Id).HasDefaultValueSql("uuid_generate_v4()");
|
||||
entity.HasMany(e => e.MobLevelInfos).WithOne().OnDelete(DeleteBehavior.Cascade);
|
||||
entity.HasMany(e => e.Skills).WithOne(x=>x.MobInfo).OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MobLevelInfo>(entity =>
|
||||
{
|
||||
entity.Property(x => x.Id).HasDefaultValueSql("uuid_generate_v4()");
|
||||
entity.HasMany(e => e.Skills).WithOne(x => x.MobLevelInfo).OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MobSkill>(entity =>
|
||||
{
|
||||
entity.Property(x => x.Id).HasDefaultValueSql("uuid_generate_v4()");
|
||||
entity.Property(x => x.MobInfoId).IsRequired(false);
|
||||
entity.Property(x => x.MobLevelInfoId).IsRequired(false);
|
||||
});
|
||||
}
|
||||
|
||||
public string DbPath { get; }
|
||||
@ -142,6 +164,9 @@ namespace Church.Net.DAL.EF
|
||||
public DbSet<HappinessCost> HappinessCosts { get; set; }
|
||||
|
||||
|
||||
//public DbSet<GamePlayer> GamePlayers { get; set; }
|
||||
public DbSet<MobInfo> Md2MobInfos { get; set; }
|
||||
public DbSet<MobLevelInfo> Md2MobLevelInfos { get; set; }
|
||||
#endregion
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Net.NetworkInformation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF
|
||||
namespace Church.Net.DAL.EFCoreDBF.Interface
|
||||
{
|
||||
public interface ICrudDAL<T> where T : class, IEntity
|
||||
{
|
||||
984
Church.Net.DAL.EFCoreDBF/Migrations/20240502213000_AddMD2MobInfo.Designer.cs
generated
Normal file
984
Church.Net.DAL.EFCoreDBF/Migrations/20240502213000_AddMD2MobInfo.Designer.cs
generated
Normal file
@ -0,0 +1,984 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Church.Net.DAL.EF;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
{
|
||||
[DbContext(typeof(ChurchNetContext))]
|
||||
[Migration("20240502213000_AddMD2MobInfo")]
|
||||
partial class AddMD2MobInfo
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.AddressInfo", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("City")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Zip")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AddressInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.AutoReplyItem", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Command")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AutoReplyItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Career", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Careers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PastoralDomainId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PastoralDomainId");
|
||||
|
||||
b.ToTable("CellGroupRoutineEvents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventAttendee", b =>
|
||||
{
|
||||
b.Property<string>("EventId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("JoinPotluck")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PotluckItem")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("EventId", "Id");
|
||||
|
||||
b.ToTable("CellGroupRoutineEventAttendees");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventPrayer", b =>
|
||||
{
|
||||
b.Property<string>("EventId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("MemberId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Prayer")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("EventId", "MemberId");
|
||||
|
||||
b.ToTable("CellGroupRoutineEventPrayers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Contribution", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Contributor")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("GroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("Contributions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.FamilyMember", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<string>("AvatarImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Baptized")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime?>("Birthday")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("CareerId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ComunityAppId")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<DateTime?>("DateOfBaptized")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DateOfWalkIn")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<int>("Gender")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<bool>("Married")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CareerId");
|
||||
|
||||
b.ToTable("FamilyMembers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.FamilyMemberOAuth", b =>
|
||||
{
|
||||
b.Property<string>("FamilyMemberId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("OAuthType")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("OAuthAccessToken")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("FamilyMemberId", "OAuthType");
|
||||
|
||||
b.ToTable("FamilyMemberOAuths");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobInfo", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasDefaultValueSql("uuid_generate_v4()");
|
||||
|
||||
b.Property<int>("From")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Md2MobInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobLevelInfo", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid")
|
||||
.HasDefaultValueSql("uuid_generate_v4()");
|
||||
|
||||
b.Property<Guid>("MobInfoId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("MobInfoId1")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("MobInfoId2")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MobInfoId");
|
||||
|
||||
b.HasIndex("MobInfoId1");
|
||||
|
||||
b.ToTable("Md2MobLevelInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("GroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("HappinessBESTs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessCost", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Tasker")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WeekId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WeekId");
|
||||
|
||||
b.ToTable("HappinessCosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessTask", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Tasker")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WeekId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WeekId");
|
||||
|
||||
b.ToTable("HappinessTask");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("CityAndZipCode")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("GroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("InvitationText")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SEQ")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("HappinessWeeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.LineMessagingAccount", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ChatToken")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Seq")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TotalUsage")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LineMessagingAccounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.LogInfo", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DetailMessage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Source")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("StackTrace")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("TrackNo")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("TrackNo"));
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LogInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Messenger.LineMessageClient", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClientId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsGroup")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsManager")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LineMessageClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.NewVisitor", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<DateTime?>("BirthDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ComunityAppId")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("character varying(150)");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<int>("Gender")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("character varying(150)");
|
||||
|
||||
b.Property<int?>("ReligionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("VisitingDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ReligionId");
|
||||
|
||||
b.ToTable("NewVisitors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Image1")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Image2")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Image3")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Image4")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Image5")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LeaderMemberId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LineAccountId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LineGroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LogoImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ServiceAddressId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime?>("ServiceTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("TimeZone")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LeaderMemberId");
|
||||
|
||||
b.HasIndex("LineAccountId");
|
||||
|
||||
b.HasIndex("ServiceAddressId");
|
||||
|
||||
b.ToTable("PastoralDomains");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomainAutoReplys", b =>
|
||||
{
|
||||
b.Property<string>("PastoralDomainCommunityAppId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("AutoReplyItemId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.HasKey("PastoralDomainCommunityAppId", "AutoReplyItemId");
|
||||
|
||||
b.HasIndex("AutoReplyItemId");
|
||||
|
||||
b.ToTable("PastoralDomainAutoReplys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomainMembers", b =>
|
||||
{
|
||||
b.Property<string>("PastoralDomainId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("FamilyMemberId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.HasKey("PastoralDomainId", "FamilyMemberId");
|
||||
|
||||
b.HasIndex("FamilyMemberId");
|
||||
|
||||
b.ToTable("PastoralDomainMembers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Religion", b =>
|
||||
{
|
||||
b.Property<int>("ReligionId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ReligionId"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ReligionId");
|
||||
|
||||
b.ToTable("Religions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Vocabulary", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("DefinitionCh")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DefinitionEn")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("FlashCardTimes")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ImagesUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("InsertDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("NounPlural")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("PartOfSpeech")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("PracticeApply")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("PracticeDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("PracticeMemorized")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PracticeReview")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PracticeSelect")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("PracticeSentence")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("PracticeStage")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("PracticeVisualize")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("VerbParticiple")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("VerbPast")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Word")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Vocabulary");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.WhoIsSpy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Answer1Chs")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Answer1Cht")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Answer1En")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Answer2Chs")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Answer2Cht")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Answer2En")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WhoIsSpy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "CellGroupInfo")
|
||||
.WithMany()
|
||||
.HasForeignKey("PastoralDomainId");
|
||||
|
||||
b.Navigation("CellGroupInfo");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventAttendee", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.CellGroupRoutineEvent", "CellGroupRoutineEvent")
|
||||
.WithMany("Attendees")
|
||||
.HasForeignKey("EventId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CellGroupRoutineEvent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventPrayer", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.CellGroupRoutineEvent", "CellGroupRoutineEvent")
|
||||
.WithMany("Prayers")
|
||||
.HasForeignKey("EventId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CellGroupRoutineEvent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Contribution", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup")
|
||||
.WithMany("Contributions")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.FamilyMember", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.Career", "Career")
|
||||
.WithMany()
|
||||
.HasForeignKey("CareerId");
|
||||
|
||||
b.Navigation("Career");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.FamilyMemberOAuth", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.FamilyMember", null)
|
||||
.WithMany("OAuthInfos")
|
||||
.HasForeignKey("FamilyMemberId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobLevelInfo", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.Games.MD2.MobInfo", "MobInfo")
|
||||
.WithMany()
|
||||
.HasForeignKey("MobInfoId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Church.Net.Entity.Games.MD2.MobInfo", null)
|
||||
.WithMany("MobLevelInfos")
|
||||
.HasForeignKey("MobInfoId1")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("MobInfo");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup")
|
||||
.WithMany("Bests")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessCost", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek")
|
||||
.WithMany("Costs")
|
||||
.HasForeignKey("WeekId");
|
||||
|
||||
b.Navigation("HappinessWeek");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessTask", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek")
|
||||
.WithMany("Tasks")
|
||||
.HasForeignKey("WeekId");
|
||||
|
||||
b.Navigation("HappinessWeek");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup")
|
||||
.WithMany("HappinessWeeks")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.NewVisitor", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.Religion", "Religion")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReligionId");
|
||||
|
||||
b.Navigation("Religion");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.FamilyMember", "Leader")
|
||||
.WithMany()
|
||||
.HasForeignKey("LeaderMemberId");
|
||||
|
||||
b.HasOne("Church.Net.Entity.LineMessagingAccount", "LineMessagingAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("LineAccountId");
|
||||
|
||||
b.HasOne("Church.Net.Entity.AddressInfo", "ServiceAddress")
|
||||
.WithMany()
|
||||
.HasForeignKey("ServiceAddressId");
|
||||
|
||||
b.Navigation("Leader");
|
||||
|
||||
b.Navigation("LineMessagingAccount");
|
||||
|
||||
b.Navigation("ServiceAddress");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomainAutoReplys", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.AutoReplyItem", "FamilyMember")
|
||||
.WithMany("AutoReplyItemRelations")
|
||||
.HasForeignKey("AutoReplyItemId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "PastoralDomain")
|
||||
.WithMany("AutoReplyItemRelations")
|
||||
.HasForeignKey("PastoralDomainCommunityAppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("FamilyMember");
|
||||
|
||||
b.Navigation("PastoralDomain");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomainMembers", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.FamilyMember", "FamilyMember")
|
||||
.WithMany("PastoralDomains")
|
||||
.HasForeignKey("FamilyMemberId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "PastoralDomain")
|
||||
.WithMany("Members")
|
||||
.HasForeignKey("PastoralDomainId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("FamilyMember");
|
||||
|
||||
b.Navigation("PastoralDomain");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.AutoReplyItem", b =>
|
||||
{
|
||||
b.Navigation("AutoReplyItemRelations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b =>
|
||||
{
|
||||
b.Navigation("Attendees");
|
||||
|
||||
b.Navigation("Prayers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.FamilyMember", b =>
|
||||
{
|
||||
b.Navigation("OAuthInfos");
|
||||
|
||||
b.Navigation("PastoralDomains");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobInfo", b =>
|
||||
{
|
||||
b.Navigation("MobLevelInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.Navigation("Costs");
|
||||
|
||||
b.Navigation("Tasks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b =>
|
||||
{
|
||||
b.Navigation("AutoReplyItemRelations");
|
||||
|
||||
b.Navigation("Bests");
|
||||
|
||||
b.Navigation("Contributions");
|
||||
|
||||
b.Navigation("HappinessWeeks");
|
||||
|
||||
b.Navigation("Members");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
{
|
||||
public partial class AddMD2MobInfo : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Md2MobInfos",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "uuid_generate_v4()"),
|
||||
Type = table.Column<int>(type: "integer", nullable: false),
|
||||
From = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Md2MobInfos", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Md2MobLevelInfos",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false, defaultValueSql: "uuid_generate_v4()"),
|
||||
MobInfoId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MobInfoId1 = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
MobInfoId2 = table.Column<Guid>(type: "uuid", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Md2MobLevelInfos", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Md2MobLevelInfos_Md2MobInfos_MobInfoId",
|
||||
column: x => x.MobInfoId,
|
||||
principalTable: "Md2MobInfos",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_Md2MobLevelInfos_Md2MobInfos_MobInfoId1",
|
||||
column: x => x.MobInfoId1,
|
||||
principalTable: "Md2MobInfos",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Md2MobLevelInfos_MobInfoId",
|
||||
table: "Md2MobLevelInfos",
|
||||
column: "MobInfoId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Md2MobLevelInfos_MobInfoId1",
|
||||
table: "Md2MobLevelInfos",
|
||||
column: "MobInfoId1");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Md2MobLevelInfos");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Md2MobInfos");
|
||||
}
|
||||
}
|
||||
}
|
||||
978
Church.Net.DAL.EFCoreDBF/Migrations/20240502213603_AddMD2MobInfoUpdateId.Designer.cs
generated
Normal file
978
Church.Net.DAL.EFCoreDBF/Migrations/20240502213603_AddMD2MobInfoUpdateId.Designer.cs
generated
Normal file
@ -0,0 +1,978 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Church.Net.DAL.EF;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
{
|
||||
[DbContext(typeof(ChurchNetContext))]
|
||||
[Migration("20240502213603_AddMD2MobInfoUpdateId")]
|
||||
partial class AddMD2MobInfoUpdateId
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "6.0.8")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.AddressInfo", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("City")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("State")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Zip")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AddressInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.AutoReplyItem", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Command")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AutoReplyItems");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Career", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Careers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PastoralDomainId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PastoralDomainId");
|
||||
|
||||
b.ToTable("CellGroupRoutineEvents");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventAttendee", b =>
|
||||
{
|
||||
b.Property<string>("EventId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("JoinPotluck")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PotluckItem")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("EventId", "Id");
|
||||
|
||||
b.ToTable("CellGroupRoutineEventAttendees");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventPrayer", b =>
|
||||
{
|
||||
b.Property<string>("EventId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("MemberId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Prayer")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("EventId", "MemberId");
|
||||
|
||||
b.ToTable("CellGroupRoutineEventPrayers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Contribution", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Contributor")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("GroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("Contributions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.FamilyMember", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<string>("AvatarImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("Baptized")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime?>("Birthday")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("CareerId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ComunityAppId")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<DateTime?>("DateOfBaptized")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTime?>("DateOfWalkIn")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<int>("Gender")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<bool>("Married")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Role")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CareerId");
|
||||
|
||||
b.ToTable("FamilyMembers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.FamilyMemberOAuth", b =>
|
||||
{
|
||||
b.Property<string>("FamilyMemberId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("OAuthType")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.Property<string>("OAuthAccessToken")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("FamilyMemberId", "OAuthType");
|
||||
|
||||
b.ToTable("FamilyMemberOAuths");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobInfo", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValueSql("uuid_generate_v4()");
|
||||
|
||||
b.Property<int>("From")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Md2MobInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobLevelInfo", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValueSql("uuid_generate_v4()");
|
||||
|
||||
b.Property<string>("MobInfoId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MobInfoId2")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MobInfoId");
|
||||
|
||||
b.HasIndex("MobInfoId2");
|
||||
|
||||
b.ToTable("Md2MobLevelInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("GroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("HappinessBESTs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessCost", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<decimal>("Amount")
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Tasker")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WeekId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WeekId");
|
||||
|
||||
b.ToTable("HappinessCosts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessTask", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Tasker")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("WeekId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("WeekId");
|
||||
|
||||
b.ToTable("HappinessTask");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("CityAndZipCode")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Date")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("GroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("InvitationText")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SEQ")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.ToTable("HappinessWeeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.LineMessagingAccount", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ChatToken")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Seq")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TotalUsage")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LineMessagingAccounts");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.LogInfo", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DetailMessage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Level")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Message")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Source")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("StackTrace")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("Time")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("TrackNo")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("TrackNo"));
|
||||
|
||||
b.Property<string>("Url")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("UserId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LogInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Messenger.LineMessageClient", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ClientId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsGroup")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsManager")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LineMessageClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.NewVisitor", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("character varying(500)");
|
||||
|
||||
b.Property<DateTime?>("BirthDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("ComunityAppId")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("character varying(150)");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<int>("Gender")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("character varying(50)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.IsRequired()
|
||||
.HasMaxLength(150)
|
||||
.HasColumnType("character varying(150)");
|
||||
|
||||
b.Property<int?>("ReligionId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTime>("VisitingDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ReligionId");
|
||||
|
||||
b.ToTable("NewVisitors");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Image1")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Image2")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Image3")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Image4")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Image5")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LeaderMemberId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LineAccountId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LineGroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LogoImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ServiceAddressId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime?>("ServiceTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("TimeZone")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LeaderMemberId");
|
||||
|
||||
b.HasIndex("LineAccountId");
|
||||
|
||||
b.HasIndex("ServiceAddressId");
|
||||
|
||||
b.ToTable("PastoralDomains");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomainAutoReplys", b =>
|
||||
{
|
||||
b.Property<string>("PastoralDomainCommunityAppId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("AutoReplyItemId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.HasKey("PastoralDomainCommunityAppId", "AutoReplyItemId");
|
||||
|
||||
b.HasIndex("AutoReplyItemId");
|
||||
|
||||
b.ToTable("PastoralDomainAutoReplys");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomainMembers", b =>
|
||||
{
|
||||
b.Property<string>("PastoralDomainId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(0);
|
||||
|
||||
b.Property<string>("FamilyMemberId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnOrder(1);
|
||||
|
||||
b.HasKey("PastoralDomainId", "FamilyMemberId");
|
||||
|
||||
b.HasIndex("FamilyMemberId");
|
||||
|
||||
b.ToTable("PastoralDomainMembers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Religion", b =>
|
||||
{
|
||||
b.Property<int>("ReligionId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("ReligionId"));
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("ReligionId");
|
||||
|
||||
b.ToTable("Religions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Vocabulary", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("DefinitionCh")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("DefinitionEn")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("FlashCardTimes")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("ImagesUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("InsertDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("NounPlural")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("PartOfSpeech")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("PracticeApply")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTime>("PracticeDate")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("PracticeMemorized")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PracticeReview")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("PracticeSelect")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("PracticeSentence")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("PracticeStage")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("PracticeVisualize")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("VerbParticiple")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("VerbPast")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Word")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Vocabulary");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.WhoIsSpy", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Answer1Chs")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Answer1Cht")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Answer1En")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Answer2Chs")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Answer2Cht")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Answer2En")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("WhoIsSpy");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "CellGroupInfo")
|
||||
.WithMany()
|
||||
.HasForeignKey("PastoralDomainId");
|
||||
|
||||
b.Navigation("CellGroupInfo");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventAttendee", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.CellGroupRoutineEvent", "CellGroupRoutineEvent")
|
||||
.WithMany("Attendees")
|
||||
.HasForeignKey("EventId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CellGroupRoutineEvent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEventPrayer", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.CellGroupRoutineEvent", "CellGroupRoutineEvent")
|
||||
.WithMany("Prayers")
|
||||
.HasForeignKey("EventId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CellGroupRoutineEvent");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Contribution", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup")
|
||||
.WithMany("Contributions")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.FamilyMember", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.Career", "Career")
|
||||
.WithMany()
|
||||
.HasForeignKey("CareerId");
|
||||
|
||||
b.Navigation("Career");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.FamilyMemberOAuth", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.FamilyMember", null)
|
||||
.WithMany("OAuthInfos")
|
||||
.HasForeignKey("FamilyMemberId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobLevelInfo", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.Games.MD2.MobInfo", "MobInfo")
|
||||
.WithMany()
|
||||
.HasForeignKey("MobInfoId");
|
||||
|
||||
b.HasOne("Church.Net.Entity.Games.MD2.MobInfo", null)
|
||||
.WithMany("MobLevelInfos")
|
||||
.HasForeignKey("MobInfoId2")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("MobInfo");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup")
|
||||
.WithMany("Bests")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessCost", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek")
|
||||
.WithMany("Costs")
|
||||
.HasForeignKey("WeekId");
|
||||
|
||||
b.Navigation("HappinessWeek");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessTask", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.HappinessWeek", "HappinessWeek")
|
||||
.WithMany("Tasks")
|
||||
.HasForeignKey("WeekId");
|
||||
|
||||
b.Navigation("HappinessWeek");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup")
|
||||
.WithMany("HappinessWeeks")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.NewVisitor", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.Religion", "Religion")
|
||||
.WithMany()
|
||||
.HasForeignKey("ReligionId");
|
||||
|
||||
b.Navigation("Religion");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.FamilyMember", "Leader")
|
||||
.WithMany()
|
||||
.HasForeignKey("LeaderMemberId");
|
||||
|
||||
b.HasOne("Church.Net.Entity.LineMessagingAccount", "LineMessagingAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("LineAccountId");
|
||||
|
||||
b.HasOne("Church.Net.Entity.AddressInfo", "ServiceAddress")
|
||||
.WithMany()
|
||||
.HasForeignKey("ServiceAddressId");
|
||||
|
||||
b.Navigation("Leader");
|
||||
|
||||
b.Navigation("LineMessagingAccount");
|
||||
|
||||
b.Navigation("ServiceAddress");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomainAutoReplys", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.AutoReplyItem", "FamilyMember")
|
||||
.WithMany("AutoReplyItemRelations")
|
||||
.HasForeignKey("AutoReplyItemId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "PastoralDomain")
|
||||
.WithMany("AutoReplyItemRelations")
|
||||
.HasForeignKey("PastoralDomainCommunityAppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("FamilyMember");
|
||||
|
||||
b.Navigation("PastoralDomain");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomainMembers", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.FamilyMember", "FamilyMember")
|
||||
.WithMany("PastoralDomains")
|
||||
.HasForeignKey("FamilyMemberId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "PastoralDomain")
|
||||
.WithMany("Members")
|
||||
.HasForeignKey("PastoralDomainId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("FamilyMember");
|
||||
|
||||
b.Navigation("PastoralDomain");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.AutoReplyItem", b =>
|
||||
{
|
||||
b.Navigation("AutoReplyItemRelations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.CellGroupRoutineEvent", b =>
|
||||
{
|
||||
b.Navigation("Attendees");
|
||||
|
||||
b.Navigation("Prayers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.FamilyMember", b =>
|
||||
{
|
||||
b.Navigation("OAuthInfos");
|
||||
|
||||
b.Navigation("PastoralDomains");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobInfo", b =>
|
||||
{
|
||||
b.Navigation("MobLevelInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.Navigation("Costs");
|
||||
|
||||
b.Navigation("Tasks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b =>
|
||||
{
|
||||
b.Navigation("AutoReplyItemRelations");
|
||||
|
||||
b.Navigation("Bests");
|
||||
|
||||
b.Navigation("Contributions");
|
||||
|
||||
b.Navigation("HappinessWeeks");
|
||||
|
||||
b.Navigation("Members");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,168 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
{
|
||||
public partial class AddMD2MobInfoUpdateId : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Md2MobLevelInfos_Md2MobInfos_MobInfoId",
|
||||
table: "Md2MobLevelInfos");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Md2MobLevelInfos_Md2MobInfos_MobInfoId1",
|
||||
table: "Md2MobLevelInfos");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Md2MobLevelInfos_MobInfoId1",
|
||||
table: "Md2MobLevelInfos");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "MobInfoId1",
|
||||
table: "Md2MobLevelInfos");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MobInfoId2",
|
||||
table: "Md2MobLevelInfos",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "MobInfoId",
|
||||
table: "Md2MobLevelInfos",
|
||||
type: "text",
|
||||
nullable: true,
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Id",
|
||||
table: "Md2MobLevelInfos",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValueSql: "uuid_generate_v4()",
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldDefaultValueSql: "uuid_generate_v4()");
|
||||
|
||||
migrationBuilder.AlterColumn<string>(
|
||||
name: "Id",
|
||||
table: "Md2MobInfos",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValueSql: "uuid_generate_v4()",
|
||||
oldClrType: typeof(Guid),
|
||||
oldType: "uuid",
|
||||
oldDefaultValueSql: "uuid_generate_v4()");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Md2MobLevelInfos_MobInfoId2",
|
||||
table: "Md2MobLevelInfos",
|
||||
column: "MobInfoId2");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Md2MobLevelInfos_Md2MobInfos_MobInfoId",
|
||||
table: "Md2MobLevelInfos",
|
||||
column: "MobInfoId",
|
||||
principalTable: "Md2MobInfos",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Md2MobLevelInfos_Md2MobInfos_MobInfoId2",
|
||||
table: "Md2MobLevelInfos",
|
||||
column: "MobInfoId2",
|
||||
principalTable: "Md2MobInfos",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Md2MobLevelInfos_Md2MobInfos_MobInfoId",
|
||||
table: "Md2MobLevelInfos");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Md2MobLevelInfos_Md2MobInfos_MobInfoId2",
|
||||
table: "Md2MobLevelInfos");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Md2MobLevelInfos_MobInfoId2",
|
||||
table: "Md2MobLevelInfos");
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "MobInfoId2",
|
||||
table: "Md2MobLevelInfos",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "MobInfoId",
|
||||
table: "Md2MobLevelInfos",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "Id",
|
||||
table: "Md2MobLevelInfos",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValueSql: "uuid_generate_v4()",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldDefaultValueSql: "uuid_generate_v4()");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "MobInfoId1",
|
||||
table: "Md2MobLevelInfos",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
|
||||
|
||||
migrationBuilder.AlterColumn<Guid>(
|
||||
name: "Id",
|
||||
table: "Md2MobInfos",
|
||||
type: "uuid",
|
||||
nullable: false,
|
||||
defaultValueSql: "uuid_generate_v4()",
|
||||
oldClrType: typeof(string),
|
||||
oldType: "text",
|
||||
oldDefaultValueSql: "uuid_generate_v4()");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Md2MobLevelInfos_MobInfoId1",
|
||||
table: "Md2MobLevelInfos",
|
||||
column: "MobInfoId1");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Md2MobLevelInfos_Md2MobInfos_MobInfoId",
|
||||
table: "Md2MobLevelInfos",
|
||||
column: "MobInfoId",
|
||||
principalTable: "Md2MobInfos",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Md2MobLevelInfos_Md2MobInfos_MobInfoId1",
|
||||
table: "Md2MobLevelInfos",
|
||||
column: "MobInfoId1",
|
||||
principalTable: "Md2MobInfos",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -255,6 +255,46 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
b.ToTable("FamilyMemberOAuths");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobInfo", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValueSql("uuid_generate_v4()");
|
||||
|
||||
b.Property<int>("From")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Md2MobInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobLevelInfo", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValueSql("uuid_generate_v4()");
|
||||
|
||||
b.Property<string>("MobInfoId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("MobInfoId2")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MobInfoId");
|
||||
|
||||
b.HasIndex("MobInfoId2");
|
||||
|
||||
b.ToTable("Md2MobLevelInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
@ -769,6 +809,20 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobLevelInfo", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.Games.MD2.MobInfo", "MobInfo")
|
||||
.WithMany()
|
||||
.HasForeignKey("MobInfoId");
|
||||
|
||||
b.HasOne("Church.Net.Entity.Games.MD2.MobInfo", null)
|
||||
.WithMany("MobLevelInfos")
|
||||
.HasForeignKey("MobInfoId2")
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
b.Navigation("MobInfo");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup")
|
||||
@ -892,6 +946,11 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
b.Navigation("PastoralDomains");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.Games.MD2.MobInfo", b =>
|
||||
{
|
||||
b.Navigation("MobLevelInfos");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.Navigation("Costs");
|
||||
|
||||
149
Church.Net.Entity2/Games/MD2/MobInfo.cs
Normal file
149
Church.Net.Entity2/Games/MD2/MobInfo.cs
Normal file
@ -0,0 +1,149 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using Church.Net.Entity.Interface;
|
||||
|
||||
namespace Church.Net.Entity.Games.MD2
|
||||
{
|
||||
public enum MobType
|
||||
{
|
||||
Mob,
|
||||
RoamingMonster,
|
||||
Boss
|
||||
}
|
||||
|
||||
public enum GameBundle
|
||||
{
|
||||
CoreGame,
|
||||
HeavenFallen,
|
||||
Zombiecide,
|
||||
|
||||
}
|
||||
public enum MobSkillType
|
||||
{
|
||||
Attack,
|
||||
Defense,
|
||||
Combat,
|
||||
Passive
|
||||
}
|
||||
|
||||
public enum MobSkillTarget
|
||||
{
|
||||
LeastHp,
|
||||
LeastMaxHp,
|
||||
LeastMana,
|
||||
LeastMaxMana,
|
||||
}
|
||||
public enum MD2Icon
|
||||
{
|
||||
Attack,
|
||||
Defense,
|
||||
Mana,
|
||||
Shadow,
|
||||
EnemySkill,
|
||||
EnemyClaw,
|
||||
Reroll,
|
||||
Fire,
|
||||
Frost,
|
||||
OneHand,
|
||||
TwoHand,
|
||||
Helmet,
|
||||
Armor,
|
||||
Ring,
|
||||
Foot,
|
||||
Melee,
|
||||
Range,
|
||||
Magic,
|
||||
HP,
|
||||
MP,
|
||||
Dice,
|
||||
Arrow,
|
||||
ArrowBullseye,
|
||||
ArrowOverload,
|
||||
SoulToken,
|
||||
Rage,
|
||||
RedDice,
|
||||
BlueDice,
|
||||
YellowDice,
|
||||
OrangeDice,
|
||||
BlackDice
|
||||
}
|
||||
public class MobInfo : IEntity
|
||||
{
|
||||
[Key]
|
||||
public string Id { get; set; }
|
||||
public MobType Type { get; set; }
|
||||
public GameBundle From { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string LeaderImgUrl { get; set; }
|
||||
public string MinionImgUrl { get; set; }
|
||||
public virtual ICollection<MobLevelInfo> MobLevelInfos { get; set; }
|
||||
public virtual ICollection<MobSkill> Skills { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class MobLevelInfo : IEntity
|
||||
{
|
||||
|
||||
[Key]
|
||||
public string Id { get; set; }
|
||||
[ForeignKey("MobInfo")]
|
||||
public string MobInfoId { get; set; }
|
||||
[JsonIgnore]
|
||||
public virtual MobInfo MobInfo { get; set; }
|
||||
public int RewardTokens { get; set; }
|
||||
public int FixedRareTreasure { get; set; }
|
||||
public int FixedEpicTreasure { get; set; }
|
||||
public int FixedLegendTreasure { get; set; }
|
||||
public int FixedHp { get; set; }
|
||||
public int HpPerHero { get; set; }
|
||||
public int Actions { get; set; }
|
||||
|
||||
[ForeignKey("AttackInfo")]
|
||||
public string AttackInfoId { get; set; }
|
||||
public MD2DiceSet AttackInfo { get; set; }
|
||||
[ForeignKey("DefenceInfo")]
|
||||
public string DefenceInfoId { get; set; }
|
||||
public MD2DiceSet DefenceInfo { get; set; }
|
||||
public virtual ICollection<MobSkill> Skills { get; set; }
|
||||
|
||||
|
||||
}
|
||||
public class MobSkill : IEntity
|
||||
{
|
||||
|
||||
[Key]
|
||||
public string Id { get; set; }
|
||||
[ForeignKey("MobLevelInfo")]
|
||||
public string MobLevelInfoId { get; set; }
|
||||
|
||||
[ForeignKey("MobInfo")]
|
||||
public string MobInfoId { get; set; }
|
||||
[JsonIgnore]
|
||||
public virtual MobInfo MobInfo { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual MobLevelInfo MobLevelInfo { get; set; }
|
||||
|
||||
public MobSkillType Type { get; set; }
|
||||
public int ClawRoll { get; set; }
|
||||
public int SkillRoll { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
}
|
||||
|
||||
public class MD2DiceSet : IEntity
|
||||
{
|
||||
[Key]
|
||||
public string Id { get; set; }
|
||||
public int? Yellow { get; set; }
|
||||
public int? Orange { get; set; }
|
||||
public int? Red { get; set; }
|
||||
public int? Blue { get; set; }
|
||||
public int? Green { get; set; }
|
||||
public int? Black { get; set; }
|
||||
}
|
||||
}
|
||||
@ -11,4 +11,8 @@ namespace Church.Net.Entity.Interface
|
||||
public interface ICombinedKeyEntity
|
||||
{
|
||||
}
|
||||
public interface IBussinessEntity
|
||||
{
|
||||
Guid Id { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Church.Net.WebAPI/App_Data/Files/BigTresureChest-Epic.jpg
Normal file
BIN
Church.Net.WebAPI/App_Data/Files/BigTresureChest-Epic.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 4.4 KiB |
@ -4,6 +4,7 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<UserSecretsId>983731f5-925d-44ec-b4c8-a7c4ad857569</UserSecretsId>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<FileVersion>1.0.0.2</FileVersion>
|
||||
<StartupObject></StartupObject>
|
||||
</PropertyGroup>
|
||||
|
||||
@ -38,9 +39,10 @@
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.8" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="QRCoder-ImageSharp" Version="0.9.0" />
|
||||
<PackageReference Include="SharpGrabber.YouTube" Version="1.4.0" />
|
||||
<PackageReference Include="SharpGrabber.Converter" Version="1.1.0" />
|
||||
<PackageReference Include="SharpGrabber.YouTube" Version="1.5.0" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.3" />
|
||||
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta15" />
|
||||
</ItemGroup>
|
||||
@ -143,4 +143,6 @@ namespace WebAPI.Controllers
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
42
Church.Net.WebAPI/Controllers/FileListController.cs
Normal file
42
Church.Net.WebAPI/Controllers/FileListController.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using WebAPI;
|
||||
using WebAPI.Services.Interfaces;
|
||||
|
||||
namespace Church.Net.WebAPI.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class FileListController : ControllerBase
|
||||
{
|
||||
private readonly ILoggingService loggingService;
|
||||
|
||||
public FileListController(ILoggingService loggingService)
|
||||
{
|
||||
this.loggingService = loggingService;
|
||||
}
|
||||
[HttpGet("{*filePath}")]
|
||||
public ActionResult<string[]> Get(string filePath)
|
||||
{
|
||||
string folderRootPath = "";
|
||||
string folderPath = "";
|
||||
try
|
||||
{
|
||||
#if DEBUG
|
||||
folderRootPath = "//ArkNAS/docker/ChurchAPI/App_Data/Files";
|
||||
#else
|
||||
folderRootPath = "/App_Data/Files";
|
||||
#endif
|
||||
folderPath = System.IO.Path.Combine(folderRootPath, filePath);
|
||||
return Directory.GetFiles(folderPath).Select(s=>s.Replace(folderRootPath,"").Replace(filePath, "").Replace("\\","/")).ToArray();
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
loggingService.Error(ex);
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
40
Church.Net.WebAPI/Controllers/FilesController.cs
Normal file
40
Church.Net.WebAPI/Controllers/FilesController.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.IO;
|
||||
using WebAPI;
|
||||
using WebAPI.Services.Interfaces;
|
||||
|
||||
namespace Church.Net.WebAPI.Controllers
|
||||
{
|
||||
[Route("[controller]")]
|
||||
[ApiController]
|
||||
public class FilesController : ControllerBase
|
||||
{
|
||||
private readonly ILoggingService loggingService;
|
||||
|
||||
public FilesController(ILoggingService loggingService)
|
||||
{
|
||||
this.loggingService = loggingService;
|
||||
}
|
||||
[HttpGet("{*filePath}")]
|
||||
public IActionResult Get(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
string folderRootPath = "";
|
||||
#if DEBUG
|
||||
folderRootPath = "//ArkNAS/docker/ChurchAPI/App_Data/Files";
|
||||
#else
|
||||
folderRootPath = "/App_Data/Files";
|
||||
#endif
|
||||
|
||||
return PhysicalFile(System.IO.Path.Combine(folderRootPath, filePath), "image/jpeg");
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
loggingService.Error(ex);
|
||||
return NotFound();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
57
Church.Net.WebAPI/Controllers/GameRoomController.cs
Normal file
57
Church.Net.WebAPI/Controllers/GameRoomController.cs
Normal file
@ -0,0 +1,57 @@
|
||||
using Church.Net.WebAPI.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using WebAPI.Models.IceBreak;
|
||||
using WebAPI;
|
||||
using System.Linq;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace Church.Net.WebAPI.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class GameRoomController : ControllerBase
|
||||
{
|
||||
private readonly GameRoomLogic gameRoomLogic;
|
||||
|
||||
public GameRoomController(GameRoomLogic gameRoomLogic)
|
||||
{
|
||||
this.gameRoomLogic = gameRoomLogic;
|
||||
}
|
||||
// GET: api/<GameRoomMessageController>
|
||||
[HttpGet]
|
||||
public IEnumerable<GameRoom> Get()
|
||||
{
|
||||
return gameRoomLogic.GameRooms;
|
||||
}
|
||||
|
||||
// GET api/<GameRoomMessageController>/5
|
||||
[HttpGet("{id}")]
|
||||
public IEnumerable<IGamePlayer> Get(string roomId)
|
||||
{
|
||||
return gameRoomLogic.GameRooms.Where(r => r.Id == roomId).FirstOrDefault()?.Players;
|
||||
}
|
||||
|
||||
// POST api/<GameRoomMessageController>
|
||||
[HttpPost]
|
||||
public void Post([FromBody] GamePlayer gamePlayer)
|
||||
{
|
||||
gameRoomLogic.CreateGameRoom(gamePlayer);
|
||||
}
|
||||
|
||||
// PUT api/<GameRoomMessageController>/5
|
||||
[HttpPut("{roomId}")]
|
||||
public bool Put(string roomId, [FromBody] GamePlayer value)
|
||||
{
|
||||
return gameRoomLogic.UserJoinGameRoom(roomId, value);
|
||||
}
|
||||
|
||||
// DELETE api/<GameRoomMessageController>/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(string id)
|
||||
{
|
||||
gameRoomLogic.UserLeave(new GamePlayer() { Id = id });
|
||||
}
|
||||
}
|
||||
}
|
||||
55
Church.Net.WebAPI/Controllers/GameRoomMessageController.cs
Normal file
55
Church.Net.WebAPI/Controllers/GameRoomMessageController.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using Church.Net.WebAPI.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using WebAPI;
|
||||
using WebAPI.Models.IceBreak;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace Church.Net.WebAPI.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class GameRoomMessageController : ControllerBase
|
||||
{
|
||||
private readonly GameRoomLogic gameRoomLogic;
|
||||
|
||||
public GameRoomMessageController(GameRoomLogic gameRoomLogic)
|
||||
{
|
||||
this.gameRoomLogic = gameRoomLogic;
|
||||
}
|
||||
// GET: api/<GameRoomMessageController>
|
||||
[HttpGet]
|
||||
public IEnumerable<GameRoom> Get()
|
||||
{
|
||||
return gameRoomLogic.GameRooms;
|
||||
}
|
||||
|
||||
// GET api/<GameRoomMessageController>/5
|
||||
[HttpGet("{id}")]
|
||||
public IEnumerable<IGamePlayer> Get(string roomId)
|
||||
{
|
||||
return gameRoomLogic.GameRooms.Where(r => r.Id == roomId).FirstOrDefault()?.Players;
|
||||
}
|
||||
|
||||
// POST api/<GameRoomMessageController>
|
||||
[HttpPost]
|
||||
public void Post([FromBody] SignalRMessage message)
|
||||
{
|
||||
gameRoomLogic.SendMessage(message);
|
||||
}
|
||||
|
||||
// PUT api/<GameRoomMessageController>/5
|
||||
[HttpPut("{id}")]
|
||||
public void Put(int id, [FromBody] string value)
|
||||
{
|
||||
}
|
||||
|
||||
// DELETE api/<GameRoomMessageController>/5
|
||||
[HttpDelete("{id}")]
|
||||
public void Delete(int id)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -23,8 +23,8 @@ using WebAPI.Services;
|
||||
using Jint.Native;
|
||||
using WebAPI.Services.Interfaces;
|
||||
using Church.Net.DAL.EFCoreDBF.Migrations;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using WebAPI.Logics;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
19
Church.Net.WebAPI/Controllers/MD2Controller.cs
Normal file
19
Church.Net.WebAPI/Controllers/MD2Controller.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Entity.Games.MD2;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using WebAPI.Logics.Interface;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
{
|
||||
[Route("[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class MD2MobInfoController : ApiControllerBase<MobInfo>
|
||||
{
|
||||
public MD2MobInfoController(ICrudLogic<MobInfo> logic) : base(logic)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
using Church.Net.DAL.EF;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.DAL.EFCoreDBF.Core;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Utility;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
93
Church.Net.WebAPI/Controllers/QRCodeController.cs
Normal file
93
Church.Net.WebAPI/Controllers/QRCodeController.cs
Normal file
@ -0,0 +1,93 @@
|
||||
using Church.Net.Utility;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using QRCoder;
|
||||
using SixLabors.Fonts;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Drawing.Processing;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace Church.Net.WebAPI.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class QRCodeController : ControllerBase
|
||||
{
|
||||
// GET api/<QRCodeController>/5
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get(string content,int size)
|
||||
{
|
||||
|
||||
QRCodeGenerator gen = new QRCodeGenerator();
|
||||
QRCodeGenerator qrGenerator = new QRCodeGenerator();
|
||||
QRCodeData qrCodeData = qrGenerator.CreateQrCode(content, QRCodeGenerator.ECCLevel.Q);
|
||||
QRCode qrCode = new QRCode(qrCodeData);
|
||||
var qrCodeImage = qrCode.GetGraphic(size);
|
||||
//string qrCodeImagePath = "/App_Data/ScaneMeQrCode.png";
|
||||
//var backgroundBitmap = SixLabors.ImageSharp.Image.Load(qrCodeImagePath);
|
||||
//string qrCodeImagePath = Environment.GetEnvironmentVariable("AppData");
|
||||
//HttpContext.Current.Server.MapPath("~/App_Data/");
|
||||
//var fullPath = System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/ScaneMeQrCode.png");
|
||||
//System.Web.Hosting.HostingEnvironment.MapPath(@"~/App_Data/yourXmlFile.xml");
|
||||
|
||||
//int positionLeft = 0;
|
||||
//int positionTop = 0;
|
||||
//var best = logic.GetById(id);
|
||||
//if (best != null)
|
||||
//{
|
||||
// using (var memoryStream = new MemoryStream())
|
||||
// {
|
||||
// //fileStream.CopyTo(memoryStream);
|
||||
// var image = Superimpose(best.Name, backgroundBitmap, qrCodeImage, 10, 32);
|
||||
// image.Scalling(75);
|
||||
// image.SaveAsPng(memoryStream);
|
||||
// byte[] byteImage = memoryStream.ToArray();
|
||||
// return File(byteImage, "image/png");
|
||||
// }
|
||||
//}
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
qrCodeImage.SaveAsJpeg(memoryStream);
|
||||
return File(memoryStream.ToArray(), "image/jpeg");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Font arialFont;
|
||||
[NonAction]
|
||||
public Image Superimpose(string bestName, Image largeBmp, Image smallBmp, int? x = null, int? y = null)
|
||||
{
|
||||
FontCollection collection = new();
|
||||
FontFamily family = collection.Add("/App_Data/arial.ttf");
|
||||
arialFont = family.CreateFont(12, FontStyle.Italic);
|
||||
//Graphics g = Graphics.FromImage(largeBmp);
|
||||
//g.CompositingMode = CompositingMode.SourceOver;
|
||||
//smallBmp.MakeTransparent();
|
||||
int margin = 5;
|
||||
if (!x.HasValue)
|
||||
{
|
||||
x = largeBmp.Width - smallBmp.Width - margin;
|
||||
}
|
||||
if (!y.HasValue)
|
||||
{
|
||||
y = largeBmp.Height - smallBmp.Height - margin;
|
||||
}
|
||||
var scale = 0.8;
|
||||
var scaleWidth = (int)(smallBmp.Width * scale);
|
||||
var scaleHeight = (int)(smallBmp.Height * scale);
|
||||
|
||||
|
||||
largeBmp.Mutate(x => x.DrawText(bestName, arialFont, Color.Black, new PointF(10, 10)));
|
||||
|
||||
smallBmp.Scalling(80);
|
||||
|
||||
largeBmp.Mutate(ctx => ctx.DrawImage(smallBmp, new Point(x.Value, y.Value), 1f));
|
||||
return largeBmp;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
26
Church.Net.WebAPI/Controllers/VersionController.cs
Normal file
26
Church.Net.WebAPI/Controllers/VersionController.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class VersionController : ControllerBase
|
||||
{
|
||||
|
||||
[HttpGet]
|
||||
public string Get()
|
||||
{
|
||||
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||
string version = fvi.FileVersion;
|
||||
return version;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,19 +7,19 @@ EXPOSE 443
|
||||
|
||||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||
WORKDIR /src
|
||||
COPY ["WebAPI/WebAPI.csproj", "WebAPI/"]
|
||||
COPY ["Church.Net.WebAPI/Church.Net.WebAPI.csproj", "Church.Net.WebAPI/"]
|
||||
COPY ["Church.Net.DAL.EFCoreDBF/Church.Net.DAL.EFCoreDBF.csproj", "Church.Net.DAL.EFCoreDBF/"]
|
||||
COPY ["Church.Net.Entity2/Church.Net.Entity.csproj", "Church.Net.Entity/"]
|
||||
COPY ["Church.Net.Utility/Church.Net.Utility.csproj", "Church.Net.Utility/"]
|
||||
RUN dotnet restore "WebAPI/WebAPI.csproj"
|
||||
RUN dotnet restore "Church.Net.WebAPI/Church.Net.WebAPI.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/WebAPI"
|
||||
RUN dotnet build "WebAPI.csproj" -c Release -o /app/build
|
||||
WORKDIR "/src/Church.Net.WebAPI"
|
||||
RUN dotnet build "Church.Net.WebAPI.csproj" -c Release -o /app/build
|
||||
|
||||
FROM build AS publish
|
||||
RUN dotnet publish "WebAPI.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
RUN dotnet publish "Church.Net.WebAPI.csproj" -c Release -o /app/publish /p:UseAppHost=false
|
||||
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "WebAPI.dll"]
|
||||
ENTRYPOINT ["dotnet", "Church.Net.WebAPI.dll"]
|
||||
141
Church.Net.WebAPI/GameRoomLogic.cs
Normal file
141
Church.Net.WebAPI/GameRoomLogic.cs
Normal file
@ -0,0 +1,141 @@
|
||||
using Church.Net.WebAPI.Models;
|
||||
using Jint.Native;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WebAPI.Hubs;
|
||||
using WebAPI.Models.IceBreak;
|
||||
using WebAPI.Services.Interfaces;
|
||||
|
||||
namespace WebAPI
|
||||
{
|
||||
public class GameRoomLogic
|
||||
{
|
||||
public List<IGamePlayer> OnlinePlayers { get; set; }
|
||||
private readonly IHubContext<GameRoomHub> gameHubContext;
|
||||
|
||||
public GameRoomLogic(
|
||||
IHubContext<GameRoomHub> GameHubContext
|
||||
)
|
||||
{
|
||||
gameHubContext = GameHubContext;
|
||||
GameRooms = new List<GameRoom>();
|
||||
OnlinePlayers = new List<IGamePlayer>();
|
||||
}
|
||||
public List<GameRoom> GameRooms { get; set; }
|
||||
public void CreateGameRoom(IGamePlayer gamePlayer)
|
||||
{
|
||||
if (!this.GameRooms.Any(g => g.Id == gamePlayer.Id))
|
||||
{
|
||||
this.GameRooms.Add(new GameRoom()
|
||||
{
|
||||
Id = gamePlayer.Id,
|
||||
Name = gamePlayer.Name,
|
||||
SignalRClientId = gamePlayer.SignalRClientId,
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var existingRoom = this.GameRooms.FirstOrDefault(g => g.Id == gamePlayer.Id);
|
||||
existingRoom.SignalRClientId = gamePlayer.SignalRClientId;
|
||||
}
|
||||
//this.OnlinePlayers.FirstOrDefault(p => p.SignalRClientId == gamePlayer.SignalRClientId).GameRoomId = gamePlayer.Id;
|
||||
//gameHubContext.Groups.AddToGroupAsync(gamePlayer.SignalRClientId, gamePlayer.Id);
|
||||
}
|
||||
|
||||
public bool UserJoinGameRoom(string gameRoomId, IGamePlayer gamePlayer)
|
||||
{
|
||||
//this.OnlinePlayers.FirstOrDefault(p => p.SignalRClientId == gamePlayer.SignalRClientId)
|
||||
// .GameRoomId = gameRoomId;
|
||||
//if (GameRooms.Any(g => g.Id == gameRoomId))
|
||||
//{
|
||||
// //Make sure user not exist in other room
|
||||
// UserLeave(gamePlayer);
|
||||
|
||||
//}
|
||||
|
||||
var gameRoom = GameRooms.FirstOrDefault(r => r.Id == gameRoomId);
|
||||
if (gameRoom == null)
|
||||
{
|
||||
CreateGameRoom(gamePlayer);
|
||||
}
|
||||
if (gameRoom != null)
|
||||
{
|
||||
//gameHubContext.Groups.AddToGroupAsync(gamePlayer.SignalRClientId, gameRoomId);
|
||||
gameRoom.Players.Add(gamePlayer);
|
||||
var message = new SignalRMessage(new SignalRSession(gameRoomId, "", true), "GameRoom", "Join");
|
||||
message.From = new SignalRSession(gamePlayer.SignalRClientId, gamePlayer.Name);
|
||||
SendMessage(message);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void UserLeave(IGamePlayer gamePlayer)
|
||||
{
|
||||
//foreach (var room in GameRooms)
|
||||
//{
|
||||
// if (room.Id == gamePlayer.SignalRClientId)
|
||||
// {
|
||||
// GameRooms.Remove(room);
|
||||
// break;
|
||||
|
||||
// }
|
||||
// if (room.Players.Any(p => p.Id == gamePlayer.Id))
|
||||
// {
|
||||
// room.Players.Remove(room.Players.FirstOrDefault(p => p.Id == gamePlayer.Id));
|
||||
// var message = new SignalRMessage(new SignalRSession(room.Id, "", true), "GameRoom", "Leaving");
|
||||
// message.From = new SignalRSession(gamePlayer.SignalRClientId, gamePlayer.Name);
|
||||
// SendMessage(message);
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
if (!string.IsNullOrWhiteSpace(gamePlayer.GameRoomId))
|
||||
{
|
||||
//gameHubContext.Groups.RemoveFromGroupAsync(gamePlayer.SignalRClientId, gamePlayer.GameRoomId);
|
||||
var message = new SignalRMessage(new SignalRSession(gamePlayer.GameRoomId, "", true), "GameRoom", "Leaving");
|
||||
message.From = new SignalRSession(gamePlayer.TabId, gamePlayer.Name);
|
||||
SendMessage(message);
|
||||
}
|
||||
}
|
||||
public void BrodcastMessage(GameRoom room)
|
||||
{
|
||||
}
|
||||
|
||||
public void SendMessage(SignalRMessage message)
|
||||
{
|
||||
string jsonString = JsonConvert.SerializeObject(message, new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
|
||||
//DateTimeZoneHandling = DateTimeZoneHandling.Local
|
||||
});
|
||||
if (message.Receiver.IsGroup)
|
||||
{
|
||||
//this.gameHubContext.Clients.Clients(
|
||||
// this.GameRooms.FirstOrDefault(g => g.Id == message.Receiver.SessionId).Players.Select(p => p.Id))
|
||||
// .SendAsync("ReceivedMessage", jsonString);
|
||||
//this.gameHubContext.Clients.All.SendAsync("ReceivedMessage", jsonString);
|
||||
|
||||
gameHubContext.Clients.Group(message.Receiver.SessionId).SendAsync("ReceivedMessage", jsonString);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
gameHubContext.Clients.Client(message.Receiver.SessionId).SendAsync("ReceivedMessage", jsonString);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public bool GetOnlinePlayerByTabId(string tabId,out IGamePlayer gamePlayer)
|
||||
{
|
||||
gamePlayer= this.OnlinePlayers.FirstOrDefault(p => p.TabId == tabId);
|
||||
return gamePlayer != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
121
Church.Net.WebAPI/Hubs/GameRoomHub.cs
Normal file
121
Church.Net.WebAPI/Hubs/GameRoomHub.cs
Normal file
@ -0,0 +1,121 @@
|
||||
|
||||
using Church.Net.WebAPI.Models;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WebAPI.Models.IceBreak;
|
||||
using System.Diagnostics;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace WebAPI.Hubs
|
||||
{
|
||||
public class GameRoomHub : Hub
|
||||
{
|
||||
private readonly GameRoomLogic gameRoomLogic;
|
||||
|
||||
public GameRoomHub(GameRoomLogic gameRoomLogic)
|
||||
{
|
||||
this.gameRoomLogic = gameRoomLogic;
|
||||
}
|
||||
|
||||
public void SendMessage(SignalRMessage message)
|
||||
{
|
||||
string jsonString = JsonConvert.SerializeObject(message, new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new CamelCasePropertyNamesContractResolver(),
|
||||
ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
|
||||
//DateTimeZoneHandling = DateTimeZoneHandling.Local
|
||||
});
|
||||
Task.Run(() =>
|
||||
{
|
||||
if (message.Receiver.IsGroup)
|
||||
{
|
||||
Clients.Group(message.Receiver.SessionId).SendAsync("ReceivedMessage", jsonString);
|
||||
}
|
||||
else
|
||||
{
|
||||
Clients.Client(message.Receiver.SessionId).SendAsync("ReceivedMessage", jsonString);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public override Task OnConnectedAsync()
|
||||
{
|
||||
var playerInfo = GetPlayerInfoFromRequest();
|
||||
//var gameHostName = Context.GetHttpContext().Request.Query["gameHostName"];
|
||||
//if (false==string.IsNullOrWhiteSpace(gameHostName))
|
||||
//{
|
||||
|
||||
//}
|
||||
//var groupId = Context.GetHttpContext().Request.Query["groupId"];
|
||||
//Groups.AddToGroupAsync(Context.ConnectionId, groupId);
|
||||
Debug.WriteLine($"{playerInfo.Name}({playerInfo.Id}) Conection Id:{playerInfo.SignalRClientId}");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(playerInfo.TabId))
|
||||
{
|
||||
if (gameRoomLogic.GetOnlinePlayerByTabId(playerInfo.TabId, out IGamePlayer gamePlayer))
|
||||
{
|
||||
gamePlayer.SignalRClientId = Context.ConnectionId;
|
||||
}
|
||||
else
|
||||
{
|
||||
gameRoomLogic.OnlinePlayers.Add(playerInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(playerInfo.GameRoomId))
|
||||
{
|
||||
Groups.AddToGroupAsync(Context.ConnectionId, playerInfo.GameRoomId);
|
||||
}
|
||||
|
||||
|
||||
this.SendMessage(new SignalRMessage(new SignalRSession(playerInfo.SignalRClientId, ""), "GameRoom", "sendJoinInfo").AddParameter("signalRConnId", Context.ConnectionId));
|
||||
|
||||
return base.OnConnectedAsync();
|
||||
}
|
||||
|
||||
public override Task OnDisconnectedAsync(Exception exception)
|
||||
{
|
||||
|
||||
var playerInfo = GetPlayerInfoFromRequest();
|
||||
Debug.WriteLine($"{playerInfo.Name}({playerInfo.Id}) Conection Id:{playerInfo.SignalRClientId} Disconnected");
|
||||
//var groupId = Context.GetHttpContext().Request.Query["groupId"];
|
||||
//Groups.RemoveFromGroupAsync(Context.ConnectionId, groupId);
|
||||
if (!string.IsNullOrWhiteSpace(playerInfo.GameRoomId))
|
||||
{
|
||||
Groups.RemoveFromGroupAsync(Context.ConnectionId, playerInfo.GameRoomId);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(playerInfo.TabId))
|
||||
{
|
||||
gameRoomLogic.UserLeave(playerInfo);
|
||||
gameRoomLogic.OnlinePlayers.RemoveAll(u => u.TabId == playerInfo.TabId);
|
||||
}
|
||||
return base.OnDisconnectedAsync(exception);
|
||||
}
|
||||
private GamePlayer GetPlayerInfoFromRequest()
|
||||
{
|
||||
var playerId = Context.GetHttpContext().Request.Query["userId"];
|
||||
var username = Context.GetHttpContext().Request.Query["username"];
|
||||
var playerTabId = Context.GetHttpContext().Request.Query["tabId"];
|
||||
var roomId = Context.GetHttpContext().Request.Query["roomId"];
|
||||
return new GamePlayer()
|
||||
{
|
||||
Id = playerId,
|
||||
SignalRClientId = Context.ConnectionId,
|
||||
Name = username,
|
||||
TabId = playerTabId,
|
||||
GameRoomId = roomId,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,7 +7,7 @@ using System.Linq;
|
||||
using Church.Net.Utility;
|
||||
using System.Threading.Tasks;
|
||||
using WebAPI.Logics.Interface;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
|
||||
namespace WebAPI.Logics.Core
|
||||
{
|
||||
@ -7,7 +7,7 @@ using System.Linq;
|
||||
using Church.Net.Utility;
|
||||
using System.Threading.Tasks;
|
||||
using WebAPI.Logics.Interface;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
|
||||
namespace WebAPI.Logics.Core
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Entity.Interface;
|
||||
using System;
|
||||
@ -1,4 +1,4 @@
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
using Church.Net.Entity;
|
||||
using WebAPI.Logics.Core;
|
||||
using WebAPI.Logics.Interface;
|
||||
@ -1,5 +1,4 @@
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Utility;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
@ -9,6 +8,7 @@ using WebAPI.Logics.Interface;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Text.RegularExpressions;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
|
||||
namespace WebAPI.Logics
|
||||
{
|
||||
@ -11,20 +11,32 @@ namespace WebAPI.Models.IceBreak
|
||||
WereWolf,
|
||||
WhoIsSpy
|
||||
}
|
||||
public class GameRoom
|
||||
|
||||
public interface IGameRoom
|
||||
{
|
||||
string Id { get; set; }
|
||||
string Name { get; set; }
|
||||
List<IGamePlayer> Players { get; set; }
|
||||
int TotalPlayer { get; }
|
||||
string SignalRClientId { get; set; }
|
||||
}
|
||||
|
||||
public class GameRoom : IGameRoom
|
||||
{
|
||||
GameType Type { get; set; }
|
||||
public string Id { get; set; }
|
||||
private List<WhoIsSpyPlayer> _players;
|
||||
public string SignalRClientId { get; set; }
|
||||
public string Name { get; set; }
|
||||
private List<IGamePlayer> _players;
|
||||
public int TotalPlayer => Players.Count;
|
||||
|
||||
public List<WhoIsSpyPlayer> Players
|
||||
public List<IGamePlayer> Players
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_players == null)
|
||||
{
|
||||
_players = new List<WhoIsSpyPlayer>();
|
||||
_players = new List<IGamePlayer>();
|
||||
|
||||
}
|
||||
|
||||
@ -35,12 +47,26 @@ namespace WebAPI.Models.IceBreak
|
||||
}
|
||||
|
||||
|
||||
public class GamePlayer
|
||||
public interface IGamePlayer
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string SignalRClientId { get; set; }
|
||||
public string TabId { get; set; }
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
public string TempGameRoomId { get; set; }
|
||||
public string GameRoomId { get; set; }
|
||||
public bool IsPlayer { get; set; }
|
||||
}
|
||||
|
||||
public class GamePlayer : IGamePlayer
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string SignalRClientId { get; set; }
|
||||
public string TabId { get; set; }
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
public string GameRoomId { get; set; }
|
||||
public bool IsPlayer { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@ -54,7 +80,7 @@ namespace WebAPI.Models.IceBreak
|
||||
Closed
|
||||
}
|
||||
|
||||
public class WhoIsSpyGameRoom : GameRoom
|
||||
public class WhoIsSpyGameRoom : GameRoom, IGameRoom
|
||||
{
|
||||
public WhoIsSpyGameRoom()
|
||||
{
|
||||
@ -76,12 +102,10 @@ namespace WebAPI.Models.IceBreak
|
||||
public List<int> PlayedAnswerId { get; set; }
|
||||
public int VoteAmount { get; set; }
|
||||
}
|
||||
public class WhoIsSpyPlayer
|
||||
public class WhoIsSpyPlayer : GamePlayer, IGamePlayer
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string RoomId { get; set; }
|
||||
public int Seed { get; set; }
|
||||
public string Name { get; set; }
|
||||
public WhoIsSpyAnswer Answer { get; set; }
|
||||
public bool IsSpy { get; set; }
|
||||
public bool IsDead { get; set; }
|
||||
72
Church.Net.WebAPI/Models/SigmalRMessage.cs
Normal file
72
Church.Net.WebAPI/Models/SigmalRMessage.cs
Normal file
@ -0,0 +1,72 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Church.Net.WebAPI.Models
|
||||
{
|
||||
|
||||
public class SignalRMessage
|
||||
{
|
||||
public SignalRSession From { get; set; }
|
||||
public SignalRSession Receiver { get; set; }
|
||||
public string ActionType { get; set; }
|
||||
public string ActionName { get; set; }
|
||||
public Dictionary<string, string> Parameters { get; set; }
|
||||
public string JsonValue { get; set; }
|
||||
[JsonIgnore]
|
||||
public object Value { get; set; }
|
||||
public SignalRMessage()
|
||||
{
|
||||
Parameters = new Dictionary<string, string>();
|
||||
|
||||
}
|
||||
|
||||
public SignalRMessage(SignalRSession receiver, string actionType, string actionName = null, object value = null)
|
||||
{
|
||||
Parameters = new Dictionary<string, string>();
|
||||
this.Receiver = receiver;
|
||||
ActionType = actionType;
|
||||
ActionName = actionName;
|
||||
Value = value;
|
||||
}
|
||||
public SignalRMessage AddParameter(string key, string value)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(key))
|
||||
{
|
||||
key = key.ToLower();
|
||||
if (Parameters.ContainsKey(key))
|
||||
{
|
||||
Parameters[key] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
Parameters.Add(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
public string GetParameter(string key)
|
||||
{
|
||||
return Parameters[key.ToLower()];
|
||||
}
|
||||
}
|
||||
|
||||
public class SignalRSession
|
||||
{
|
||||
public SignalRSession()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SignalRSession(string sessionId, string name, bool isGroup = false)
|
||||
{
|
||||
SessionId = sessionId;
|
||||
Name = name;
|
||||
IsGroup = isGroup;
|
||||
}
|
||||
|
||||
public string SessionId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public bool IsGroup { get; set; }
|
||||
}
|
||||
}
|
||||
151
Church.Net.WebAPI/Program.cs
Normal file
151
Church.Net.WebAPI/Program.cs
Normal file
@ -0,0 +1,151 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using DotNetTools.SharpGrabber.Grabbed;
|
||||
using DotNetTools.SharpGrabber;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using DotNetTools.SharpGrabber.Converter;
|
||||
|
||||
namespace WebAPI
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
}
|
||||
//public static class Program
|
||||
//{
|
||||
// private static readonly HttpClient Client = new HttpClient();
|
||||
// private static readonly HashSet<string> TempFiles = new HashSet<string>();
|
||||
|
||||
// public static async Task Main(string[] args)
|
||||
// {
|
||||
// var grabber = GrabberBuilder.New()
|
||||
// .UseDefaultServices()
|
||||
// .AddYouTube()
|
||||
// .Build();
|
||||
|
||||
// Console.WriteLine("Enter FFMPEG path:");
|
||||
// var ffmpegPath = Console.ReadLine().Trim();
|
||||
// FFmpeg.AutoGen.ffmpeg.RootPath = ffmpegPath;
|
||||
|
||||
// Console.WriteLine("Enter a YouTube URL:");
|
||||
// var url = Console.ReadLine();
|
||||
// if (url == null)
|
||||
// return;
|
||||
|
||||
// var result = await grabber.GrabAsync(new Uri(url, UriKind.Absolute));
|
||||
|
||||
// var audioStream = ChooseMonoMedia(result, MediaChannels.Audio);
|
||||
// //var videoStream = ChooseMonoMedia(result, MediaChannels.Video);
|
||||
// if (audioStream == null)
|
||||
// throw new InvalidOperationException("No audio stream detected.");
|
||||
// //if (videoStream == null)
|
||||
// // throw new InvalidOperationException("No video stream detected.");
|
||||
|
||||
// try
|
||||
// {
|
||||
// var audioPath = await DownloadMedia(audioStream, result);
|
||||
// //var videoPath = await DownloadMedia(videoStream, result);
|
||||
// GenerateOutputFile(audioPath);
|
||||
// }
|
||||
// finally
|
||||
// {
|
||||
// foreach (var tempFile in TempFiles)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// File.Delete(tempFile);
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// // ignored
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private static void GenerateOutputFile(string audioPath)
|
||||
// {
|
||||
// Console.WriteLine("Output Path:");
|
||||
// var outputPath = Console.ReadLine();
|
||||
// if (string.IsNullOrWhiteSpace(outputPath))
|
||||
// throw new Exception("No output path is specified.");
|
||||
// var merger = new MediaMerger(outputPath);
|
||||
// merger.AddStreamSource(audioPath, MediaStreamType.Audio);
|
||||
// //merger.AddStreamSource(videoPath, MediaStreamType.Video);
|
||||
// merger.OutputMimeType = "audio/mp3";//videoStream.Format.Mime;
|
||||
// merger.OutputShortName = "mp3";//videoStream.Format.Extension;
|
||||
|
||||
// merger.Build();
|
||||
// Console.WriteLine($"Output file successfully created.");
|
||||
// }
|
||||
|
||||
// private static GrabbedMedia ChooseMonoMedia(GrabResult result, MediaChannels channel)
|
||||
// {
|
||||
// var resources = result.Resources<GrabbedMedia>()
|
||||
// .Where(m => m.Channels == channel)
|
||||
// .ToList();
|
||||
|
||||
// if (resources.Count == 0)
|
||||
// return null;
|
||||
|
||||
// for (var i = 0; i < resources.Count; i++)
|
||||
// {
|
||||
// var resource = resources[i];
|
||||
// Console.WriteLine($"{i}. {resource.Title ?? resource.FormatTitle ?? resource.Resolution}");
|
||||
// }
|
||||
|
||||
// while (true)
|
||||
// {
|
||||
// Console.Write($"Choose the {channel} file: ");
|
||||
// var choiceStr = Console.ReadLine();
|
||||
// if (!int.TryParse(choiceStr, out var choice))
|
||||
// {
|
||||
// Console.WriteLine("Number expected.");
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// if (choice < 0 || choice >= resources.Count)
|
||||
// {
|
||||
// Console.WriteLine("Invalid number.");
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// return resources[choice];
|
||||
// }
|
||||
// }
|
||||
|
||||
// private static async Task<string> DownloadMedia(GrabbedMedia media, IGrabResult grabResult)
|
||||
// {
|
||||
// Console.WriteLine("Downloading {0}...", media.Title ?? media.FormatTitle ?? media.Resolution);
|
||||
// Console.WriteLine(media.ResourceUri);
|
||||
// Client.Timeout=TimeSpan.FromSeconds(200);
|
||||
// using var response = await Client.GetAsync(media.ResourceUri);
|
||||
// response.EnsureSuccessStatusCode();
|
||||
// using var downloadStream = await response.Content.ReadAsStreamAsync();
|
||||
// using var resourceStream = await grabResult.WrapStreamAsync(downloadStream);
|
||||
// var path = Path.GetTempFileName();
|
||||
|
||||
// using var fileStream = new FileStream(path, FileMode.Create);
|
||||
// TempFiles.Add(path);
|
||||
// await resourceStream.CopyToAsync(fileStream);
|
||||
// return path;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
@ -5,9 +5,9 @@ using WebAPI.Services.Interfaces;
|
||||
using System.Diagnostics;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Entity.Interface;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Newtonsoft.Json;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
|
||||
namespace WebAPI.Services
|
||||
{
|
||||
@ -1,4 +1,4 @@
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Entity.Messenger;
|
||||
using Church.Net.Utility;
|
||||
@ -4,7 +4,8 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Church.Net.DAL.EF;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.DAL.EFCoreDBF.Core;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
using Church.Net.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
@ -64,14 +65,22 @@ namespace WebAPI
|
||||
services.AddSignalR();
|
||||
|
||||
services.AddSingleton<GameRoomLogic>();
|
||||
//services.AddSingleton(_ => new DatabaseOptions { ConnectionString = "Host=192.168.86.131;Port=49154;Database=Church;Username=chris;Password=1124" });
|
||||
services.AddSingleton(_ => new DatabaseOptions { ConnectionString = "Host=192.168.86.131;Port=49154;Database=Church;Username=chris;Password=1124" });
|
||||
|
||||
services.AddSingleton<GameRoomHub>();
|
||||
|
||||
//Localted at \\ArkNAS\docker\ChurchAPI\docker-compose.yaml
|
||||
string databaseConnString = Environment.GetEnvironmentVariable("DB_CONN_STRING");
|
||||
#if DEBUG
|
||||
databaseConnString = "Host=192.168.68.55;Port=49154;Database=Church;Username=chris;Password=1124";
|
||||
#endif
|
||||
//services.AddSingleton(_ => new DatabaseOptions { ConnectionString = databaseConnString });
|
||||
services.AddSingleton(_ => new DatabaseOptions { ConnectionString = databaseConnString });
|
||||
//services.AddSingleton<ChurchNetContext>(new ChurchNetContext());
|
||||
services.AddDbContext<ChurchNetContext>(options =>
|
||||
options.UseNpgsql(
|
||||
//Configuration.GetConnectionString()
|
||||
//"Host=192.168.86.131;Port=49154;Database=ChurchSandbox;Username=chris;Password=1124"
|
||||
"Host=192.168.86.131;Port=49154;Database=Church;Username=chris;Password=1124"
|
||||
//"Host=192.168.68.55;Port=49154;Database=ChurchSandbox;Username=chris;Password=1124"
|
||||
databaseConnString
|
||||
));
|
||||
|
||||
services.AddScoped<LineAutoBotService>();
|
||||
@ -82,7 +91,7 @@ namespace WebAPI
|
||||
services.AddScoped<IAutoReplyCommand, ArHappinessGroupTask>();
|
||||
services.AddScoped<IAutoReplyCommand, ArHappinessBEST>();
|
||||
|
||||
services.AddScoped<IScheduledTask, MorningPrayer>();
|
||||
//services.AddScoped<IScheduledTask, MorningPrayer>();
|
||||
|
||||
|
||||
services.AddScoped<VideoDownloadLogic>();
|
||||
@ -155,6 +164,7 @@ namespace WebAPI
|
||||
endpoints.MapHub<AvalonHub>("/AvalonHub");
|
||||
endpoints.MapHub<WhoIsSpyHub>("/WhoIsSpyHub");
|
||||
endpoints.MapHub<BaseHub>("/BaseHub");
|
||||
endpoints.MapHub<GameRoomHub>("/GameRoomHub");
|
||||
|
||||
endpoints.MapControllers();
|
||||
|
||||
@ -9,7 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "BLL", "BLL", "{8EA076BD-086
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Utility", "Utility", "{251C9BF4-223F-4D00-9BB0-9C80537D1A37}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebAPI", "WebAPI\WebAPI.csproj", "{1DD6DC3F-D6E1-43E0-A2FD-2E5FF7AE20C6}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Church.Net.WebAPI", "Church.Net.WebAPI\Church.Net.WebAPI.csproj", "{1DD6DC3F-D6E1-43E0-A2FD-2E5FF7AE20C6}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Church.Net.Entity", "Church.Net.Entity2\Church.Net.Entity.csproj", "{FAEEA0AD-9C16-4BED-BF7D-BF74A3810D77}"
|
||||
EndProject
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using Church.Net.DAL.EF;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
using Church.Net.Entity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using Church.Net.DAL.EF;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
using Church.Net.Entity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
using Church.Net.DAL.EF;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Utility;
|
||||
using LineMessaging;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using Church.Net.DAL.EF;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.DAL.EFCoreDBF.Core;
|
||||
using Church.Net.DAL.EFCoreDBF.Interface;
|
||||
using Church.Net.Entity;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@ -21,7 +22,7 @@ namespace TestProject
|
||||
services.AddDbContext<ChurchNetContext>(options =>
|
||||
options.UseNpgsql(
|
||||
//Configuration.GetConnectionString()
|
||||
"Host=192.168.86.131;Port=49154;Database=Church;Username=chris;Password=1124"
|
||||
"Host=192.168.68.55;Port=49154;Database=Church;Username=chris;Password=1124"
|
||||
));
|
||||
|
||||
services.AddTransient<LineAutoBotService>();
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Church.Net.DAL.EFCoreDBF\Church.Net.DAL.EFCoreDBF.csproj" />
|
||||
<ProjectReference Include="..\WebAPI\WebAPI.csproj" />
|
||||
<ProjectReference Include="..\Church.Net.WebAPI\Church.Net.WebAPI.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WebAPI.Models.IceBreak;
|
||||
|
||||
namespace WebAPI
|
||||
{
|
||||
public class GameRoomLogic
|
||||
{
|
||||
public List<GameRoom> GameRooms { get; set; }
|
||||
|
||||
public bool UserJoinGameRoom(string id,string userName,string gameRoomId)
|
||||
{
|
||||
if (GameRooms.Any(g => g.Id == gameRoomId))
|
||||
{
|
||||
//Make sure user not exist in other room
|
||||
UserLeave(id);
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void UserLeave(string id)
|
||||
{
|
||||
foreach (var room in GameRooms)
|
||||
{
|
||||
if (room.Players.Any(p => p.Id == id))
|
||||
{
|
||||
room.Players.Remove(room.Players.FirstOrDefault(p => p.Id == id));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace WebAPI
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
||||
public static IHostBuilder CreateHostBuilder(string[] args) =>
|
||||
Host.CreateDefaultBuilder(args)
|
||||
.ConfigureWebHostDefaults(webBuilder =>
|
||||
{
|
||||
webBuilder.UseStartup<Startup>();
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user