mirror of
https://github.com/yawaflua/PL_JusticeBot.git
synced 2025-12-08 19:39:27 +02:00
добавил патенты, верификацию, сделал паспорта, ип ооо
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using DiscordApp.Database.Tables;
|
||||
using Microsoft.AspNetCore.DataProtection.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace DiscordApp.Database
|
||||
@@ -9,6 +10,10 @@ namespace DiscordApp.Database
|
||||
|
||||
public DbSet<Passport> Passport { get; set; }
|
||||
public DbSet<Autobranches> Autobranches { get; set; }
|
||||
public DbSet<ArtsPatents> ArtPatents { get; set; }
|
||||
public DbSet<BooksPatents> BookPatents { get; set; }
|
||||
public DbSet<Bizness> Bizness { get; set; }
|
||||
public DbSet<Reports> Reports { get; set; }
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
@@ -4,17 +4,19 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DiscordApp.Database.Tables
|
||||
{
|
||||
[Table("Patents", Schema = "public")]
|
||||
public class Patents
|
||||
[Table("ArtsPatent", Schema = "public")]
|
||||
public class ArtsPatents
|
||||
{
|
||||
public string Employee { get; set; }
|
||||
public string Applicant { get; set; }
|
||||
public int Date { get; set; }
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public string Employee { get; set; }
|
||||
public Passport passport { get; set; }
|
||||
public long Date { get; set; }
|
||||
public int[] Number { get; set; }
|
||||
public Supporter Support { get; set; }
|
||||
public string Gender { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Size { get; set; }
|
||||
public bool isAllowedToResell { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
21
Database/Tables/Bizness.cs
Normal file
21
Database/Tables/Bizness.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using DiscordApp.Types;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DiscordApp.Database.Tables
|
||||
{
|
||||
[Table("Bizness", Schema = "public")]
|
||||
public class Bizness
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public Passport Applicant { get; set; }
|
||||
public string Employee { get; set; }
|
||||
public string BiznessName { get; set; }
|
||||
public int[] BiznessEmployes { get; set; }
|
||||
public long Date { get; set; }
|
||||
public string BiznessType { get; set; }
|
||||
public int CardNumber { get; set; }
|
||||
}
|
||||
}
|
||||
22
Database/Tables/BooksPatents.cs
Normal file
22
Database/Tables/BooksPatents.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using DiscordApp.Enums;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DiscordApp.Database.Tables
|
||||
{
|
||||
[Table("BooksPatent", Schema = "public")]
|
||||
public class BooksPatents
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public string Employee { get; set; }
|
||||
public Passport passport { get; set; }
|
||||
public long Date { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Annotation { get; set; }
|
||||
public string Janre { get; set; }
|
||||
public bool isAllowedToResell { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
16
Database/Tables/Reports.cs
Normal file
16
Database/Tables/Reports.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using DiscordApp.Types;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace DiscordApp.Database.Tables
|
||||
{
|
||||
[Table("Reports", Schema = "public")]
|
||||
public class Reports
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public string Employee { get; set; }
|
||||
public ReportTypes type { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
27
Justice/Commands/Bizness.cs
Normal file
27
Justice/Commands/Bizness.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Discord;
|
||||
using Discord.Interactions;
|
||||
|
||||
namespace DiscordApp.Justice.Commands
|
||||
{
|
||||
public class Bizness : InteractionModuleBase<SocketInteractionContext>
|
||||
{
|
||||
[SlashCommand("bizness-embed", "Отправляет сообщение с кнопками для регистрации")]
|
||||
[DefaultMemberPermissions(GuildPermission.Administrator)]
|
||||
public async Task sendBiznessEmbed()
|
||||
{
|
||||
await DeferAsync(true);
|
||||
var Embed = new EmbedBuilder()
|
||||
.WithTitle("**Регистрация бизнеса!**")
|
||||
.WithDescription("Ниже вы можете нажать на кнопку для создания ИП или ООО!")
|
||||
.WithColor(Color.Blue)
|
||||
.Build();
|
||||
var Components = new ComponentBuilder()
|
||||
.WithButton(new ButtonBuilder() { CustomId = "NewIndividualEntrepreneur", Label = "ИП", Style = ButtonStyle.Primary })
|
||||
.WithButton(new ButtonBuilder() { CustomId = "NewBizness", Label = "ООО", Style = ButtonStyle.Primary })
|
||||
.Build();
|
||||
await Context.Channel.SendMessageAsync(embed: Embed, components: Components);
|
||||
await FollowupAsync("OK!");//, ephemeral: true);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ namespace DiscordApp.Justice.Commands
|
||||
{
|
||||
public InteractionService Commands { get; set; }
|
||||
[SlashCommand("send_passport_embed", description: "Отправляет сообщение для регистрации паспортов")]
|
||||
[DefaultMemberPermissions(GuildPermission.Administrator)]
|
||||
public async Task sendPassportBuilerEmbed()
|
||||
{
|
||||
await DeferAsync(true);
|
||||
|
||||
29
Justice/Commands/Patents.cs
Normal file
29
Justice/Commands/Patents.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Discord.Interactions;
|
||||
using Discord;
|
||||
|
||||
namespace DiscordApp.Justice.Commands
|
||||
{
|
||||
public class Patents : InteractionModuleBase<SocketInteractionContext>
|
||||
{
|
||||
public InteractionService Commands { get; set; }
|
||||
|
||||
[SlashCommand("send_patent_embed", description: "Отправляет сообщение для регистрации паспортов")]
|
||||
[DefaultMemberPermissions(GuildPermission.Administrator)]
|
||||
public async Task sendPatentBuilerEmbed()
|
||||
{
|
||||
await DeferAsync(true);
|
||||
var Embed = new EmbedBuilder()
|
||||
.WithTitle("**Регистрация патента!**")
|
||||
.WithDescription("Ниже вы можете нажать на кнопку для создания патентов!")
|
||||
.WithColor(Color.Blue)
|
||||
.Build();
|
||||
var Components = new ComponentBuilder()
|
||||
.WithButton(new ButtonBuilder() { CustomId = "artPatent", Label = "Патент на арт", Style = ButtonStyle.Primary })
|
||||
.WithButton(new ButtonBuilder() { CustomId = "bookPatent", Label = "Патент на книгу", Style = ButtonStyle.Primary })
|
||||
.Build();
|
||||
await Context.Channel.SendMessageAsync(embed: Embed, components: Components);
|
||||
await FollowupAsync("OK!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace DiscordApp.Discord.Commands
|
||||
await DeferAsync(true);
|
||||
var embed = new EmbedBuilder()
|
||||
.WithTitle("**Верификация игроков**")
|
||||
.WithDescription($"Если что-то случилось, и вам не выдается роль <@&1165687128366268511>, то нажмите на кнопку ниже!")
|
||||
.WithDescription($"Если что-то случилось, и вам не выдается роль <@&1136564585420304444>, то нажмите на кнопку ниже!")
|
||||
.WithImageUrl("")
|
||||
.WithColor(Color.Blue)
|
||||
.Build();
|
||||
@@ -74,8 +74,25 @@ namespace DiscordApp.Discord.Commands
|
||||
await Context.Channel.SendMessageAsync(embed: embed, components: components);
|
||||
await FollowupAsync("Ok", ephemeral: true);
|
||||
}
|
||||
[SlashCommand("раздача-зарплаты", "Берет данные из баз данных и раздает кому надо")]
|
||||
[DefaultMemberPermissions(GuildPermission.Administrator)]
|
||||
public async Task giveAvanse()
|
||||
{
|
||||
await DeferAsync(true);
|
||||
int allCount = 0;
|
||||
var allReports = Startup.appDbContext.Reports.ToArray();
|
||||
var allEmployee = new Dictionary<string, int>();
|
||||
foreach (var report in allReports)
|
||||
{
|
||||
allEmployee[report.Employee] += (int)report.type;
|
||||
|
||||
|
||||
// ReplyAsync is a method on ModuleBase
|
||||
}
|
||||
foreach (var employee in allEmployee)
|
||||
{
|
||||
await Startup.sp.CreateTransaction(employee.Key, employee.Value, "АвтоЗарплата Юстиций");
|
||||
allCount += employee.Value;
|
||||
}
|
||||
await FollowupAsync($"Готово! Раздал {allCount} АР", ephemeral: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
138
Justice/Interactions/BiznessInteractions.cs
Normal file
138
Justice/Interactions/BiznessInteractions.cs
Normal file
@@ -0,0 +1,138 @@
|
||||
using Discord;
|
||||
using Discord.Interactions;
|
||||
using DiscordApp.Database.Tables;
|
||||
using DiscordApp.Justice.Modals;
|
||||
using spworlds.Types;
|
||||
|
||||
namespace DiscordApp.Justice.Interactions
|
||||
{
|
||||
public class BiznessInteraction : InteractionModuleBase<SocketInteractionContext>
|
||||
{
|
||||
[ComponentInteraction("NewIndividualEntrepreneur")]
|
||||
public async Task AplyWork()
|
||||
=> await Context.Interaction.RespondWithModalAsync<INewIndividualEntrepreneur>("newIndividualEterpreneur");
|
||||
[ComponentInteraction("NewBizness")]
|
||||
public async Task reCreatePassport()
|
||||
=> await Context.Interaction.RespondWithModalAsync<INewBizness>("NewBizness");
|
||||
|
||||
[ModalInteraction("newIndividualEterpreneur")]
|
||||
public async Task newIndividualEterpreneur(INewIndividualEntrepreneur modal)
|
||||
{
|
||||
await DeferAsync(true);
|
||||
Passport? applicant = await Startup.appDbContext.Passport.FindAsync(int.Parse(modal.passportId));
|
||||
if (applicant == null)
|
||||
{
|
||||
await FollowupAsync("Ошибка! Такого паспорта не существует. Попробуйте старого бота.", ephemeral: true);
|
||||
return;
|
||||
}
|
||||
User spApplicant = await User.CreateUser(applicant.Applicant);
|
||||
var employees = new List<int>();
|
||||
employees.Add(applicant.Id);
|
||||
|
||||
Bizness biznessDB = new()
|
||||
{
|
||||
Applicant = applicant,
|
||||
Employee = ((IGuildUser)Context.User).DisplayName,
|
||||
BiznessEmployes = employees.ToArray(),
|
||||
BiznessName = modal.Name,
|
||||
BiznessType = modal.BiznessType,
|
||||
CardNumber = modal.CardNumber,
|
||||
Date = DateTimeOffset.Now.ToUnixTimeSeconds()
|
||||
};
|
||||
Reports report = new()
|
||||
{
|
||||
Employee = ((IGuildUser)Context.User).DisplayName,
|
||||
type = Types.ReportTypes.Bizness
|
||||
};
|
||||
await Startup.appDbContext.Reports.AddAsync(report);
|
||||
await Startup.appDbContext.Bizness.AddAsync(biznessDB);
|
||||
|
||||
if (!modal.Name.StartsWith("test")) { await Startup.appDbContext.SaveChangesAsync(); }
|
||||
|
||||
var fieldBuilder = new EmbedFieldBuilder()
|
||||
.WithName("Данные:")
|
||||
.WithValue($"```Аппликант: {applicant.Applicant}\nНазвание: {modal.Name}\nТип деятельности: {modal.BiznessType}\nНомер карты:{modal.CardNumber}```");
|
||||
var author = new EmbedAuthorBuilder()
|
||||
.WithIconUrl(Context.User.GetAvatarUrl())
|
||||
.WithName(((IGuildUser)Context.User).DisplayName);
|
||||
var embed = new EmbedBuilder()
|
||||
.WithTitle("Новый ИП зарегестрирован!")
|
||||
.WithAuthor(author)
|
||||
.WithFields(fieldBuilder)
|
||||
.WithThumbnailUrl(spApplicant.GetSkinPart(SkinPart.face))
|
||||
.WithColor(Color.Blue)
|
||||
.Build();
|
||||
await FollowupAsync("Готово!", ephemeral: true);
|
||||
var channel = Context.Guild.GetChannel(1108006685626355733) as ITextChannel;
|
||||
|
||||
await channel.SendMessageAsync(embed: embed);
|
||||
}
|
||||
|
||||
[ModalInteraction("NewBizness")]
|
||||
public async Task newBizness(INewBizness modal)
|
||||
{
|
||||
await DeferAsync(true);
|
||||
Passport? applicant = await Startup.appDbContext.Passport.FindAsync(int.Parse(modal.passportId));
|
||||
|
||||
if (applicant == null)
|
||||
{
|
||||
await FollowupAsync("Ошибка! Такого паспорта не существует. Попробуйте старого бота.", ephemeral: true);
|
||||
return;
|
||||
}
|
||||
User spApplicant = await User.CreateUser(applicant.Applicant);
|
||||
var employees = new List<int>
|
||||
{
|
||||
applicant.Id
|
||||
};
|
||||
string employeesNames = "";
|
||||
foreach (var passportId in modal.BiznessEmployee.Split(","))
|
||||
{
|
||||
Passport? employee = await Startup.appDbContext.Passport.FindAsync(int.Parse(passportId));
|
||||
if (employee != null) { employees.Add(employee.Id); employeesNames += $" {employee.Applicant}"; }
|
||||
else
|
||||
{
|
||||
await FollowupAsync($"У {passportId} указан неправильный номер паспорта.", ephemeral: true);
|
||||
}
|
||||
}
|
||||
|
||||
Bizness biznessDB = new()
|
||||
{
|
||||
Applicant = applicant,
|
||||
Employee = ((IGuildUser)Context.User).DisplayName,
|
||||
BiznessEmployes = employees.ToArray(),
|
||||
BiznessName = modal.Name,
|
||||
BiznessType = modal.BiznessType,
|
||||
CardNumber = modal.CardNumber,
|
||||
Date = DateTimeOffset.Now.ToUnixTimeSeconds()
|
||||
};
|
||||
Reports report = new()
|
||||
{
|
||||
Employee = ((IGuildUser)Context.User).DisplayName,
|
||||
type = Types.ReportTypes.Bizness
|
||||
};
|
||||
await Startup.appDbContext.Reports.AddAsync(report);
|
||||
await Startup.appDbContext.Bizness.AddAsync(biznessDB);
|
||||
|
||||
if (!modal.Name.StartsWith("test")) { await Startup.appDbContext.SaveChangesAsync(); }
|
||||
|
||||
var fieldBuilder = new EmbedFieldBuilder()
|
||||
.WithName("Данные:")
|
||||
.WithValue($"```Аппликант: {applicant.Applicant}\nНазвание: {modal.Name}\nТип деятельности: {modal.BiznessType}\nНомер карты:{modal.CardNumber}\nСотрудники:{employeesNames}```");
|
||||
var author = new EmbedAuthorBuilder()
|
||||
.WithIconUrl(Context.User.GetAvatarUrl())
|
||||
.WithName(((IGuildUser)Context.User).DisplayName);
|
||||
var embed = new EmbedBuilder()
|
||||
.WithTitle("Новый ООО зарегестрирован!")
|
||||
.WithAuthor(author)
|
||||
.WithFields(fieldBuilder)
|
||||
.WithThumbnailUrl(spApplicant.GetSkinPart(SkinPart.face))
|
||||
.WithColor(Color.Blue)
|
||||
.Build();
|
||||
await FollowupAsync("Готово!", ephemeral: true);
|
||||
var channel = Context.Guild.GetChannel(1108006685626355733) as ITextChannel;
|
||||
|
||||
await channel.SendMessageAsync(embed: embed);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using Discord.WebSocket;
|
||||
using DiscordApp.Database.Tables;
|
||||
using DiscordApp.Enums;
|
||||
using spworlds.Types;
|
||||
|
||||
using DiscordApp.Justice.Modals;
|
||||
namespace DiscordApp.Justice.Interactions
|
||||
{
|
||||
public class PassportInteraction : InteractionModuleBase<SocketInteractionContext>
|
||||
@@ -15,16 +15,16 @@ namespace DiscordApp.Justice.Interactions
|
||||
|
||||
[ComponentInteraction("newPassport")]
|
||||
public async Task AplyWork()
|
||||
=> await Context.Interaction.RespondWithModalAsync<NewPassportModal>("passportModal");
|
||||
=> await Context.Interaction.RespondWithModalAsync<INewPassportModal>("passportModal");
|
||||
[ComponentInteraction("reworkPassport")]
|
||||
public async Task reCreatePassport()
|
||||
=> await Context.Interaction.RespondWithModalAsync<ReWorkPassportModal>("reworkpassportModal");
|
||||
=> await Context.Interaction.RespondWithModalAsync<IReWorkPassportModal>("reworkpassportModal");
|
||||
[ComponentInteraction("reNewPassportButton")]
|
||||
public async Task reNewPassportModal() => await Context.Interaction.RespondWithModalAsync<NewPassportModal>("ReNewPassportModal");
|
||||
public async Task reNewPassportModal() => await Context.Interaction.RespondWithModalAsync<INewPassportModal>("ReNewPassportModal");
|
||||
|
||||
|
||||
[ModalInteraction("reworkpassportModal")]
|
||||
public async Task reCreatePassportInteraction(ReWorkPassportModal modal)
|
||||
public async Task reCreatePassportInteraction(IReWorkPassportModal modal)
|
||||
{
|
||||
await DeferAsync(true);
|
||||
double passportId = modal.Id;
|
||||
@@ -109,7 +109,7 @@ namespace DiscordApp.Justice.Interactions
|
||||
}
|
||||
}
|
||||
[ModalInteraction("ReNewPassportModal")]
|
||||
public async Task renewPassportInteraction(NewPassportModal modal)
|
||||
public async Task renewPassportInteraction(INewPassportModal modal)
|
||||
{
|
||||
await DeferAsync(true);
|
||||
string name = modal.NickName;
|
||||
@@ -170,6 +170,12 @@ namespace DiscordApp.Justice.Interactions
|
||||
Id = id,
|
||||
Support = supporter
|
||||
};
|
||||
Reports report = new()
|
||||
{
|
||||
Employee = ((IGuildUser)Context.User).DisplayName,
|
||||
type = Types.ReportTypes.editPassport
|
||||
};
|
||||
await Startup.appDbContext.Reports.AddAsync(report);
|
||||
|
||||
if (Startup.appDbContext.Passport.FindAsync(passport.Id).Result != null)
|
||||
{
|
||||
@@ -219,7 +225,7 @@ namespace DiscordApp.Justice.Interactions
|
||||
|
||||
}
|
||||
[ModalInteraction("passportModal")]
|
||||
public async Task createPassportInteraction(NewPassportModal modal)
|
||||
public async Task createPassportInteraction(INewPassportModal modal)
|
||||
{
|
||||
await DeferAsync(true);
|
||||
string name = modal.NickName;
|
||||
@@ -233,7 +239,7 @@ namespace DiscordApp.Justice.Interactions
|
||||
Random random = new();
|
||||
User spUser = await User.CreateUser(name);
|
||||
|
||||
DateTimeOffset toTime = DateTime.Now.AddDays(14);
|
||||
DateTimeOffset toTime;
|
||||
DateTime birthDate;
|
||||
int id = random.Next(00001, 99999);
|
||||
long unixTime;
|
||||
@@ -244,8 +250,12 @@ namespace DiscordApp.Justice.Interactions
|
||||
unixTime = ((DateTimeOffset)birthDate).ToUnixTimeSeconds();
|
||||
if (birthDate.AddDays(14) < DateTime.Now)
|
||||
{
|
||||
await FollowupAsync($"Возможно, игрок {name} больше не новичек, и бесплатный паспорт ему не положен! Оформляю паспорт на месяц...0", ephemeral: true);
|
||||
toTime = DateTimeOffset.Now.AddDays(60);
|
||||
await FollowupAsync($"Возможно, игрок {name} больше не новичек, и бесплатный паспорт ему не положен! Оформляю паспорт на месяц...", ephemeral: true);
|
||||
toTime = DateTimeOffset.Now.AddMonths(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
toTime = DateTime.Now.AddDays(14);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -324,54 +334,20 @@ namespace DiscordApp.Justice.Interactions
|
||||
.WithTimestamp(toTime)
|
||||
.Build();
|
||||
|
||||
|
||||
Reports report = new()
|
||||
{
|
||||
Employee = ((IGuildUser)Context.User).DisplayName,
|
||||
type = Types.ReportTypes.NewPassport
|
||||
};
|
||||
await Startup.appDbContext.Reports.AddAsync(report);
|
||||
await Startup.appDbContext.Passport.AddAsync(passport);
|
||||
await Startup.appDbContext.SaveChangesAsync();
|
||||
await FollowupAsync($"ID для паспорта: {id}", embed: embed, ephemeral: true);
|
||||
|
||||
var channel = Context.Guild.GetChannel(1108006685626355733) as ITextChannel;
|
||||
|
||||
var message = await channel.SendMessageAsync(embed: embed);
|
||||
await channel.SendMessageAsync(embed: embed);
|
||||
}
|
||||
}
|
||||
|
||||
public class NewPassportModal : IModal
|
||||
{
|
||||
public string Title => "Создание паспорта";
|
||||
|
||||
[InputLabel("Ник игрока")]
|
||||
[ModalTextInput("nickname", TextInputStyle.Short, placeholder: "YaFlay", maxLength: 90)]
|
||||
public string NickName { get; set; }
|
||||
|
||||
[InputLabel("Благотворитель")]
|
||||
[ModalTextInput("Supporter", TextInputStyle.Short, placeholder: "1", maxLength: 5)]
|
||||
public int Supporter { get; set; }
|
||||
|
||||
[InputLabel("РП Имя")]
|
||||
[ModalTextInput("rolePlayName", TextInputStyle.Short, placeholder: "Олег Бебров", maxLength: 200)]
|
||||
public string RPName { get; set; }
|
||||
|
||||
[InputLabel("Пол")]
|
||||
[ModalTextInput("gender", TextInputStyle.Short, maxLength: 200)]
|
||||
public string Gender { get; set; }
|
||||
[InputLabel("Дата рождения")]
|
||||
[ModalTextInput("BirthDay", TextInputStyle.Short, placeholder: "16.02.2023", maxLength: 100)]
|
||||
public string Birthday { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ReWorkPassportModal : IModal
|
||||
{
|
||||
public string Title => "Создание паспорта";
|
||||
|
||||
[InputLabel("ID паспорта")]
|
||||
[ModalTextInput("id", TextInputStyle.Short, placeholder: "82-777", maxLength: 7)]
|
||||
public double Id { get; set; }
|
||||
|
||||
[InputLabel("Новые данные(0/1)")]
|
||||
[ModalTextInput("isNewPassportData", TextInputStyle.Short, placeholder: "1 - да, 0 - нет", maxLength: 1, initValue: "0")]
|
||||
public int IsNewPassport { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace DiscordApp.Justice.Interactions
|
||||
{
|
||||
public class Patents
|
||||
{
|
||||
}
|
||||
}
|
||||
147
Justice/Interactions/PatentsInteractions.cs
Normal file
147
Justice/Interactions/PatentsInteractions.cs
Normal file
@@ -0,0 +1,147 @@
|
||||
using Discord.Interactions;
|
||||
using DiscordApp.Justice.Modals;
|
||||
using DiscordApp.Database.Tables;
|
||||
using Discord.WebSocket;
|
||||
using Discord;
|
||||
using spworlds.Types;
|
||||
|
||||
namespace DiscordApp.Justice.Interactions
|
||||
{
|
||||
public class PatentInteraction : InteractionModuleBase<SocketInteractionContext>
|
||||
{
|
||||
[ComponentInteraction("artPatent")]
|
||||
public async Task artPatentInteractions() => await RespondWithModalAsync<INewArtModal>("newArtCallback");
|
||||
|
||||
[ComponentInteraction("bookPatent")]
|
||||
public async Task bookPatentInteractions() => await RespondWithModalAsync<INewBookModal>("newBookCallback");
|
||||
|
||||
[ModalInteraction("newArtCallback")]
|
||||
public async Task newArtModalInteraction(INewArtModal modal)
|
||||
{
|
||||
await DeferAsync(true);
|
||||
string name = modal.Name;
|
||||
string maps = modal.MapNumbers;
|
||||
string size = modal.Size;
|
||||
int passportId = modal.PassportId;
|
||||
bool isAllowedToReSell = modal.IsAllowedToResell == 1;
|
||||
|
||||
Passport? passport = await Startup.appDbContext.Passport.FindAsync(passportId);
|
||||
if (passport == null)
|
||||
{
|
||||
await FollowupAsync("ID паспорта не найден в базе данных. Попробуйте использовать старого бота.");
|
||||
return;
|
||||
}
|
||||
|
||||
var mapDictionary = new List<int>();
|
||||
User spUser = await User.CreateUser(passport.Applicant);
|
||||
try
|
||||
{
|
||||
foreach (var map in maps.Split(','))
|
||||
{
|
||||
mapDictionary.Add(int.Parse(map));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Console.Out.WriteLineAsync($"new error in patentInteractions 32-37 {ex.Message}");
|
||||
await FollowupAsync("Возникла ошибка при парсинге ID карт. Вы точно указали через запятую данные?");
|
||||
return;
|
||||
}
|
||||
ArtsPatents artsPatent = new()
|
||||
{
|
||||
Name = name,
|
||||
Employee = ((IGuildUser)Context.User).DisplayName,
|
||||
Size = size,
|
||||
Date = DateTimeOffset.Now.ToUnixTimeSeconds(),
|
||||
Number = mapDictionary.ToArray(),
|
||||
isAllowedToResell = isAllowedToReSell,
|
||||
passport = passport
|
||||
};
|
||||
Reports report = new()
|
||||
{
|
||||
Employee = ((IGuildUser)Context.User).DisplayName,
|
||||
type = Types.ReportTypes.Patent
|
||||
};
|
||||
await Startup.appDbContext.Reports.AddAsync(report);
|
||||
await Startup.appDbContext.ArtPatents.AddAsync(artsPatent);
|
||||
|
||||
if (!name.StartsWith("test")) { await Startup.appDbContext.SaveChangesAsync(); }
|
||||
|
||||
var field = new EmbedFieldBuilder()
|
||||
.WithName("Данные патента")
|
||||
.WithValue($"```Название арта: {name} \nРазмер: {size} \nНомера: {maps} \nРазрешена перепродажа?: {isAllowedToReSell} \nАппликант: {passport.Applicant}```")
|
||||
.WithIsInline(false);
|
||||
var author = new EmbedAuthorBuilder()
|
||||
.WithIconUrl(Context.User.GetAvatarUrl())
|
||||
.WithName(((IGuildUser)Context.User).DisplayName);
|
||||
var Embed = new EmbedBuilder()
|
||||
.WithTitle("Новый патент!")
|
||||
.WithFields(field)
|
||||
.WithAuthor(author)
|
||||
.WithColor(Color.Blue)
|
||||
.WithCurrentTimestamp()
|
||||
.WithThumbnailUrl(spUser.GetSkinPart(SkinPart.face))
|
||||
.Build();
|
||||
await FollowupAsync("Готово!", ephemeral: true);
|
||||
var channel = Context.Guild.GetChannel(1108006685626355733) as ITextChannel;
|
||||
await channel.SendMessageAsync(embed: Embed);
|
||||
}
|
||||
[ModalInteraction("newBookCallback")]
|
||||
public async Task newBookModalInteraction(INewBookModal modal)
|
||||
{
|
||||
await DeferAsync(true);
|
||||
string name = modal.Name;
|
||||
string janre = modal.Janre;
|
||||
string annotation = modal.Annotation;
|
||||
int passportId = modal.PassportId;
|
||||
bool isAllowedToReSell = modal.IsAllowedToResell == 1;
|
||||
|
||||
Passport? passport = await Startup.appDbContext.Passport.FindAsync(passportId);
|
||||
if (passport == null)
|
||||
{
|
||||
await FollowupAsync("ID паспорта не найден в базе данных. Попробуйте использовать старого бота.");
|
||||
return;
|
||||
}
|
||||
|
||||
User spUser = await User.CreateUser(passport.Applicant);
|
||||
BooksPatents bookPatent = new()
|
||||
{
|
||||
Name = name,
|
||||
Employee = ((IGuildUser)Context.User).DisplayName,
|
||||
Janre = janre,
|
||||
Date = DateTimeOffset.Now.ToUnixTimeSeconds(),
|
||||
Annotation = annotation,
|
||||
isAllowedToResell = isAllowedToReSell,
|
||||
passport = passport
|
||||
};
|
||||
Reports report = new()
|
||||
{
|
||||
Employee = ((IGuildUser)Context.User).DisplayName,
|
||||
type = Types.ReportTypes.Patent
|
||||
};
|
||||
await Startup.appDbContext.Reports.AddAsync(report);
|
||||
await Startup.appDbContext.BookPatents.AddAsync(bookPatent);
|
||||
|
||||
if (!name.StartsWith("test")) { await Startup.appDbContext.SaveChangesAsync(); }
|
||||
|
||||
var field = new EmbedFieldBuilder()
|
||||
.WithName("Данные патента")
|
||||
.WithValue($"```Название книги: {name} \nАннотация: {annotation} \nЖанр: {janre} \nРазрешена перепродажа?:{isAllowedToReSell} \nАппликант:{passport.Applicant}```")
|
||||
.WithIsInline(false);
|
||||
var author = new EmbedAuthorBuilder()
|
||||
.WithIconUrl(Context.User.GetAvatarUrl())
|
||||
.WithName(((IGuildUser)Context.User).DisplayName);
|
||||
var Embed = new EmbedBuilder()
|
||||
.WithTitle("Новый патент!")
|
||||
.WithFields(field)
|
||||
.WithAuthor(author)
|
||||
.WithColor(Color.Blue)
|
||||
.WithCurrentTimestamp()
|
||||
.WithThumbnailUrl(spUser.GetSkinPart(SkinPart.face))
|
||||
.Build();
|
||||
await FollowupAsync("Готово!", ephemeral: true);
|
||||
var channel = Context.Guild.GetChannel(1108006685626355733) as ITextChannel;
|
||||
await channel.SendMessageAsync(embed: Embed);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace DiscordApp.Justice.Interactions
|
||||
{
|
||||
await FollowupAsync("Готово!", ephemeral: true);
|
||||
var guildUser = Context.Guild.GetUser(Context.User.Id);
|
||||
await guildUser.AddRoleAsync(1165687128366268511);
|
||||
await guildUser.AddRoleAsync(1136564585420304444);
|
||||
await guildUser.ModifyAsync(func =>
|
||||
{
|
||||
func.Nickname = user.Name;
|
||||
|
||||
49
Justice/Modals/BiznessModals.cs
Normal file
49
Justice/Modals/BiznessModals.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Discord;
|
||||
using Discord.Interactions;
|
||||
|
||||
namespace DiscordApp.Justice.Modals
|
||||
{
|
||||
public class INewIndividualEntrepreneur : IModal
|
||||
{
|
||||
public string Title => "Регистрация ИП";
|
||||
[InputLabel("ID паспорта")]
|
||||
[ModalTextInput("nickname", TextInputStyle.Short, placeholder: "96534", maxLength: 10)]
|
||||
public string passportId { get; set; }
|
||||
|
||||
[InputLabel("Название")]
|
||||
[ModalTextInput("Name", TextInputStyle.Short, placeholder: "ИП Оганесян", maxLength: 100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[InputLabel("Тип деятельности")]
|
||||
[ModalTextInput("Type", TextInputStyle.Short, placeholder: "Продажа", maxLength: 200)]
|
||||
public string BiznessType { get; set; }
|
||||
|
||||
[InputLabel("Номер карты")]
|
||||
[ModalTextInput("cardNumber", TextInputStyle.Short, placeholder: "70835", maxLength: 100)]
|
||||
public int CardNumber { get; set; }
|
||||
|
||||
}
|
||||
public class INewBizness : IModal
|
||||
{
|
||||
public string Title => "Регистрация ИП";
|
||||
[InputLabel("ID паспорта")]
|
||||
[ModalTextInput("nickname", TextInputStyle.Short, placeholder: "96534", maxLength: 10)]
|
||||
public string passportId { get; set; }
|
||||
|
||||
[InputLabel("Название")]
|
||||
[ModalTextInput("Name", TextInputStyle.Short, placeholder: "ИП Оганесян", maxLength: 100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[InputLabel("Тип деятельности")]
|
||||
[ModalTextInput("Type", TextInputStyle.Short, placeholder: "Продажа", maxLength: 200)]
|
||||
public string BiznessType { get; set; }
|
||||
|
||||
[InputLabel("Участники(через запятую)")]
|
||||
[ModalTextInput("Employee", TextInputStyle.Short, placeholder: "96534, 12742", maxLength: 200)]
|
||||
public string BiznessEmployee { get; set; }
|
||||
|
||||
[InputLabel("Номер карты")]
|
||||
[ModalTextInput("cardNumber", TextInputStyle.Short, placeholder: "70835", maxLength: 100)]
|
||||
public int CardNumber { get; set; }
|
||||
}
|
||||
}
|
||||
46
Justice/Modals/PassportModals.cs
Normal file
46
Justice/Modals/PassportModals.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using Discord.Interactions;
|
||||
using Discord;
|
||||
|
||||
namespace DiscordApp.Justice.Modals
|
||||
{
|
||||
public class INewPassportModal : IModal
|
||||
{
|
||||
public string Title => "Создание паспорта";
|
||||
|
||||
[InputLabel("Ник игрока")]
|
||||
[ModalTextInput("nickname", TextInputStyle.Short, placeholder: "YaFlay", maxLength: 90)]
|
||||
public string NickName { get; set; }
|
||||
|
||||
[InputLabel("Благотворитель")]
|
||||
[ModalTextInput("Supporter", TextInputStyle.Short, placeholder: "1", maxLength: 5)]
|
||||
public int Supporter { get; set; }
|
||||
|
||||
[InputLabel("РП Имя")]
|
||||
[ModalTextInput("rolePlayName", TextInputStyle.Short, placeholder: "Олег Бебров", maxLength: 200)]
|
||||
public string RPName { get; set; }
|
||||
|
||||
[InputLabel("Пол")]
|
||||
[ModalTextInput("gender", TextInputStyle.Short, maxLength: 200)]
|
||||
public string Gender { get; set; }
|
||||
[InputLabel("Дата рождения")]
|
||||
[ModalTextInput("BirthDay", TextInputStyle.Short, placeholder: "16.02.2023", maxLength: 100)]
|
||||
public string Birthday { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class IReWorkPassportModal : IModal
|
||||
{
|
||||
public string Title => "Создание паспорта";
|
||||
|
||||
[InputLabel("ID паспорта")]
|
||||
[ModalTextInput("id", TextInputStyle.Short, placeholder: "82-777", maxLength: 7)]
|
||||
public double Id { get; set; }
|
||||
|
||||
[InputLabel("Новые данные(0/1)")]
|
||||
[ModalTextInput("isNewPassportData", TextInputStyle.Short, placeholder: "1 - да, 0 - нет", maxLength: 1, initValue: "0")]
|
||||
public int IsNewPassport { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
54
Justice/Modals/PatentModals.cs
Normal file
54
Justice/Modals/PatentModals.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Discord;
|
||||
using Discord.Interactions;
|
||||
|
||||
namespace DiscordApp.Justice.Modals
|
||||
{
|
||||
public class INewArtModal : IModal
|
||||
{
|
||||
public string Title => "Новый патент на арт";
|
||||
|
||||
[InputLabel("ID паспорта")]
|
||||
[ModalTextInput("passportId", TextInputStyle.Short, placeholder: "97664", maxLength: 10)]
|
||||
public int PassportId { get; set; }
|
||||
|
||||
[InputLabel("Название арта")]
|
||||
[ModalTextInput("artName", TextInputStyle.Short, placeholder: "Пикачу", maxLength: 100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[InputLabel("Номера карт арта(Через запятую)")]
|
||||
[ModalTextInput("mapNumbers", TextInputStyle.Short, placeholder: "14322, 14323")]
|
||||
public string MapNumbers { get; set; }
|
||||
|
||||
[InputLabel("Размер арта")]
|
||||
[ModalTextInput("artSize", TextInputStyle.Short, placeholder: "3х1")]
|
||||
public string Size { get; set; }
|
||||
[InputLabel("Разрешено ли перепродавать(0/1)")]
|
||||
[ModalTextInput("artResell", TextInputStyle.Short, placeholder: "0 - нет, 1 - да")]
|
||||
public int IsAllowedToResell { get; set; }
|
||||
}
|
||||
|
||||
public class INewBookModal : IModal
|
||||
{
|
||||
public string Title => "Новый патент на книгу";
|
||||
|
||||
[InputLabel("ID паспорта")]
|
||||
[ModalTextInput("passportId", TextInputStyle.Short, placeholder: "97664", maxLength: 10)]
|
||||
public int PassportId { get; set; }
|
||||
|
||||
[InputLabel("Название книги")]
|
||||
[ModalTextInput("bookName", TextInputStyle.Short, placeholder: "Пикачу", maxLength: 100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[InputLabel("Аннотация")]
|
||||
[ModalTextInput("bookAnnotation", TextInputStyle.Short, placeholder: "14322, 14323")]
|
||||
public string Annotation { get; set; }
|
||||
|
||||
[InputLabel("Жанр")]
|
||||
[ModalTextInput("bookJanre", TextInputStyle.Short, placeholder: "3х1")]
|
||||
public string Janre { get; set; }
|
||||
|
||||
[InputLabel("Разрешено ли перепродавать(0/1)")]
|
||||
[ModalTextInput("bookResell", TextInputStyle.Short, placeholder: "0 - нет, 1 - да")]
|
||||
public int IsAllowedToResell { get; set; }
|
||||
}
|
||||
}
|
||||
81
Migrations/20231029124001_InitMigrate.Designer.cs
generated
Normal file
81
Migrations/20231029124001_InitMigrate.Designer.cs
generated
Normal file
@@ -0,0 +1,81 @@
|
||||
// <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("20231029124001_InitMigrate")]
|
||||
partial class InitMigrate
|
||||
{
|
||||
/// <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.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.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");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Migrations/20231029124001_InitMigrate.cs
Normal file
22
Migrations/20231029124001_InitMigrate.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DiscordApp.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitMigrate : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
183
Migrations/20231029140047_InitMigrate29.Designer.cs
generated
Normal file
183
Migrations/20231029140047_InitMigrate29.Designer.cs
generated
Normal file
@@ -0,0 +1,183 @@
|
||||
// <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("20231029140047_InitMigrate29")]
|
||||
partial class InitMigrate29
|
||||
{
|
||||
/// <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.BooksPatents", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Annotation")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Date")
|
||||
.HasColumnType("integer");
|
||||
|
||||
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.ArtsPatents", b =>
|
||||
{
|
||||
b.HasOne("DiscordApp.Database.Tables.Passport", "passport")
|
||||
.WithMany()
|
||||
.HasForeignKey("passportId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("passport");
|
||||
});
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
93
Migrations/20231029140047_InitMigrate29.cs
Normal file
93
Migrations/20231029140047_InitMigrate29.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DiscordApp.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitMigrate29 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ArtsPatent",
|
||||
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),
|
||||
passportId = table.Column<int>(type: "integer", nullable: false),
|
||||
Date = table.Column<long>(type: "bigint", nullable: false),
|
||||
Number = table.Column<int[]>(type: "integer[]", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Size = table.Column<string>(type: "text", nullable: false),
|
||||
isAllowedToResell = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ArtsPatent", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_ArtsPatent_Passport_passportId",
|
||||
column: x => x.passportId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Passport",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BooksPatent",
|
||||
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),
|
||||
passportId = table.Column<int>(type: "integer", nullable: false),
|
||||
Date = table.Column<int>(type: "integer", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Annotation = table.Column<string>(type: "text", nullable: false),
|
||||
Janre = table.Column<string>(type: "text", nullable: false),
|
||||
isAllowedToResell = table.Column<bool>(type: "boolean", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BooksPatent", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BooksPatent_Passport_passportId",
|
||||
column: x => x.passportId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Passport",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ArtsPatent_passportId",
|
||||
schema: "public",
|
||||
table: "ArtsPatent",
|
||||
column: "passportId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BooksPatent_passportId",
|
||||
schema: "public",
|
||||
table: "BooksPatent",
|
||||
column: "passportId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "ArtsPatent",
|
||||
schema: "public");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "BooksPatent",
|
||||
schema: "public");
|
||||
}
|
||||
}
|
||||
}
|
||||
248
Migrations/20231029160409_InitMigrate291903.Designer.cs
generated
Normal file
248
Migrations/20231029160409_InitMigrate291903.Designer.cs
generated
Normal file
@@ -0,0 +1,248 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
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("20231029160409_InitMigrate291903")]
|
||||
partial class InitMigrate291903
|
||||
{
|
||||
/// <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<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");
|
||||
});
|
||||
|
||||
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<int?>("BiznessId")
|
||||
.HasColumnType("integer");
|
||||
|
||||
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.HasIndex("BiznessId");
|
||||
|
||||
b.ToTable("Passport", "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");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiscordApp.Database.Tables.Passport", b =>
|
||||
{
|
||||
b.HasOne("DiscordApp.Database.Tables.Bizness", null)
|
||||
.WithMany("BiznessEmployes")
|
||||
.HasForeignKey("BiznessId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DiscordApp.Database.Tables.Bizness", b =>
|
||||
{
|
||||
b.Navigation("BiznessEmployes");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
106
Migrations/20231029160409_InitMigrate291903.cs
Normal file
106
Migrations/20231029160409_InitMigrate291903.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DiscordApp.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitMigrate291903 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AlterColumn<long>(
|
||||
name: "Date",
|
||||
schema: "public",
|
||||
table: "BooksPatent",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "integer");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Bizness",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
ApplicantId = table.Column<int>(type: "integer", nullable: false),
|
||||
Employee = table.Column<string>(type: "text", nullable: false),
|
||||
BiznessName = table.Column<string>(type: "text", nullable: false),
|
||||
Date = table.Column<long>(type: "bigint", nullable: false),
|
||||
BiznessType = table.Column<string>(type: "text", nullable: false),
|
||||
CardNumber = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Bizness", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Bizness_Passport_ApplicantId",
|
||||
column: x => x.ApplicantId,
|
||||
principalSchema: "public",
|
||||
principalTable: "Passport",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Passport_BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport",
|
||||
column: "BiznessId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Bizness_ApplicantId",
|
||||
table: "Bizness",
|
||||
column: "ApplicantId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Passport_Bizness_BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport",
|
||||
column: "BiznessId",
|
||||
principalTable: "Bizness",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Passport_Bizness_BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Bizness");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Passport_BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Date",
|
||||
schema: "public",
|
||||
table: "BooksPatent",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
oldClrType: typeof(long),
|
||||
oldType: "bigint");
|
||||
}
|
||||
}
|
||||
}
|
||||
234
Migrations/20231029164526_InitMigrate291945.Designer.cs
generated
Normal file
234
Migrations/20231029164526_InitMigrate291945.Designer.cs
generated
Normal file
@@ -0,0 +1,234 @@
|
||||
// <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("20231029164526_InitMigrate291945")]
|
||||
partial class InitMigrate291945
|
||||
{
|
||||
/// <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");
|
||||
});
|
||||
|
||||
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.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
|
||||
}
|
||||
}
|
||||
}
|
||||
65
Migrations/20231029164526_InitMigrate291945.cs
Normal file
65
Migrations/20231029164526_InitMigrate291945.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DiscordApp.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class InitMigrate291945 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Passport_Bizness_BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Passport_BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport");
|
||||
|
||||
migrationBuilder.AddColumn<int[]>(
|
||||
name: "BiznessEmployes",
|
||||
table: "Bizness",
|
||||
type: "integer[]",
|
||||
nullable: false,
|
||||
defaultValue: new int[0]);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BiznessEmployes",
|
||||
table: "Bizness");
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport",
|
||||
type: "integer",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Passport_BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport",
|
||||
column: "BiznessId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Passport_Bizness_BiznessId",
|
||||
schema: "public",
|
||||
table: "Passport",
|
||||
column: "BiznessId",
|
||||
principalTable: "Bizness",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,46 @@ namespace DiscordApp.Migrations
|
||||
|
||||
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")
|
||||
@@ -36,6 +76,86 @@ namespace DiscordApp.Migrations
|
||||
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");
|
||||
});
|
||||
|
||||
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")
|
||||
@@ -72,6 +192,39 @@ namespace DiscordApp.Migrations
|
||||
|
||||
b.ToTable("Passport", "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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace DiscordApp
|
||||
.AddEnvironmentVariables(prefix: "m.")
|
||||
.AddJsonFile("appsettings.json", optional: true)
|
||||
.Build();
|
||||
string CardId = "9bfb91d2-8e14-4c6d-b91d-8a55ab4c6559";
|
||||
string CardToken = "L3NsEQsW69sM3Gm0v/+hHDaU4TFocp7F";
|
||||
string CardId = "28fd1597-05a9-4ee0-8845-16ca37135081";
|
||||
string CardToken = "m+ziDmuTdFElD0vcKYnO3DS1h/9HuRGk";
|
||||
sp = new SPWorlds(CardId, CardToken);
|
||||
}
|
||||
|
||||
|
||||
14
Types/ReportTypes.cs
Normal file
14
Types/ReportTypes.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
namespace DiscordApp.Types
|
||||
{
|
||||
public enum ReportTypes
|
||||
{
|
||||
NewPassport = 3,
|
||||
editPassport = 2,
|
||||
Bizness = 4,
|
||||
ChangePassportId = 64,
|
||||
PetPassport = 2,
|
||||
Marry = 4,
|
||||
BirthDocument = 4,
|
||||
Patent = 2
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user