Update Happiness Task
This commit is contained in:
parent
b33c0d8286
commit
f9a5dc5e34
@ -97,8 +97,8 @@ namespace Church.Net.DAL.EF
|
||||
modelBuilder.Entity<PastoralDomainAutoReplys>()
|
||||
.HasOne(tt => tt.PastoralDomain)
|
||||
.WithMany(t => t.AutoReplyItemRelations)
|
||||
.HasForeignKey(tt => tt.PastoralDomainCommunityAppId)
|
||||
.HasPrincipalKey(tt => tt.CommunityAppId);
|
||||
.HasForeignKey(tt => tt.PastoralDomainCommunityAppId);
|
||||
//.HasPrincipalKey(tt => tt.L);
|
||||
|
||||
//modelBuilder.Entity<PastoralDomainMembers>()
|
||||
// .HasOne(t => t.PastoralDomain)
|
||||
@ -126,7 +126,6 @@ namespace Church.Net.DAL.EF
|
||||
public DbSet<PastoralDomain> PastoralDomains { get; set; }
|
||||
public DbSet<WhoIsSpy> WhoIsSpy { get; set; }
|
||||
public DbSet<Vocabulary> Vocabulary { get; set; }
|
||||
public DbSet<HappinessGroup> HappinessGroups { get; set; }
|
||||
public DbSet<HappinessBEST> HappinessBESTs { get; set; }
|
||||
public DbSet<HappinessWeek> HappinessWeeks { get; set; }
|
||||
public DbSet<CellGroupRoutineEvent> CellGroupRoutineEvents { get; set; }
|
||||
|
||||
884
Church.Net.DAL.EFCoreDBF/Migrations/20221001111411_AddLineId.Designer.cs
generated
Normal file
884
Church.Net.DAL.EFCoreDBF/Migrations/20221001111411_AddLineId.Designer.cs
generated
Normal file
@ -0,0 +1,884 @@
|
||||
// <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("20221001111411_AddLineId")]
|
||||
partial class AddLineId
|
||||
{
|
||||
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.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.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.HappinessGroup", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("BeginTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("CityAndZipCode")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("CommunityAppId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("InvitationText")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LineAccountId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LineAccountId");
|
||||
|
||||
b.ToTable("HappinessGroups");
|
||||
});
|
||||
|
||||
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>("CommunityAppId")
|
||||
.IsRequired()
|
||||
.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>("LogoImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ServiceAddressId")
|
||||
.HasColumnType("text");
|
||||
|
||||
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.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.HappinessBEST", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.HappinessGroup", "HappinessGroup")
|
||||
.WithMany("BestList")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessGroup", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.LineMessagingAccount", "LineMessagingAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("LineAccountId");
|
||||
|
||||
b.Navigation("LineMessagingAccount");
|
||||
});
|
||||
|
||||
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.HappinessGroup", "HappinessGroup")
|
||||
.WithMany("Weeks")
|
||||
.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")
|
||||
.HasPrincipalKey("CommunityAppId")
|
||||
.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.HappinessGroup", b =>
|
||||
{
|
||||
b.Navigation("BestList");
|
||||
|
||||
b.Navigation("Weeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.Navigation("Tasks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b =>
|
||||
{
|
||||
b.Navigation("AutoReplyItemRelations");
|
||||
|
||||
b.Navigation("Members");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
105
Church.Net.DAL.EFCoreDBF/Migrations/20221001111411_AddLineId.cs
Normal file
105
Church.Net.DAL.EFCoreDBF/Migrations/20221001111411_AddLineId.cs
Normal file
@ -0,0 +1,105 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
{
|
||||
public partial class AddLineId : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "LineAccountId",
|
||||
table: "PastoralDomains",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "LineAccountId",
|
||||
table: "HappinessGroups",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "PastoralDomainId",
|
||||
table: "CellGroupRoutineEvents",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_PastoralDomains_LineAccountId",
|
||||
table: "PastoralDomains",
|
||||
column: "LineAccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HappinessGroups_LineAccountId",
|
||||
table: "HappinessGroups",
|
||||
column: "LineAccountId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CellGroupRoutineEvents_PastoralDomainId",
|
||||
table: "CellGroupRoutineEvents",
|
||||
column: "PastoralDomainId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CellGroupRoutineEvents_PastoralDomains_PastoralDomainId",
|
||||
table: "CellGroupRoutineEvents",
|
||||
column: "PastoralDomainId",
|
||||
principalTable: "PastoralDomains",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HappinessGroups_LineMessagingAccounts_LineAccountId",
|
||||
table: "HappinessGroups",
|
||||
column: "LineAccountId",
|
||||
principalTable: "LineMessagingAccounts",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PastoralDomains_LineMessagingAccounts_LineAccountId",
|
||||
table: "PastoralDomains",
|
||||
column: "LineAccountId",
|
||||
principalTable: "LineMessagingAccounts",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CellGroupRoutineEvents_PastoralDomains_PastoralDomainId",
|
||||
table: "CellGroupRoutineEvents");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HappinessGroups_LineMessagingAccounts_LineAccountId",
|
||||
table: "HappinessGroups");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PastoralDomains_LineMessagingAccounts_LineAccountId",
|
||||
table: "PastoralDomains");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_PastoralDomains_LineAccountId",
|
||||
table: "PastoralDomains");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_HappinessGroups_LineAccountId",
|
||||
table: "HappinessGroups");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_CellGroupRoutineEvents_PastoralDomainId",
|
||||
table: "CellGroupRoutineEvents");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LineAccountId",
|
||||
table: "PastoralDomains");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LineAccountId",
|
||||
table: "HappinessGroups");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PastoralDomainId",
|
||||
table: "CellGroupRoutineEvents");
|
||||
}
|
||||
}
|
||||
}
|
||||
882
Church.Net.DAL.EFCoreDBF/Migrations/20221001120825_RemoveAutoReply.Designer.cs
generated
Normal file
882
Church.Net.DAL.EFCoreDBF/Migrations/20221001120825_RemoveAutoReply.Designer.cs
generated
Normal file
@ -0,0 +1,882 @@
|
||||
// <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("20221001120825_RemoveAutoReply")]
|
||||
partial class RemoveAutoReply
|
||||
{
|
||||
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.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.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.HappinessGroup", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("BeginTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("CityAndZipCode")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("InvitationText")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LineAccountId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LineGroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LineAccountId");
|
||||
|
||||
b.ToTable("HappinessGroups");
|
||||
});
|
||||
|
||||
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.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.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.HappinessBEST", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.HappinessGroup", "HappinessGroup")
|
||||
.WithMany("BestList")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessGroup", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.LineMessagingAccount", "LineMessagingAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("LineAccountId");
|
||||
|
||||
b.Navigation("LineMessagingAccount");
|
||||
});
|
||||
|
||||
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.HappinessGroup", "HappinessGroup")
|
||||
.WithMany("Weeks")
|
||||
.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.HappinessGroup", b =>
|
||||
{
|
||||
b.Navigation("BestList");
|
||||
|
||||
b.Navigation("Weeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.Navigation("Tasks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b =>
|
||||
{
|
||||
b.Navigation("AutoReplyItemRelations");
|
||||
|
||||
b.Navigation("Members");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
{
|
||||
public partial class RemoveAutoReply : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PastoralDomainAutoReplys_PastoralDomains_PastoralDomainComm~",
|
||||
table: "PastoralDomainAutoReplys");
|
||||
|
||||
migrationBuilder.DropUniqueConstraint(
|
||||
name: "AK_PastoralDomains_CommunityAppId",
|
||||
table: "PastoralDomains");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CommunityAppId",
|
||||
table: "PastoralDomains");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "CommunityAppId",
|
||||
table: "HappinessGroups",
|
||||
newName: "LineGroupId");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "LineGroupId",
|
||||
table: "PastoralDomains",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PastoralDomainAutoReplys_PastoralDomains_PastoralDomainComm~",
|
||||
table: "PastoralDomainAutoReplys",
|
||||
column: "PastoralDomainCommunityAppId",
|
||||
principalTable: "PastoralDomains",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_PastoralDomainAutoReplys_PastoralDomains_PastoralDomainComm~",
|
||||
table: "PastoralDomainAutoReplys");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LineGroupId",
|
||||
table: "PastoralDomains");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "LineGroupId",
|
||||
table: "HappinessGroups",
|
||||
newName: "CommunityAppId");
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CommunityAppId",
|
||||
table: "PastoralDomains",
|
||||
type: "text",
|
||||
nullable: false,
|
||||
defaultValue: "");
|
||||
|
||||
migrationBuilder.AddUniqueConstraint(
|
||||
name: "AK_PastoralDomains_CommunityAppId",
|
||||
table: "PastoralDomains",
|
||||
column: "CommunityAppId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_PastoralDomainAutoReplys_PastoralDomains_PastoralDomainComm~",
|
||||
table: "PastoralDomainAutoReplys",
|
||||
column: "PastoralDomainCommunityAppId",
|
||||
principalTable: "PastoralDomains",
|
||||
principalColumn: "CommunityAppId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
||||
910
Church.Net.DAL.EFCoreDBF/Migrations/20221002060819_MergeHappinessGroup.Designer.cs
generated
Normal file
910
Church.Net.DAL.EFCoreDBF/Migrations/20221002060819_MergeHappinessGroup.Designer.cs
generated
Normal file
@ -0,0 +1,910 @@
|
||||
// <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("20221002060819_MergeHappinessGroup")]
|
||||
partial class MergeHappinessGroup
|
||||
{
|
||||
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.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.HappinessBEST", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("GroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("HappinessGroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Phone")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("HappinessGroupId");
|
||||
|
||||
b.ToTable("HappinessBESTs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessGroup", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("BeginTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("CityAndZipCode")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("InvitationText")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LineAccountId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LineGroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LineAccountId");
|
||||
|
||||
b.ToTable("HappinessGroups");
|
||||
});
|
||||
|
||||
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>("HappinessGroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("InvitationText")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("SEQ")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("GroupId");
|
||||
|
||||
b.HasIndex("HappinessGroupId");
|
||||
|
||||
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<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.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.HappinessBEST", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup")
|
||||
.WithMany("Bests")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.HasOne("Church.Net.Entity.HappinessGroup", null)
|
||||
.WithMany("BestList")
|
||||
.HasForeignKey("HappinessGroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessGroup", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.LineMessagingAccount", "LineMessagingAccount")
|
||||
.WithMany()
|
||||
.HasForeignKey("LineAccountId");
|
||||
|
||||
b.Navigation("LineMessagingAccount");
|
||||
});
|
||||
|
||||
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.HasOne("Church.Net.Entity.HappinessGroup", null)
|
||||
.WithMany("Weeks")
|
||||
.HasForeignKey("HappinessGroupId");
|
||||
|
||||
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.HappinessGroup", b =>
|
||||
{
|
||||
b.Navigation("BestList");
|
||||
|
||||
b.Navigation("Weeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.Navigation("Tasks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b =>
|
||||
{
|
||||
b.Navigation("AutoReplyItemRelations");
|
||||
|
||||
b.Navigation("Bests");
|
||||
|
||||
b.Navigation("HappinessWeeks");
|
||||
|
||||
b.Navigation("Members");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
{
|
||||
public partial class MergeHappinessGroup : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HappinessBESTs_HappinessGroups_GroupId",
|
||||
table: "HappinessBESTs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HappinessWeeks_HappinessGroups_GroupId",
|
||||
table: "HappinessWeeks");
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "ServiceTime",
|
||||
table: "PastoralDomains",
|
||||
type: "timestamp with time zone",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Type",
|
||||
table: "PastoralDomains",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "HappinessGroupId",
|
||||
table: "HappinessWeeks",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "HappinessGroupId",
|
||||
table: "HappinessBESTs",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HappinessWeeks_HappinessGroupId",
|
||||
table: "HappinessWeeks",
|
||||
column: "HappinessGroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HappinessBESTs_HappinessGroupId",
|
||||
table: "HappinessBESTs",
|
||||
column: "HappinessGroupId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HappinessBESTs_HappinessGroups_HappinessGroupId",
|
||||
table: "HappinessBESTs",
|
||||
column: "HappinessGroupId",
|
||||
principalTable: "HappinessGroups",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HappinessBESTs_PastoralDomains_GroupId",
|
||||
table: "HappinessBESTs",
|
||||
column: "GroupId",
|
||||
principalTable: "PastoralDomains",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HappinessWeeks_HappinessGroups_HappinessGroupId",
|
||||
table: "HappinessWeeks",
|
||||
column: "HappinessGroupId",
|
||||
principalTable: "HappinessGroups",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HappinessWeeks_PastoralDomains_GroupId",
|
||||
table: "HappinessWeeks",
|
||||
column: "GroupId",
|
||||
principalTable: "PastoralDomains",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HappinessBESTs_HappinessGroups_HappinessGroupId",
|
||||
table: "HappinessBESTs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HappinessBESTs_PastoralDomains_GroupId",
|
||||
table: "HappinessBESTs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HappinessWeeks_HappinessGroups_HappinessGroupId",
|
||||
table: "HappinessWeeks");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HappinessWeeks_PastoralDomains_GroupId",
|
||||
table: "HappinessWeeks");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_HappinessWeeks_HappinessGroupId",
|
||||
table: "HappinessWeeks");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_HappinessBESTs_HappinessGroupId",
|
||||
table: "HappinessBESTs");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ServiceTime",
|
||||
table: "PastoralDomains");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Type",
|
||||
table: "PastoralDomains");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HappinessGroupId",
|
||||
table: "HappinessWeeks");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HappinessGroupId",
|
||||
table: "HappinessBESTs");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HappinessBESTs_HappinessGroups_GroupId",
|
||||
table: "HappinessBESTs",
|
||||
column: "GroupId",
|
||||
principalTable: "HappinessGroups",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HappinessWeeks_HappinessGroups_GroupId",
|
||||
table: "HappinessWeeks",
|
||||
column: "GroupId",
|
||||
principalTable: "HappinessGroups",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
843
Church.Net.DAL.EFCoreDBF/Migrations/20221002114621_RemoveHappinessGroup.Designer.cs
generated
Normal file
843
Church.Net.DAL.EFCoreDBF/Migrations/20221002114621_RemoveHappinessGroup.Designer.cs
generated
Normal file
@ -0,0 +1,843 @@
|
||||
// <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("20221002114621_RemoveHappinessGroup")]
|
||||
partial class RemoveHappinessGroup
|
||||
{
|
||||
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.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.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.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<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.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.HappinessBEST", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup")
|
||||
.WithMany("Bests")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
});
|
||||
|
||||
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.HappinessWeek", b =>
|
||||
{
|
||||
b.Navigation("Tasks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.PastoralDomain", b =>
|
||||
{
|
||||
b.Navigation("AutoReplyItemRelations");
|
||||
|
||||
b.Navigation("Bests");
|
||||
|
||||
b.Navigation("HappinessWeeks");
|
||||
|
||||
b.Navigation("Members");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
{
|
||||
public partial class RemoveHappinessGroup : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HappinessBESTs_HappinessGroups_HappinessGroupId",
|
||||
table: "HappinessBESTs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HappinessWeeks_HappinessGroups_HappinessGroupId",
|
||||
table: "HappinessWeeks");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HappinessGroups");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_HappinessWeeks_HappinessGroupId",
|
||||
table: "HappinessWeeks");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_HappinessBESTs_HappinessGroupId",
|
||||
table: "HappinessBESTs");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HappinessGroupId",
|
||||
table: "HappinessWeeks");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HappinessGroupId",
|
||||
table: "HappinessBESTs");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "HappinessGroupId",
|
||||
table: "HappinessWeeks",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "HappinessGroupId",
|
||||
table: "HappinessBESTs",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HappinessGroups",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "text", nullable: false),
|
||||
LineAccountId = table.Column<string>(type: "text", nullable: true),
|
||||
Address = table.Column<string>(type: "text", nullable: true),
|
||||
BeginTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
CityAndZipCode = table.Column<string>(type: "text", nullable: true),
|
||||
InvitationText = table.Column<string>(type: "text", nullable: true),
|
||||
LineGroupId = table.Column<string>(type: "text", nullable: true),
|
||||
Name = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HappinessGroups", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_HappinessGroups_LineMessagingAccounts_LineAccountId",
|
||||
column: x => x.LineAccountId,
|
||||
principalTable: "LineMessagingAccounts",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HappinessWeeks_HappinessGroupId",
|
||||
table: "HappinessWeeks",
|
||||
column: "HappinessGroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HappinessBESTs_HappinessGroupId",
|
||||
table: "HappinessBESTs",
|
||||
column: "HappinessGroupId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HappinessGroups_LineAccountId",
|
||||
table: "HappinessGroups",
|
||||
column: "LineAccountId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HappinessBESTs_HappinessGroups_HappinessGroupId",
|
||||
table: "HappinessBESTs",
|
||||
column: "HappinessGroupId",
|
||||
principalTable: "HappinessGroups",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HappinessWeeks_HappinessGroups_HappinessGroupId",
|
||||
table: "HappinessWeeks",
|
||||
column: "HappinessGroupId",
|
||||
principalTable: "HappinessGroups",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -85,11 +85,16 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
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");
|
||||
});
|
||||
|
||||
@ -248,34 +253,6 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
b.ToTable("HappinessBESTs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessGroup", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("BeginTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("CityAndZipCode")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("CommunityAppId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("InvitationText")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("HappinessGroups");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessTask", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
@ -476,10 +453,6 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("CommunityAppId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
@ -501,6 +474,12 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
b.Property<string>("LeaderMemberId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LineAccountId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LineGroupId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("LogoImage")
|
||||
.HasColumnType("text");
|
||||
|
||||
@ -510,10 +489,18 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
b.Property<string>("ServiceAddressId")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime?>("ServiceTime")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("LeaderMemberId");
|
||||
|
||||
b.HasIndex("LineAccountId");
|
||||
|
||||
b.HasIndex("ServiceAddressId");
|
||||
|
||||
b.ToTable("PastoralDomains");
|
||||
@ -670,6 +657,15 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
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")
|
||||
@ -712,8 +708,8 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessBEST", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.HappinessGroup", "HappinessGroup")
|
||||
.WithMany("BestList")
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup")
|
||||
.WithMany("Bests")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
@ -730,8 +726,8 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.HasOne("Church.Net.Entity.HappinessGroup", "HappinessGroup")
|
||||
.WithMany("Weeks")
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "HappinessGroup")
|
||||
.WithMany("HappinessWeeks")
|
||||
.HasForeignKey("GroupId");
|
||||
|
||||
b.Navigation("HappinessGroup");
|
||||
@ -752,12 +748,18 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
.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");
|
||||
});
|
||||
|
||||
@ -772,7 +774,6 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
b.HasOne("Church.Net.Entity.PastoralDomain", "PastoralDomain")
|
||||
.WithMany("AutoReplyItemRelations")
|
||||
.HasForeignKey("PastoralDomainCommunityAppId")
|
||||
.HasPrincipalKey("CommunityAppId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
@ -819,13 +820,6 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
b.Navigation("PastoralDomains");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessGroup", b =>
|
||||
{
|
||||
b.Navigation("BestList");
|
||||
|
||||
b.Navigation("Weeks");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Church.Net.Entity.HappinessWeek", b =>
|
||||
{
|
||||
b.Navigation("Tasks");
|
||||
@ -835,6 +829,10 @@ namespace Church.Net.DAL.EFCoreDBF.Migrations
|
||||
{
|
||||
b.Navigation("AutoReplyItemRelations");
|
||||
|
||||
b.Navigation("Bests");
|
||||
|
||||
b.Navigation("HappinessWeeks");
|
||||
|
||||
b.Navigation("Members");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
|
||||
@ -1,17 +1,31 @@
|
||||
using System;
|
||||
using Church.Net.Entity.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
|
||||
namespace Church.Net.Entity
|
||||
{
|
||||
public class AddressInfo
|
||||
public class AddressInfo : IEntity
|
||||
{
|
||||
public AddressInfo()
|
||||
{
|
||||
Id = "new";
|
||||
}
|
||||
[Key]
|
||||
public string Id { get; set; }
|
||||
public string Address { get; set; }
|
||||
public string City { get; set; }
|
||||
public string State { get; set; }
|
||||
public string Zip { get; set; }
|
||||
|
||||
public string GetCSZ()
|
||||
{
|
||||
string result = City;
|
||||
|
||||
string sz = $"{State} {Zip}".Trim();
|
||||
|
||||
return result + (string.IsNullOrWhiteSpace(sz) ? "" : $", {sz}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ namespace Church.Net.Entity
|
||||
[ForeignKey("HappinessGroup")]
|
||||
public string GroupId { get; set; }
|
||||
|
||||
public HappinessGroup HappinessGroup { get; set; }
|
||||
public PastoralDomain HappinessGroup { get; set; }
|
||||
[Key]
|
||||
public string Id { get; set; }
|
||||
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
using Church.Net.Entity.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Church.Net.Entity
|
||||
{
|
||||
public class HappinessGroup : IEntity, IMessengerClient
|
||||
{
|
||||
[Required, Key]
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:yyyy/MM/dd HH:mm}")]
|
||||
public DateTime BeginTime { get; set; }
|
||||
public string Address { get; set; }
|
||||
public string CityAndZipCode { get; set; }
|
||||
|
||||
public string InvitationText { get; set; }
|
||||
|
||||
public virtual ICollection<HappinessBEST> BestList { get; set; }
|
||||
public virtual ICollection<HappinessWeek> Weeks { get; set; }
|
||||
public string CommunityAppId { get; set; }
|
||||
|
||||
[ForeignKey("LineMessagingAccount")]
|
||||
public string LineAccountId { get; set; }
|
||||
public virtual LineMessagingAccount LineMessagingAccount { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
using Church.Net.Entity.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
@ -14,7 +15,7 @@ namespace Church.Net.Entity
|
||||
[ForeignKey("HappinessGroup")]
|
||||
public string GroupId { get; set; }
|
||||
|
||||
public HappinessGroup HappinessGroup { get; set; }
|
||||
public PastoralDomain HappinessGroup { get; set; }
|
||||
[Required, Key]
|
||||
public string Id { get; set; }
|
||||
|
||||
@ -25,17 +26,25 @@ namespace Church.Net.Entity
|
||||
public int SEQ { get; set; }
|
||||
[NotMapped]
|
||||
public bool UpdateRestWeekDate { get; set; }
|
||||
[NotMapped]
|
||||
public string Topic { get; set; }
|
||||
public virtual ICollection<HappinessTask> Tasks { get; set; }
|
||||
public string Comment { get; set; }
|
||||
}
|
||||
|
||||
public enum HappinessTaskType
|
||||
{
|
||||
[Description("帶遊戲")]
|
||||
IceBreak,
|
||||
[Description("唱歌")]
|
||||
Worship,
|
||||
[Description("見證")]
|
||||
Testimony,
|
||||
[Description("信息")]
|
||||
Message,
|
||||
[Description("準備禮物")]
|
||||
Gift,
|
||||
[Description("準備點心")]
|
||||
Dessert
|
||||
}
|
||||
public class HappinessTask : IEntity
|
||||
|
||||
@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text;
|
||||
|
||||
namespace Church.Net.Entity
|
||||
{
|
||||
public class LineBotInfo
|
||||
{
|
||||
|
||||
public string Id { get; set; }
|
||||
public string GroupId { get; set; }
|
||||
}
|
||||
|
||||
public class LineClient
|
||||
{
|
||||
[Required, Key]
|
||||
public string Id { get; set; }
|
||||
public string LineId { get; set; }
|
||||
public bool IsGroup { get; set; }
|
||||
public bool IsManager { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,14 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace Church.Net.Entity
|
||||
{
|
||||
public enum DomainType
|
||||
{
|
||||
CellGroup,
|
||||
HappinessGroup,
|
||||
CellGroupCoworker,
|
||||
ChurchCoworker,
|
||||
Person = 99
|
||||
}
|
||||
public class PastoralDomain : IEntity, IMessengerClient
|
||||
{
|
||||
public PastoralDomain()
|
||||
@ -31,7 +39,8 @@ namespace Church.Net.Entity
|
||||
public string Image4 { get; set; }
|
||||
|
||||
public string Image5 { get; set; }
|
||||
public string CommunityAppId { get; set; }
|
||||
|
||||
public string LineGroupId { get; set; }
|
||||
|
||||
[ForeignKey("LineMessagingAccount")]
|
||||
public string LineAccountId { get; set; }
|
||||
@ -46,7 +55,10 @@ namespace Church.Net.Entity
|
||||
public string ServiceAddressId { get; set; }
|
||||
public AddressInfo ServiceAddress { get; set; }
|
||||
|
||||
|
||||
public DomainType Type { get; set; }
|
||||
public DateTime? ServiceTime { get; set; }
|
||||
public virtual ICollection<HappinessBEST> Bests { get; set; }
|
||||
public virtual ICollection<HappinessWeek> HappinessWeeks { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public virtual ICollection<PastoralDomainMembers> Members { get; set; }
|
||||
@ -54,6 +66,6 @@ namespace Church.Net.Entity
|
||||
public virtual IList<PastoralDomainAutoReplys> AutoReplyItemRelations { get; set; }
|
||||
[NotMapped]
|
||||
public virtual ICollection<FamilyMember> FamilyMembers { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Drawing.Processing;
|
||||
using SixLabors.ImageSharp.Formats;
|
||||
using SixLabors.ImageSharp.Processing;
|
||||
using WebAPI.Logics;
|
||||
using WebAPI.Logics.Interface;
|
||||
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
@ -24,19 +25,19 @@ namespace WebAPI.Controllers
|
||||
public class BestController : ApiControllerBase<HappinessBEST>
|
||||
{
|
||||
private readonly ICrudLogic<HappinessBEST> logic;
|
||||
private readonly ICrudLogic<HappinessGroup> groupLogic;
|
||||
private readonly ICrudLogic<HappinessWeek> weekLogic;
|
||||
private readonly PastoralDomainLogic cellGroupLogic;
|
||||
|
||||
public BestController(
|
||||
ICrudLogic<HappinessBEST> logic,
|
||||
ICrudLogic<HappinessGroup> groupLogic,
|
||||
ICrudLogic<HappinessWeek> weekLogic
|
||||
ICrudLogic<HappinessWeek> weekLogic,
|
||||
PastoralDomainLogic cellGroupLogic
|
||||
|
||||
) : base(logic)
|
||||
{
|
||||
this.logic = logic;
|
||||
this.groupLogic = groupLogic;
|
||||
this.weekLogic = weekLogic;
|
||||
this.cellGroupLogic = cellGroupLogic;
|
||||
}
|
||||
|
||||
// GET api/<BestController>/5
|
||||
@ -49,8 +50,8 @@ namespace WebAPI.Controllers
|
||||
{
|
||||
return Task<HappinessBEST>.Run(() => {
|
||||
var best = logic.GetById(id);
|
||||
best.HappinessGroup = groupLogic.GetById(best.GroupId);
|
||||
best.HappinessGroup.Weeks = weekLogic.GetAll(w => w.GroupId == best.GroupId).OrderBy(w=>w.SEQ).ToList();
|
||||
best.HappinessGroup = cellGroupLogic.GetById(best.GroupId);
|
||||
best.HappinessGroup.HappinessWeeks = weekLogic.GetAll(w => w.GroupId == best.GroupId).OrderBy(w=>w.SEQ).ToList();
|
||||
return best;
|
||||
});
|
||||
}
|
||||
@ -91,6 +92,13 @@ namespace WebAPI.Controllers
|
||||
|
||||
return this.NotFound();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public int UpdateBestWeek(HappinessWeek week)
|
||||
{
|
||||
return weekLogic.CreateOrUpdate(week,out string id);
|
||||
}
|
||||
|
||||
private Font arialFont;
|
||||
[NonAction]
|
||||
public Image Superimpose(string bestName, Image largeBmp, Image smallBmp, int? x = null, int? y = null)
|
||||
|
||||
@ -18,12 +18,12 @@ namespace WebAPI.Controllers
|
||||
[ApiController]
|
||||
public class CellGroupRoutineEventsController : ApiControllerBase<CellGroupRoutineEvent>
|
||||
{
|
||||
private readonly CellGroupLogic logic;
|
||||
private readonly PastoralDomainLogic logic;
|
||||
private readonly ICombinedKeyCrudLogic<CellGroupRoutineEventPrayer> prayerLogic;
|
||||
private readonly ICombinedKeyCrudLogic<CellGroupRoutineEventAttendee> dinnerLogic;
|
||||
|
||||
public CellGroupRoutineEventsController(
|
||||
CellGroupLogic logic,
|
||||
PastoralDomainLogic logic,
|
||||
ICrudLogic<CellGroupRoutineEvent> crudLogic,
|
||||
ICombinedKeyCrudLogic<CellGroupRoutineEventPrayer> prayerLogic,
|
||||
ICombinedKeyCrudLogic<CellGroupRoutineEventAttendee> dinnerLogic
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Church.Net.DAL.EF;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Utility;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using WebAPI.Logics;
|
||||
using WebAPI.Logics.Interface;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[Route("[controller]/[action]")]
|
||||
public class HappinessGroupController : ApiControllerBase<HappinessGroup>
|
||||
{
|
||||
|
||||
private readonly HappinessGroupLogic logic;
|
||||
|
||||
public HappinessGroupController(
|
||||
ICrudLogic<HappinessGroup> crudLogic,
|
||||
HappinessGroupLogic logic
|
||||
):base(crudLogic)
|
||||
{
|
||||
this.logic = logic;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public override async Task<IEnumerable<HappinessGroup>> GetAll()
|
||||
{
|
||||
return await Task.Run(() => { return logic.GetAllGroups(); });
|
||||
}
|
||||
[HttpPost]
|
||||
public virtual async Task<int> UpdateBestWeek(HappinessWeek entity)
|
||||
{
|
||||
return await Task.Run(() => {
|
||||
return logic.UpdateWeekInfo(entity);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
23
WebAPI/Controllers/HappinessWeekTaskController.cs
Normal file
23
WebAPI/Controllers/HappinessWeekTaskController.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Entity.Messenger;
|
||||
using LineMessaging;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using WebAPI.Logics;
|
||||
using WebAPI.Logics.Interface;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
{
|
||||
[Route("[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class HappinessWeekTaskController : ApiControllerBase<HappinessTask>
|
||||
{
|
||||
public HappinessWeekTaskController(ICrudLogic<HappinessTask> logic) : base(logic)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -22,6 +22,8 @@ using System.Text;
|
||||
using WebAPI.Services;
|
||||
using Jint.Native;
|
||||
using WebAPI.Services.Interfaces;
|
||||
using Church.Net.DAL.EFCoreDBF.Migrations;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
@ -33,15 +35,17 @@ namespace WebAPI.Controllers
|
||||
{
|
||||
private readonly LineAutoBotService lineAutoBotService;
|
||||
private readonly ILoggingService loggingService;
|
||||
|
||||
private readonly ICrudDAL<LineMessagingAccount> crudDAL;
|
||||
|
||||
public LineMessageController(
|
||||
LineAutoBotService lineAutoBotService,
|
||||
ILoggingService loggingService
|
||||
ILoggingService loggingService,
|
||||
ICrudDAL<LineMessagingAccount> crudDAL
|
||||
)
|
||||
{
|
||||
this.lineAutoBotService = lineAutoBotService;
|
||||
this.loggingService = loggingService;
|
||||
this.crudDAL = crudDAL;
|
||||
}
|
||||
//private ChurchNetContext dbContext = new ChurchNetContext();
|
||||
//// GET: api/<BestController>
|
||||
@ -65,20 +69,21 @@ namespace WebAPI.Controllers
|
||||
|
||||
// POST api/<BestController>
|
||||
[HttpPost]
|
||||
//[Route("[controller]/[action]")]
|
||||
//[Route("[controller]/[action]/{id?}")]
|
||||
public async Task PostFromLine(string id, [FromBody] object jsonData)
|
||||
public async Task PostFromLine(int seq, [FromBody] object jsonData)
|
||||
{
|
||||
//string txtPath = ServerUtils.MapPath("App_Data/LinePostRawLog.txt");
|
||||
|
||||
//System.IO.File.AppendAllText(txtPath, JsonConvert.SerializeObject(jsonData.ToString(), Formatting.Indented));
|
||||
try
|
||||
{
|
||||
LineMessagingAccount lineAccount = crudDAL.GetAll(l => l.Seq == seq).FirstOrDefault();
|
||||
if (lineAccount != null)
|
||||
{
|
||||
LineWebhookContent content = JsonConvert.DeserializeObject<LineWebhookContent>(jsonData.ToString());
|
||||
|
||||
LineWebhookContent content = JsonConvert.DeserializeObject<LineWebhookContent>(jsonData.ToString());
|
||||
|
||||
await lineAutoBotService.AutoReply(lineAccount,content);
|
||||
}
|
||||
//this.loggingService.Log("PostFromLine");
|
||||
await lineAutoBotService.AutoReply(content);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -104,11 +109,11 @@ namespace WebAPI.Controllers
|
||||
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public Task PushCommandMessage(string groupToken, string command)
|
||||
{
|
||||
return lineAutoBotService.PushCommandMessage(EnumHelper.GetEnumValueFromDescription<LineGroup>(groupToken), "#" + command);
|
||||
}
|
||||
//[HttpGet]
|
||||
//public Task PushCommandMessage(string groupToken, string command)
|
||||
//{
|
||||
// return lineAutoBotService.PushCommandMessage(EnumHelper.GetEnumValueFromDescription<LineGroup>(groupToken), "#" + command);
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Entity.Messenger;
|
||||
using LineMessaging;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -32,4 +33,16 @@ namespace WebAPI.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[Route("[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class LineClientController : ApiControllerBase<LineMessageClient>
|
||||
{
|
||||
public LineClientController(ICrudLogic<LineMessageClient> logic) : base(logic)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ namespace WebAPI.Controllers
|
||||
[ApiController]
|
||||
public class PastoralDomainController : ApiControllerBase<PastoralDomain>
|
||||
{
|
||||
public PastoralDomainController(ICrudLogic<PastoralDomain> logic) : base(logic)
|
||||
public PastoralDomainController(PastoralDomainLogic logic) : base(logic)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ using WebAPI.Logics;
|
||||
using WebAPI.Services;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
using WebAPI.Services.Interfaces;
|
||||
using WebAPI.Logics.Interface;
|
||||
|
||||
namespace WebAPI.Controllers
|
||||
{
|
||||
@ -24,9 +25,12 @@ namespace WebAPI.Controllers
|
||||
public class PingController : ControllerBase
|
||||
{
|
||||
private readonly IEnumerable<IAutoReplyCommand> autoReplyCommands;
|
||||
private readonly PastoralDomainLogic pastoralDomainLogic;
|
||||
private readonly LineAutoBotService lineAutoBotService;
|
||||
|
||||
public PingController(VideoDownloadLogic videoDownloadLogic,
|
||||
IEnumerable<IAutoReplyCommand> autoReplyCommands)
|
||||
IEnumerable<IAutoReplyCommand> autoReplyCommands
|
||||
)
|
||||
{
|
||||
VideoDownloadLogic = videoDownloadLogic;
|
||||
this.autoReplyCommands = autoReplyCommands;
|
||||
@ -129,41 +133,6 @@ namespace WebAPI.Controllers
|
||||
}
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public async void TestAutoReply(string command)
|
||||
{
|
||||
//\\ArkNAS\Church\WorshipVideo
|
||||
//this.VideoDownloadLogic.Download(@"https://www.youtube.com/watch?v=K2bdSYim7uI", @"\\ArkNAS\home\Test.mp4");
|
||||
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(command))
|
||||
{
|
||||
string text = command;
|
||||
var group = LineGroup.Chris;
|
||||
|
||||
var autoReply = autoReplyCommands.Where(ar => ar.SupportGroups.Contains(group) && ar.Commands.Contains(text)).FirstOrDefault();
|
||||
if (autoReply != null)
|
||||
{
|
||||
|
||||
if (autoReply.LineMessage != null)
|
||||
{
|
||||
ReplyLineMessage(group.EnumToDescriptionString(), autoReply.LineMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
// ReplyTextMessage(replyToken, autoReply.ReplyMessage);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
public string[] GetFiles(string path)
|
||||
@ -193,14 +162,6 @@ namespace WebAPI.Controllers
|
||||
|
||||
}
|
||||
|
||||
private async void ReplyLineMessage(string replyToken, IEnumerable<ILineMessage> lineMessages)
|
||||
{
|
||||
var test = new LineMessagingClient();
|
||||
|
||||
var replyMessage = new LinePushMessage() { To = replyToken };
|
||||
replyMessage.Messages = lineMessages;
|
||||
await test.PushMessage(replyMessage);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,12 +3,20 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Authorization.Policy;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using WebAPI.Services;
|
||||
|
||||
public class BasicAuthorizationMiddlewareResultHandler : IAuthorizationMiddlewareResultHandler
|
||||
{
|
||||
private readonly AuthorizationMiddlewareResultHandler defaultHandler = new();
|
||||
private readonly IServiceScopeFactory serviceScopeFactory;
|
||||
|
||||
public BasicAuthorizationMiddlewareResultHandler(IServiceScopeFactory serviceScopeFactory)
|
||||
{
|
||||
this.serviceScopeFactory = serviceScopeFactory;
|
||||
}
|
||||
|
||||
public async Task HandleAsync(
|
||||
RequestDelegate next,
|
||||
@ -33,6 +41,15 @@
|
||||
return;
|
||||
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// using (var scope = serviceScopeFactory.CreateScope())
|
||||
// {
|
||||
// var service = scope.ServiceProvider.GetService<IdentityService>();
|
||||
// service.UserAccessToken =;
|
||||
// }
|
||||
|
||||
//}
|
||||
// Fall back to the default implementation.
|
||||
//await defaultHandler.HandleAsync(next, context, policy, authorizeResult);
|
||||
await next(context);
|
||||
|
||||
@ -1,65 +0,0 @@
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Utility;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using WebAPI.Logics.Core;
|
||||
using WebAPI.Logics.Interface;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace WebAPI.Logics
|
||||
{
|
||||
public class CellGroupLogic
|
||||
{
|
||||
private readonly IServiceScopeFactory serviceScopeFactory;
|
||||
private readonly ICrudDAL<CellGroupRoutineEvent> eventCrudDAL;
|
||||
private readonly ICombinedKeyCrudDAL<CellGroupRoutineEventAttendee> attendeeCrudDAL;
|
||||
private readonly ICrudDAL<FamilyMember> memberCrudDAL;
|
||||
|
||||
public CellGroupLogic(
|
||||
IServiceScopeFactory serviceScopeFactory,
|
||||
ICrudDAL<CellGroupRoutineEvent> eventCrudDAL,
|
||||
ICombinedKeyCrudDAL<CellGroupRoutineEventAttendee> attendeeCrudDAL,
|
||||
ICrudDAL<FamilyMember> memberCrudDAL
|
||||
)
|
||||
{
|
||||
this.serviceScopeFactory = serviceScopeFactory;
|
||||
this.eventCrudDAL = eventCrudDAL;
|
||||
this.attendeeCrudDAL = attendeeCrudDAL;
|
||||
this.memberCrudDAL = memberCrudDAL;
|
||||
}
|
||||
|
||||
public CellGroupRoutineEvent GetComingEvent()
|
||||
{
|
||||
var _event = eventCrudDAL.GetDbSet().Where(e => e.Time >= DateTime.UtcNow)
|
||||
.Include(e => e.Attendees).Include(e => e.Prayers).FirstOrDefault();
|
||||
if (_event == null)
|
||||
{
|
||||
_event = new CellGroupRoutineEvent()
|
||||
{
|
||||
Id = Format.Get33BaseGuid(),
|
||||
Time = DateTimeHelper.GetNextWeekday(DateTime.Today, DayOfWeek.Friday).AddHours(19).AddMinutes(30),
|
||||
Address = "1881 Forest Dr., Azusa, CA 91702",
|
||||
Attendees = new List<CellGroupRoutineEventAttendee>()
|
||||
};
|
||||
eventCrudDAL.Create(_event);
|
||||
}
|
||||
|
||||
return _event;
|
||||
}
|
||||
public CellGroupRoutineEvent GetLastEvent()
|
||||
{
|
||||
var _event = eventCrudDAL.GetDbSet().OrderByDescending(e=>e.Time)
|
||||
.Include(e => e.Attendees).Include(e => e.Prayers).FirstOrDefault();
|
||||
return _event;
|
||||
}
|
||||
|
||||
public string GetMemberFirstNameById(string memberId)
|
||||
{
|
||||
return memberCrudDAL.GetById(memberId)?.FirstName;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -30,23 +30,37 @@ namespace WebAPI.Logics.Core
|
||||
return this.crudDAL.CheckExist(obj);
|
||||
}
|
||||
|
||||
public virtual void BeforeCreate(T entity)
|
||||
{
|
||||
}
|
||||
public virtual int Create(T entity)
|
||||
{
|
||||
return this.crudDAL.Create(entity);
|
||||
BeforeCreate(entity);
|
||||
return this.crudDAL.Create(entity) + CreateDone(entity);
|
||||
}
|
||||
|
||||
public virtual Task<int> CreateAsync(T entity)
|
||||
{
|
||||
BeforeCreate(entity);
|
||||
return this.crudDAL.CreateAsync(entity);
|
||||
}
|
||||
|
||||
public void CreateDone(T entity)
|
||||
public virtual int CreateDone(T entity)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int CreateOrUpdate(T entity, out string id)
|
||||
public virtual int CreateOrUpdate(T entity, out string id)
|
||||
{
|
||||
var result= this.crudDAL.CreateOrUpdate(entity);
|
||||
int result = 0;
|
||||
if (this.crudDAL.CheckExist(entity))
|
||||
{
|
||||
result = this.Update(entity);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = this.Create(entity);
|
||||
}
|
||||
id = entity.Id;
|
||||
return result;
|
||||
}
|
||||
@ -56,7 +70,7 @@ namespace WebAPI.Logics.Core
|
||||
// return this.crudDAL.CreateReturnId(entity);
|
||||
//}
|
||||
|
||||
public int Delete(T obj)
|
||||
public virtual int Delete(T obj)
|
||||
{
|
||||
return this.crudDAL.Delete(obj);
|
||||
}
|
||||
@ -70,7 +84,7 @@ namespace WebAPI.Logics.Core
|
||||
return this.crudDAL.First(filter);
|
||||
}
|
||||
|
||||
public IEnumerable<T> GetAll(Func<T, bool> filter = null)
|
||||
public virtual IEnumerable<T> GetAll(Func<T, bool> filter = null)
|
||||
{
|
||||
return this.crudDAL.GetAll(filter);
|
||||
}
|
||||
@ -85,18 +99,39 @@ namespace WebAPI.Logics.Core
|
||||
return this.crudDAL.GetById(Id);
|
||||
}
|
||||
|
||||
public int Update(T entity)
|
||||
public virtual void BeforeUpdate(T entity)
|
||||
{
|
||||
return this.crudDAL.Update(entity);
|
||||
}
|
||||
|
||||
public void UpdateDone(T entity)
|
||||
public virtual int Update(T entity)
|
||||
{
|
||||
BeforeUpdate(entity);
|
||||
return this.crudDAL.Update(entity)+ UpdateDone(entity);
|
||||
}
|
||||
|
||||
public virtual int UpdateDone(T entity)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int UpdateRange(IEnumerable<T> entities)
|
||||
{
|
||||
return this.crudDAL.UpdateRange(entities);
|
||||
int result = 0;
|
||||
foreach (var item in entities)
|
||||
{
|
||||
result += Update(item);
|
||||
}
|
||||
return result;// this.crudDAL.UpdateRange(entities);
|
||||
}
|
||||
|
||||
public int CreateOrUpdateAll(IEnumerable<T> entities)
|
||||
{
|
||||
int result = 0;
|
||||
foreach (var item in entities)
|
||||
{
|
||||
result += CreateOrUpdate(item,out string id);
|
||||
}
|
||||
return result;// this.crudDAL.UpdateRange(entities);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,13 +7,16 @@ namespace WebAPI.Logics.Core
|
||||
public class LogicService
|
||||
{
|
||||
private readonly IServiceScopeFactory serviceScopeFactory;
|
||||
private readonly IdentityService identityService;
|
||||
|
||||
public LogicService(
|
||||
//ChurchNetContext dbContext
|
||||
IServiceScopeFactory serviceScopeFactory
|
||||
IServiceScopeFactory serviceScopeFactory,
|
||||
IdentityService identityService
|
||||
)
|
||||
{
|
||||
this.serviceScopeFactory = serviceScopeFactory;
|
||||
this.identityService = identityService;
|
||||
//DbContext = dbContext;
|
||||
}
|
||||
|
||||
@ -22,11 +25,7 @@ namespace WebAPI.Logics.Core
|
||||
{
|
||||
get
|
||||
{
|
||||
using (var scope = serviceScopeFactory.CreateScope())
|
||||
{
|
||||
var service = scope.ServiceProvider.GetService<IdentityService>();
|
||||
return service.UserId;
|
||||
}
|
||||
return identityService.UserId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,85 +0,0 @@
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Utility;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Metrics;
|
||||
using System.Linq;
|
||||
|
||||
namespace WebAPI.Logics
|
||||
{
|
||||
public class HappinessGroupLogic
|
||||
{
|
||||
private readonly ICrudDAL<HappinessGroup> groupCrudDAL;
|
||||
private readonly ICrudDAL<HappinessWeek> weekCrudDAL;
|
||||
string[] weekTitles = new string[] { "真幸福", "真相大白", "萬世巨星", "幸福連線", "當上帝來敲門", "十字架的勝利", "釋放與自由", "幸福的教會" };
|
||||
|
||||
public HappinessGroupLogic(
|
||||
ICrudDAL<HappinessGroup> groupCrudDAL,
|
||||
ICrudDAL<HappinessWeek> weekCrudDAL
|
||||
)
|
||||
{
|
||||
this.groupCrudDAL = groupCrudDAL;
|
||||
this.weekCrudDAL = weekCrudDAL;
|
||||
}
|
||||
|
||||
public List<HappinessGroup> GetAllGroups()
|
||||
{
|
||||
var list = groupCrudDAL.GetDbSet().Include(g => g.BestList).Include(g => g.Weeks).ToList();
|
||||
|
||||
foreach (var group in list)
|
||||
{
|
||||
if (group.Weeks == null || group.Weeks.Count() == 0)
|
||||
{
|
||||
group.Weeks = new List<HappinessWeek>();
|
||||
for (int i = 1; i <= 8; i++)
|
||||
{
|
||||
var week = GetHappinessWeek(group, i);
|
||||
group.Weeks.Add(week);
|
||||
weekCrudDAL.CreateOrUpdate(week);
|
||||
}
|
||||
}
|
||||
group.Weeks = group.Weeks.OrderBy(w => w.SEQ).ToList();
|
||||
}
|
||||
|
||||
|
||||
return list;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public int UpdateWeekInfo(HappinessWeek value)
|
||||
{
|
||||
if (value.UpdateRestWeekDate)
|
||||
{
|
||||
var list = weekCrudDAL.GetAll(week => week.SEQ >= value.SEQ && week.GroupId == value.GroupId).OrderBy(w => w.SEQ).ToList();
|
||||
var tempDate = new DateTime(value.Date.Year, value.Date.Month, value.Date.Day, value.Date.Hour, value.Date.Minute, value.Date.Second);
|
||||
int count = 0;
|
||||
foreach (var week in list)
|
||||
{
|
||||
week.Date = tempDate.AddDays(count * 7);
|
||||
week.Address = value.Address;
|
||||
week.CityAndZipCode = value.CityAndZipCode;
|
||||
week.InvitationText = value.InvitationText;
|
||||
count++;
|
||||
}
|
||||
return weekCrudDAL.UpdateRange(list);
|
||||
}
|
||||
return weekCrudDAL.CreateOrUpdate(value);
|
||||
|
||||
}
|
||||
|
||||
private HappinessWeek GetHappinessWeek(HappinessGroup group, int weekNo)
|
||||
{
|
||||
return new HappinessWeek()
|
||||
{
|
||||
GroupId = group.Id,
|
||||
Address = group.Address,
|
||||
CityAndZipCode = group.CityAndZipCode,
|
||||
Date = group.BeginTime.AddDays(7 * (weekNo - 1)),
|
||||
SEQ = weekNo
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17,11 +17,11 @@ namespace WebAPI.Logics.Interface
|
||||
int Create(T entity);
|
||||
Task<int> CreateAsync(T entity);
|
||||
//string CreateReturnId(T entity);
|
||||
|
||||
int CreateOrUpdate(T entity, out string id);
|
||||
int CreateOrUpdateAll(IEnumerable<T> entities);
|
||||
int Update(T entity);
|
||||
void CreateDone(T entity);
|
||||
void UpdateDone(T entity);
|
||||
int CreateDone(T entity);
|
||||
int UpdateDone(T entity);
|
||||
int UpdateRange(IEnumerable<T> entities);
|
||||
int Delete(T obj);
|
||||
int Delete(Func<T, bool> filter = null);
|
||||
|
||||
@ -11,36 +11,27 @@ namespace WebAPI.Logics
|
||||
{
|
||||
public class LineMessagingAccountLogic : LogicBase<LineMessagingAccount>, ICrudLogic<LineMessagingAccount>
|
||||
{
|
||||
private readonly ICrudDAL<HappinessGroup> happinessGroupDAL;
|
||||
private readonly ICrudDAL<PastoralDomain> cellGroupDAL;
|
||||
|
||||
public LineMessagingAccountLogic(
|
||||
LogicService logicService,
|
||||
ICrudDAL<LineMessagingAccount> crudDAL,
|
||||
ICrudDAL<HappinessGroup> happinessGroupDAL,
|
||||
ICrudDAL<PastoralDomain> cellGroupDAL
|
||||
) : base(logicService, crudDAL)
|
||||
{
|
||||
this.happinessGroupDAL = happinessGroupDAL;
|
||||
this.cellGroupDAL = cellGroupDAL;
|
||||
}
|
||||
|
||||
public HappinessGroup GetHappinessGroup(string lineGroupId)
|
||||
{
|
||||
var group= happinessGroupDAL.First(c => c.CommunityAppId == lineGroupId);
|
||||
GetLineMessagingAccount(group);
|
||||
return group;
|
||||
}
|
||||
public PastoralDomain GetCellGroup(string lineGroupId)
|
||||
{
|
||||
var group = cellGroupDAL.First(c => c.CommunityAppId == lineGroupId);
|
||||
var group = cellGroupDAL.First(c => c.LineGroupId == lineGroupId);
|
||||
GetLineMessagingAccount(group);
|
||||
return group;
|
||||
}
|
||||
|
||||
private void GetLineMessagingAccount(IMessengerClient messengerClient)
|
||||
public void GetLineMessagingAccount(IMessengerClient messengerClient)
|
||||
{
|
||||
if (messengerClient != null)
|
||||
if (messengerClient != null && messengerClient.LineAccountId != null)
|
||||
{
|
||||
messengerClient.LineMessagingAccount = crudDAL.GetById(messengerClient.LineAccountId);
|
||||
}
|
||||
|
||||
240
WebAPI/Logics/PastoralDomainLogic.cs
Normal file
240
WebAPI/Logics/PastoralDomainLogic.cs
Normal file
@ -0,0 +1,240 @@
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Utility;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using WebAPI.Logics.Core;
|
||||
using WebAPI.Logics.Interface;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace WebAPI.Logics
|
||||
{
|
||||
public class PastoralDomainLogic : LogicBase<PastoralDomain>, ICrudLogic<PastoralDomain>
|
||||
{
|
||||
string[] weekTopics = new string[] { "真幸福", "真相大白", "萬世巨星", "幸福連線", "當上帝來敲門", "十字架的勝利", "釋放與自由", "幸福的教會" };
|
||||
private readonly IServiceScopeFactory serviceScopeFactory;
|
||||
private readonly ICrudDAL<CellGroupRoutineEvent> eventCrudDAL;
|
||||
private readonly ICombinedKeyCrudDAL<CellGroupRoutineEventAttendee> attendeeCrudDAL;
|
||||
private readonly ICrudDAL<FamilyMember> memberCrudDAL;
|
||||
private readonly ICrudDAL<AddressInfo> addressCrudDAL;
|
||||
private readonly ICombinedKeyCrudDAL<PastoralDomainMembers> pastoralDomainMemberDAL;
|
||||
private readonly ICrudDAL<HappinessWeek> weekCrudDAL;
|
||||
private readonly ICrudDAL<HappinessBEST> bestCrudDAL;
|
||||
private readonly ICrudDAL<HappinessTask> weekTaskCrudDAL;
|
||||
|
||||
public PastoralDomainLogic(
|
||||
IServiceScopeFactory serviceScopeFactory,
|
||||
LogicService logicService,
|
||||
ICrudDAL<PastoralDomain> crudDAL,
|
||||
ICrudDAL<CellGroupRoutineEvent> eventCrudDAL,
|
||||
ICombinedKeyCrudDAL<CellGroupRoutineEventAttendee> attendeeCrudDAL,
|
||||
ICrudDAL<FamilyMember> memberCrudDAL,
|
||||
ICrudDAL<AddressInfo> addressCrudDAL,
|
||||
ICombinedKeyCrudDAL<PastoralDomainMembers> pastoralDomainMemberDAL,
|
||||
ICrudDAL<HappinessWeek> weekCrudDAL,
|
||||
ICrudDAL<HappinessBEST> bestCrudDAL,
|
||||
ICrudDAL<HappinessTask> weekTaskCrudDAL
|
||||
) : base(logicService, crudDAL)
|
||||
{
|
||||
this.serviceScopeFactory = serviceScopeFactory;
|
||||
this.eventCrudDAL = eventCrudDAL;
|
||||
this.attendeeCrudDAL = attendeeCrudDAL;
|
||||
this.memberCrudDAL = memberCrudDAL;
|
||||
this.addressCrudDAL = addressCrudDAL;
|
||||
this.pastoralDomainMemberDAL = pastoralDomainMemberDAL;
|
||||
this.weekCrudDAL = weekCrudDAL;
|
||||
this.bestCrudDAL = bestCrudDAL;
|
||||
this.weekTaskCrudDAL = weekTaskCrudDAL;
|
||||
}
|
||||
|
||||
|
||||
#region override
|
||||
|
||||
|
||||
public override IEnumerable<PastoralDomain> GetAll(Func<PastoralDomain, bool> filter = null)
|
||||
{
|
||||
var list = base.GetAll(filter);
|
||||
foreach (var item in list)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.ServiceAddressId))
|
||||
{
|
||||
item.ServiceAddress = addressCrudDAL.GetById(item.ServiceAddressId);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.ServiceAddress = new AddressInfo();
|
||||
}
|
||||
if (item.Type == DomainType.HappinessGroup)
|
||||
{
|
||||
GetHappinessGroupInfo(item);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public override void BeforeCreate(PastoralDomain entity)
|
||||
{
|
||||
addressCrudDAL.CreateOrUpdate(entity.ServiceAddress);
|
||||
entity.ServiceAddressId = entity.ServiceAddress.Id;
|
||||
}
|
||||
public override void BeforeUpdate(PastoralDomain entity)
|
||||
{
|
||||
addressCrudDAL.CreateOrUpdate(entity.ServiceAddress);
|
||||
entity.ServiceAddressId = entity.ServiceAddress.Id;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public CellGroupRoutineEvent GetComingEvent(string domainId = null)
|
||||
{
|
||||
if (domainId == null)
|
||||
{
|
||||
var cellGroup = GetCurrentUserCellGroup();
|
||||
if (cellGroup != null)
|
||||
{
|
||||
domainId = cellGroup.Id;
|
||||
|
||||
var _event = eventCrudDAL.GetDbSet().OrderByDescending(e => e.Time)
|
||||
.Include(e => e.Attendees).Include(e => e.Prayers)
|
||||
.Where(e => e.PastoralDomainId == domainId).FirstOrDefault();
|
||||
return _event;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (domainId != null)
|
||||
{
|
||||
var _event = eventCrudDAL.GetDbSet().Where(e => e.PastoralDomainId == domainId && e.Time >= DateTime.UtcNow)
|
||||
.Include(e => e.Attendees).Include(e => e.Prayers).FirstOrDefault();
|
||||
if (_event == null)
|
||||
{
|
||||
_event = new CellGroupRoutineEvent()
|
||||
{
|
||||
Id = Format.Get33BaseGuid(),
|
||||
Time = DateTimeHelper.GetNextWeekday(DateTime.Today, DayOfWeek.Friday).AddHours(19).AddMinutes(30),
|
||||
Address = "1881 Forest Dr., Azusa, CA 91702",
|
||||
Attendees = new List<CellGroupRoutineEventAttendee>(),
|
||||
PastoralDomainId = domainId
|
||||
};
|
||||
eventCrudDAL.Create(_event);
|
||||
}
|
||||
|
||||
return _event;
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public CellGroupRoutineEvent GetLastEvent(string domainId = null)
|
||||
{
|
||||
if (domainId == null)
|
||||
{
|
||||
var cellGroup = GetCurrentUserCellGroup();
|
||||
if (cellGroup != null)
|
||||
{
|
||||
domainId = cellGroup.Id;
|
||||
|
||||
var _event = eventCrudDAL.GetDbSet().OrderByDescending(e => e.Time)
|
||||
.Include(e => e.Attendees).Include(e => e.Prayers)
|
||||
.Where(e => e.PastoralDomainId == domainId).FirstOrDefault();
|
||||
return _event;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (domainId != null)
|
||||
{
|
||||
var _event = eventCrudDAL.GetDbSet().OrderByDescending(e => e.Time)
|
||||
.Include(e => e.Attendees).Include(e => e.Prayers)
|
||||
.Where(e => e.PastoralDomainId == domainId).FirstOrDefault();
|
||||
return _event;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetMemberFirstNameById(string memberId)
|
||||
{
|
||||
return memberCrudDAL.GetById(memberId)?.FirstName;
|
||||
}
|
||||
|
||||
public IEnumerable<PastoralDomain> GetCurrentUserPastoralDomain()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(logicService.CurrentUserId))
|
||||
{
|
||||
var ids = pastoralDomainMemberDAL.GetAll(p => p.FamilyMemberId == logicService.CurrentUserId).Select(p => p.PastoralDomainId);
|
||||
return crudDAL.GetAll(p => ids.Contains(p.Id));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public PastoralDomain GetCurrentUserCellGroup()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(logicService.CurrentUserId))
|
||||
{
|
||||
var ids = pastoralDomainMemberDAL.GetAll(p => p.FamilyMemberId == logicService.CurrentUserId).Select(p => p.PastoralDomainId);
|
||||
return crudDAL.GetAll(p => ids.Contains(p.Id) && p.Type == DomainType.CellGroup).FirstOrDefault();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public int UpdateWeekInfo(HappinessWeek value)
|
||||
{
|
||||
if (value.UpdateRestWeekDate)
|
||||
{
|
||||
var list = weekCrudDAL.GetAll(week => week.SEQ >= value.SEQ && week.GroupId == value.GroupId).OrderBy(w => w.SEQ).ToList();
|
||||
var tempDate = new DateTime(value.Date.Year, value.Date.Month, value.Date.Day, value.Date.Hour, value.Date.Minute, value.Date.Second);
|
||||
int count = 0;
|
||||
foreach (var week in list)
|
||||
{
|
||||
week.Date = tempDate.AddDays(count * 7);
|
||||
week.Address = value.Address;
|
||||
week.CityAndZipCode = value.CityAndZipCode;
|
||||
week.InvitationText = value.InvitationText;
|
||||
count++;
|
||||
}
|
||||
return weekCrudDAL.UpdateRange(list);
|
||||
}
|
||||
return weekCrudDAL.CreateOrUpdate(value);
|
||||
|
||||
}
|
||||
|
||||
private HappinessWeek GetHappinessWeek(PastoralDomain group, int weekNo)
|
||||
{
|
||||
return new HappinessWeek()
|
||||
{
|
||||
GroupId = group.Id,
|
||||
Address = group.ServiceAddress.Address,
|
||||
CityAndZipCode = group.ServiceAddress.GetCSZ(),
|
||||
Date = group.ServiceTime.Value.AddDays(7 * (weekNo - 1)),
|
||||
SEQ = weekNo
|
||||
};
|
||||
}
|
||||
public void GetHappinessGroupInfo(PastoralDomain group)
|
||||
{
|
||||
group.HappinessWeeks = weekCrudDAL.GetAll(w => w.GroupId == group.Id).OrderBy(w => w.SEQ).ToList();
|
||||
if (group.HappinessWeeks == null || group.HappinessWeeks.Count() == 0)
|
||||
{
|
||||
group.HappinessWeeks = new List<HappinessWeek>();
|
||||
for (int i = 1; i <= 8; i++)
|
||||
{
|
||||
var week = GetHappinessWeek(group, i);
|
||||
group.HappinessWeeks.Add(week);
|
||||
weekCrudDAL.CreateOrUpdate(week);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var week in group.HappinessWeeks)
|
||||
{
|
||||
week.Topic = weekTopics[week.SEQ - 1];
|
||||
week.Tasks = weekTaskCrudDAL.GetAll(t => t.WeekId == week.Id).ToList();
|
||||
}
|
||||
|
||||
group.Bests = bestCrudDAL.GetAll(b => b.GroupId == group.Id).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -15,24 +15,23 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
{
|
||||
public class ArArkCellGroupDinner : IAutoReplyCommand
|
||||
{
|
||||
|
||||
private PastoralDomain pastoralDomain;
|
||||
public ArArkCellGroupDinner(
|
||||
CellGroupLogic logic)
|
||||
PastoralDomainLogic logic)
|
||||
{
|
||||
this.logic = logic;
|
||||
}
|
||||
private static readonly string[] COMMANDS = { "晚餐", "dinner" };
|
||||
|
||||
private static readonly LineGroup[] GROUPS = {
|
||||
LineGroup.Ark,
|
||||
LineGroup.Chris,
|
||||
private static readonly DomainType[] GROUPS = {
|
||||
DomainType.CellGroup,
|
||||
};
|
||||
private readonly CellGroupLogic logic;
|
||||
private readonly PastoralDomainLogic logic;
|
||||
|
||||
public string Description => "顯示方舟小組聚會晚餐";
|
||||
public string Description => "顯示小組聚會晚餐";
|
||||
public IEnumerable<string> Commands => COMMANDS;
|
||||
public IEnumerable<LineGroup> SupportGroups => GROUPS;
|
||||
public IEnumerable<string> ReplyMessage => null;
|
||||
public IEnumerable<DomainType> SupportGroups => GROUPS;
|
||||
public string ReplyTextMessage => null;
|
||||
|
||||
public IEnumerable<ILineMessage> LineMessage
|
||||
{
|
||||
@ -41,7 +40,7 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
var random = new Random();
|
||||
|
||||
List<ILineMessage> list = new List<ILineMessage>();
|
||||
var _event = logic.GetComingEvent();
|
||||
var _event = logic.GetComingEvent(pastoralDomain.Id);
|
||||
|
||||
string title = "小組晚宴,吃飯皇帝大";
|
||||
string imageUrl = "https://happiness.tours/assets/images/dinner.jpg";
|
||||
@ -191,5 +190,15 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize(PastoralDomain pastoralDomain = null)
|
||||
{
|
||||
this.pastoralDomain = pastoralDomain;
|
||||
}
|
||||
|
||||
public bool Enabled(PastoralDomain pastoralDomain = null, string command = null)
|
||||
{
|
||||
return COMMANDS.Any(c=>c.IndexOf(command)==0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using LineMessaging;
|
||||
using Church.Net.Entity;
|
||||
using LineMessaging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -9,25 +10,31 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
{
|
||||
public class ArArkCellGroupInfo : IAutoReplyCommand
|
||||
{
|
||||
private PastoralDomain pastoralDomain;
|
||||
private static readonly string[] COMMANDS = { "小組" };
|
||||
|
||||
private static readonly DomainType[] GROUPS = {
|
||||
DomainType.CellGroup,
|
||||
};
|
||||
|
||||
private static readonly string[] COMMANDS = { "方舟", "方舟小組", "ark" };
|
||||
private static readonly string[] MESSAGES = {
|
||||
public string Description => "顯示小組聚會資訊";
|
||||
public IEnumerable<string> Commands => COMMANDS;
|
||||
public string ReplyTextMessage =>
|
||||
"新生命靈糧堂 Arcadia 牧區 - 方舟小組\n" +
|
||||
"聚會時間 & 流程 周五晚上\n" +
|
||||
"07:30 PM ~ 08:30 PM - PotLuck 時光\n" +
|
||||
"08:30 PM ~ 10:00 PM - 小組分享",
|
||||
"1881 Forest Dr, Azusa, CA 91702"
|
||||
};
|
||||
private static readonly LineGroup[] GROUPS = {
|
||||
LineGroup.Ark,
|
||||
LineGroup.ArkCowoker,
|
||||
LineGroup.Chris
|
||||
};
|
||||
|
||||
public string Description => "顯示方舟小組聚會資訊";
|
||||
public IEnumerable<string> Commands => COMMANDS;
|
||||
public IEnumerable<string> ReplyMessage => MESSAGES;
|
||||
public IEnumerable<LineGroup> SupportGroups => GROUPS;
|
||||
"08:30 PM ~ 10:00 PM - 小組分享\n" +
|
||||
"1881 Forest Dr, Azusa, CA 91702";
|
||||
public IEnumerable<DomainType> SupportGroups => GROUPS;
|
||||
public IEnumerable<ILineMessage> LineMessage => null;
|
||||
|
||||
public void Initialize(PastoralDomain pastoralDomain = null)
|
||||
{
|
||||
this.pastoralDomain = pastoralDomain;
|
||||
}
|
||||
public bool Enabled(PastoralDomain pastoralDomain = null, string command = null)
|
||||
{
|
||||
return COMMANDS.Any(c => c.IndexOf(command) == 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using Church.Net.DAL.EF;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Utility;
|
||||
using Esprima;
|
||||
using LineMessaging;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
@ -15,9 +16,9 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
{
|
||||
public class ArArkCellGroupPrayer : IAutoReplyCommand
|
||||
{
|
||||
|
||||
PastoralDomain pastoralDomain;
|
||||
public ArArkCellGroupPrayer(
|
||||
CellGroupLogic logic
|
||||
PastoralDomainLogic logic
|
||||
)
|
||||
{
|
||||
this.logic = logic;
|
||||
@ -67,67 +68,15 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
}
|
||||
private static readonly string[] COMMANDS = { "禱告", "代禱", "letspray", "pray" };
|
||||
|
||||
private static readonly LineGroup[] GROUPS = {
|
||||
LineGroup.Ark,
|
||||
LineGroup.Chris,
|
||||
LineGroup.ArkCowoker,
|
||||
private static readonly DomainType[] GROUPS = {
|
||||
DomainType.CellGroup,
|
||||
};
|
||||
private readonly CellGroupLogic logic;
|
||||
private readonly PastoralDomainLogic logic;
|
||||
|
||||
public string Description => "顯示代禱事項";
|
||||
public IEnumerable<string> Commands => COMMANDS;
|
||||
public IEnumerable<LineGroup> SupportGroups => GROUPS;
|
||||
public IEnumerable<string> ReplyMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder comments = new StringBuilder();
|
||||
sb.AppendLine("方舟小組-禱告中心");
|
||||
var _event = logic.GetLastEvent();
|
||||
if (_event == null || _event.Prayers.Count == 0)
|
||||
{
|
||||
sb.AppendLine($"目前暫無禱告事項唷!");
|
||||
sb.AppendLine($"請使用方舟禱告系統,新增代禱項目唷!");
|
||||
sb.AppendLine("https://happiness.tours/CellGroup/prayer?openExternalBrowser=1");
|
||||
}
|
||||
var random = new Random();
|
||||
int index = random.Next(bibleReferrences.Count);
|
||||
var bibleSentence = bibleReferrences[index];
|
||||
|
||||
sb.AppendLine("======= 代禱事項 =======");
|
||||
foreach (var a in _event.Prayers)
|
||||
{
|
||||
var name = logic.GetMemberFirstNameById(a.MemberId);
|
||||
|
||||
sb.AppendLine($"{name} - {string.Join(", ", a.Prayer.Split('|'))}");
|
||||
//sb.AppendLine($"{logic.GetMemberFirstNameById (a.MemberId)} - ");
|
||||
//int count = 0;
|
||||
//foreach (var prayer in a.Prayer.Split('|'))
|
||||
//{
|
||||
// count++;
|
||||
// sb.AppendLine(prayer);
|
||||
|
||||
//}
|
||||
if (!string.IsNullOrWhiteSpace(a.Comment))
|
||||
{
|
||||
comments.AppendLine($"{name}:{a.Comment}");
|
||||
}
|
||||
}
|
||||
|
||||
if (comments.Length > 0)
|
||||
{
|
||||
sb.AppendLine("========= 備註 =========");
|
||||
sb.Append(comments.ToString());
|
||||
}
|
||||
|
||||
sb.AppendLine("");
|
||||
sb.AppendLine($"請使用方舟禱告系統,新增代禱項目唷!");
|
||||
sb.AppendLine("https://happiness.tours/CellGroup/prayer?openExternalBrowser=1");
|
||||
return new string[] { sb.ToString() };
|
||||
}
|
||||
}
|
||||
public IEnumerable<DomainType> SupportGroups => GROUPS;
|
||||
public string ReplyTextMessage => null;
|
||||
public IEnumerable<ILineMessage> LineMessage
|
||||
{
|
||||
get
|
||||
@ -137,7 +86,7 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
var bibleSentence = bibleReferrences[index];
|
||||
|
||||
List<ILineMessage> list = new List<ILineMessage>();
|
||||
var _event = logic.GetLastEvent();
|
||||
var _event = logic.GetLastEvent(this.pastoralDomain.Id);
|
||||
|
||||
string title = "禱告中心 普壘森特";
|
||||
string imageUrl = "https://dailyverses.net/images/tc/cuv/matthew-21-22-3.jpg";
|
||||
@ -280,6 +229,15 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
}
|
||||
|
||||
private List<BibleReferrence> bibleReferrences;
|
||||
|
||||
public void Initialize(PastoralDomain pastoralDomain = null)
|
||||
{
|
||||
this.pastoralDomain = pastoralDomain;
|
||||
}
|
||||
public bool Enabled(PastoralDomain pastoralDomain = null, string command = null)
|
||||
{
|
||||
return COMMANDS.Any(c => c.IndexOf(command) == 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using LineMessaging;
|
||||
using Church.Net.Entity;
|
||||
using LineMessaging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -11,21 +12,29 @@ namespace WebAPI.Services.AutoReplyCommands
|
||||
{
|
||||
|
||||
private static readonly string[] COMMANDS = { "教會", "church" };
|
||||
private static readonly string[] MESSAGES = {
|
||||
"新生命靈糧堂 Arcadia 牧區\n聚會時間 周日 11:00 AM - 12:30PM\n聚會後有提供精緻午餐唷!",
|
||||
"1881 S 1st Ave, Arcadia, CA 91006"
|
||||
};
|
||||
private static readonly LineGroup[] GROUPS = {
|
||||
LineGroup.Ark,
|
||||
LineGroup.ArkCowoker,
|
||||
LineGroup.Chris
|
||||
private static readonly string MESSAGES =
|
||||
"新生命靈糧堂 Arcadia 牧區\n聚會時間 周日 11:00 AM - 12:30PM\n聚會後有提供精緻午餐唷!\n"+
|
||||
"1881 S 1st Ave, Arcadia, CA 91006";
|
||||
private static readonly DomainType[] GROUPS = {
|
||||
DomainType.HappinessGroup,
|
||||
DomainType.CellGroup
|
||||
};
|
||||
|
||||
public string Description => "顯示教會主日聚會資訊";
|
||||
public IEnumerable<string> Commands => COMMANDS;
|
||||
public IEnumerable<string> ReplyMessage => MESSAGES;
|
||||
public string ReplyTextMessage => MESSAGES;
|
||||
|
||||
public IEnumerable<LineGroup> SupportGroups => GROUPS;
|
||||
public IEnumerable<ILineMessage> LineMessage => null;
|
||||
|
||||
IEnumerable<DomainType> IAutoReplyCommand.SupportGroups => GROUPS;
|
||||
|
||||
public bool Enabled(PastoralDomain pastoralDomain = null, string command = null)
|
||||
{
|
||||
return COMMANDS.Any(c => c.IndexOf(command) == 0);
|
||||
}
|
||||
|
||||
public void Initialize(PastoralDomain pastoralDomain = null)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
199
WebAPI/Services/AutoReplyCommands/ArHappinessGroupTask.cs
Normal file
199
WebAPI/Services/AutoReplyCommands/ArHappinessGroupTask.cs
Normal file
@ -0,0 +1,199 @@
|
||||
using Church.Net.DAL.EF;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Utility;
|
||||
using LineMessaging;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WebAPI.Logics;
|
||||
using WebAPI.Services.Interfaces;
|
||||
|
||||
namespace WebAPI.Services.AutoReplyCommands
|
||||
{
|
||||
public class ArHappinessGroupTask : IAutoReplyCommand
|
||||
{
|
||||
private PastoralDomain pastoralDomain;
|
||||
public ArHappinessGroupTask(
|
||||
PastoralDomainLogic logic)
|
||||
{
|
||||
this.logic = logic;
|
||||
}
|
||||
private static readonly string[] COMMANDS = { "分工", "分工#" };
|
||||
|
||||
private static readonly DomainType[] GROUPS = {
|
||||
DomainType.HappinessGroup,
|
||||
};
|
||||
private readonly PastoralDomainLogic logic;
|
||||
|
||||
public string Description => "顯示幸福小組分工表 #代表周數";
|
||||
public IEnumerable<string> Commands => COMMANDS;
|
||||
public IEnumerable<DomainType> SupportGroups => GROUPS;
|
||||
public string ReplyTextMessage => null;
|
||||
|
||||
public IEnumerable<ILineMessage> LineMessage
|
||||
{
|
||||
get
|
||||
{
|
||||
var random = new Random();
|
||||
|
||||
List<ILineMessage> list = new List<ILineMessage>();
|
||||
string title = $"W{weekSeq} {week.Topic} 分工表";
|
||||
string imageUrl = $"https://happiness.tours/assets/images/HappinessGroup/week0{weekSeq}.jpg";
|
||||
var flexMessage = new LineFlexMessage();
|
||||
flexMessage.AltText = title;
|
||||
|
||||
#region Header
|
||||
var headerContent = flexMessage.Contents.InitHeader();
|
||||
headerContent.Add(
|
||||
new LineFlexText(title)
|
||||
{
|
||||
Size = FlexObjectSize.lg,
|
||||
Weight = FlexObjectTextWeidht.Bold,
|
||||
Align = "center"
|
||||
});
|
||||
#endregion
|
||||
#region Hero
|
||||
flexMessage.Contents.InitHero()
|
||||
.Add(
|
||||
new LineFlexImage(imageUrl)
|
||||
{
|
||||
Size = FlexObjectSize.full,
|
||||
AspectRatio = "1.5:1"
|
||||
}
|
||||
);
|
||||
#endregion
|
||||
#region Body
|
||||
|
||||
var bodyContent = flexMessage.Contents.InitBody();
|
||||
|
||||
TimeSpan ts = week.Date - DateTime.Now;
|
||||
Console.WriteLine("No. of Minutes (Difference) = {0}", ts.TotalMinutes);
|
||||
bodyContent.Add(
|
||||
new LineFlexText($"再過 {ts.TotalMinutes.ToString("N0")} 分鐘,就是萬眾期待的幸福小組啦!!!")
|
||||
{
|
||||
Size = FlexObjectSize.md,
|
||||
Weight = FlexObjectTextWeidht.Regular,
|
||||
OffsetBottom = FlexObjectSize.xxl,
|
||||
Wrap = true
|
||||
});
|
||||
//bodyContent.Add(
|
||||
// new LineFlexText($"{_event.Time.ToString("MM/dd HH:mm tt")} 準時開飯唷!!")
|
||||
// {
|
||||
// Size = FlexObjectSize.md,
|
||||
// Weight = FlexObjectTextWeidht.Regular,
|
||||
// OffsetBottom = FlexObjectSize.xl,
|
||||
// Wrap = true
|
||||
// });
|
||||
|
||||
bodyContent.Add(
|
||||
new LineFlexText("分工明細")
|
||||
{
|
||||
Size = FlexObjectSize.md,
|
||||
Weight = FlexObjectTextWeidht.Bold,
|
||||
OffsetBottom = FlexObjectSize.md
|
||||
});
|
||||
//$"目前暫無禱告事項唷, 趕快來新增代禱事項吧!!"
|
||||
List<LineFlexBox> comments = new List<LineFlexBox>();
|
||||
|
||||
foreach (var a in week.Tasks)
|
||||
{
|
||||
var name = string.IsNullOrEmpty(a.Tasker)?"N/A": a.Tasker;// logic.GetMemberFirstNameById(a.MemberId);
|
||||
|
||||
var baseLineBox = new LineFlexBox()
|
||||
{
|
||||
Layout = FlexObjectBoxLayout.Baseline,
|
||||
};
|
||||
baseLineBox.Contents.Add(
|
||||
new LineFlexText(a.Type.EnumToDescriptionString())
|
||||
{
|
||||
Size = FlexObjectSize.sm,
|
||||
Color = "#aaaaaa",
|
||||
Flex = 3
|
||||
});
|
||||
baseLineBox.Contents.Add(
|
||||
new LineFlexText(
|
||||
$"{name}"
|
||||
|
||||
)
|
||||
{
|
||||
Size = FlexObjectSize.sm,
|
||||
Color = "#666666",
|
||||
Flex = 3,
|
||||
Wrap = true
|
||||
});
|
||||
baseLineBox.Contents.Add(
|
||||
new LineFlexText(
|
||||
$"內容:{a.Content}"
|
||||
|
||||
)
|
||||
{
|
||||
Size = FlexObjectSize.sm,
|
||||
Color = "#666666",
|
||||
Flex = 7,
|
||||
Wrap = true
|
||||
});
|
||||
bodyContent.Add(baseLineBox);
|
||||
|
||||
}
|
||||
|
||||
bodyContent.Add(new LineFlexSeparator());
|
||||
#endregion
|
||||
#region Footer
|
||||
//flexMessage.Contents.InitFooter()
|
||||
// .Add(
|
||||
// new LineFlexButton()
|
||||
// {
|
||||
// Action = new UriAction()
|
||||
// {
|
||||
// Uri = "https://happiness.tours/CellGroup/dinner?openExternalBrowser=1",
|
||||
// Label = "我的菜單"
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
|
||||
#endregion
|
||||
|
||||
list.Insert(0, flexMessage);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize(PastoralDomain pastoralDomain = null)
|
||||
{
|
||||
this.pastoralDomain = pastoralDomain;
|
||||
}
|
||||
private int weekSeq = 0;
|
||||
private HappinessWeek week = null;
|
||||
public bool Enabled(PastoralDomain pastoralDomain = null, string command = null)
|
||||
{
|
||||
|
||||
if (pastoralDomain != null && COMMANDS.Any(c => c.IndexOf(command) == 0))
|
||||
{
|
||||
|
||||
this.pastoralDomain = pastoralDomain;
|
||||
command = command.Replace("分工", "");
|
||||
|
||||
if (command.Length > 0)
|
||||
{
|
||||
weekSeq = int.Parse(command);
|
||||
}
|
||||
logic.GetHappinessGroupInfo(pastoralDomain);
|
||||
if (weekSeq > 0)
|
||||
{
|
||||
week = pastoralDomain.HappinessWeeks.Where(w => w.SEQ == weekSeq).FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
week = pastoralDomain.HappinessWeeks.Where(w => w.Date >= DateTime.UtcNow).FirstOrDefault();
|
||||
weekSeq = week.SEQ;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,26 +1,44 @@
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.DAL.EFCoreDBF;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Utility;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using System.Collections.Generic;
|
||||
using WebAPI.Logics;
|
||||
|
||||
namespace WebAPI.Services
|
||||
{
|
||||
public class IdentityService
|
||||
{
|
||||
public string UserAccessToken { get; set; }
|
||||
public string UserId { get; set; }
|
||||
private readonly IHttpContextAccessor httpContextAccessor;
|
||||
|
||||
public PastoralDomain CellGroup
|
||||
public IdentityService(
|
||||
IHttpContextAccessor httpContextAccessor
|
||||
)
|
||||
{
|
||||
this.httpContextAccessor = httpContextAccessor;
|
||||
}
|
||||
public string UserAccessToken
|
||||
{
|
||||
get
|
||||
{
|
||||
return httpContextAccessor.HttpContext.Request.Headers["accessToken"];
|
||||
}
|
||||
}
|
||||
private string _UserId;
|
||||
|
||||
public string UserId
|
||||
{
|
||||
get {
|
||||
|
||||
TokenHelper.GetUserIdFromToken
|
||||
return null; }
|
||||
if (string.IsNullOrWhiteSpace(_UserId))
|
||||
{
|
||||
_UserId = TokenHelper.GetUserIdFromToken(UserAccessToken);
|
||||
}
|
||||
return _UserId;
|
||||
}
|
||||
set {
|
||||
_UserId = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
using LineMessaging;
|
||||
using Church.Net.Entity;
|
||||
using LineMessaging;
|
||||
using NuGet.Protocol.Plugins;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -10,8 +12,10 @@ namespace WebAPI.Services.Interfaces
|
||||
{
|
||||
string Description { get; }
|
||||
IEnumerable<string> Commands { get; }
|
||||
IEnumerable<string> ReplyMessage { get; }
|
||||
IEnumerable<LineGroup> SupportGroups { get; }
|
||||
string ReplyTextMessage { get; }
|
||||
IEnumerable<DomainType> SupportGroups { get; }
|
||||
IEnumerable<ILineMessage> LineMessage { get; }
|
||||
bool Enabled(PastoralDomain pastoralDomain = null, string command = null);
|
||||
void Initialize(PastoralDomain pastoralDomain = null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using Church.Net.Entity.Messenger;
|
||||
using Church.Net.Entity;
|
||||
using Church.Net.Entity.Messenger;
|
||||
using Church.Net.Utility;
|
||||
using LineMessaging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
@ -9,6 +10,7 @@ using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WebAPI.Logics;
|
||||
using WebAPI.Logics.Interface;
|
||||
using WebAPI.Services.Interfaces;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
@ -22,6 +24,8 @@ namespace WebAPI.Services
|
||||
Ark = 1 << 0,
|
||||
[Description("Ca20e3b65aa58e676815eb13c3222591a")]
|
||||
ArkCowoker = 1 << 1,
|
||||
PastoralDomain = 1 << 2,
|
||||
HappinessGroup = 1 << 3,
|
||||
[Description("U97e9e579a41a5222e33bf68a3bf479a0")]
|
||||
Chris = ~(~0 << 20),
|
||||
}
|
||||
@ -30,20 +34,26 @@ namespace WebAPI.Services
|
||||
private readonly IEnumerable<IAutoReplyCommand> autoReplyCommands;
|
||||
private readonly ILoggingService loggingService;
|
||||
private readonly ICrudLogic<LineMessageClient> clientLogic;
|
||||
private readonly LineMessagingAccountLogic lineMessagingAccountLogic;
|
||||
private string chatToken;
|
||||
|
||||
private PastoralDomain cellGroup;
|
||||
|
||||
public LineAutoBotService(
|
||||
IEnumerable<IAutoReplyCommand> autoReplyCommands,
|
||||
ILoggingService loggingService,
|
||||
ICrudLogic<LineMessageClient> clientLogic
|
||||
ICrudLogic<LineMessageClient> clientLogic,
|
||||
LineMessagingAccountLogic lineMessagingAccountLogic
|
||||
)
|
||||
{
|
||||
this.autoReplyCommands = autoReplyCommands;
|
||||
this.loggingService = loggingService;
|
||||
this.clientLogic = clientLogic;
|
||||
this.lineMessagingAccountLogic = lineMessagingAccountLogic;
|
||||
}
|
||||
public void SendTextMessage(string text, LineGroup target)
|
||||
{
|
||||
var test = new LineMessagingClient();
|
||||
var test = new LineMessagingClient(this.chatToken);
|
||||
|
||||
try
|
||||
{
|
||||
@ -57,27 +67,27 @@ namespace WebAPI.Services
|
||||
}
|
||||
|
||||
}
|
||||
public async Task<bool> ReplyTextMessage(string replyToken, IEnumerable<string> textMessages)
|
||||
public async Task<bool> ReplyTextMessage(string lineId, string textMessages)
|
||||
{
|
||||
var test = new LineMessagingClient();
|
||||
var test = new LineMessagingClient(this.chatToken);
|
||||
|
||||
var replyMessage = new LineReplyMessage() { ReplyToken = replyToken };
|
||||
var messages = new List<ILineMessage>();
|
||||
foreach (var message in textMessages)
|
||||
{
|
||||
messages.Add(new LineTextMessage() { Text = message });
|
||||
}
|
||||
replyMessage.Messages = messages;
|
||||
//var replyMessage = new LineReplyMessage() { ReplyToken = replyToken };
|
||||
//var messages = new List<ILineMessage>();
|
||||
//foreach (var message in textMessages)
|
||||
//{
|
||||
// messages.Add(new LineTextMessage() { Text = message });
|
||||
//}
|
||||
//replyMessage.Messages = messages;
|
||||
//test.ReplyMessage(replyMessage);
|
||||
|
||||
try
|
||||
{
|
||||
await test.ReplyMessage(replyMessage);
|
||||
await test.PushMessage(lineId, new LineTextMessage() { Text = textMessages });
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.loggingService.Error(ex, "ReplyTextMessage:75", JsonConvert.SerializeObject(replyMessage, Formatting.Indented));
|
||||
this.loggingService.Error(ex, "ReplyTextMessage:75", textMessages);
|
||||
|
||||
if (ex.Message == "You have reached your monthly limit.")
|
||||
{
|
||||
@ -86,11 +96,11 @@ namespace WebAPI.Services
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public async Task<bool> ReplyLineMessage(string replyToken, IEnumerable<ILineMessage> lineMessages)
|
||||
public async Task<bool> ReplyLineMessage(string lineId, IEnumerable<ILineMessage> lineMessages)
|
||||
{
|
||||
var test = new LineMessagingClient();
|
||||
var test = new LineMessagingClient(this.chatToken);
|
||||
|
||||
var replyMessage = new LinePushMessage() { To = replyToken };
|
||||
var replyMessage = new LinePushMessage() { To = lineId };
|
||||
replyMessage.Messages = lineMessages;
|
||||
|
||||
try
|
||||
@ -112,8 +122,9 @@ namespace WebAPI.Services
|
||||
|
||||
}
|
||||
|
||||
public async Task<bool> AutoReply(LineWebhookContent content)
|
||||
public async Task<bool> AutoReply(LineMessagingAccount lineAccount, LineWebhookContent content)
|
||||
{
|
||||
chatToken = lineAccount.ChatToken;
|
||||
loggingService.Log("AutoReply", content);
|
||||
try
|
||||
{
|
||||
@ -127,7 +138,7 @@ namespace WebAPI.Services
|
||||
string text = e.Message.Text;
|
||||
string target = "";
|
||||
bool isGroup = true;
|
||||
var client = new LineMessagingClient();
|
||||
var client = new LineMessagingClient(this.chatToken);
|
||||
switch (e.Source.Type)
|
||||
{
|
||||
case WebhookRequestSourceType.User:
|
||||
@ -136,58 +147,74 @@ namespace WebAPI.Services
|
||||
break;
|
||||
case WebhookRequestSourceType.Group:
|
||||
target = e.Source.GroupId;
|
||||
|
||||
cellGroup = lineMessagingAccountLogic.GetCellGroup(target);
|
||||
break;
|
||||
case WebhookRequestSourceType.Room:
|
||||
target = e.Source.RoomId;
|
||||
break;
|
||||
default:
|
||||
target = e.Source.RoomId;
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
if (isGroup)
|
||||
{
|
||||
if (clientLogic.First(c => c.ClientId == e.Source.GroupId) == null)
|
||||
{
|
||||
clientLogic.CreateOrUpdate(new LineMessageClient()
|
||||
{
|
||||
ClientId = target,
|
||||
Name = client.GetGroupProfile(e.Source.GroupId).Result.GroupName,
|
||||
IsGroup = true
|
||||
}, out string id);
|
||||
}
|
||||
//TODO:Get user by user id under group
|
||||
}
|
||||
else
|
||||
{
|
||||
if (clientLogic.First(c => c.ClientId == e.Source.UserId) == null)
|
||||
{
|
||||
|
||||
clientLogic.CreateOrUpdate(new LineMessageClient()
|
||||
try
|
||||
{
|
||||
|
||||
if (isGroup)
|
||||
{
|
||||
if (clientLogic.First(c => c.ClientId == e.Source.GroupId) == null)
|
||||
{
|
||||
ClientId = target,
|
||||
Name = client.GetProfile(e.Source.UserId).Result.DisplayName,
|
||||
IsGroup = false
|
||||
}, out string id);
|
||||
clientLogic.CreateOrUpdate(new LineMessageClient()
|
||||
{
|
||||
ClientId = target,
|
||||
Name = client.GetGroupProfile(e.Source.GroupId).Result.GroupName,
|
||||
IsGroup = true
|
||||
}, out string id);
|
||||
}
|
||||
//TODO:Get user by user id under group
|
||||
}
|
||||
else
|
||||
{
|
||||
if (clientLogic.First(c => c.ClientId == e.Source.UserId) == null)
|
||||
{
|
||||
|
||||
clientLogic.CreateOrUpdate(new LineMessageClient()
|
||||
{
|
||||
ClientId = target,
|
||||
Name = client.GetProfile(e.Source.UserId).Result.DisplayName,
|
||||
IsGroup = false
|
||||
}, out string id);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(replyToken) && text.IndexOf("#") == 0)
|
||||
{
|
||||
text = text.ToLower().Substring(1);
|
||||
var group = EnumHelper.GetEnumValueFromDescription<LineGroup>(target);
|
||||
LineGroup group = LineGroup.Chris;
|
||||
|
||||
var autoReply = autoReplyCommands.Where(ar => ar.SupportGroups.Contains(group) && ar.Commands.Contains(text)).FirstOrDefault();
|
||||
if (cellGroup == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var autoReply = autoReplyCommands.Where(ar =>
|
||||
ar.SupportGroups.Contains(cellGroup.Type) &&
|
||||
ar.Enabled(cellGroup, text)
|
||||
).FirstOrDefault();
|
||||
if (autoReply != null)
|
||||
{
|
||||
|
||||
if (autoReply.LineMessage != null)
|
||||
{
|
||||
await ReplyLineMessage(target, autoReply.LineMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyTextMessage(replyToken, autoReply.ReplyMessage);
|
||||
await ReplyTextMessage(replyToken, autoReply.ReplyTextMessage);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -195,13 +222,13 @@ namespace WebAPI.Services
|
||||
else if (text == "help" || text == "?")
|
||||
{
|
||||
StringBuilder commandText = new StringBuilder();
|
||||
commandText.AppendLine("方舟資訊部 - 指令清單");
|
||||
foreach (var ar in autoReplyCommands.Where(ar => ar.SupportGroups.Contains(group)))
|
||||
commandText.AppendLine("NLCC資訊部 - 指令清單");
|
||||
foreach (var ar in autoReplyCommands.Where(ar => ar.SupportGroups.Contains(cellGroup.Type)))
|
||||
{
|
||||
commandText.AppendLine($"{string.Join(", ", ar.Commands.Select(s => $"#{s}"))} - {ar.Description}");
|
||||
}
|
||||
commandText.Append($"#help, #? - 顯示指令清單");
|
||||
await ReplyTextMessage(replyToken, new string[] { commandText.ToString() });
|
||||
await ReplyTextMessage(replyToken, commandText.ToString());
|
||||
}
|
||||
|
||||
|
||||
@ -210,11 +237,11 @@ namespace WebAPI.Services
|
||||
|
||||
|
||||
}
|
||||
else if (e.Message.Type == MessageType.Sticker && e.Source.GroupId == LineGroup.Ark.EnumToDescriptionString() && e.Message.PackageId == "1011092" && e.Message.StickerId == "510712")
|
||||
{
|
||||
//else if (e.Message.Type == MessageType.Sticker && e.Source.GroupId == LineGroup.Ark.EnumToDescriptionString() && e.Message.PackageId == "1011092" && e.Message.StickerId == "510712")
|
||||
//{
|
||||
|
||||
await ReplyLineMessage(e.Source.GroupId, autoReplyCommands.Where(ar => ar.Commands.Contains("pray")).FirstOrDefault().LineMessage);
|
||||
}
|
||||
// await ReplyLineMessage(e.Source.GroupId, autoReplyCommands.Where(ar => ar.Commands.Contains("pray")).FirstOrDefault().LineMessage);
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
@ -229,7 +256,7 @@ namespace WebAPI.Services
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> PushCommandMessage(LineGroup group, string command)
|
||||
public async Task<bool> PushCommandMessage(PastoralDomain group, string command)
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -238,32 +265,34 @@ namespace WebAPI.Services
|
||||
{
|
||||
command = command.ToLower().Substring(1);
|
||||
|
||||
var autoReply = autoReplyCommands.Where(ar => ar.SupportGroups.Contains(group) && ar.Commands.Contains(command)).FirstOrDefault();
|
||||
var autoReply = autoReplyCommands.Where(ar =>
|
||||
ar.SupportGroups.Contains(cellGroup.Type) &&
|
||||
ar.Enabled(cellGroup, command)).FirstOrDefault();
|
||||
if (autoReply != null)
|
||||
{
|
||||
|
||||
if (autoReply.LineMessage != null)
|
||||
{
|
||||
await ReplyLineMessage(group.EnumToDescriptionString(), autoReply.LineMessage);
|
||||
await ReplyLineMessage(cellGroup.LineGroupId, autoReply.LineMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
await ReplyTextMessage(group.EnumToDescriptionString(), autoReply.ReplyMessage);
|
||||
await ReplyTextMessage(cellGroup.LineGroupId, autoReply.ReplyTextMessage);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else if (command == "help" || command == "?")
|
||||
{
|
||||
StringBuilder commandText = new StringBuilder();
|
||||
commandText.AppendLine("方舟資訊部 - 指令清單");
|
||||
foreach (var ar in autoReplyCommands.Where(ar => ar.SupportGroups.Contains(group)))
|
||||
{
|
||||
commandText.AppendLine($"{string.Join(", ", ar.Commands.Select(s => $"#{s}"))} - {ar.Description}");
|
||||
}
|
||||
commandText.Append($"#help, #? - 顯示指令清單");
|
||||
await ReplyTextMessage(group.EnumToDescriptionString(), new string[] { commandText.ToString() });
|
||||
}
|
||||
//else if (command == "help" || command == "?")
|
||||
//{
|
||||
// StringBuilder commandText = new StringBuilder();
|
||||
// commandText.AppendLine("方舟資訊部 - 指令清單");
|
||||
// foreach (var ar in autoReplyCommands.Where(ar => ar.SupportGroups.Contains(group)))
|
||||
// {
|
||||
// commandText.AppendLine($"{string.Join(", ", ar.Commands.Select(s => $"#{s}"))} - {ar.Description}");
|
||||
// }
|
||||
// commandText.Append($"#help, #? - 顯示指令清單");
|
||||
// await ReplyTextMessage(group.EnumToDescriptionString(), new string[] { commandText.ToString() });
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
using Church.Net.Utility;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using WebAPI.Logics;
|
||||
using WebAPI.Services.Interfaces;
|
||||
|
||||
namespace WebAPI.Services.ScheduledTask
|
||||
@ -9,14 +10,17 @@ namespace WebAPI.Services.ScheduledTask
|
||||
{
|
||||
private readonly LineAutoBotService lineAutoBotService;
|
||||
private readonly ILoggingService loggingService;
|
||||
private readonly PastoralDomainLogic pastoralDomainLogic;
|
||||
private DateTime? nextRunningTime = null;
|
||||
public MorningPrayer(
|
||||
LineAutoBotService lineAutoBotService,
|
||||
ILoggingService loggingService
|
||||
ILoggingService loggingService,
|
||||
PastoralDomainLogic pastoralDomainLogic
|
||||
)
|
||||
{
|
||||
this.lineAutoBotService = lineAutoBotService;
|
||||
this.loggingService = loggingService;
|
||||
this.pastoralDomainLogic = pastoralDomainLogic;
|
||||
this.SetNextRunningTime();
|
||||
}
|
||||
public string Description => "Sent out Ark Morning Prayer";
|
||||
@ -35,7 +39,17 @@ namespace WebAPI.Services.ScheduledTask
|
||||
public Task<bool> RunTask()
|
||||
{
|
||||
SetNextRunningTime();
|
||||
return lineAutoBotService.PushCommandMessage(LineGroup.Ark, "#pray");
|
||||
|
||||
return Task.Run(async () =>
|
||||
{
|
||||
var list = pastoralDomainLogic.GetAll(p => p.Type == Church.Net.Entity.DomainType.CellGroup);
|
||||
foreach (var group in list)
|
||||
{
|
||||
await lineAutoBotService.PushCommandMessage(group, "#pray");
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
}
|
||||
private void SetNextRunningTime()
|
||||
{
|
||||
|
||||
@ -7,23 +7,21 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Church.Net.Utility;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace WebAPI.Services
|
||||
{
|
||||
public class WorkerService : BackgroundService
|
||||
{
|
||||
private IEnumerable<IScheduledTask> scheduledTasks;
|
||||
private ILoggingService loggingService;
|
||||
private readonly IServiceProvider serviceProvider;
|
||||
private readonly IWebHostEnvironment env;
|
||||
private static bool initialized = false;
|
||||
|
||||
public WorkerService(
|
||||
IEnumerable<IScheduledTask> scheduledTasks,
|
||||
ILoggingService loggingService
|
||||
IServiceProvider serviceProvider
|
||||
)
|
||||
{
|
||||
this.scheduledTasks = scheduledTasks;
|
||||
this.loggingService = loggingService;
|
||||
this.serviceProvider = serviceProvider;
|
||||
}
|
||||
private const int generalDelay = 5 * 60 * 1000; // 10 seconds
|
||||
|
||||
@ -48,21 +46,28 @@ namespace WebAPI.Services
|
||||
//}
|
||||
|
||||
var now = DateTimeHelper.Now();
|
||||
foreach (var worker in scheduledTasks)
|
||||
|
||||
using (var scope = serviceProvider.CreateScope())
|
||||
{
|
||||
try
|
||||
var scheduledTasks = scope.ServiceProvider.GetRequiredService<IEnumerable<IScheduledTask>>();
|
||||
var loggingService = scope.ServiceProvider.GetRequiredService<ILoggingService>();
|
||||
foreach (var worker in scheduledTasks)
|
||||
{
|
||||
if (worker.CheckTime(now))
|
||||
try
|
||||
{
|
||||
loggingService.Log($"Running {worker.Description}");
|
||||
await worker.RunTask();
|
||||
if (worker.CheckTime(now))
|
||||
{
|
||||
loggingService.Log($"Running {worker.Description}");
|
||||
await worker.RunTask();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
loggingService.Error(ex, worker.Description);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
loggingService.Error(ex, worker.Description);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return "Done";
|
||||
}
|
||||
|
||||
@ -45,6 +45,7 @@ namespace WebAPI
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
|
||||
services.AddHttpContextAccessor();
|
||||
|
||||
services.AddControllers().AddNewtonsoftJson(options =>
|
||||
{
|
||||
@ -63,33 +64,34 @@ 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(_ => new DatabaseOptions { ConnectionString = "Host=192.168.86.131;Port=49154;Database=ChurchSandbox;Username=chris;Password=1124" });
|
||||
//services.AddSingleton<ChurchNetContext>(new ChurchNetContext());
|
||||
services.AddDbContext<ChurchNetContext>(options =>
|
||||
options.UseNpgsql(
|
||||
//Configuration.GetConnectionString()
|
||||
"Host=192.168.86.131;Port=49154;Database=Church;Username=chris;Password=1124"
|
||||
"Host=192.168.86.131;Port=49154;Database=ChurchSandbox;Username=chris;Password=1124"
|
||||
));
|
||||
|
||||
services.AddSingleton<LineAutoBotService>();
|
||||
services.AddSingleton<IAutoReplyCommand, ArChurchInfo>();
|
||||
services.AddSingleton<IAutoReplyCommand, ArArkCellGroupInfo>();
|
||||
services.AddSingleton<IAutoReplyCommand, ArArkCellGroupDinner>();
|
||||
services.AddSingleton<IAutoReplyCommand, ArArkCellGroupPrayer>();
|
||||
|
||||
services.AddSingleton<IScheduledTask, MorningPrayer>();
|
||||
services.AddScoped<LineAutoBotService>();
|
||||
services.AddScoped<IAutoReplyCommand, ArChurchInfo>();
|
||||
services.AddScoped<IAutoReplyCommand, ArArkCellGroupInfo>();
|
||||
services.AddScoped<IAutoReplyCommand, ArArkCellGroupDinner>();
|
||||
services.AddScoped<IAutoReplyCommand, ArArkCellGroupPrayer>();
|
||||
services.AddScoped<IAutoReplyCommand, ArHappinessGroupTask>();
|
||||
|
||||
services.AddScoped<IScheduledTask, MorningPrayer>();
|
||||
|
||||
|
||||
services.AddSingleton<VideoDownloadLogic>();
|
||||
services.AddSingleton<LogicService>();
|
||||
services.AddSingleton<CellGroupLogic>();
|
||||
services.AddSingleton(typeof(ICrudLogic<>), typeof(LogicBase<>));
|
||||
services.AddSingleton(typeof(ICrudDAL<>), typeof(CrudDALCBase<>));
|
||||
services.AddSingleton(typeof(ICombinedKeyCrudLogic<>), typeof(CombinedKeyLogicBase<>));
|
||||
services.AddSingleton(typeof(ICombinedKeyCrudDAL<>), typeof(CombinedKeyCrudDALCBase<>));
|
||||
services.AddSingleton<HappinessGroupLogic>();
|
||||
services.AddSingleton<LineMessagingAccountLogic>();
|
||||
services.AddSingleton<ILoggingService, DbLoggingService>();
|
||||
services.AddScoped<VideoDownloadLogic>();
|
||||
services.AddScoped<LogicService>();
|
||||
services.AddScoped<PastoralDomainLogic>();
|
||||
services.AddScoped(typeof(ICrudLogic<>), typeof(LogicBase<>));
|
||||
services.AddScoped(typeof(ICrudDAL<>), typeof(CrudDALCBase<>));
|
||||
services.AddScoped(typeof(ICombinedKeyCrudLogic<>), typeof(CombinedKeyLogicBase<>));
|
||||
services.AddScoped(typeof(ICombinedKeyCrudDAL<>), typeof(CombinedKeyCrudDALCBase<>));
|
||||
services.AddScoped<LineMessagingAccountLogic>();
|
||||
services.AddScoped<ILoggingService, DbLoggingService>();
|
||||
services.AddScoped<IdentityService>();
|
||||
|
||||
|
||||
@ -98,6 +100,11 @@ namespace WebAPI
|
||||
//services.AddMvc(o => o.Filters.Add(new HandleExceptionFilter(services.BuildServiceProvider().GetService<ILoggingService>())));
|
||||
//services.BuildServiceProvider().GetService<ILoggingService>();
|
||||
services.AddSingleton<IAuthorizationMiddlewareResultHandler, BasicAuthorizationMiddlewareResultHandler>();
|
||||
|
||||
//ObjectFactory.Initialize(x =>
|
||||
// x.For<HttpContextBase>()
|
||||
// .HybridHttpOrThreadLocalScoped()
|
||||
// .Use(() => new HttpContextWrapper(HttpContext.Current));
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user