diff --git a/Streetcode/Streetcode.BLL/DTO/Sources/StreetcodeCategoryContentDTO.cs b/Streetcode/Streetcode.BLL/DTO/Sources/StreetcodeCategoryContentDTO.cs index a7afc5eca..ee669b487 100644 --- a/Streetcode/Streetcode.BLL/DTO/Sources/StreetcodeCategoryContentDTO.cs +++ b/Streetcode/Streetcode.BLL/DTO/Sources/StreetcodeCategoryContentDTO.cs @@ -1,16 +1,11 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.ComponentModel.DataAnnotations; namespace Streetcode.BLL.DTO.Sources { public class StreetcodeCategoryContentDTO { [Required] - [MaxLength(10000)] + [MaxLength(15000)] public string Text { get; set; } [Required] diff --git a/Streetcode/Streetcode.DAL/Entities/Sources/StreetcodeCategoryContent.cs b/Streetcode/Streetcode.DAL/Entities/Sources/StreetcodeCategoryContent.cs index ce7ec2436..97b7241e5 100644 --- a/Streetcode/Streetcode.DAL/Entities/Sources/StreetcodeCategoryContent.cs +++ b/Streetcode/Streetcode.DAL/Entities/Sources/StreetcodeCategoryContent.cs @@ -8,7 +8,7 @@ namespace Streetcode.DAL.Entities.Sources; public class StreetcodeCategoryContent { [Required] - [MaxLength(10000)] + [MaxLength(15000)] public string? Text { get; set; } [Required] diff --git a/Streetcode/Streetcode.DAL/Persistence/Migrations/20240122161255_ForFansLength.Designer.cs b/Streetcode/Streetcode.DAL/Persistence/Migrations/20240122161255_ForFansLength.Designer.cs new file mode 100644 index 000000000..580c8eb4e --- /dev/null +++ b/Streetcode/Streetcode.DAL/Persistence/Migrations/20240122161255_ForFansLength.Designer.cs @@ -0,0 +1,1600 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Streetcode.DAL.Persistence; + +#nullable disable + +namespace Streetcode.DAL.Persistence.Migrations +{ + [DbContext(typeof(StreetcodeDbContext))] + [Migration("20240122161255_ForFansLength")] + partial class ForFansLength + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .UseCollation("SQL_Ukrainian_CP1251_CI_AS") + .HasAnnotation("ProductVersion", "7.0.13") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.Coordinates.Coordinate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CoordinateType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Latitude") + .HasColumnType("decimal(18,4)"); + + b.Property("Longtitude") + .HasColumnType("decimal(18,4)"); + + b.HasKey("Id"); + + b.ToTable("coordinates", "add_content"); + + b.HasDiscriminator("CoordinateType").HasValue("coordinate_base"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.StreetcodeTagIndex", b => + { + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.Property("TagId") + .HasColumnType("int"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("IsVisible") + .HasColumnType("bit"); + + b.HasKey("StreetcodeId", "TagId"); + + b.HasIndex("TagId"); + + b.ToTable("streetcode_tag_index", "add_content"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.Subtitle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.Property("SubtitleText") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("Id"); + + b.HasIndex("StreetcodeId"); + + b.ToTable("subtitles", "add_content"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("tags", "add_content"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Analytics.StatisticRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("Count") + .HasColumnType("int"); + + b.Property("QrId") + .HasColumnType("int"); + + b.Property("StreetcodeCoordinateId") + .HasColumnType("int"); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("StreetcodeCoordinateId") + .IsUnique(); + + b.HasIndex("StreetcodeId"); + + b.ToTable("qr_coordinates", "coordinates"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Feedback.Response", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Name") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("responses", "feedback"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Jobs.Job", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasMaxLength(3000) + .HasColumnType("nvarchar(3000)"); + + b.Property("Salary") + .IsRequired() + .HasMaxLength(15) + .HasColumnType("nvarchar(15)"); + + b.Property("Status") + .HasColumnType("bit"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(65) + .HasColumnType("nvarchar(65)"); + + b.HasKey("Id"); + + b.ToTable("job", "jobs"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Audio", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BlobName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.Property("Title") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("audios", "media"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Images.Art", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(400) + .HasColumnType("nvarchar(400)"); + + b.Property("ImageId") + .HasColumnType("int"); + + b.Property("Title") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.HasKey("Id"); + + b.HasIndex("ImageId") + .IsUnique(); + + b.ToTable("arts", "media"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Images.Image", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("BlobName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("MimeType") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("nvarchar(10)"); + + b.HasKey("Id"); + + b.ToTable("images", "media"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Images.ImageDetails", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Alt") + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("ImageId") + .HasColumnType("int"); + + b.Property("Title") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("ImageId") + .IsUnique(); + + b.ToTable("image_details", "media"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Images.StreetcodeImage", b => + { + b.Property("ImageId") + .HasColumnType("int"); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.HasKey("ImageId", "StreetcodeId"); + + b.HasIndex("StreetcodeId"); + + b.ToTable("streetcode_image", "streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Video", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.Property("Title") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Url") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("StreetcodeId"); + + b.ToTable("videos", "media"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.News.News", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("ImageId") + .HasColumnType("int"); + + b.Property("Text") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("URL") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("ImageId") + .IsUnique() + .HasFilter("[ImageId] IS NOT NULL"); + + b.HasIndex("URL") + .IsUnique(); + + b.ToTable("news", "news"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Partners.Partner", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasMaxLength(600) + .HasColumnType("nvarchar(600)"); + + b.Property("IsKeyPartner") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("IsVisibleEverywhere") + .HasColumnType("bit"); + + b.Property("LogoId") + .HasColumnType("int"); + + b.Property("TargetUrl") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("UrlTitle") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("LogoId") + .IsUnique(); + + b.ToTable("partners", "partners"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Partners.PartnerSourceLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("LogoType") + .HasColumnType("tinyint"); + + b.Property("PartnerId") + .HasColumnType("int"); + + b.Property("TargetUrl") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("PartnerId"); + + b.ToTable("partner_source_links", "partners"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Partners.StreetcodePartner", b => + { + b.Property("PartnerId") + .HasColumnType("int"); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.HasKey("PartnerId", "StreetcodeId"); + + b.HasIndex("StreetcodeId"); + + b.ToTable("streetcode_partners", "streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Sources.SourceLinkCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ImageId") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("ImageId"); + + b.ToTable("source_link_categories", "sources"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Sources.StreetcodeCategoryContent", b => + { + b.Property("SourceLinkCategoryId") + .HasColumnType("int"); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(15000) + .HasColumnType("nvarchar(max)"); + + b.HasKey("SourceLinkCategoryId", "StreetcodeId"); + + b.HasIndex("StreetcodeId"); + + b.ToTable("streetcode_source_link_categories", "sources"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.RelatedFigure", b => + { + b.Property("ObserverId") + .HasColumnType("int"); + + b.Property("TargetId") + .HasColumnType("int"); + + b.HasKey("ObserverId", "TargetId"); + + b.HasIndex("TargetId"); + + b.ToTable("related_figures", "streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.StreetcodeArt", b => + { + b.Property("ArtId") + .HasColumnType("int"); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.Property("Index") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.HasKey("ArtId", "StreetcodeId"); + + b.HasIndex("StreetcodeId"); + + b.HasIndex("ArtId", "StreetcodeId"); + + b.ToTable("streetcode_art", "streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Alias") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("AudioId") + .HasColumnType("int"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETDATE()"); + + b.Property("DateString") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("EventEndOrPersonDeathDate") + .HasColumnType("datetime2"); + + b.Property("EventStartOrPersonBirthDate") + .HasColumnType("datetime2"); + + b.Property("Index") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("StreetcodeType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Teaser") + .HasMaxLength(650) + .HasColumnType("nvarchar(650)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TransliterationUrl") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("UpdatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("datetime2") + .HasDefaultValueSql("GETDATE()"); + + b.Property("ViewCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.HasKey("Id"); + + b.HasIndex("AudioId") + .IsUnique() + .HasFilter("[AudioId] IS NOT NULL"); + + b.HasIndex("Index") + .IsUnique(); + + b.HasIndex("TransliterationUrl") + .IsUnique(); + + b.ToTable("streetcodes", "streetcode"); + + b.HasDiscriminator("StreetcodeType").HasValue("streetcode-base"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.TextContent.Fact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FactContent") + .IsRequired() + .HasMaxLength(600) + .HasColumnType("nvarchar(600)"); + + b.Property("ImageId") + .HasColumnType("int"); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("ImageId"); + + b.HasIndex("StreetcodeId"); + + b.ToTable("facts", "streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.TextContent.RelatedTerm", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("TermId") + .HasColumnType("int"); + + b.Property("Word") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("TermId"); + + b.ToTable("related_terms", "streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.TextContent.Term", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("terms", "streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.TextContent.Text", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AdditionalText") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.Property("TextContent") + .IsRequired() + .HasMaxLength(15000) + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.HasKey("Id"); + + b.HasIndex("StreetcodeId") + .IsUnique(); + + b.ToTable("texts", "streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Team.Positions", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Position") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("positions", "team"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Team.TeamMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("ImageId") + .HasColumnType("int"); + + b.Property("IsMain") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("ImageId") + .IsUnique(); + + b.ToTable("team_members", "team"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Team.TeamMemberLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("LogoType") + .HasColumnType("tinyint"); + + b.Property("TargetUrl") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("TeamMemberId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("TeamMemberId"); + + b.ToTable("team_member_links", "team"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Team.TeamMemberPositions", b => + { + b.Property("TeamMemberId") + .HasColumnType("int"); + + b.Property("PositionsId") + .HasColumnType("int"); + + b.HasKey("TeamMemberId", "PositionsId"); + + b.HasIndex("PositionsId"); + + b.ToTable("team_member_positions", "team"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Timeline.HistoricalContext", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Title") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("historical_contexts", "timeline"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Timeline.HistoricalContextTimeline", b => + { + b.Property("TimelineId") + .HasColumnType("int"); + + b.Property("HistoricalContextId") + .HasColumnType("int"); + + b.HasKey("TimelineId", "HistoricalContextId"); + + b.HasIndex("HistoricalContextId"); + + b.ToTable("HistoricalContextsTimelines"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Timeline.TimelineItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("DateViewPattern") + .HasColumnType("int"); + + b.Property("Description") + .HasMaxLength(600) + .HasColumnType("nvarchar(600)"); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("StreetcodeId"); + + b.ToTable("timeline_items", "timeline"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Toponyms.StreetcodeToponym", b => + { + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.Property("ToponymId") + .HasColumnType("int"); + + b.HasKey("StreetcodeId", "ToponymId"); + + b.HasIndex("ToponymId"); + + b.ToTable("streetcode_toponym", "streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Toponyms.Toponym", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AdminRegionNew") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("AdminRegionOld") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("Community") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("Gromada") + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("Oblast") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("StreetName") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("StreetType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("toponyms", "toponyms"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Transactions.TransactionLink", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.Property("Url") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.Property("UrlTitle") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b.HasKey("Id"); + + b.HasIndex("StreetcodeId") + .IsUnique(); + + b.ToTable("transaction_links", "transactions"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Users.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Login") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("Role") + .HasColumnType("int"); + + b.Property("Surname") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Users", "Users"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.Coordinates.Types.StreetcodeCoordinate", b => + { + b.HasBaseType("Streetcode.DAL.Entities.AdditionalContent.Coordinates.Coordinate"); + + b.Property("StreetcodeId") + .HasColumnType("int"); + + b.HasIndex("StreetcodeId"); + + b.ToTable("coordinates", "add_content"); + + b.HasDiscriminator().HasValue("coordinate_streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.Coordinates.Types.ToponymCoordinate", b => + { + b.HasBaseType("Streetcode.DAL.Entities.AdditionalContent.Coordinates.Coordinate"); + + b.Property("ToponymId") + .HasColumnType("int"); + + b.HasIndex("ToponymId") + .IsUnique() + .HasFilter("[ToponymId] IS NOT NULL"); + + b.ToTable("coordinates", "add_content"); + + b.HasDiscriminator().HasValue("coordinate_toponym"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.Types.EventStreetcode", b => + { + b.HasBaseType("Streetcode.DAL.Entities.Streetcode.StreetcodeContent"); + + b.ToTable("streetcodes", "streetcode"); + + b.HasDiscriminator().HasValue("streetcode-event"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.Types.PersonStreetcode", b => + { + b.HasBaseType("Streetcode.DAL.Entities.Streetcode.StreetcodeContent"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Rank") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.ToTable("streetcodes", "streetcode"); + + b.HasDiscriminator().HasValue("streetcode-person"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.StreetcodeTagIndex", b => + { + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany("StreetcodeTagIndices") + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Streetcode.DAL.Entities.AdditionalContent.Tag", "Tag") + .WithMany("StreetcodeTagIndices") + .HasForeignKey("TagId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Streetcode"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.Subtitle", b => + { + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany("Subtitles") + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Analytics.StatisticRecord", b => + { + b.HasOne("Streetcode.DAL.Entities.AdditionalContent.Coordinates.Types.StreetcodeCoordinate", "StreetcodeCoordinate") + .WithOne("StatisticRecord") + .HasForeignKey("Streetcode.DAL.Entities.Analytics.StatisticRecord", "StreetcodeCoordinateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany("StatisticRecords") + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Streetcode"); + + b.Navigation("StreetcodeCoordinate"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Images.Art", b => + { + b.HasOne("Streetcode.DAL.Entities.Media.Images.Image", "Image") + .WithOne("Art") + .HasForeignKey("Streetcode.DAL.Entities.Media.Images.Art", "ImageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Image"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Images.ImageDetails", b => + { + b.HasOne("Streetcode.DAL.Entities.Media.Images.Image", "Image") + .WithOne("ImageDetails") + .HasForeignKey("Streetcode.DAL.Entities.Media.Images.ImageDetails", "ImageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Image"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Images.StreetcodeImage", b => + { + b.HasOne("Streetcode.DAL.Entities.Media.Images.Image", "Image") + .WithMany() + .HasForeignKey("ImageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany() + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Image"); + + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Video", b => + { + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany("Videos") + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.News.News", b => + { + b.HasOne("Streetcode.DAL.Entities.Media.Images.Image", "Image") + .WithOne("News") + .HasForeignKey("Streetcode.DAL.Entities.News.News", "ImageId"); + + b.Navigation("Image"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Partners.Partner", b => + { + b.HasOne("Streetcode.DAL.Entities.Media.Images.Image", "Logo") + .WithOne("Partner") + .HasForeignKey("Streetcode.DAL.Entities.Partners.Partner", "LogoId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Logo"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Partners.PartnerSourceLink", b => + { + b.HasOne("Streetcode.DAL.Entities.Partners.Partner", "Partner") + .WithMany("PartnerSourceLinks") + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Partner"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Partners.StreetcodePartner", b => + { + b.HasOne("Streetcode.DAL.Entities.Partners.Partner", "Partner") + .WithMany() + .HasForeignKey("PartnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany() + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Partner"); + + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Sources.SourceLinkCategory", b => + { + b.HasOne("Streetcode.DAL.Entities.Media.Images.Image", "Image") + .WithMany("SourceLinkCategories") + .HasForeignKey("ImageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Image"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Sources.StreetcodeCategoryContent", b => + { + b.HasOne("Streetcode.DAL.Entities.Sources.SourceLinkCategory", "SourceLinkCategory") + .WithMany("StreetcodeCategoryContents") + .HasForeignKey("SourceLinkCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany("StreetcodeCategoryContents") + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SourceLinkCategory"); + + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.RelatedFigure", b => + { + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Observer") + .WithMany("Observers") + .HasForeignKey("ObserverId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Target") + .WithMany("Targets") + .HasForeignKey("TargetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Observer"); + + b.Navigation("Target"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.StreetcodeArt", b => + { + b.HasOne("Streetcode.DAL.Entities.Media.Images.Art", "Art") + .WithMany("StreetcodeArts") + .HasForeignKey("ArtId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany("StreetcodeArts") + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Art"); + + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", b => + { + b.HasOne("Streetcode.DAL.Entities.Media.Audio", "Audio") + .WithOne("Streetcode") + .HasForeignKey("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "AudioId") + .OnDelete(DeleteBehavior.Cascade); + + b.Navigation("Audio"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.TextContent.Fact", b => + { + b.HasOne("Streetcode.DAL.Entities.Media.Images.Image", "Image") + .WithMany("Facts") + .HasForeignKey("ImageId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany("Facts") + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Image"); + + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.TextContent.RelatedTerm", b => + { + b.HasOne("Streetcode.DAL.Entities.Streetcode.TextContent.Term", "Term") + .WithMany("RelatedTerms") + .HasForeignKey("TermId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Term"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.TextContent.Text", b => + { + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithOne("Text") + .HasForeignKey("Streetcode.DAL.Entities.Streetcode.TextContent.Text", "StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Team.TeamMember", b => + { + b.HasOne("Streetcode.DAL.Entities.Media.Images.Image", "Image") + .WithOne("TeamMember") + .HasForeignKey("Streetcode.DAL.Entities.Team.TeamMember", "ImageId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Image"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Team.TeamMemberLink", b => + { + b.HasOne("Streetcode.DAL.Entities.Team.TeamMember", "TeamMember") + .WithMany("TeamMemberLinks") + .HasForeignKey("TeamMemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("TeamMember"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Team.TeamMemberPositions", b => + { + b.HasOne("Streetcode.DAL.Entities.Team.Positions", "Positions") + .WithMany() + .HasForeignKey("PositionsId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Streetcode.DAL.Entities.Team.TeamMember", "TeamMember") + .WithMany() + .HasForeignKey("TeamMemberId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Positions"); + + b.Navigation("TeamMember"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Timeline.HistoricalContextTimeline", b => + { + b.HasOne("Streetcode.DAL.Entities.Timeline.HistoricalContext", "HistoricalContext") + .WithMany("HistoricalContextTimelines") + .HasForeignKey("HistoricalContextId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Streetcode.DAL.Entities.Timeline.TimelineItem", "Timeline") + .WithMany("HistoricalContextTimelines") + .HasForeignKey("TimelineId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("HistoricalContext"); + + b.Navigation("Timeline"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Timeline.TimelineItem", b => + { + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany("TimelineItems") + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Toponyms.StreetcodeToponym", b => + { + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany() + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Streetcode.DAL.Entities.Toponyms.Toponym", "Toponym") + .WithMany() + .HasForeignKey("ToponymId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Streetcode"); + + b.Navigation("Toponym"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Transactions.TransactionLink", b => + { + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithOne("TransactionLink") + .HasForeignKey("Streetcode.DAL.Entities.Transactions.TransactionLink", "StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.Coordinates.Types.StreetcodeCoordinate", b => + { + b.HasOne("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", "Streetcode") + .WithMany("Coordinates") + .HasForeignKey("StreetcodeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.Coordinates.Types.ToponymCoordinate", b => + { + b.HasOne("Streetcode.DAL.Entities.Toponyms.Toponym", "Toponym") + .WithOne("Coordinate") + .HasForeignKey("Streetcode.DAL.Entities.AdditionalContent.Coordinates.Types.ToponymCoordinate", "ToponymId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Toponym"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.Tag", b => + { + b.Navigation("StreetcodeTagIndices"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Audio", b => + { + b.Navigation("Streetcode"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Images.Art", b => + { + b.Navigation("StreetcodeArts"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Media.Images.Image", b => + { + b.Navigation("Art"); + + b.Navigation("Facts"); + + b.Navigation("ImageDetails"); + + b.Navigation("News"); + + b.Navigation("Partner"); + + b.Navigation("SourceLinkCategories"); + + b.Navigation("TeamMember"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Partners.Partner", b => + { + b.Navigation("PartnerSourceLinks"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Sources.SourceLinkCategory", b => + { + b.Navigation("StreetcodeCategoryContents"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.StreetcodeContent", b => + { + b.Navigation("Coordinates"); + + b.Navigation("Facts"); + + b.Navigation("Observers"); + + b.Navigation("StatisticRecords"); + + b.Navigation("StreetcodeArts"); + + b.Navigation("StreetcodeCategoryContents"); + + b.Navigation("StreetcodeTagIndices"); + + b.Navigation("Subtitles"); + + b.Navigation("Targets"); + + b.Navigation("Text"); + + b.Navigation("TimelineItems"); + + b.Navigation("TransactionLink"); + + b.Navigation("Videos"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Streetcode.TextContent.Term", b => + { + b.Navigation("RelatedTerms"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Team.TeamMember", b => + { + b.Navigation("TeamMemberLinks"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Timeline.HistoricalContext", b => + { + b.Navigation("HistoricalContextTimelines"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Timeline.TimelineItem", b => + { + b.Navigation("HistoricalContextTimelines"); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.Toponyms.Toponym", b => + { + b.Navigation("Coordinate") + .IsRequired(); + }); + + modelBuilder.Entity("Streetcode.DAL.Entities.AdditionalContent.Coordinates.Types.StreetcodeCoordinate", b => + { + b.Navigation("StatisticRecord") + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Streetcode/Streetcode.DAL/Persistence/Migrations/20240122161255_ForFansLength.cs b/Streetcode/Streetcode.DAL/Persistence/Migrations/20240122161255_ForFansLength.cs new file mode 100644 index 000000000..bc3c1b1fd --- /dev/null +++ b/Streetcode/Streetcode.DAL/Persistence/Migrations/20240122161255_ForFansLength.cs @@ -0,0 +1,20 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Streetcode.DAL.Persistence.Migrations +{ + /// + public partial class ForFansLength : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + } + } +} diff --git a/Streetcode/Streetcode.DAL/Persistence/Migrations/StreetcodeDbContextModelSnapshot.cs b/Streetcode/Streetcode.DAL/Persistence/Migrations/StreetcodeDbContextModelSnapshot.cs index 0c3c73915..c431b2263 100644 --- a/Streetcode/Streetcode.DAL/Persistence/Migrations/StreetcodeDbContextModelSnapshot.cs +++ b/Streetcode/Streetcode.DAL/Persistence/Migrations/StreetcodeDbContextModelSnapshot.cs @@ -507,7 +507,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Text") .IsRequired() - .HasMaxLength(10000) + .HasMaxLength(15000) .HasColumnType("nvarchar(max)"); b.HasKey("SourceLinkCategoryId", "StreetcodeId"); diff --git a/Streetcode/Streetcode.XIntegrationTest/ControllerTests/AdditionalContent/CoordinateControllerTests.cs b/Streetcode/Streetcode.XIntegrationTest/ControllerTests/AdditionalContent/CoordinateControllerTests.cs index 5986c9ae5..ac520b783 100644 --- a/Streetcode/Streetcode.XIntegrationTest/ControllerTests/AdditionalContent/CoordinateControllerTests.cs +++ b/Streetcode/Streetcode.XIntegrationTest/ControllerTests/AdditionalContent/CoordinateControllerTests.cs @@ -5,7 +5,7 @@ namespace Streetcode.XIntegrationTest.ControllerTests.AdditionalContent { - public class CoordinateControllerTests : BaseControllerTests, IClassFixture> + public class CoordinateControllerTests : BaseControllerTests, IClassFixture> { public CoordinateControllerTests(CustomWebApplicationFactory factory) : base(factory, "/api/Coordinate") diff --git a/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Media/VideoControllerTests.cs b/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Media/VideoControllerTests.cs index fe09ba013..f38e04d5b 100644 --- a/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Media/VideoControllerTests.cs +++ b/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Media/VideoControllerTests.cs @@ -1,11 +1,11 @@ using Streetcode.BLL.DTO.Media; +using Streetcode.BLL.DTO.Media.Audio; using Streetcode.XIntegrationTest.ControllerTests.Utils; using Streetcode.XIntegrationTest.ControllerTests.Utils.BeforeAndAfterTestAtribute.Media.Video; using Xunit; + namespace Streetcode.XIntegrationTest.ControllerTests.Media { - - public class VideoControllerTests : BaseControllerTests, IClassFixture> { public VideoControllerTests(CustomWebApplicationFactory factory) diff --git a/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Streetcode/Update/StreetcodeUpdateControllerTests.cs b/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Streetcode/Update/StreetcodeUpdateControllerTests.cs new file mode 100644 index 000000000..d477733f9 --- /dev/null +++ b/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Streetcode/Update/StreetcodeUpdateControllerTests.cs @@ -0,0 +1,95 @@ +using Streetcode.BLL.DTO.AdditionalContent.Tag; +using Streetcode.BLL.DTO.Streetcode.Update; +using Streetcode.BLL.Enums; +using Streetcode.DAL.Entities.Streetcode; +using Streetcode.XIntegrationTest.ControllerTests.Utils; +using Streetcode.XIntegrationTest.ControllerTests.Utils.BeforeAndAfterTestAtribute.Streetcode; +using System.Net; +using Xunit; + +namespace Streetcode.XIntegrationTest.ControllerTests.Streetcode.Update +{ + public class StreetcodeUpdateControllerTests : + BaseControllerTests, IClassFixture> + { + public StreetcodeUpdateControllerTests(CustomWebApplicationFactory factory) + : base(factory, "/api/Streetcode") + { + + } + + [Fact] + [ExtractTestUpdateStreetcode] + public async Task Update_ReturnSuccessStatusCode() + { + StreetcodeUpdateDTO updateStreetCodeDTO = ExtractTestUpdateStreetcode.StreetcodeForTest; + + var response = await client.UpdateAsync(updateStreetCodeDTO); + + Assert.True(response.IsSuccessStatusCode); + } + + [Fact] + [ExtractTestUpdateStreetcode] + public async Task Update_ChangesTitleAndTransliterationUrl() + { + StreetcodeUpdateDTO updateStreetCodeDTO = ExtractTestUpdateStreetcode.StreetcodeForTest; + await client.UpdateAsync(updateStreetCodeDTO); + + var responseGetByIdUpdated = await client.GetByIdAsync(updateStreetCodeDTO.Id); + var streetCodeContent = CaseIsensitiveJsonDeserializer.Deserialize(responseGetByIdUpdated.Content); + Assert.Multiple(() => + { + Assert.Equal(updateStreetCodeDTO.Title, streetCodeContent.Title); + Assert.Equal(updateStreetCodeDTO.DateString, streetCodeContent.DateString); + }); + } + + [Fact] + [ExtractTestUpdateStreetcode] + public async Task Update_WithInvalidId_ReturnsBadRequest() + { + StreetcodeUpdateDTO updateStreetCodeDTO = ExtractTestUpdateStreetcode.StreetcodeForTest; + updateStreetCodeDTO.Id++; + + var response = await client.UpdateAsync(updateStreetCodeDTO); + + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + } + + [Fact] + [ExtractTestUpdateStreetcode] + public async Task Update_WithInvalidData_ReturnsBadRequest() + { + StreetcodeUpdateDTO updateStreetCodeDTO = ExtractTestUpdateStreetcode.StreetcodeForTest; + updateStreetCodeDTO.Title = null; // Invalid data + + var response = await client.UpdateAsync(updateStreetCodeDTO); + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + } + + [Fact] + [ExtractTestUpdateStreetcode] + public async Task Update_WithInvalidTags_ReturnsBadRequest() + { + StreetcodeUpdateDTO updateStreetCodeDTO = ExtractTestUpdateStreetcode.StreetcodeForTest; + + // Invalid tag data + updateStreetCodeDTO.Tags = new List + { + new StreetcodeTagUpdateDTO + { + Id = 9999, // Non-existent tag ID + Title = "Invalid Tag", + IsVisible = true, + Index = 0, + StreetcodeId = updateStreetCodeDTO.Id, + ModelState = ModelState.Updated + }, + }; + + var response = await client.UpdateAsync(updateStreetCodeDTO); + Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode); + } + } +} \ No newline at end of file diff --git a/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/ExtractTestStreetcode.cs b/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/ExtractTestStreetcode.cs index 32f16ad51..7813994db 100644 --- a/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/ExtractTestStreetcode.cs +++ b/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/ExtractTestStreetcode.cs @@ -31,5 +31,25 @@ public override void Before(MethodInfo methodUnderTest) sqlDbHelper.SaveChanges(); } } + + public override void After(MethodInfo methodUnderTest) + { + var sqlDbHelper = BaseControllerTests.GetSqlDbHelper(); + var streetcodeContent = sqlDbHelper.GetExistItem(); + if (streetcodeContent != null) + { + // Restore the original StreetcodeContent + streetcodeContent.EventStartOrPersonBirthDate = StreetcodeForTest.EventStartOrPersonBirthDate; + streetcodeContent.EventEndOrPersonDeathDate = StreetcodeForTest.EventEndOrPersonDeathDate; + streetcodeContent.ViewCount = StreetcodeForTest.ViewCount; + streetcodeContent.DateString = StreetcodeForTest.DateString; + streetcodeContent.Alias = StreetcodeForTest.Alias; + streetcodeContent.Title = StreetcodeForTest.Title; + streetcodeContent.TransliterationUrl = StreetcodeForTest.TransliterationUrl; + streetcodeContent.Teaser = StreetcodeForTest.Teaser; + + sqlDbHelper.SaveChanges(); + } + } } } diff --git a/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/ExtractTestUpdateStreetcode.cs b/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/ExtractTestUpdateStreetcode.cs new file mode 100644 index 000000000..a1e9ee7a9 --- /dev/null +++ b/Streetcode/Streetcode.XIntegrationTest/ControllerTests/Utils/BeforeAndAfterTestAtribute/Streetcode/ExtractTestUpdateStreetcode.cs @@ -0,0 +1,101 @@ +using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Streetcode.BLL.DTO.AdditionalContent.Tag; +using Streetcode.BLL.DTO.Analytics.Update; +using Streetcode.BLL.DTO.Media.Art; +using Streetcode.BLL.DTO.Media.Audio; +using Streetcode.BLL.DTO.Media.Images; +using Streetcode.BLL.DTO.Media.Video; +using Streetcode.BLL.DTO.Partners.Update; +using Streetcode.BLL.DTO.Sources.Update; +using Streetcode.BLL.DTO.Streetcode.RelatedFigure; +using Streetcode.BLL.DTO.Streetcode.TextContent.Fact; +using Streetcode.BLL.DTO.Streetcode.Update; +using Streetcode.BLL.DTO.Timeline.Update; +using Streetcode.BLL.DTO.Toponyms; +using Streetcode.DAL.Entities.Streetcode; +using System.Reflection; +using Xunit.Sdk; + +namespace Streetcode.XIntegrationTest.ControllerTests.Utils.BeforeAndAfterTestAtribute.Streetcode +{ + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] + class ExtractTestUpdateStreetcode : BeforeAfterTestAttribute + { + public static StreetcodeUpdateDTO StreetcodeForTest; + private static StreetcodeContent _streetcodeContent; + + public override void Before(MethodInfo methodUnderTest) + { + var sqlDbHelper = BaseControllerTests.GetSqlDbHelper(); + _streetcodeContent = sqlDbHelper.GetExistItem(); + if (_streetcodeContent == null) + { + _streetcodeContent = sqlDbHelper.AddNewItem(new StreetcodeContent() + { + Index = new Random().Next(0, 1000000), + UpdatedAt = DateTime.Now, + CreatedAt = DateTime.Now, + EventStartOrPersonBirthDate = DateTime.Now, + EventEndOrPersonDeathDate = DateTime.Now, + ViewCount = 1, + DateString = "20 травня 2023", + Alias = "dsf", + Title = "Title", + TransliterationUrl = Guid.NewGuid().ToString(), + Teaser = "Test Teaser", + }); + sqlDbHelper.SaveChanges(); + } + + StreetcodeForTest = this.CreateMoqStreetCodeDTO( + _streetcodeContent.Id, + _streetcodeContent.Index, + _streetcodeContent.TransliterationUrl); + } + + public override void After(MethodInfo methodUnderTest) + { + var sqlDbHelper = BaseControllerTests.GetSqlDbHelper(); + var streetcodeContent = sqlDbHelper.GetExistItem(); + if (streetcodeContent != null) + { + // Restore the original StreetcodeContent + streetcodeContent.EventStartOrPersonBirthDate = _streetcodeContent.EventStartOrPersonBirthDate; + streetcodeContent.EventEndOrPersonDeathDate = _streetcodeContent.EventEndOrPersonDeathDate; + streetcodeContent.ViewCount = _streetcodeContent.ViewCount; + streetcodeContent.DateString = _streetcodeContent.DateString; + streetcodeContent.Alias = _streetcodeContent.Alias; + streetcodeContent.Title = _streetcodeContent.Title; + streetcodeContent.TransliterationUrl = _streetcodeContent.TransliterationUrl; + streetcodeContent.Teaser = _streetcodeContent.Teaser; + + sqlDbHelper.SaveChanges(); + } + } + + private StreetcodeUpdateDTO CreateMoqStreetCodeDTO(int id, int index, string transliterationUrl) + { + return new StreetcodeUpdateDTO + { + Id = id, + Index = index, + Title = "New Title", + TransliterationUrl = transliterationUrl, + Tags = new List(), + Facts = new List(), + Audios = new List(), + Images = new List(), + Videos = new List(), + Partners = new List(), + Toponyms = new List(), + Subtitles = new List(), + DateString = "22 травня 2023", + TimelineItems = new List(), + RelatedFigures = new List(), + StreetcodeArts = new List(), + StatisticRecords = new List(), + StreetcodeCategoryContents = new List(), + }; + } + } +} \ No newline at end of file diff --git a/Streetcode/Streetcode.XIntegrationTest/Streetcode.XIntegrationTest.csproj b/Streetcode/Streetcode.XIntegrationTest/Streetcode.XIntegrationTest.csproj index 460f80ab3..9e022df0c 100644 --- a/Streetcode/Streetcode.XIntegrationTest/Streetcode.XIntegrationTest.csproj +++ b/Streetcode/Streetcode.XIntegrationTest/Streetcode.XIntegrationTest.csproj @@ -51,8 +51,4 @@ - - - -