mirror of
https://github.com/yawaflua/PL_JusticeBot.git
synced 2025-12-09 20:09:31 +02:00
pisua
This commit is contained in:
@@ -92,6 +92,7 @@ namespace DiscordApp.Justice.Interactions
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
await FollowupAsync($"У {passportId} указан неправильный номер паспорта.", ephemeral: true);
|
await FollowupAsync($"У {passportId} указан неправильный номер паспорта.", ephemeral: true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ using DiscordApp.Database.Tables;
|
|||||||
using DiscordApp.Enums;
|
using DiscordApp.Enums;
|
||||||
using spworlds.Types;
|
using spworlds.Types;
|
||||||
using DiscordApp.Justice.Modals;
|
using DiscordApp.Justice.Modals;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace DiscordApp.Justice.Interactions
|
namespace DiscordApp.Justice.Interactions
|
||||||
{
|
{
|
||||||
public class PassportInteraction : InteractionModuleBase<SocketInteractionContext>
|
public class PassportInteraction : InteractionModuleBase<SocketInteractionContext>
|
||||||
@@ -34,7 +36,7 @@ namespace DiscordApp.Justice.Interactions
|
|||||||
await FollowupAsync("Нажмите на кнопку ниже", components: new ComponentBuilder().WithButton(new ButtonBuilder("Кнопочка", "reNewPassportButton")).Build(), ephemeral: true);
|
await FollowupAsync("Нажмите на кнопку ниже", components: new ComponentBuilder().WithButton(new ButtonBuilder("Кнопочка", "reNewPassportButton")).Build(), ephemeral: true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var passport = Startup.appDbContext.Passport.Where(x => x.Id == passportId).FirstOrDefault();
|
var passport = Startup.appDbContext.Passport.Where(x => x.Id == passportId).FirstOrDefault();
|
||||||
if (passport == null) { await FollowupAsync("ID паспорта не правильный, или не существует.", ephemeral: true); return; }
|
if (passport == null) { await FollowupAsync("ID паспорта не правильный, или не существует.", ephemeral: true); return; }
|
||||||
|
|
||||||
@@ -123,15 +125,25 @@ namespace DiscordApp.Justice.Interactions
|
|||||||
Random random = new();
|
Random random = new();
|
||||||
User spUser = await User.CreateUser(name);
|
User spUser = await User.CreateUser(name);
|
||||||
|
|
||||||
DateTimeOffset toTime = DateTime.Now.AddDays(_AddDays);
|
DateTimeOffset toTime;
|
||||||
DateTime birthDate;
|
DateOnly birthDate;
|
||||||
int id = random.Next(00001, 99999);
|
int id = random.Next(00001, 99999);
|
||||||
while (id.ToString().Length < 5) { id = random.Next(00001, 99999); }
|
while (id.ToString().Length < 5) { id = random.Next(00001, 99999); }
|
||||||
long unixTime = toTime.ToUnixTimeSeconds();
|
long unixBirthDateTime;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
birthDate = DateTime.Parse(birthday);
|
birthDate = DateOnly.Parse(birthday);
|
||||||
|
unixBirthDateTime = DateTimeOffset.Parse(birthDate.ToString()).ToUnixTimeSeconds();
|
||||||
|
if (birthDate.AddDays(14) < DateOnly.FromDateTime(DateTime.Now))
|
||||||
|
{
|
||||||
|
await FollowupAsync($"Возможно, игрок {name} больше не новичек, и бесплатный паспорт ему не положен! Оформляю паспорт на месяц...", ephemeral: true);
|
||||||
|
toTime = DateTimeOffset.Now.AddMonths(2);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
toTime = DateTimeOffset.Now.AddDays(14);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -164,15 +176,15 @@ namespace DiscordApp.Justice.Interactions
|
|||||||
Employee = user.Id,
|
Employee = user.Id,
|
||||||
RpName = RpName,
|
RpName = RpName,
|
||||||
Gender = gender,
|
Gender = gender,
|
||||||
Date = unixTime,
|
Date = toTime.ToUnixTimeSeconds(),
|
||||||
birthDate = ((DateTimeOffset)birthDate).ToUnixTimeSeconds(),
|
birthDate = unixBirthDateTime,
|
||||||
Applicant = name,
|
Applicant = name,
|
||||||
Id = id,
|
Id = id,
|
||||||
Support = supporter
|
Support = supporter
|
||||||
};
|
};
|
||||||
Reports report = new()
|
Reports report = new()
|
||||||
{
|
{
|
||||||
Employee = ((IGuildUser)Context.User).DisplayName,
|
Employee = Startup.sp.GetUser(Context.User.Id.ToString()).Result.Name,
|
||||||
type = Types.ReportTypes.editPassport
|
type = Types.ReportTypes.editPassport
|
||||||
};
|
};
|
||||||
await Startup.appDbContext.Reports.AddAsync(report);
|
await Startup.appDbContext.Reports.AddAsync(report);
|
||||||
@@ -235,33 +247,43 @@ namespace DiscordApp.Justice.Interactions
|
|||||||
string gender = modal.Gender;
|
string gender = modal.Gender;
|
||||||
|
|
||||||
SocketGuildUser user = Context.Guild.GetUser(Context.User.Id);
|
SocketGuildUser user = Context.Guild.GetUser(Context.User.Id);
|
||||||
Supporter supporter;
|
|
||||||
Random random = new();
|
Random random = new();
|
||||||
User spUser = await User.CreateUser(name);
|
Supporter supporter;
|
||||||
|
User spUser;
|
||||||
DateTimeOffset toTime;
|
DateTimeOffset toTime;
|
||||||
DateTime birthDate;
|
DateOnly birthDate;
|
||||||
int id = random.Next(00001, 99999);
|
long unixBirthDateTime;
|
||||||
long unixTime;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
birthDate = DateTime.Parse(birthday);
|
spUser = await User.CreateUser(name);
|
||||||
unixTime = ((DateTimeOffset)birthDate).ToUnixTimeSeconds();
|
}
|
||||||
if (birthDate.AddDays(14) < DateTime.Now)
|
catch
|
||||||
|
{
|
||||||
|
await FollowupAsync("Игрок с таким ником не найден!", ephemeral: true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int id = random.Next(00001, 99999);
|
||||||
|
while (id.ToString().Length < 5) { id = random.Next(00001, 99999); }
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
birthDate = DateOnly.Parse(birthday);
|
||||||
|
unixBirthDateTime = DateTimeOffset.Parse(birthDate.ToString()).ToUnixTimeSeconds();
|
||||||
|
if (birthDate.AddDays(14) < DateOnly.FromDateTime(DateTime.Now))
|
||||||
{
|
{
|
||||||
await FollowupAsync($"Возможно, игрок {name} больше не новичек, и бесплатный паспорт ему не положен! Оформляю паспорт на месяц...", ephemeral: true);
|
await FollowupAsync($"Возможно, игрок {name} играет больше двух недель, и бесплатный паспорт ему не положен! Оформляю паспорт на два месяца...", ephemeral: true);
|
||||||
toTime = DateTimeOffset.Now.AddMonths(2);
|
toTime = DateTimeOffset.Now.AddMonths(2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
toTime = DateTime.Now.AddDays(14);
|
toTime = DateTimeOffset.Now.AddDays(14);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch
|
||||||
{
|
{
|
||||||
await FollowupAsync($"Возможно, с датой {modal.Birthday} какая-то ошибка, попробуйте такой тип: 14.02.2023", ephemeral: true);
|
await FollowupAsync($"Возможно, с датой `{modal.Birthday}` какая-то ошибка, попробуйте такой тип: 14.02.2023", ephemeral: true);
|
||||||
Console.WriteLine($"Error in 237-243 line. Error: {ex.Message}");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,7 +312,8 @@ namespace DiscordApp.Justice.Interactions
|
|||||||
Employee = user.Id,
|
Employee = user.Id,
|
||||||
RpName = RpName,
|
RpName = RpName,
|
||||||
Gender = gender,
|
Gender = gender,
|
||||||
Date = unixTime,
|
Date = DateTimeOffset.Now.ToUnixTimeSeconds(),
|
||||||
|
birthDate = unixBirthDateTime,
|
||||||
Applicant = name,
|
Applicant = name,
|
||||||
Id = id,
|
Id = id,
|
||||||
Support = supporter
|
Support = supporter
|
||||||
@@ -303,7 +326,7 @@ namespace DiscordApp.Justice.Interactions
|
|||||||
{
|
{
|
||||||
id = random.Next(00001, 99999);
|
id = random.Next(00001, 99999);
|
||||||
passport.Id = id;
|
passport.Id = id;
|
||||||
Console.WriteLine(passport.Id);
|
while (id.ToString().Length < 5) { id = random.Next(00001, 99999); }
|
||||||
if (Startup.appDbContext.Passport.FindAsync(passport.Id).Result == null) { break; }
|
if (Startup.appDbContext.Passport.FindAsync(passport.Id).Result == null) { break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -314,7 +337,7 @@ namespace DiscordApp.Justice.Interactions
|
|||||||
Имя: {passport.Applicant}
|
Имя: {passport.Applicant}
|
||||||
РП Имя: {passport.RpName}
|
РП Имя: {passport.RpName}
|
||||||
Айди: {id}
|
Айди: {id}
|
||||||
Благотворитель: {passport.Support}
|
Благотворитель: {(int)passport.Support }
|
||||||
Гендер: {passport.Gender}
|
Гендер: {passport.Gender}
|
||||||
Дата рождения: <t:{passport.birthDate}:D>")
|
Дата рождения: <t:{passport.birthDate}:D>")
|
||||||
.WithIsInline(true);
|
.WithIsInline(true);
|
||||||
@@ -341,7 +364,7 @@ namespace DiscordApp.Justice.Interactions
|
|||||||
};
|
};
|
||||||
await Startup.appDbContext.Reports.AddAsync(report);
|
await Startup.appDbContext.Reports.AddAsync(report);
|
||||||
await Startup.appDbContext.Passport.AddAsync(passport);
|
await Startup.appDbContext.Passport.AddAsync(passport);
|
||||||
await Startup.appDbContext.SaveChangesAsync();
|
if (!RpName.StartsWith("test")) { await Startup.appDbContext.SaveChangesAsync(); }
|
||||||
await FollowupAsync($"ID для паспорта: {id}", embed: embed, ephemeral: true);
|
await FollowupAsync($"ID для паспорта: {id}", embed: embed, ephemeral: true);
|
||||||
|
|
||||||
var channel = Context.Guild.GetChannel(1108006685626355733) as ITextChannel;
|
var channel = Context.Guild.GetChannel(1108006685626355733) as ITextChannel;
|
||||||
|
|||||||
254
Migrations/20231029182451_InitMigrate292124.Designer.cs
generated
Normal file
254
Migrations/20231029182451_InitMigrate292124.Designer.cs
generated
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using DiscordApp.Database;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DiscordApp.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20231029182451_InitMigrate292124")]
|
||||||
|
partial class InitMigrate292124
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.13")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.ArtsPatents", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<long>("Date")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("Employee")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int[]>("Number")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
|
b.Property<string>("Size")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("isAllowedToResell")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<int>("passportId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("passportId");
|
||||||
|
|
||||||
|
b.ToTable("ArtsPatent", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.Autobranches", b =>
|
||||||
|
{
|
||||||
|
b.Property<decimal>("ChannelId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("numeric(20,0)");
|
||||||
|
|
||||||
|
b.Property<string>("BranchName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("ChannelId");
|
||||||
|
|
||||||
|
b.ToTable("Autobranches", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.Bizness", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ApplicantId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int[]>("BiznessEmployes")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
|
b.Property<string>("BiznessName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("BiznessType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("CardNumber")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<long>("Date")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("Employee")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ApplicantId");
|
||||||
|
|
||||||
|
b.ToTable("Bizness", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.BooksPatents", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Annotation")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<long>("Date")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("Employee")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Janre")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("isAllowedToResell")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<int>("passportId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("passportId");
|
||||||
|
|
||||||
|
b.ToTable("BooksPatent", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.Passport", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Applicant")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<long>("Date")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<decimal>("Employee")
|
||||||
|
.HasColumnType("numeric(20,0)");
|
||||||
|
|
||||||
|
b.Property<string>("Gender")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("RpName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Support")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<long>("birthDate")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Passport", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.Reports", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Employee")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("type")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Reports", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.ArtsPatents", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DiscordApp.Database.Tables.Passport", "passport")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("passportId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("passport");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.Bizness", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DiscordApp.Database.Tables.Passport", "Applicant")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ApplicantId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Applicant");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.BooksPatents", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DiscordApp.Database.Tables.Passport", "passport")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("passportId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("passport");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
48
Migrations/20231029182451_InitMigrate292124.cs
Normal file
48
Migrations/20231029182451_InitMigrate292124.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DiscordApp.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class InitMigrate292124 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "Bizness",
|
||||||
|
newName: "Bizness",
|
||||||
|
newSchema: "public");
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Reports",
|
||||||
|
schema: "public",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||||
|
Employee = table.Column<string>(type: "text", nullable: false),
|
||||||
|
type = table.Column<int>(type: "integer", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Reports", x => x.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Reports",
|
||||||
|
schema: "public");
|
||||||
|
|
||||||
|
migrationBuilder.RenameTable(
|
||||||
|
name: "Bizness",
|
||||||
|
schema: "public",
|
||||||
|
newName: "Bizness");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
254
Migrations/20231101125356_Migrate01111553.Designer.cs
generated
Normal file
254
Migrations/20231101125356_Migrate01111553.Designer.cs
generated
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using DiscordApp.Database;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DiscordApp.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(AppDbContext))]
|
||||||
|
[Migration("20231101125356_Migrate01111553")]
|
||||||
|
partial class Migrate01111553
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.13")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.ArtsPatents", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<long>("Date")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("Employee")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int[]>("Number")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
|
b.Property<string>("Size")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("isAllowedToResell")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<int>("passportId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("passportId");
|
||||||
|
|
||||||
|
b.ToTable("ArtsPatent", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.Autobranches", b =>
|
||||||
|
{
|
||||||
|
b.Property<decimal>("ChannelId")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("numeric(20,0)");
|
||||||
|
|
||||||
|
b.Property<string>("BranchName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("ChannelId");
|
||||||
|
|
||||||
|
b.ToTable("Autobranches", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.Bizness", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ApplicantId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int[]>("BiznessEmployes")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("integer[]");
|
||||||
|
|
||||||
|
b.Property<string>("BiznessName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("BiznessType")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("CardNumber")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<long>("Date")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("Employee")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ApplicantId");
|
||||||
|
|
||||||
|
b.ToTable("Bizness", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.BooksPatents", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Annotation")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<long>("Date")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<string>("Employee")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Janre")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("isAllowedToResell")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<int>("passportId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("passportId");
|
||||||
|
|
||||||
|
b.ToTable("BooksPatent", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.Passport", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Applicant")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<long>("Date")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.Property<decimal>("Employee")
|
||||||
|
.HasColumnType("numeric(20,0)");
|
||||||
|
|
||||||
|
b.Property<string>("Gender")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("RpName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("Support")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<long>("birthDate")
|
||||||
|
.HasColumnType("bigint");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Passport", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.Reports", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Employee")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("type")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Reports", "public");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.ArtsPatents", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DiscordApp.Database.Tables.Passport", "passport")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("passportId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("passport");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.Bizness", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DiscordApp.Database.Tables.Passport", "Applicant")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ApplicantId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Applicant");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.BooksPatents", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DiscordApp.Database.Tables.Passport", "passport")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("passportId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("passport");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
22
Migrations/20231101125356_Migrate01111553.cs
Normal file
22
Migrations/20231101125356_Migrate01111553.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DiscordApp.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Migrate01111553 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -113,7 +113,7 @@ namespace DiscordApp.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ApplicantId");
|
b.HasIndex("ApplicantId");
|
||||||
|
|
||||||
b.ToTable("Bizness");
|
b.ToTable("Bizness", "public");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DiscordApp.Database.Tables.BooksPatents", b =>
|
modelBuilder.Entity("DiscordApp.Database.Tables.BooksPatents", b =>
|
||||||
@@ -193,6 +193,26 @@ namespace DiscordApp.Migrations
|
|||||||
b.ToTable("Passport", "public");
|
b.ToTable("Passport", "public");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DiscordApp.Database.Tables.Reports", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Employee")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int>("type")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Reports", "public");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DiscordApp.Database.Tables.ArtsPatents", b =>
|
modelBuilder.Entity("DiscordApp.Database.Tables.ArtsPatents", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("DiscordApp.Database.Tables.Passport", "passport")
|
b.HasOne("DiscordApp.Database.Tables.Passport", "passport")
|
||||||
|
|||||||
Reference in New Issue
Block a user