From e617b5ffd3aae3208e03b07e5aa372e9b071b71e Mon Sep 17 00:00:00 2001 From: Jonathan Bourdon Date: Sun, 4 Aug 2024 21:52:09 -0400 Subject: [PATCH] Changed all MaxLength to be 64, 128, 256, or 2048 probably we need to review this --- src/Web/Features/Contents/Data/Creator.cs | 2 +- ....cs => 20240805012309_Initial.Designer.cs} | 6 ++--- ...7_Initial.cs => 20240805012309_Initial.cs} | 2 +- .../ContentDbContextModelSnapshot.cs | 4 +-- src/Web/Features/Messages/Data/Message.cs | 4 +-- ....cs => 20240805012343_Initial.Designer.cs} | 10 +++---- ...7_Initial.cs => 20240805012343_Initial.cs} | 4 +-- .../MessagingDbContextModelSnapshot.cs | 8 +++--- src/Web/TestDataSeeder.cs | 26 ++++++++++--------- 9 files changed, 34 insertions(+), 32 deletions(-) rename src/Web/Features/Contents/Migrations/{20240804071117_Initial.Designer.cs => 20240805012309_Initial.Designer.cs} (98%) rename src/Web/Features/Contents/Migrations/{20240804071117_Initial.cs => 20240805012309_Initial.cs} (99%) rename src/Web/Features/Messages/Migrations/{20240802044717_Initial.Designer.cs => 20240805012343_Initial.Designer.cs} (89%) rename src/Web/Features/Messages/Migrations/{20240802044717_Initial.cs => 20240805012343_Initial.cs} (93%) diff --git a/src/Web/Features/Contents/Data/Creator.cs b/src/Web/Features/Contents/Data/Creator.cs index 67803d0..d0b0b37 100644 --- a/src/Web/Features/Contents/Data/Creator.cs +++ b/src/Web/Features/Contents/Data/Creator.cs @@ -18,7 +18,7 @@ public class Creator public class About { [MaxLength(255)] public string? Title { get; set; } - [MaxLength(255)] public string? Description { get; set; } + [MaxLength(2048)] public string? Description { get; set; } } public class ProfileColors diff --git a/src/Web/Features/Contents/Migrations/20240804071117_Initial.Designer.cs b/src/Web/Features/Contents/Migrations/20240805012309_Initial.Designer.cs similarity index 98% rename from src/Web/Features/Contents/Migrations/20240804071117_Initial.Designer.cs rename to src/Web/Features/Contents/Migrations/20240805012309_Initial.Designer.cs index 2239cb6..25a08d7 100644 --- a/src/Web/Features/Contents/Migrations/20240804071117_Initial.Designer.cs +++ b/src/Web/Features/Contents/Migrations/20240805012309_Initial.Designer.cs @@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace Hutopy.Web.Features.Contents.Migrations { [DbContext(typeof(ContentDbContext))] - [Migration("20240804071117_Initial")] + [Migration("20240805012309_Initial")] partial class Initial { /// @@ -119,8 +119,8 @@ namespace Hutopy.Web.Features.Contents.Migrations .HasColumnType("uuid"); b1.Property("Description") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("Title") .HasMaxLength(255) diff --git a/src/Web/Features/Contents/Migrations/20240804071117_Initial.cs b/src/Web/Features/Contents/Migrations/20240805012309_Initial.cs similarity index 99% rename from src/Web/Features/Contents/Migrations/20240804071117_Initial.cs rename to src/Web/Features/Contents/Migrations/20240805012309_Initial.cs index f4db5f5..bb3198d 100644 --- a/src/Web/Features/Contents/Migrations/20240804071117_Initial.cs +++ b/src/Web/Features/Contents/Migrations/20240805012309_Initial.cs @@ -24,7 +24,7 @@ namespace Hutopy.Web.Features.Contents.Migrations CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), Name = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), About_Title = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), - About_Description = table.Column(type: "character varying(255)", maxLength: 255, nullable: true) + About_Description = table.Column(type: "character varying(2048)", maxLength: 2048, nullable: true) }, constraints: table => { diff --git a/src/Web/Features/Contents/Migrations/ContentDbContextModelSnapshot.cs b/src/Web/Features/Contents/Migrations/ContentDbContextModelSnapshot.cs index cd39fe1..2904a21 100644 --- a/src/Web/Features/Contents/Migrations/ContentDbContextModelSnapshot.cs +++ b/src/Web/Features/Contents/Migrations/ContentDbContextModelSnapshot.cs @@ -116,8 +116,8 @@ namespace Hutopy.Web.Features.Contents.Migrations .HasColumnType("uuid"); b1.Property("Description") - .HasMaxLength(255) - .HasColumnType("character varying(255)"); + .HasMaxLength(2048) + .HasColumnType("character varying(2048)"); b1.Property("Title") .HasMaxLength(255) diff --git a/src/Web/Features/Messages/Data/Message.cs b/src/Web/Features/Messages/Data/Message.cs index 97dde47..83af411 100644 --- a/src/Web/Features/Messages/Data/Message.cs +++ b/src/Web/Features/Messages/Data/Message.cs @@ -7,8 +7,8 @@ public class Message public Guid Id { get; set; } public Guid SubjectId { get; set; } public Guid CreatedBy { get; set; } - [MaxLength(64)] public required string CreatedByName { get; set; } - [MaxLength(256)] public string? CreatedByPortraitUrl { get; set; } + [MaxLength(255)] public required string CreatedByName { get; set; } + [MaxLength(255)] public string? CreatedByPortraitUrl { get; set; } public DateTimeOffset CreatedAt { get; set; } public Guid? ParentId { get; set; } public required string Value { get; set; } diff --git a/src/Web/Features/Messages/Migrations/20240802044717_Initial.Designer.cs b/src/Web/Features/Messages/Migrations/20240805012343_Initial.Designer.cs similarity index 89% rename from src/Web/Features/Messages/Migrations/20240802044717_Initial.Designer.cs rename to src/Web/Features/Messages/Migrations/20240805012343_Initial.Designer.cs index 63d787f..31e6ba9 100644 --- a/src/Web/Features/Messages/Migrations/20240802044717_Initial.Designer.cs +++ b/src/Web/Features/Messages/Migrations/20240805012343_Initial.Designer.cs @@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace Hutopy.Web.Features.Messages.Migrations { [DbContext(typeof(MessagingDbContext))] - [Migration("20240802044717_Initial")] + [Migration("20240805012343_Initial")] partial class Initial { /// @@ -42,12 +42,12 @@ namespace Hutopy.Web.Features.Messages.Migrations b.Property("CreatedByName") .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("CreatedByPortraitUrl") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ParentId") .HasColumnType("uuid"); diff --git a/src/Web/Features/Messages/Migrations/20240802044717_Initial.cs b/src/Web/Features/Messages/Migrations/20240805012343_Initial.cs similarity index 93% rename from src/Web/Features/Messages/Migrations/20240802044717_Initial.cs rename to src/Web/Features/Messages/Migrations/20240805012343_Initial.cs index fa9c144..ce0f4cd 100644 --- a/src/Web/Features/Messages/Migrations/20240802044717_Initial.cs +++ b/src/Web/Features/Messages/Migrations/20240805012343_Initial.cs @@ -22,8 +22,8 @@ namespace Hutopy.Web.Features.Messages.Migrations Id = table.Column(type: "uuid", nullable: false), SubjectId = table.Column(type: "uuid", nullable: false), CreatedBy = table.Column(type: "uuid", nullable: false), - CreatedByName = table.Column(type: "character varying(64)", maxLength: 64, nullable: false), - CreatedByPortraitUrl = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + CreatedByName = table.Column(type: "character varying(255)", maxLength: 255, nullable: false), + CreatedByPortraitUrl = table.Column(type: "character varying(255)", maxLength: 255, nullable: true), CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), ParentId = table.Column(type: "uuid", nullable: true), Value = table.Column(type: "text", nullable: false) diff --git a/src/Web/Features/Messages/Migrations/MessagingDbContextModelSnapshot.cs b/src/Web/Features/Messages/Migrations/MessagingDbContextModelSnapshot.cs index 111cb88..b1848d8 100644 --- a/src/Web/Features/Messages/Migrations/MessagingDbContextModelSnapshot.cs +++ b/src/Web/Features/Messages/Migrations/MessagingDbContextModelSnapshot.cs @@ -39,12 +39,12 @@ namespace Hutopy.Web.Features.Messages.Migrations b.Property("CreatedByName") .IsRequired() - .HasMaxLength(64) - .HasColumnType("character varying(64)"); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("CreatedByPortraitUrl") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); + .HasMaxLength(255) + .HasColumnType("character varying(255)"); b.Property("ParentId") .HasColumnType("uuid"); diff --git a/src/Web/TestDataSeeder.cs b/src/Web/TestDataSeeder.cs index 6bd5a16..1b23093 100644 --- a/src/Web/TestDataSeeder.cs +++ b/src/Web/TestDataSeeder.cs @@ -35,7 +35,8 @@ internal class TestDataSeeder( if (contentContext.Contents.Any()) return; _users.Add(await CreateUserAsync("admin", null, Roles.Administrator)); - _users.Add(await CreateUserAsync("userA", null)); + var userA = await CreateUserAsync("userA", null); + _users.Add(userA); _users.Add(await CreateUserAsync("userB", null)); foreach (var creator in _creators) @@ -48,6 +49,7 @@ internal class TestDataSeeder( creator.Id = creatorUser.Id; creator.CreatedBy = creator.Id; + await contentContext.Subscriptions.AddAsync(new() { CreatedBy = userA.Id, CreatorId = creator.Id }); await contentContext.Creators.AddAsync(creator); var contents = GenerateContent(creator, 10); @@ -256,14 +258,15 @@ internal class TestDataSeeder( ProfilePictureUrl = "/images/usersmedia/chloebeaugrand/profilepictures/profileChloeBeaugrand01.png" } }; - + private readonly static Creator GuillaumeMCreator = new() { Name = "guillaumem", About = new() { Title = "Page officielle", - Description = "Mettre en lumière le côté humain des entrepreneurs. Chaque service, chaque produit est porteur d’une histoire, d’une passion, d’une vision unique. Mon objectif est de faire rayonner cette unicité, de créer des connexions authentiques entre ces entrepreneurs et leurs clients potentiels. Parce que derrière chaque entreprise, il y a des personnes inspirantes qui méritent d’être entendues et comprises. Et toi, quel est ton objectif pour cette année?", + Description = + "Mettre en lumière le côté humain des entrepreneurs. Chaque service, chaque produit est porteur d’une histoire, d’une passion, d’une vision unique. Mon objectif est de faire rayonner cette unicité, de créer des connexions authentiques entre ces entrepreneurs et leurs clients potentiels. Parce que derrière chaque entreprise, il y a des personnes inspirantes qui méritent d’être entendues et comprises. Et toi, quel est ton objectif pour cette année?", }, ProfileColors = new() { @@ -279,17 +282,19 @@ internal class TestDataSeeder( StoredDataUrls = new() { BannerPictureUrl = "/images/usersmedia/guillaumeMousseau/banners/bannerGuillaumeMousseau01.png", - ProfilePictureUrl = "/images/usersmedia/guillaumeMousseau/profilepictures/profileGuillaumeMousseau01.png" + ProfilePictureUrl = + "/images/usersmedia/guillaumeMousseau/profilepictures/profileGuillaumeMousseau01.png" } }; - + private readonly static Creator LeffetCreator = new() { Name = "leffet", About = new() { Title = "Page officielle", - Description = "Mettre en lumière le côté humain des entrepreneurs. Chaque service, chaque produit est porteur d’une histoire, d’une passion, d’une vision unique. Mon objectif est de faire rayonner cette unicité, de créer des connexions authentiques entre ces entrepreneurs et leurs clients potentiels. Parce que derrière chaque entreprise, il y a des personnes inspirantes qui méritent d’être entendues et comprises. Et toi, quel est ton objectif pour cette année?", + Description = + "Mettre en lumière le côté humain des entrepreneurs. Chaque service, chaque produit est porteur d’une histoire, d’une passion, d’une vision unique. Mon objectif est de faire rayonner cette unicité, de créer des connexions authentiques entre ces entrepreneurs et leurs clients potentiels. Parce que derrière chaque entreprise, il y a des personnes inspirantes qui méritent d’être entendues et comprises. Et toi, quel est ton objectif pour cette année?", }, ProfileColors = new() { @@ -308,14 +313,15 @@ internal class TestDataSeeder( ProfilePictureUrl = "/images/usersmedia/leffet/profilepictures/leffetProfile01.png" } }; - + private readonly static Creator MathieuCaron = new() { Name = "mathieucaron", About = new() { Title = "Page officielle", - Description = "Mettre en lumière le côté humain des entrepreneurs. Chaque service, chaque produit est porteur d’une histoire, d’une passion, d’une vision unique. Mon objectif est de faire rayonner cette unicité, de créer des connexions authentiques entre ces entrepreneurs et leurs clients potentiels. Parce que derrière chaque entreprise, il y a des personnes inspirantes qui méritent d’être entendues et comprises. Et toi, quel est ton objectif pour cette année?", + Description = + "Mettre en lumière le côté humain des entrepreneurs. Chaque service, chaque produit est porteur d’une histoire, d’une passion, d’une vision unique. Mon objectif est de faire rayonner cette unicité, de créer des connexions authentiques entre ces entrepreneurs et leurs clients potentiels. Parce que derrière chaque entreprise, il y a des personnes inspirantes qui méritent d’être entendues et comprises. Et toi, quel est ton objectif pour cette année?", }, ProfileColors = new() { @@ -326,7 +332,6 @@ internal class TestDataSeeder( { FacebookUrl = "https://www.facebook.com/MathieuCaronPro/", YoutubeUrl = "https://www.youtube.com/@lesinterviewsatypiquesdema4692", - }, StoredDataUrls = new() { @@ -343,8 +348,5 @@ internal class TestDataSeeder( GuillaumeMCreator, LeffetCreator, MathieuCaron - - - ]; }