diff --git a/backend/dev.Dockerfile b/backend/dev.Dockerfile index 42b5c5c8d..47224d580 100644 --- a/backend/dev.Dockerfile +++ b/backend/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 +FROM mcr.microsoft.com/dotnet/sdk:8.0 # needed in sln file RUN mkdir /build && echo '' > /build/docker-compose.dcproj diff --git a/backend/global.json b/backend/global.json new file mode 100644 index 000000000..b5b37b60d --- /dev/null +++ b/backend/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "8.0.0", + "rollForward": "latestMajor", + "allowPrerelease": false + } +} \ No newline at end of file diff --git a/backend/src/AcmStatisticsBackend.Application/AcmStatisticsBackend.Application.csproj b/backend/src/AcmStatisticsBackend.Application/AcmStatisticsBackend.Application.csproj index 4d815c251..fd3b1e4a1 100644 --- a/backend/src/AcmStatisticsBackend.Application/AcmStatisticsBackend.Application.csproj +++ b/backend/src/AcmStatisticsBackend.Application/AcmStatisticsBackend.Application.csproj @@ -1,7 +1,7 @@ 1.0.0.0 - net7.0 + net8.0 AcmStatisticsBackend.Application AcmStatisticsBackend.Application false @@ -21,6 +21,9 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/backend/src/AcmStatisticsBackend.Application/Crawlers/Dto/QueryWorkerHistoryDto.cs b/backend/src/AcmStatisticsBackend.Application/Crawlers/Dto/QueryWorkerHistoryDto.cs index 3fe54bd40..2d593646b 100644 --- a/backend/src/AcmStatisticsBackend.Application/Crawlers/Dto/QueryWorkerHistoryDto.cs +++ b/backend/src/AcmStatisticsBackend.Application/Crawlers/Dto/QueryWorkerHistoryDto.cs @@ -3,7 +3,6 @@ using System.Diagnostics.CodeAnalysis; using Abp.AutoMapper; using Abp.Runtime.Validation; -using Castle.Core.Internal; namespace AcmStatisticsBackend.Crawlers.Dto { @@ -63,7 +62,7 @@ public class QueryWorkerHistoryDto : ICustomValidate public void AddValidationErrors(CustomValidationContext context) { - if (!ErrorMessage.IsNullOrEmpty()) + if (!string.IsNullOrEmpty(ErrorMessage)) { if (SolvedList != null || SubmissionsByCrawlerName != null) { diff --git a/backend/src/AcmStatisticsBackend.Core/AcmStatisticsBackend.Core.csproj b/backend/src/AcmStatisticsBackend.Core/AcmStatisticsBackend.Core.csproj index 608df666e..b824c812a 100644 --- a/backend/src/AcmStatisticsBackend.Core/AcmStatisticsBackend.Core.csproj +++ b/backend/src/AcmStatisticsBackend.Core/AcmStatisticsBackend.Core.csproj @@ -1,7 +1,7 @@ 1.0.0.0 - net7.0 + net8.0 AcmStatisticsBackend.Core AcmStatisticsBackend.Core false @@ -14,9 +14,9 @@ - - - - + + + + diff --git a/backend/src/AcmStatisticsBackend.Core/ServiceClients/CrawlerApiBackendClient.cs b/backend/src/AcmStatisticsBackend.Core/ServiceClients/CrawlerApiBackendClient.cs index 0ea2de170..4065ecfa9 100644 --- a/backend/src/AcmStatisticsBackend.Core/ServiceClients/CrawlerApiBackendClient.cs +++ b/backend/src/AcmStatisticsBackend.Core/ServiceClients/CrawlerApiBackendClient.cs @@ -37,7 +37,7 @@ public async Task> GetCrawlerMeta() #pragma warning disable SA1300 private class GetMetaReturn { - public string error { get; set; } + public bool error { get; set; } public IDictionary data { get; set; } } diff --git a/backend/src/AcmStatisticsBackend.EntityFrameworkCore/AcmStatisticsBackend.EntityFrameworkCore.csproj b/backend/src/AcmStatisticsBackend.EntityFrameworkCore/AcmStatisticsBackend.EntityFrameworkCore.csproj index 4f514e7a4..11660a235 100644 --- a/backend/src/AcmStatisticsBackend.EntityFrameworkCore/AcmStatisticsBackend.EntityFrameworkCore.csproj +++ b/backend/src/AcmStatisticsBackend.EntityFrameworkCore/AcmStatisticsBackend.EntityFrameworkCore.csproj @@ -1,17 +1,17 @@ - net7.0 + net8.0 AcmStatisticsBackend true true true - + all runtime; build; native; contentfiles; analyzers - + diff --git a/backend/src/AcmStatisticsBackend.EntityFrameworkCore/Migrations/20250813025256_UpgradeAbp840.Designer.cs b/backend/src/AcmStatisticsBackend.EntityFrameworkCore/Migrations/20250813025256_UpgradeAbp840.Designer.cs new file mode 100644 index 000000000..bdda75aeb --- /dev/null +++ b/backend/src/AcmStatisticsBackend.EntityFrameworkCore/Migrations/20250813025256_UpgradeAbp840.Designer.cs @@ -0,0 +1,2332 @@ +// +using System; +using AcmStatisticsBackend.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace AcmStatisticsBackend.Migrations +{ + [DbContext(typeof(AcmStatisticsBackendDbContext))] + [Migration("20250813025256_UpgradeAbp840")] + partial class UpgradeAbp840 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.19") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); + + modelBuilder.Entity("Abp.Application.Editions.Edition", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("DeleterUserId") + .HasColumnType("bigint"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierUserId") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.HasKey("Id"); + + b.ToTable("AbpEditions"); + }); + + modelBuilder.Entity("Abp.Application.Features.FeatureSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("varchar(2000)"); + + b.HasKey("Id"); + + b.ToTable("AbpFeatures"); + + b.HasDiscriminator().HasValue("FeatureSetting"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Abp.Auditing.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CustomData") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)"); + + b.Property("Exception") + .HasMaxLength(2000) + .HasColumnType("varchar(2000)"); + + b.Property("ExceptionMessage") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ExecutionDuration") + .HasColumnType("int"); + + b.Property("ExecutionTime") + .HasColumnType("datetime(6)"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("int"); + + b.Property("ImpersonatorUserId") + .HasColumnType("bigint"); + + b.Property("MethodName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Parameters") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("ReturnValue") + .HasColumnType("longtext"); + + b.Property("ServiceName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionDuration"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Abp.Authorization.PermissionSetting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("varchar(21)"); + + b.Property("IsGranted") + .HasColumnType("tinyint(1)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpPermissions"); + + b.HasDiscriminator().HasValue("PermissionSetting"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Abp.Authorization.Roles.RoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("TenantId", "ClaimType"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("DeleterUserId") + .HasColumnType("bigint"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("EmailAddress") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierUserId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.Property("UserLinkId") + .HasColumnType("bigint"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("EmailAddress"); + + b.HasIndex("UserName"); + + b.HasIndex("TenantId", "EmailAddress"); + + b.HasIndex("TenantId", "UserId"); + + b.HasIndex("TenantId", "UserName"); + + b.ToTable("AbpUserAccounts"); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("ClaimValue") + .HasColumnType("longtext"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("TenantId", "ClaimType"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserLogin", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("LoginProvider") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("ProviderKey") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("ProviderKey", "TenantId") + .IsUnique(); + + b.HasIndex("TenantId", "UserId"); + + b.HasIndex("TenantId", "LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserLoginAttempt", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("Result") + .HasColumnType("tinyint unsigned"); + + b.Property("TenancyName") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.Property("UserNameOrEmailAddress") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "TenantId"); + + b.HasIndex("TenancyName", "UserNameOrEmailAddress", "Result"); + + b.ToTable("AbpUserLoginAttempts"); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserOrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("OrganizationUnitId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "OrganizationUnitId"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpUserOrganizationUnits"); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("TenantId", "RoleId"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserToken", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ExpireDate") + .HasColumnType("datetime(6)"); + + b.Property("LoginProvider") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Name") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.Property("Value") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Abp.BackgroundJobs.BackgroundJobInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("IsAbandoned") + .HasColumnType("tinyint(1)"); + + b.Property("JobArgs") + .IsRequired() + .HasMaxLength(1048576) + .HasColumnType("longtext"); + + b.Property("JobType") + .IsRequired() + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("LastTryTime") + .HasColumnType("datetime(6)"); + + b.Property("NextTryTime") + .HasColumnType("datetime(6)"); + + b.Property("Priority") + .HasColumnType("tinyint unsigned"); + + b.Property("TryCount") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs"); + }); + + modelBuilder.Entity("Abp.Configuration.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierUserId") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.Property("Value") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("TenantId", "Name", "UserId") + .IsUnique(); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Abp.DynamicEntityProperties.DynamicEntityProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DynamicPropertyId") + .HasColumnType("int"); + + b.Property("EntityFullName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DynamicPropertyId"); + + b.HasIndex("EntityFullName", "DynamicPropertyId", "TenantId") + .IsUnique(); + + b.ToTable("AbpDynamicEntityProperties"); + }); + + modelBuilder.Entity("Abp.DynamicEntityProperties.DynamicEntityPropertyValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DynamicEntityPropertyId") + .HasColumnType("int"); + + b.Property("EntityId") + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("Value") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("DynamicEntityPropertyId"); + + b.ToTable("AbpDynamicEntityPropertyValues"); + }); + + modelBuilder.Entity("Abp.DynamicEntityProperties.DynamicProperty", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DisplayName") + .HasColumnType("longtext"); + + b.Property("InputType") + .HasColumnType("longtext"); + + b.Property("Permission") + .HasColumnType("longtext"); + + b.Property("PropertyName") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("PropertyName", "TenantId") + .IsUnique(); + + b.ToTable("AbpDynamicProperties"); + }); + + modelBuilder.Entity("Abp.DynamicEntityProperties.DynamicPropertyValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("DynamicPropertyId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("Value") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("DynamicPropertyId"); + + b.ToTable("AbpDynamicPropertyValues"); + }); + + modelBuilder.Entity("Abp.EntityHistory.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ChangeTime") + .HasColumnType("datetime(6)"); + + b.Property("ChangeType") + .HasColumnType("tinyint unsigned"); + + b.Property("EntityChangeSetId") + .HasColumnType("bigint"); + + b.Property("EntityId") + .HasMaxLength(48) + .HasColumnType("varchar(48)"); + + b.Property("EntityTypeFullName") + .HasMaxLength(192) + .HasColumnType("varchar(192)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeSetId"); + + b.HasIndex("EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Abp.EntityHistory.EntityChangeSet", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("BrowserInfo") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("ClientIpAddress") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ClientName") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("ExtensionData") + .HasColumnType("longtext"); + + b.Property("ImpersonatorTenantId") + .HasColumnType("int"); + + b.Property("ImpersonatorUserId") + .HasColumnType("bigint"); + + b.Property("Reason") + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "CreationTime"); + + b.HasIndex("TenantId", "Reason"); + + b.HasIndex("TenantId", "UserId"); + + b.ToTable("AbpEntityChangeSets"); + }); + + modelBuilder.Entity("Abp.EntityHistory.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("EntityChangeId") + .HasColumnType("bigint"); + + b.Property("NewValue") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("NewValueHash") + .HasColumnType("longtext"); + + b.Property("OriginalValue") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("OriginalValueHash") + .HasColumnType("longtext"); + + b.Property("PropertyName") + .HasMaxLength(96) + .HasColumnType("varchar(96)"); + + b.Property("PropertyTypeFullName") + .HasMaxLength(192) + .HasColumnType("varchar(192)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Abp.Localization.ApplicationLanguage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("DeleterUserId") + .HasColumnType("bigint"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("Icon") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("IsDisabled") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierUserId") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpLanguages"); + }); + + modelBuilder.Entity("Abp.Localization.ApplicationLanguageText", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("Key") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("LanguageName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierUserId") + .HasColumnType("bigint"); + + b.Property("Source") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(67108864) + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "Source", "LanguageName", "Key"); + + b.ToTable("AbpLanguageTexts"); + }); + + modelBuilder.Entity("Abp.Notifications.NotificationInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("Data") + .HasMaxLength(1048576) + .HasColumnType("longtext"); + + b.Property("DataTypeName") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("EntityId") + .HasMaxLength(96) + .HasColumnType("varchar(96)"); + + b.Property("EntityTypeAssemblyQualifiedName") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("EntityTypeName") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("ExcludedUserIds") + .HasMaxLength(131072) + .HasColumnType("longtext"); + + b.Property("NotificationName") + .IsRequired() + .HasMaxLength(96) + .HasColumnType("varchar(96)"); + + b.Property("Severity") + .HasColumnType("tinyint unsigned"); + + b.Property("TargetNotifiers") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("TenantIds") + .HasMaxLength(131072) + .HasColumnType("longtext"); + + b.Property("UserIds") + .HasMaxLength(131072) + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("AbpNotifications"); + }); + + modelBuilder.Entity("Abp.Notifications.NotificationSubscriptionInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("EntityId") + .HasMaxLength(96) + .HasColumnType("varchar(96)"); + + b.Property("EntityTypeAssemblyQualifiedName") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("EntityTypeName") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("NotificationName") + .HasMaxLength(96) + .HasColumnType("varchar(96)"); + + b.Property("TargetNotifiers") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("NotificationName", "EntityTypeName", "EntityId", "UserId"); + + b.HasIndex("TenantId", "NotificationName", "EntityTypeName", "EntityId", "UserId"); + + b.ToTable("AbpNotificationSubscriptions"); + }); + + modelBuilder.Entity("Abp.Notifications.TenantNotificationInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("Data") + .HasMaxLength(1048576) + .HasColumnType("longtext"); + + b.Property("DataTypeName") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("EntityId") + .HasMaxLength(96) + .HasColumnType("varchar(96)"); + + b.Property("EntityTypeAssemblyQualifiedName") + .HasMaxLength(512) + .HasColumnType("varchar(512)"); + + b.Property("EntityTypeName") + .HasMaxLength(250) + .HasColumnType("varchar(250)"); + + b.Property("NotificationName") + .IsRequired() + .HasMaxLength(96) + .HasColumnType("varchar(96)"); + + b.Property("Severity") + .HasColumnType("tinyint unsigned"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId"); + + b.ToTable("AbpTenantNotifications"); + }); + + modelBuilder.Entity("Abp.Notifications.UserNotificationInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("State") + .HasColumnType("int"); + + b.Property("TargetNotifiers") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("TenantNotificationId") + .HasColumnType("char(36)"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("UserId", "State", "CreationTime"); + + b.ToTable("AbpUserNotifications"); + }); + + modelBuilder.Entity("Abp.Organizations.OrganizationUnit", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("Code") + .IsRequired() + .HasMaxLength(95) + .HasColumnType("varchar(95)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("DeleterUserId") + .HasColumnType("bigint"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierUserId") + .HasColumnType("bigint"); + + b.Property("ParentId") + .HasColumnType("bigint"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("TenantId", "Code"); + + b.ToTable("AbpOrganizationUnits"); + }); + + modelBuilder.Entity("Abp.Organizations.OrganizationUnitRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("OrganizationUnitId") + .HasColumnType("bigint"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "OrganizationUnitId"); + + b.HasIndex("TenantId", "RoleId"); + + b.ToTable("AbpOrganizationUnitRoles"); + }); + + modelBuilder.Entity("Abp.Webhooks.WebhookEvent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("Data") + .HasColumnType("longtext"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WebhookName") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("AbpWebhookEvents"); + }); + + modelBuilder.Entity("Abp.Webhooks.WebhookSendAttempt", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("Response") + .HasColumnType("longtext"); + + b.Property("ResponseStatusCode") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WebhookEventId") + .HasColumnType("char(36)"); + + b.Property("WebhookSubscriptionId") + .HasColumnType("char(36)"); + + b.HasKey("Id"); + + b.HasIndex("WebhookEventId"); + + b.ToTable("AbpWebhookSendAttempts"); + }); + + modelBuilder.Entity("Abp.Webhooks.WebhookSubscriptionInfo", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("Headers") + .HasColumnType("longtext"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("Secret") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("WebhookUri") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("Webhooks") + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.ToTable("AbpWebhookSubscriptions"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Authorization.Roles.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("DeleterUserId") + .HasColumnType("bigint"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("IsDefault") + .HasColumnType("tinyint(1)"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("IsStatic") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierUserId") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CreatorUserId"); + + b.HasIndex("DeleterUserId"); + + b.HasIndex("LastModifierUserId"); + + b.HasIndex("TenantId", "NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Authorization.Users.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("AuthenticationSource") + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("DeleterUserId") + .HasColumnType("bigint"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("EmailAddress") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("EmailConfirmationCode") + .HasMaxLength(328) + .HasColumnType("varchar(328)"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("IsEmailConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("IsLockoutEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("IsPhoneNumberConfirmed") + .HasColumnType("tinyint(1)"); + + b.Property("IsTwoFactorEnabled") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierUserId") + .HasColumnType("bigint"); + + b.Property("LockoutEndDateUtc") + .HasColumnType("datetime(6)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("NormalizedEmailAddress") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("NormalizedUserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("PasswordResetCode") + .HasMaxLength(328) + .HasColumnType("varchar(328)"); + + b.Property("PhoneNumber") + .HasMaxLength(32) + .HasColumnType("varchar(32)"); + + b.Property("SecurityStamp") + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("Surname") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.Property("TenantId") + .HasColumnType("int"); + + b.Property("UserName") + .IsRequired() + .HasMaxLength(256) + .HasColumnType("varchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("CreatorUserId"); + + b.HasIndex("DeleterUserId"); + + b.HasIndex("LastModifierUserId"); + + b.HasIndex("TenantId", "NormalizedEmailAddress"); + + b.HasIndex("TenantId", "NormalizedUserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.DefaultQuery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("DeleterUserId") + .HasColumnType("bigint"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierUserId") + .HasColumnType("bigint"); + + b.Property("MainUsername") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.Property("UsernamesInCrawlers") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("CreatorUserId"); + + b.HasIndex("DeleterUserId"); + + b.HasIndex("LastModifierUserId"); + + b.HasIndex("UserId"); + + b.ToTable("DefaultQueries"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.QueryCrawlerSummary", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CrawlerName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("IsVirtualJudge") + .HasColumnType("tinyint(1)"); + + b.Property("QuerySummaryId") + .HasColumnType("bigint"); + + b.Property("Solved") + .HasColumnType("int"); + + b.Property("Submission") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("QuerySummaryId"); + + b.ToTable("QueryCrawlerSummaries"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.QueryHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("IsReliableSource") + .HasColumnType("tinyint(1)"); + + b.Property("MainUsername") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("QueryHistories"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.QuerySummary", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("GenerateTime") + .HasColumnType("datetime(6)"); + + b.Property("QueryHistoryId") + .HasColumnType("bigint"); + + b.Property("Solved") + .HasColumnType("int"); + + b.Property("Submission") + .HasColumnType("int"); + + b.Property("SummaryWarnings") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("QueryHistoryId") + .IsUnique(); + + b.ToTable("QuerySummaries"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.QueryWorkerHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CrawlerName") + .IsRequired() + .HasColumnType("longtext"); + + b.Property("ErrorMessage") + .HasColumnType("longtext"); + + b.Property("IsVirtualJudge") + .HasColumnType("tinyint(1)"); + + b.Property("QueryHistoryId") + .HasColumnType("bigint"); + + b.Property("Solved") + .HasColumnType("int"); + + b.Property("SolvedList") + .HasColumnType("longtext"); + + b.Property("Submission") + .HasColumnType("int"); + + b.Property("SubmissionsByCrawlerName") + .HasColumnType("longtext"); + + b.Property("Username") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("QueryHistoryId"); + + b.ToTable("QueryWorkerHistories"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.UsernameInCrawler", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("FromCrawlerName") + .HasColumnType("longtext"); + + b.Property("QueryCrawlerSummaryId") + .HasColumnType("bigint"); + + b.Property("Username") + .IsRequired() + .HasColumnType("longtext"); + + b.HasKey("Id"); + + b.HasIndex("QueryCrawlerSummaryId"); + + b.ToTable("UsernameInCrawler"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.MultiTenancy.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("ConnectionString") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("DeleterUserId") + .HasColumnType("bigint"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("EditionId") + .HasColumnType("int"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierUserId") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("varchar(128)"); + + b.Property("TenancyName") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("varchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("CreatorUserId"); + + b.HasIndex("DeleterUserId"); + + b.HasIndex("EditionId"); + + b.HasIndex("LastModifierUserId"); + + b.HasIndex("TenancyName"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Settings.UserSettingAttribute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + + b.Property("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorUserId") + .HasColumnType("bigint"); + + b.Property("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierUserId") + .HasColumnType("bigint"); + + b.Property("LastTimeZoneChangedTime") + .HasColumnType("datetime(6)"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("CreatorUserId"); + + b.HasIndex("LastModifierUserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserSettingAttributes"); + }); + + modelBuilder.Entity("Abp.Application.Features.EditionFeatureSetting", b => + { + b.HasBaseType("Abp.Application.Features.FeatureSetting"); + + b.Property("EditionId") + .HasColumnType("int"); + + b.HasIndex("EditionId", "Name"); + + b.ToTable("AbpFeatures"); + + b.HasDiscriminator().HasValue("EditionFeatureSetting"); + }); + + modelBuilder.Entity("Abp.MultiTenancy.TenantFeatureSetting", b => + { + b.HasBaseType("Abp.Application.Features.FeatureSetting"); + + b.HasIndex("TenantId", "Name"); + + b.ToTable("AbpFeatures"); + + b.HasDiscriminator().HasValue("TenantFeatureSetting"); + }); + + modelBuilder.Entity("Abp.Authorization.Roles.RolePermissionSetting", b => + { + b.HasBaseType("Abp.Authorization.PermissionSetting"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpPermissions"); + + b.HasDiscriminator().HasValue("RolePermissionSetting"); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserPermissionSetting", b => + { + b.HasBaseType("Abp.Authorization.PermissionSetting"); + + b.Property("UserId") + .HasColumnType("bigint"); + + b.HasIndex("UserId"); + + b.ToTable("AbpPermissions"); + + b.HasDiscriminator().HasValue("UserPermissionSetting"); + }); + + modelBuilder.Entity("Abp.Authorization.Roles.RoleClaim", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Roles.Role", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserClaim", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserLogin", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserRole", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserToken", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Abp.Configuration.Setting", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", null) + .WithMany("Settings") + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("Abp.DynamicEntityProperties.DynamicEntityProperty", b => + { + b.HasOne("Abp.DynamicEntityProperties.DynamicProperty", "DynamicProperty") + .WithMany() + .HasForeignKey("DynamicPropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DynamicProperty"); + }); + + modelBuilder.Entity("Abp.DynamicEntityProperties.DynamicEntityPropertyValue", b => + { + b.HasOne("Abp.DynamicEntityProperties.DynamicEntityProperty", "DynamicEntityProperty") + .WithMany() + .HasForeignKey("DynamicEntityPropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DynamicEntityProperty"); + }); + + modelBuilder.Entity("Abp.DynamicEntityProperties.DynamicPropertyValue", b => + { + b.HasOne("Abp.DynamicEntityProperties.DynamicProperty", "DynamicProperty") + .WithMany("DynamicPropertyValues") + .HasForeignKey("DynamicPropertyId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DynamicProperty"); + }); + + modelBuilder.Entity("Abp.EntityHistory.EntityChange", b => + { + b.HasOne("Abp.EntityHistory.EntityChangeSet", null) + .WithMany("EntityChanges") + .HasForeignKey("EntityChangeSetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Abp.EntityHistory.EntityPropertyChange", b => + { + b.HasOne("Abp.EntityHistory.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Abp.Organizations.OrganizationUnit", b => + { + b.HasOne("Abp.Organizations.OrganizationUnit", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Abp.Webhooks.WebhookSendAttempt", b => + { + b.HasOne("Abp.Webhooks.WebhookEvent", "WebhookEvent") + .WithMany() + .HasForeignKey("WebhookEventId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WebhookEvent"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Authorization.Roles.Role", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "CreatorUser") + .WithMany() + .HasForeignKey("CreatorUserId"); + + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "DeleterUser") + .WithMany() + .HasForeignKey("DeleterUserId"); + + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "LastModifierUser") + .WithMany() + .HasForeignKey("LastModifierUserId"); + + b.Navigation("CreatorUser"); + + b.Navigation("DeleterUser"); + + b.Navigation("LastModifierUser"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Authorization.Users.User", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "CreatorUser") + .WithMany() + .HasForeignKey("CreatorUserId"); + + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "DeleterUser") + .WithMany() + .HasForeignKey("DeleterUserId"); + + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "LastModifierUser") + .WithMany() + .HasForeignKey("LastModifierUserId"); + + b.Navigation("CreatorUser"); + + b.Navigation("DeleterUser"); + + b.Navigation("LastModifierUser"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.DefaultQuery", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "CreatorUser") + .WithMany() + .HasForeignKey("CreatorUserId"); + + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "DeleterUser") + .WithMany() + .HasForeignKey("DeleterUserId"); + + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "LastModifierUser") + .WithMany() + .HasForeignKey("LastModifierUserId"); + + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatorUser"); + + b.Navigation("DeleterUser"); + + b.Navigation("LastModifierUser"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.QueryCrawlerSummary", b => + { + b.HasOne("AcmStatisticsBackend.Crawlers.QuerySummary", "QuerySummary") + .WithMany("QueryCrawlerSummaries") + .HasForeignKey("QuerySummaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QuerySummary"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.QueryHistory", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.QuerySummary", b => + { + b.HasOne("AcmStatisticsBackend.Crawlers.QueryHistory", "QueryHistory") + .WithOne() + .HasForeignKey("AcmStatisticsBackend.Crawlers.QuerySummary", "QueryHistoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QueryHistory"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.QueryWorkerHistory", b => + { + b.HasOne("AcmStatisticsBackend.Crawlers.QueryHistory", "QueryHistory") + .WithMany("QueryWorkerHistories") + .HasForeignKey("QueryHistoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QueryHistory"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.UsernameInCrawler", b => + { + b.HasOne("AcmStatisticsBackend.Crawlers.QueryCrawlerSummary", "QueryCrawlerSummary") + .WithMany("Usernames") + .HasForeignKey("QueryCrawlerSummaryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("QueryCrawlerSummary"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.MultiTenancy.Tenant", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "CreatorUser") + .WithMany() + .HasForeignKey("CreatorUserId"); + + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "DeleterUser") + .WithMany() + .HasForeignKey("DeleterUserId"); + + b.HasOne("Abp.Application.Editions.Edition", "Edition") + .WithMany() + .HasForeignKey("EditionId"); + + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "LastModifierUser") + .WithMany() + .HasForeignKey("LastModifierUserId"); + + b.Navigation("CreatorUser"); + + b.Navigation("DeleterUser"); + + b.Navigation("Edition"); + + b.Navigation("LastModifierUser"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Settings.UserSettingAttribute", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "CreatorUser") + .WithMany() + .HasForeignKey("CreatorUserId"); + + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "LastModifierUser") + .WithMany() + .HasForeignKey("LastModifierUserId"); + + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatorUser"); + + b.Navigation("LastModifierUser"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Abp.Application.Features.EditionFeatureSetting", b => + { + b.HasOne("Abp.Application.Editions.Edition", "Edition") + .WithMany() + .HasForeignKey("EditionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Edition"); + }); + + modelBuilder.Entity("Abp.Authorization.Roles.RolePermissionSetting", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Roles.Role", null) + .WithMany("Permissions") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Abp.Authorization.Users.UserPermissionSetting", b => + { + b.HasOne("AcmStatisticsBackend.Authorization.Users.User", null) + .WithMany("Permissions") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Abp.DynamicEntityProperties.DynamicProperty", b => + { + b.Navigation("DynamicPropertyValues"); + }); + + modelBuilder.Entity("Abp.EntityHistory.EntityChange", b => + { + b.Navigation("PropertyChanges"); + }); + + modelBuilder.Entity("Abp.EntityHistory.EntityChangeSet", b => + { + b.Navigation("EntityChanges"); + }); + + modelBuilder.Entity("Abp.Organizations.OrganizationUnit", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Authorization.Roles.Role", b => + { + b.Navigation("Claims"); + + b.Navigation("Permissions"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Authorization.Users.User", b => + { + b.Navigation("Claims"); + + b.Navigation("Logins"); + + b.Navigation("Permissions"); + + b.Navigation("Roles"); + + b.Navigation("Settings"); + + b.Navigation("Tokens"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.QueryCrawlerSummary", b => + { + b.Navigation("Usernames"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.QueryHistory", b => + { + b.Navigation("QueryWorkerHistories"); + }); + + modelBuilder.Entity("AcmStatisticsBackend.Crawlers.QuerySummary", b => + { + b.Navigation("QueryCrawlerSummaries"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/backend/src/AcmStatisticsBackend.EntityFrameworkCore/Migrations/20250813025256_UpgradeAbp840.cs b/backend/src/AcmStatisticsBackend.EntityFrameworkCore/Migrations/20250813025256_UpgradeAbp840.cs new file mode 100644 index 000000000..104730094 --- /dev/null +++ b/backend/src/AcmStatisticsBackend.EntityFrameworkCore/Migrations/20250813025256_UpgradeAbp840.cs @@ -0,0 +1,739 @@ +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace AcmStatisticsBackend.Migrations +{ + /// + public partial class UpgradeAbp840 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Id", + table: "UserSettingAttributes", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "UsernameInCrawler", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "QueryWorkerHistories", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "QuerySummaries", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "QueryHistories", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "QueryCrawlerSummaries", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "DefaultQueries", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserTokens", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUsers", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserRoles", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserOrganizationUnits", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AddColumn( + name: "TargetNotifiers", + table: "AbpUserNotifications", + type: "varchar(1024)", + maxLength: 1024, + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserLogins", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserLoginAttempts", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserClaims", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserAccounts", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpTenants", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpSettings", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpRoles", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpRoleClaims", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Discriminator", + table: "AbpPermissions", + type: "varchar(21)", + maxLength: 21, + nullable: false, + oldClrType: typeof(string), + oldType: "longtext") + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpPermissions", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpOrganizationUnits", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpOrganizationUnitRoles", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AddColumn( + name: "TargetNotifiers", + table: "AbpNotificationSubscriptions", + type: "varchar(1024)", + maxLength: 1024, + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AddColumn( + name: "TargetNotifiers", + table: "AbpNotifications", + type: "varchar(1024)", + maxLength: 1024, + nullable: true) + .Annotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpLanguageTexts", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpLanguages", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Discriminator", + table: "AbpFeatures", + type: "varchar(21)", + maxLength: 21, + nullable: false, + oldClrType: typeof(string), + oldType: "longtext") + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpFeatures", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpEntityPropertyChanges", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpEntityChangeSets", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpEntityChanges", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpEditions", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpDynamicPropertyValues", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpDynamicProperties", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpDynamicEntityPropertyValues", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpDynamicEntityProperties", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpBackgroundJobs", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpAuditLogs", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.CreateIndex( + name: "IX_AbpUserLogins_ProviderKey_TenantId", + table: "AbpUserLogins", + columns: new[] { "ProviderKey", "TenantId" }, + unique: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_AbpUserLogins_ProviderKey_TenantId", + table: "AbpUserLogins"); + + migrationBuilder.DropColumn( + name: "TargetNotifiers", + table: "AbpUserNotifications"); + + migrationBuilder.DropColumn( + name: "TargetNotifiers", + table: "AbpNotificationSubscriptions"); + + migrationBuilder.DropColumn( + name: "TargetNotifiers", + table: "AbpNotifications"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "UserSettingAttributes", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "UsernameInCrawler", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "QueryWorkerHistories", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "QuerySummaries", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "QueryHistories", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "QueryCrawlerSummaries", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "DefaultQueries", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserTokens", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUsers", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserRoles", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserOrganizationUnits", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserLogins", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserLoginAttempts", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserClaims", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpUserAccounts", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpTenants", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpSettings", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpRoles", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpRoleClaims", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Discriminator", + table: "AbpPermissions", + type: "longtext", + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(21)", + oldMaxLength: 21) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpPermissions", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpOrganizationUnits", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpOrganizationUnitRoles", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpLanguageTexts", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpLanguages", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Discriminator", + table: "AbpFeatures", + type: "longtext", + nullable: false, + oldClrType: typeof(string), + oldType: "varchar(21)", + oldMaxLength: 21) + .Annotation("MySql:CharSet", "utf8mb4") + .OldAnnotation("MySql:CharSet", "utf8mb4"); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpFeatures", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpEntityPropertyChanges", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpEntityChangeSets", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpEntityChanges", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpEditions", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpDynamicPropertyValues", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpDynamicProperties", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpDynamicEntityPropertyValues", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpDynamicEntityProperties", + type: "int", + nullable: false, + oldClrType: typeof(int), + oldType: "int") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpBackgroundJobs", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + + migrationBuilder.AlterColumn( + name: "Id", + table: "AbpAuditLogs", + type: "bigint", + nullable: false, + oldClrType: typeof(long), + oldType: "bigint") + .OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn); + } + } +} diff --git a/backend/src/AcmStatisticsBackend.EntityFrameworkCore/Migrations/AcmStatisticsBackendDbContextModelSnapshot.cs b/backend/src/AcmStatisticsBackend.EntityFrameworkCore/Migrations/AcmStatisticsBackendDbContextModelSnapshot.cs index cb60e98aa..ef3165c06 100644 --- a/backend/src/AcmStatisticsBackend.EntityFrameworkCore/Migrations/AcmStatisticsBackendDbContextModelSnapshot.cs +++ b/backend/src/AcmStatisticsBackend.EntityFrameworkCore/Migrations/AcmStatisticsBackendDbContextModelSnapshot.cs @@ -3,8 +3,11 @@ using AcmStatisticsBackend.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +#nullable disable + namespace AcmStatisticsBackend.Migrations { [DbContext(typeof(AcmStatisticsBackendDbContext))] @@ -14,8 +17,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 64) - .HasAnnotation("ProductVersion", "5.0.7"); + .HasAnnotation("ProductVersion", "8.0.19") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder); modelBuilder.Entity("Abp.Application.Editions.Edition", b => { @@ -23,6 +28,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -65,6 +72,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -73,7 +82,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Discriminator") .IsRequired() - .HasColumnType("longtext"); + .HasMaxLength(21) + .HasColumnType("varchar(21)"); b.Property("Name") .IsRequired() @@ -92,7 +102,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("AbpFeatures"); - b.HasDiscriminator("Discriminator").HasValue("FeatureSetting"); + b.HasDiscriminator().HasValue("FeatureSetting"); + + b.UseTphMappingStrategy(); }); modelBuilder.Entity("Abp.Auditing.AuditLog", b => @@ -101,6 +113,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("BrowserInfo") .HasMaxLength(512) .HasColumnType("varchar(512)"); @@ -175,6 +189,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -183,7 +199,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Discriminator") .IsRequired() - .HasColumnType("longtext"); + .HasMaxLength(21) + .HasColumnType("varchar(21)"); b.Property("IsGranted") .HasColumnType("tinyint(1)"); @@ -202,7 +219,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("AbpPermissions"); - b.HasDiscriminator("Discriminator").HasValue("PermissionSetting"); + b.HasDiscriminator().HasValue("PermissionSetting"); + + b.UseTphMappingStrategy(); }); modelBuilder.Entity("Abp.Authorization.Roles.RoleClaim", b => @@ -211,6 +230,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("ClaimType") .HasMaxLength(256) .HasColumnType("varchar(256)"); @@ -245,6 +266,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -304,6 +327,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("ClaimType") .HasMaxLength(256) .HasColumnType("varchar(256)"); @@ -338,6 +363,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("LoginProvider") .IsRequired() .HasMaxLength(128) @@ -358,6 +385,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("UserId"); + b.HasIndex("ProviderKey", "TenantId") + .IsUnique(); + b.HasIndex("TenantId", "UserId"); b.HasIndex("TenantId", "LoginProvider", "ProviderKey"); @@ -371,6 +401,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("BrowserInfo") .HasMaxLength(512) .HasColumnType("varchar(512)"); @@ -418,6 +450,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -451,6 +485,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -483,6 +519,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("ExpireDate") .HasColumnType("datetime(6)"); @@ -519,6 +557,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -563,6 +603,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -605,6 +647,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("DynamicPropertyId") .HasColumnType("int"); @@ -631,6 +675,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("DynamicEntityPropertyId") .HasColumnType("int"); @@ -657,6 +703,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("DisplayName") .HasColumnType("longtext"); @@ -687,6 +735,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("DynamicPropertyId") .HasColumnType("int"); @@ -710,6 +760,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("ChangeTime") .HasColumnType("datetime(6)"); @@ -745,6 +797,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("BrowserInfo") .HasMaxLength(512) .HasColumnType("varchar(512)"); @@ -796,6 +850,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("EntityChangeId") .HasColumnType("bigint"); @@ -837,6 +893,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -891,6 +949,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -977,6 +1037,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Severity") .HasColumnType("tinyint unsigned"); + b.Property("TargetNotifiers") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + b.Property("TenantIds") .HasMaxLength(131072) .HasColumnType("longtext"); @@ -1018,6 +1082,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasMaxLength(96) .HasColumnType("varchar(96)"); + b.Property("TargetNotifiers") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + b.Property("TenantId") .HasColumnType("int"); @@ -1095,6 +1163,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("State") .HasColumnType("int"); + b.Property("TargetNotifiers") + .HasMaxLength(1024) + .HasColumnType("varchar(1024)"); + b.Property("TenantId") .HasColumnType("int"); @@ -1117,6 +1189,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("Code") .IsRequired() .HasMaxLength(95) @@ -1169,6 +1243,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -1303,6 +1379,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasMaxLength(128) @@ -1372,6 +1450,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("AccessFailedCount") .HasColumnType("int"); @@ -1498,6 +1578,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -1549,6 +1631,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CrawlerName") .IsRequired() .HasColumnType("longtext"); @@ -1578,6 +1662,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); @@ -1604,6 +1690,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("GenerateTime") .HasColumnType("datetime(6)"); @@ -1634,6 +1722,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CrawlerName") .IsRequired() .HasColumnType("longtext"); @@ -1676,6 +1766,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("FromCrawlerName") .HasColumnType("longtext"); @@ -1699,6 +1791,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("ConnectionString") .HasMaxLength(1024) .HasColumnType("varchar(1024)"); @@ -1761,6 +1855,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); + MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id")); + b.Property("CreationTime") .HasColumnType("datetime(6)"); diff --git a/backend/src/AcmStatisticsBackend.Web.Core/AcmStatisticsBackend.Web.Core.csproj b/backend/src/AcmStatisticsBackend.Web.Core/AcmStatisticsBackend.Web.Core.csproj index 687137292..d7b8a42cc 100644 --- a/backend/src/AcmStatisticsBackend.Web.Core/AcmStatisticsBackend.Web.Core.csproj +++ b/backend/src/AcmStatisticsBackend.Web.Core/AcmStatisticsBackend.Web.Core.csproj @@ -1,7 +1,7 @@ 1.0.0.0 - net7.0 + net8.0 AcmStatisticsBackend.Web.Core AcmStatisticsBackend.Web.Core false @@ -21,9 +21,9 @@ - - - - + + + + diff --git a/backend/src/AcmStatisticsBackend.Web.Host/AcmStatisticsBackend.Web.Host.csproj b/backend/src/AcmStatisticsBackend.Web.Host/AcmStatisticsBackend.Web.Host.csproj index cfe7f9a19..089d8d573 100644 --- a/backend/src/AcmStatisticsBackend.Web.Host/AcmStatisticsBackend.Web.Host.csproj +++ b/backend/src/AcmStatisticsBackend.Web.Host/AcmStatisticsBackend.Web.Host.csproj @@ -1,6 +1,6 @@ - net7.0 + net8.0 true AcmStatisticsBackend.Web.Host Exe @@ -30,12 +30,12 @@ - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/backend/src/AcmStatisticsBackend.Web.Host/Dockerfile b/backend/src/AcmStatisticsBackend.Web.Host/Dockerfile index f3b099652..673452ce4 100644 --- a/backend/src/AcmStatisticsBackend.Web.Host/Dockerfile +++ b/backend/src/AcmStatisticsBackend.Web.Host/Dockerfile @@ -1,10 +1,10 @@ #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. -FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src COPY ["src/AcmStatisticsBackend.Web.Host/AcmStatisticsBackend.Web.Host.csproj", "src/AcmStatisticsBackend.Web.Host/"] COPY ["src/AcmStatisticsBackend.Web.Core/AcmStatisticsBackend.Web.Core.csproj", "src/AcmStatisticsBackend.Web.Core/"] @@ -24,4 +24,5 @@ RUN apt-get update && apt-get install -y wait-for-it ENV WAIT_COMMAND true WORKDIR /app COPY --from=publish /app/publish . +ENV ASPNETCORE_URLS=http://0.0.0.0:80 CMD $WAIT_COMMAND && dotnet AcmStatisticsBackend.Web.Host.dll diff --git a/backend/test/AcmStatisticsBackend.Tests/AcmStatisticsBackend.Tests.csproj b/backend/test/AcmStatisticsBackend.Tests/AcmStatisticsBackend.Tests.csproj index 5df0b4ab5..f45f64cea 100644 --- a/backend/test/AcmStatisticsBackend.Tests/AcmStatisticsBackend.Tests.csproj +++ b/backend/test/AcmStatisticsBackend.Tests/AcmStatisticsBackend.Tests.csproj @@ -1,7 +1,7 @@  1.0.0.0 - net7.0 + net8.0 AcmStatisticsBackend.Tests AcmStatisticsBackend.Tests true @@ -18,18 +18,18 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + - - - - + + + + all runtime; build; native; contentfiles; analyzers - - + + diff --git a/build/docker-compose.yml b/build/docker-compose.yml index 954f4f30c..4a0ccaedb 100644 --- a/build/docker-compose.yml +++ b/build/docker-compose.yml @@ -90,21 +90,20 @@ services: db-backup: image: databack/mysql-backup + command: dump restart: always user: "${DB_BACKUP_UID}" volumes: - ./db-backup:/db environment: - DB_NAMES: acm_statistics DB_DUMP_TARGET: /db DB_USER: root DB_PASS: ${MYSQL_ROOT_PASSWORD} # DB_DUMP_BEGIN: +2 # backup at 3:00 am - DB_DUMP_BEGIN: " 0300" + DB_DUMP_BEGIN: "0300" DB_SERVER: db - # Do not backup Logs table - MYSQLDUMP_OPTS: --ignore-table=acm_statistics.AbpAuditLogs --ignore-table=acm_statistics.AbpUserLoginAttempts + DB_DUMP_INCLUDE: acm_statistics depends_on: - db labels: diff --git a/ohunt/OHunt.Tests/Dataflow/CrawlerPropagatorTests.cs b/ohunt/OHunt.Tests/Dataflow/CrawlerPropagatorTests.cs index 374f9c8f6..fb168c0b8 100644 --- a/ohunt/OHunt.Tests/Dataflow/CrawlerPropagatorTests.cs +++ b/ohunt/OHunt.Tests/Dataflow/CrawlerPropagatorTests.cs @@ -6,7 +6,6 @@ using OHunt.Web.Crawlers; using OHunt.Web.Dataflow; using OHunt.Web.Models; -using Xbehave; using Xunit; namespace OHunt.Tests.Dataflow @@ -26,51 +25,44 @@ public CrawlerPropagatorTests() _propagator = new CrawlerPropagator(_submissionOutput, _errorOutput); } - [Scenario] - public void It_ShouldWork() + [Fact] + public async Task It_ShouldWork() { - "Given a propagator".x(() => { }); - - "When receiving data" - .x(() => _propagator.SendAsync(new CrawlerMessage - { - Submission = new Submission - { - Status = RunResult.Accepted, - Time = new DateTime(2020, 4, 1, 0, 0, 0), - ProblemLabel = "1001", - SubmissionId = 42, - UserName = "user1", - OnlineJudgeId = OnlineJudge.ZOJ, - }, - CrawlerError = new CrawlerError - { - Crawler = "zoj", - Data = null, - Message = "An error", - Time = new DateTime(2020, 4, 1, 1, 0, 0), - }, - }) - ); - - "Then they are cached" - .x(async () => + // Given a propagator + + // When receiving data + await _propagator.SendAsync(new CrawlerMessage + { + Submission = new Submission + { + Status = RunResult.Accepted, + Time = new DateTime(2020, 4, 1, 0, 0, 0), + ProblemLabel = "1001", + SubmissionId = 42, + UserName = "user1", + OnlineJudgeId = OnlineJudge.ZOJ, + }, + CrawlerError = new CrawlerError { - await Utils.WaitSecond(); - _submissionOutput.Count.Should().Be(0); - _errorOutput.Count.Should().Be(0); - }); + Crawler = "zoj", + Data = null, + Message = "An error", + Time = new DateTime(2020, 4, 1, 1, 0, 0), + }, + }); - "When a checkpoint is sent" - .x(() => _propagator.SendAsync(new CrawlerMessage { Checkpoint = true })); + // Then they are cached + await Utils.WaitSecond(); + _submissionOutput.Count.Should().Be(0); + _errorOutput.Count.Should().Be(0); - "Then data are dispatched" - .x(async () => - { - await Utils.WaitSecond(); - _submissionOutput.Count.Should().Be(1); - _errorOutput.Count.Should().Be(1); - }); + // When a checkpoint is sent + await _propagator.SendAsync(new CrawlerMessage { Checkpoint = true }); + + // Then data are dispatched + await Utils.WaitSecond(); + _submissionOutput.Count.Should().Be(1); + _errorOutput.Count.Should().Be(1); } [Fact] @@ -107,7 +99,7 @@ await _propagator.SendAsync(new CrawlerMessage await _propagator.SendAsync(new CrawlerMessage { Submission = new Submission - { + { SubmissionId = 4, }, Checkpoint = true, diff --git a/ohunt/OHunt.Tests/Dataflow/SubmissionCrawlerCoordinatorTests.cs b/ohunt/OHunt.Tests/Dataflow/SubmissionCrawlerCoordinatorTests.cs index 70916e48d..cfe7a4f9b 100644 --- a/ohunt/OHunt.Tests/Dataflow/SubmissionCrawlerCoordinatorTests.cs +++ b/ohunt/OHunt.Tests/Dataflow/SubmissionCrawlerCoordinatorTests.cs @@ -10,7 +10,6 @@ using OHunt.Web.Crawlers; using OHunt.Web.Dataflow; using OHunt.Web.Models; -using Xbehave; using Xunit; using Xunit.Abstractions; @@ -42,120 +41,111 @@ private static Submission CreateSubmission(long id) }; } - [Scenario] - public void It_ShouldWork() + [Fact] + public async Task It_ShouldWork() { - "Given a coordinator".x(() => { }); + // Given a coordinator - "When it is initialized" - .x(() => _coordinator.Initialize(new[] { _crawlerMock })); + // When it is initialized + _coordinator.Initialize(new[] { _crawlerMock }); - "But crawler does not immediately work" - .x(() => _crawlerMock.CalledCount.Should().Be(0)); + // But crawler does not immediately work + _crawlerMock.CalledCount.Should().Be(0); - $"When calling {nameof(_coordinator.StartAllCrawlers)}" - .x(() => _coordinator.StartAllCrawlers()); + // When calling StartAllCrawlers + await _coordinator.StartAllCrawlers(); - $"Then crawler's {nameof(_crawlerMock.WorkAsync)} is called" - .x(() => _crawlerMock.CalledCount.Should().Be(1)); + // Then crawler's WorkAsync is called + _crawlerMock.CalledCount.Should().Be(1); - "And there is nothing in the database" - .x(() => WithDb(context => - { - context.Submission.Should().BeEmpty(); - context.CrawlerErrors.Should().BeEmpty(); - })); + // And there is nothing in the database + WithDb(context => + { + context.Submission.Should().BeEmpty(); + context.CrawlerErrors.Should().BeEmpty(); + }); - "And lastSubmissionId sent to crawler should be null" - .x(() => _crawlerMock.LastSubmissionId.Should().BeNull()); + // And lastSubmissionId sent to crawler should be null + _crawlerMock.LastSubmissionId.Should().BeNull(); - "When crawler sends data" - .x(async () => + // When crawler sends data + await _crawlerMock.Pipeline.SendAsync(new CrawlerMessage + { + Submission = new Submission { - await _crawlerMock.Pipeline.SendAsync(new CrawlerMessage - { - Submission = new Submission - { - Status = RunResult.Accepted, - Time = new DateTime(2020, 4, 1, 0, 0, 0), - ProblemLabel = "1001", - SubmissionId = 42, - UserName = "user1", - OnlineJudgeId = OnlineJudge.ZOJ, - }, - }); - await _crawlerMock.Pipeline.SendAsync(new CrawlerMessage - { - CrawlerError = new CrawlerError - { - Crawler = "zoj", - Data = null, - Message = "An error", - Time = new DateTime(2020, 4, 1, 1, 0, 0), - }, - }); - await Utils.WaitSecond(); - }); - - "But data are not saved to database immediately" - .x(() => WithDb(context => + Status = RunResult.Accepted, + Time = new DateTime(2020, 4, 1, 0, 0, 0), + ProblemLabel = "1001", + SubmissionId = 42, + UserName = "user1", + OnlineJudgeId = OnlineJudge.ZOJ, + }, + }); + await _crawlerMock.Pipeline.SendAsync(new CrawlerMessage + { + CrawlerError = new CrawlerError { - context.Submission.Should().BeEmpty(); - context.CrawlerErrors.Should().BeEmpty(); - })); + Crawler = "zoj", + Data = null, + Message = "An error", + Time = new DateTime(2020, 4, 1, 1, 0, 0), + }, + }); + await Utils.WaitSecond(); - "When crawler sends a checkpoint" - .x(async () => - { - await _crawlerMock.Pipeline.SendAsync(new CrawlerMessage - { - Checkpoint = true, - }); - await Utils.WaitSecond(); - }); + // But data are not saved to database immediately + WithDb(context => + { + context.Submission.Should().BeEmpty(); + context.CrawlerErrors.Should().BeEmpty(); + }); - "But data are not saved to database immediately" - .x(() => WithDb(context => - { - context.Submission.Should().BeEmpty(); - context.CrawlerErrors.Should().BeEmpty(); - })); + // When crawler sends a checkpoint + await _crawlerMock.Pipeline.SendAsync(new CrawlerMessage + { + Checkpoint = true, + }); + await Utils.WaitSecond(); + + // But data are not saved to database immediately + WithDb(context => + { + context.Submission.Should().BeEmpty(); + context.CrawlerErrors.Should().BeEmpty(); + }); + + // When crawler finished + _crawlerMock.TaskSource.SetResult(1); + // wait longer to insert database + await Utils.WaitSecond(); - "When crawler finished" - .x(async () => + // Then data are saved to database + WithDb(context => + { + context.Submission.Should().HaveCount(1); + context.Submission.Should().AllBeEquivalentTo(new Submission { - _crawlerMock.TaskSource.SetResult(1); - // wait longer to insert database - await Utils.WaitSecond(); + Status = RunResult.Accepted, + Time = new DateTime(2020, 4, 1, 0, 0, 0), + ProblemLabel = "1001", + SubmissionId = 42, + UserName = "user1", + OnlineJudgeId = OnlineJudge.ZOJ, }); - "Then data are saved to database" - .x(() => WithDb(context => + context.CrawlerErrors.Should().HaveCount(1); + context.CrawlerErrors.Single().Invoking(it => { - context.Submission.Should().HaveCount(1); - context.Submission.Should().AllBeEquivalentTo(new Submission - { - Status = RunResult.Accepted, - Time = new DateTime(2020, 4, 1, 0, 0, 0), - ProblemLabel = "1001", - SubmissionId = 42, - UserName = "user1", - OnlineJudgeId = OnlineJudge.ZOJ, - }); - - context.CrawlerErrors.Should().HaveCount(1); - context.CrawlerErrors.Single().Invoking(it => - { - it.Crawler.Should().Be("zoj"); - it.Data.Should().BeNull(); - it.Message.Should().Be("An error"); - it.Time.Should().Be(new DateTime(2020, 4, 1, 1, 0, 0)); - it.Id.Should().NotBe(0); - }); - })); + it.Crawler.Should().Be("zoj"); + it.Data.Should().BeNull(); + it.Message.Should().Be("An error"); + it.Time.Should().Be(new DateTime(2020, 4, 1, 1, 0, 0)); + it.Id.Should().NotBe(0); + }); + }); - "When cancelling a coordinator, it should not throw" - .x(() => _coordinator.Cancel()); + // When cancelling a coordinator, it should not throw + await _coordinator.Cancel(); } [Fact] @@ -211,78 +201,61 @@ public void WhenNotInitialized_ItShouldThrow() .Should().ThrowExactlyAsync(); } - [Scenario] - public void WhenCrawlerThrows() + [Fact] + public async Task WhenCrawlerThrows() { - "Given an initialized coordinator" - .x(() => - { - _coordinator.Initialize(new[] { _crawlerMock }); - _coordinator.StartAllCrawlers(); - }); - - "And some data" - .x(async () => - { - _crawlerMock.CalledCount.Should().Be(1); + // Given an initialized coordinator + _coordinator.Initialize(new[] { _crawlerMock }); + await _coordinator.StartAllCrawlers(); - await SendToPipeline(new CrawlerMessage - { - Submission = CreateSubmission(1), - Checkpoint = true, - }); - await SendToPipeline(new CrawlerMessage - { - Submission = CreateSubmission(2), - }); - }); + // And some data + _crawlerMock.CalledCount.Should().Be(1); + await SendToPipeline(new CrawlerMessage + { + Submission = CreateSubmission(1), + Checkpoint = true, + }); + await SendToPipeline(new CrawlerMessage + { + Submission = CreateSubmission(2), + }); - "When crawler throws" - .x(() => _crawlerMock.TaskSource.SetException(new Exception("Crawler throws"))); + // When crawler throws + _crawlerMock.TaskSource.SetException(new Exception("Crawler throws")); - "Then coordinator should complete" - .x(async () => - { - // cannot test it - await Utils.WaitSecond(); - }); + // Then coordinator should complete (allow processing to settle) + await Utils.WaitSecond(); - "And data before checkpoint should be saved" - .x(() => WithDb(context => - { - context.Submission.Should().HaveCount(1); - context.Submission.Single().Should() - .Match(it => it.As().SubmissionId == 1); - })); + // And data before checkpoint should be saved + WithDb(context => + { + context.Submission.Should().HaveCount(1); + context.Submission.Single().Should() + .Match(it => it.As().SubmissionId == 1); + }); - "When start coordinator again" - .x(() => _coordinator.StartAllCrawlers()); + // When start coordinator again + await _coordinator.StartAllCrawlers(); - "And send some data" - .x(() => - { - _crawlerMock.CalledCount.Should().Be(2); - return SendToPipeline(new CrawlerMessage - { - Submission = CreateSubmission(3), - Checkpoint = true, - }); - }); + // And send some data + _crawlerMock.CalledCount.Should().Be(2); + await SendToPipeline(new CrawlerMessage + { + Submission = CreateSubmission(3), + Checkpoint = true, + }); - "And complete crawler" - .x(() => _crawlerMock.TaskSource.SetResult(1)); + // And complete crawler + _crawlerMock.TaskSource.SetResult(1); - "Then data should be saved" - .x(async () => - { - await Utils.WaitSecond(); - WithDb(context => - { - context.Submission.Should().HaveCount(2); - context.Submission.Select(it => it.SubmissionId) - .Should().Equal(1, 3); - }); - }); + // Then data should be saved + await Utils.WaitSecond(); + WithDb(context => + { + context.Submission.Should().HaveCount(2); + context.Submission.Select(it => it.SubmissionId) + .Should().Equal(1, 3); + }); } [Fact] @@ -319,99 +292,84 @@ await SendToPipeline(new CrawlerMessage }); } - [Scenario] - public void WhenCancelled(Task cancelTask) + [Fact] + public async Task WhenCancelled() { - "Given an initialized coordinator" - .x(() => - { - _coordinator.Initialize(new[] { _crawlerMock }); - _coordinator.StartAllCrawlers(); - }); + // Given an initialized coordinator + _coordinator.Initialize(new[] { _crawlerMock }); + await _coordinator.StartAllCrawlers(); - "And some data" - .x(async () => - { - await SendToPipeline(new CrawlerMessage - { - Submission = CreateSubmission(1), - Checkpoint = true, - }); - await SendToPipeline(new CrawlerMessage - { - Submission = CreateSubmission(2), - }); - }); + // And some data + await SendToPipeline(new CrawlerMessage + { + Submission = CreateSubmission(1), + Checkpoint = true, + }); + await SendToPipeline(new CrawlerMessage + { + Submission = CreateSubmission(2), + }); - "When calling coordinator.cancel" - .x(() => { cancelTask = _coordinator.Cancel(); }); + // When calling coordinator.cancel + var cancelTask = _coordinator.Cancel(); - "Then crawler should receive cancel" - .x(() => _crawlerMock.CancellationToken.IsCancellationRequested.Should().BeTrue()); + // Then crawler should receive cancel + _crawlerMock.CancellationToken.IsCancellationRequested.Should().BeTrue(); - "And cancelling task is still not completed" - .x(() => cancelTask.IsCompleted.Should().BeFalse()); + // And cancelling task is still not completed + cancelTask.IsCompleted.Should().BeFalse(); - "And crawler can still sending data until exit" - .x(async () => - { - await SendToPipeline(new CrawlerMessage - { - Submission = CreateSubmission(3), - Checkpoint = true, - }); - await SendToPipeline(new CrawlerMessage - { - Submission = CreateSubmission(4), - }); - }); + // And crawler can still sending data until exit + await SendToPipeline(new CrawlerMessage + { + Submission = CreateSubmission(3), + Checkpoint = true, + }); + await SendToPipeline(new CrawlerMessage + { + Submission = CreateSubmission(4), + }); - "When crawler is exited" - .x(() => _crawlerMock.TaskSource.SetCanceled()); + // When crawler is exited + _crawlerMock.TaskSource.SetCanceled(); - "Then cancel task is completed" - .x(() => cancelTask); + // Then cancel task is completed + await cancelTask; - "And data before checkpoint is saved to database without needing to wait" - .x(() => WithDb(context => - { - context.Submission.Should().HaveCount(3); - context.Submission.Select(it => it.SubmissionId) - .Should().Equal(1, 2, 3); - })); + // And data before checkpoint is saved to database without needing to wait + WithDb(context => + { + context.Submission.Should().HaveCount(3); + context.Submission.Select(it => it.SubmissionId) + .Should().Equal(1, 2, 3); + }); - "When start crawlers without initializing, it should throw" - .x(() => _coordinator.StartAllCrawlers() - .ShouldResult().ThrowAsync()); + // When start crawlers without initializing, it should throw + await _coordinator.StartAllCrawlers() + .ShouldResult().ThrowAsync(); - "When restarting crawlers" - .x(async () => - { - _coordinator.Initialize(new[] { _crawlerMock }); - await _coordinator.StartAllCrawlers(); - await Utils.WaitSecond(); - _crawlerMock.CalledCount.Should().Be(2); - }); + // When restarting crawlers + _coordinator.Initialize(new[] { _crawlerMock }); + await _coordinator.StartAllCrawlers(); + await Utils.WaitSecond(); + _crawlerMock.CalledCount.Should().Be(2); - "And send some data and finish the crawler" - .x(async () => - { - await SendToPipeline(new CrawlerMessage - { - Checkpoint = true, - Submission = CreateSubmission(5), - }); - _crawlerMock.TaskSource.SetResult(1); - await Utils.WaitSecond(); - }); + // And send some data and finish the crawler + await SendToPipeline(new CrawlerMessage + { + Checkpoint = true, + Submission = CreateSubmission(5), + }); + _crawlerMock.TaskSource.SetResult(1); + await Utils.WaitSecond(); - "Then data after checkpoint of previous run are discarded" - .x(() => WithDb(context => - { - context.Submission.Should().HaveCount(4); - context.Submission.Select(it => it.SubmissionId) - .Should().Equal(1, 2, 3, 5); - })); + // Then data after checkpoint of previous run are discarded + WithDb(context => + { + context.Submission.Should().HaveCount(4); + context.Submission.Select(it => it.SubmissionId) + .Should().Equal(1, 2, 3, 5); + }); } [Fact] diff --git a/ohunt/OHunt.Tests/OHunt.Tests.csproj b/ohunt/OHunt.Tests/OHunt.Tests.csproj index bf0bd1034..637bebfde 100644 --- a/ohunt/OHunt.Tests/OHunt.Tests.csproj +++ b/ohunt/OHunt.Tests/OHunt.Tests.csproj @@ -1,31 +1,30 @@ - net7.0 + net8.0 false enable - - - - - - - + + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + - - - - + + + all runtime; build; native; contentfiles; analyzers diff --git a/ohunt/OHunt.Tests/Web/ProblemControllerTests.cs b/ohunt/OHunt.Tests/Web/ProblemControllerTests.cs index c103075ef..79f6fd350 100644 --- a/ohunt/OHunt.Tests/Web/ProblemControllerTests.cs +++ b/ohunt/OHunt.Tests/Web/ProblemControllerTests.cs @@ -4,86 +4,19 @@ using System.Net.Http; using System.Net.Mime; using System.Text; +using System.Threading.Tasks; using FluentAssertions; using Flurl.Http.Testing; using OHunt.Tests.Dependency; using OHunt.Web; using OHunt.Web.Controllers.Dto; -using Xbehave; +using Xunit; using Xunit.Abstractions; namespace OHunt.Tests.Web { public class ProblemControllerTests : OHuntTestBase { - [Scenario] - public void TestResolveLabel(HttpTest httpTest, HttpResponseMessage response) - { - "When request label at the first time" - .x(async () => - { - httpTest = new HttpTest(); - httpTest.RespondWithJson(new - { - num = 2001, - }); - - using var client = Factory.CreateClient(); - response = await client.PostAsync("/api/ohunt/problems/resolve-label", - new StringContent("{\"onlineJudge\": \"uva\", \"list\": [1]}", - Encoding.Default, - MediaTypeNames.Application.Json)); - }); - - "Then we should get the correct label" - .x(async () => - { - response.StatusCode.Should().Be(HttpStatusCode.OK); - - var output = await ResponseJson(response); - output.Result.Should().HaveCount(1); - output.Result.Single().Should().Be( - new KeyValuePair("1", "2001")); - }); - - "And a request should be made by crawler" - .x(() => - { - httpTest.ShouldHaveMadeACall(); - httpTest.CallLog.Should().HaveCount(1); - httpTest.Dispose(); - }); - - "When we request it again" - .x(async () => - { - httpTest = new HttpTest(); - using var client = Factory.CreateClient(); - response = await client.PostAsync("/api/ohunt/problems/resolve-label", - new StringContent("{\"onlineJudge\": \"uva\", \"list\": [1]}", - Encoding.Default, - MediaTypeNames.Application.Json)); - }); - - "Then we should get the same result" - .x(async () => - { - response.StatusCode.Should().Be(HttpStatusCode.OK); - - var output = await ResponseJson(response); - output.Result.Should().HaveCount(1); - output.Result.Single().Should().Be( - new KeyValuePair("1", "2001")); - }); - - "And there is not crawler request made" - .x(() => - { - httpTest.ShouldNotHaveMadeACall(); - httpTest.Dispose(); - }); - } - public ProblemControllerTests( TestWebApplicationFactory factory, ITestOutputHelper outputHelper) : base(factory, outputHelper) @@ -92,5 +25,52 @@ public ProblemControllerTests( // see https://github.com/tmenier/Flurl/issues/504#issuecomment-601817280 Factory.Server.PreserveExecutionContext = true; } + [Fact] + public async Task TestResolveLabel() + { + // When request label at the first time + var httpTest = new HttpTest(); + httpTest.RespondWithJson(new + { + num = 2001, + }); + + using var client = Factory.CreateClient(); + var response = await client.PostAsync("/api/ohunt/problems/resolve-label", + new StringContent("{\"onlineJudge\": \"uva\", \"list\": [1]}", + Encoding.Default, + MediaTypeNames.Application.Json)); + + // Then we should get the correct label + response.StatusCode.Should().Be(HttpStatusCode.OK); + var output = await ResponseJson(response); + output.Result.Should().HaveCount(1); + output.Result.Single().Should().Be( + new KeyValuePair("1", "2001")); + + // And a request should be made by crawler + httpTest.ShouldHaveMadeACall(); + httpTest.CallLog.Should().HaveCount(1); + httpTest.Dispose(); + + // When we request it again + httpTest = new HttpTest(); + using var client2 = Factory.CreateClient(); + response = await client2.PostAsync("/api/ohunt/problems/resolve-label", + new StringContent("{\"onlineJudge\": \"uva\", \"list\": [1]}", + Encoding.Default, + MediaTypeNames.Application.Json)); + + // Then we should get the same result + response.StatusCode.Should().Be(HttpStatusCode.OK); + var output2 = await ResponseJson(response); + output2.Result.Should().HaveCount(1); + output2.Result.Single().Should().Be( + new KeyValuePair("1", "2001")); + + // And there is not crawler request made + httpTest.ShouldNotHaveMadeACall(); + httpTest.Dispose(); + } } } diff --git a/ohunt/OHunt.Tests/Web/__snapshots__/SwaggerTests.It_ShouldOutputDocument.snap b/ohunt/OHunt.Tests/Web/__snapshots__/SwaggerTests.It_ShouldOutputDocument.snap index b16a4bef6..beea1a2ff 100644 --- a/ohunt/OHunt.Tests/Web/__snapshots__/SwaggerTests.It_ShouldOutputDocument.snap +++ b/ohunt/OHunt.Tests/Web/__snapshots__/SwaggerTests.It_ShouldOutputDocument.snap @@ -1,5 +1,5 @@ { - "openapi": "3.0.1", + "openapi": "3.0.4", "info": { "title": "OHunt API", "description": "OHunt is a crawler that reads data from online coding competition platform and serve them as API, just like uHunt of UVA.", @@ -14,7 +14,7 @@ "operationId": "api/ohunt/$metadata", "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "application/json;odata.metadata=minimal;odata.streaming=true": { "schema": { @@ -76,6 +76,126 @@ "$ref": "#/components/schemas/IEdmModel" } }, + "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=minimal;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=minimal;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=full;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=full;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=none;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.metadata=none;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, + "application/json;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/IEdmModel" + } + }, "application/xml": { "schema": { "$ref": "#/components/schemas/IEdmModel" @@ -109,7 +229,7 @@ "operationId": "api/ohunt/", "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "application/json;odata.metadata=minimal;odata.streaming=true": { "schema": { @@ -171,6 +291,126 @@ "$ref": "#/components/schemas/ODataServiceDocument" } }, + "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=minimal;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=minimal;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=full;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=full;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=none;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.metadata=none;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, + "application/json;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ODataServiceDocument" + } + }, "application/xml": { "schema": { "$ref": "#/components/schemas/ODataServiceDocument" @@ -264,6 +504,126 @@ "$ref": "#/components/schemas/ResolveLabelInput" } }, + "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=minimal;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=minimal;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=full;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=full;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=none;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.metadata=none;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.streaming=true;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.streaming=true;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.streaming=false;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;odata.streaming=false;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;IEEE754Compatible=false": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, + "application/json;IEEE754Compatible=true": { + "schema": { + "$ref": "#/components/schemas/ResolveLabelInput" + } + }, "application/xml": { "schema": { "$ref": "#/components/schemas/ResolveLabelInput" @@ -288,7 +648,7 @@ }, "responses": { "200": { - "description": "Success", + "description": "OK", "content": { "application/json": { "schema": { @@ -306,7 +666,7 @@ "Submissions" ], "summary": "Get the submission in an OJ.", - "description": "The api uses odata to create arbitrary query requests.\r\nSee the document https://www.odata.org/ for more information.\r\n\r\nSample request:\r\n\r\n GET /api/ohunt/submissions?oj=zoj&$filter=userName eq 'vjudge5' and status eq 'Accepted'&$count=true", + "description": "The api uses odata to create arbitrary query requests.\nSee the document https://www.odata.org/ for more information.\n\nSample request:\n\n GET /api/ohunt/submissions?oj=zoj&$filter=userName eq 'vjudge5' and status eq 'Accepted'&$count=true", "parameters": [ { "name": "oj", @@ -416,7 +776,7 @@ "Path", "If", "Cast", - "IsType", + "IsOf", "FunctionApplication", "LabeledExpressionReference", "Labeled", @@ -462,11 +822,8 @@ "IEdmEntityContainer": { "type": "object", "properties": { - "elements": { - "type": "array", - "items": { - "$ref": "#/components/schemas/IEdmEntityContainerElement" - }, + "name": { + "type": "string", "nullable": true, "readOnly": true }, @@ -478,8 +835,11 @@ "nullable": true, "readOnly": true }, - "name": { - "type": "string", + "elements": { + "type": "array", + "items": { + "$ref": "#/components/schemas/IEdmEntityContainerElement" + }, "nullable": true, "readOnly": true } @@ -489,16 +849,16 @@ "IEdmEntityContainerElement": { "type": "object", "properties": { + "name": { + "type": "string", + "nullable": true, + "readOnly": true + }, "containerElementKind": { "$ref": "#/components/schemas/EdmContainerElementKind" }, "container": { "$ref": "#/components/schemas/IEdmEntityContainer" - }, - "name": { - "type": "string", - "nullable": true, - "readOnly": true } }, "additionalProperties": false @@ -559,15 +919,15 @@ "IEdmSchemaElement": { "type": "object", "properties": { - "schemaElementKind": { - "$ref": "#/components/schemas/EdmSchemaElementKind" - }, - "namespace": { + "name": { "type": "string", "nullable": true, "readOnly": true }, - "name": { + "schemaElementKind": { + "$ref": "#/components/schemas/EdmSchemaElementKind" + }, + "namespace": { "type": "string", "nullable": true, "readOnly": true @@ -578,28 +938,28 @@ "IEdmTerm": { "type": "object", "properties": { - "type": { - "$ref": "#/components/schemas/IEdmTypeReference" - }, - "appliesTo": { + "name": { "type": "string", "nullable": true, "readOnly": true }, - "defaultValue": { + "schemaElementKind": { + "$ref": "#/components/schemas/EdmSchemaElementKind" + }, + "namespace": { "type": "string", "nullable": true, "readOnly": true }, - "schemaElementKind": { - "$ref": "#/components/schemas/EdmSchemaElementKind" + "type": { + "$ref": "#/components/schemas/IEdmTypeReference" }, - "namespace": { + "appliesTo": { "type": "string", "nullable": true, "readOnly": true }, - "name": { + "defaultValue": { "type": "string", "nullable": true, "readOnly": true @@ -649,6 +1009,10 @@ }, "value": { "$ref": "#/components/schemas/IEdmExpression" + }, + "usesDefault": { + "type": "boolean", + "readOnly": true } }, "additionalProperties": false @@ -800,7 +1164,8 @@ "result": { "type": "object", "additionalProperties": { - "type": "string" + "type": "string", + "nullable": true }, "description": "The result from the output", "nullable": true @@ -836,7 +1201,7 @@ "submissionId": { "minimum": 1, "type": "integer", - "description": "The id of the submission. It should be unique per oj.\r\n \r\nIt is used to identify submissions, so newer submission\r\nshould have larger id.", + "description": "The id of the submission. It should be unique per oj.\n \nIt is used to identify submissions, so newer submission\nshould have larger id.", "format": "int64" }, "onlineJudgeId": { diff --git a/ohunt/OHunt.Web/Crawlers/CrawlerBase.cs b/ohunt/OHunt.Web/Crawlers/CrawlerBase.cs index b3d5f9f63..b20893f9c 100644 --- a/ohunt/OHunt.Web/Crawlers/CrawlerBase.cs +++ b/ohunt/OHunt.Web/Crawlers/CrawlerBase.cs @@ -29,7 +29,7 @@ protected async Task GetDocument( await Task.Delay(delta, cancellationToken); } - var response = await url.GetStreamAsync(cancellationToken); + var response = await url.GetStreamAsync(cancellationToken: cancellationToken); var document = await Context.OpenAsync( req => req.Content(response), cancellationToken); @@ -48,7 +48,7 @@ protected async Task GetJson( await Task.Delay(delta, cancellationToken); } - var result = await request.GetStreamAsync(cancellationToken); + var result = await request.GetStreamAsync(cancellationToken: cancellationToken); _lastRequestTime = DateTime.Now; return await JsonDocument.ParseAsync(result, cancellationToken: cancellationToken); diff --git a/ohunt/OHunt.Web/Crawlers/ZojSubmissionCrawler.cs b/ohunt/OHunt.Web/Crawlers/ZojSubmissionCrawler.cs index fd696a34c..35dbb7109 100644 --- a/ohunt/OHunt.Web/Crawlers/ZojSubmissionCrawler.cs +++ b/ohunt/OHunt.Web/Crawlers/ZojSubmissionCrawler.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Net; using System.Text.Json; using System.Threading; using System.Threading.Tasks; @@ -65,7 +64,7 @@ private async Task Request( cancellationToken.ThrowIfCancellationRequested(); var request = BaseUrl.SetQueryParam("after", after) .WithHeader("Accept", "application/json;charset=UTF-8") - .AllowHttpStatus(HttpStatusCode.InternalServerError); + .AllowHttpStatus(500); if (before != null) { request = request.SetQueryParam("before", before); diff --git a/ohunt/OHunt.Web/Dockerfile b/ohunt/OHunt.Web/Dockerfile index ba13d484d..105449bbb 100644 --- a/ohunt/OHunt.Web/Dockerfile +++ b/ohunt/OHunt.Web/Dockerfile @@ -1,11 +1,11 @@ #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. -FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base WORKDIR /app EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /src COPY ["OHunt.Web/OHunt.Web.csproj", "OHunt.Web/"] RUN dotnet restore "OHunt.Web/OHunt.Web.csproj" @@ -21,4 +21,5 @@ RUN apt-get update && apt-get install -y wait-for-it ENV WAIT_COMMAND true WORKDIR /app COPY --from=publish /app/publish . +ENV ASPNETCORE_HTTP_PORTS 80 CMD $WAIT_COMMAND && dotnet OHunt.Web.dll diff --git a/ohunt/OHunt.Web/GlobalConfigurer.cs b/ohunt/OHunt.Web/GlobalConfigurer.cs index 356366e85..6c1b28ea8 100644 --- a/ohunt/OHunt.Web/GlobalConfigurer.cs +++ b/ohunt/OHunt.Web/GlobalConfigurer.cs @@ -1,8 +1,5 @@ -using System.Net.Http; -using System.Net.Security; using System.Runtime.CompilerServices; using Flurl.Http; -using Flurl.Http.Configuration; namespace OHunt.Web { @@ -14,17 +11,8 @@ public class GlobalConfigurer [ModuleInitializer] public static void Configure() { - FlurlHttp.ConfigureClient("https://icpcarchive.ecs.baylor.edu/uhunt", cli => - cli.Settings.HttpClientFactory = new UntrustedCertClientFactory()); - } - } - - public class UntrustedCertClientFactory : DefaultHttpClientFactory - { - public override HttpMessageHandler CreateMessageHandler() { - return new HttpClientHandler { - ServerCertificateCustomValidationCallback = (a, b, c, d) => true - }; + FlurlHttp.ConfigureClientForUrl("https://icpcarchive.ecs.baylor.edu/uhunt") + .ConfigureInnerHandler(handler => handler.ServerCertificateCustomValidationCallback = (msg, cert, chain, errors) => true); } } } diff --git a/ohunt/OHunt.Web/OHunt.Web.csproj b/ohunt/OHunt.Web/OHunt.Web.csproj index e513d5ab4..f54c7788e 100644 --- a/ohunt/OHunt.Web/OHunt.Web.csproj +++ b/ohunt/OHunt.Web/OHunt.Web.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable @@ -14,21 +14,21 @@ - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/ohunt/dev.Dockerfile b/ohunt/dev.Dockerfile index d0166081b..c3b006481 100644 --- a/ohunt/dev.Dockerfile +++ b/ohunt/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 +FROM mcr.microsoft.com/dotnet/sdk:8.0 WORKDIR /src diff --git a/ohunt/global.json b/ohunt/global.json new file mode 100644 index 000000000..b5b37b60d --- /dev/null +++ b/ohunt/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "8.0.0", + "rollForward": "latestMajor", + "allowPrerelease": false + } +} \ No newline at end of file