Il reste a faire la migration! Je ne suis pas capable.
This commit is contained in:
@@ -11,8 +11,11 @@ public class Content
|
|||||||
public Guid? DeletedBy { get; set; }
|
public Guid? DeletedBy { get; set; }
|
||||||
public DateTimeOffset? DeletedAt { get; set; }
|
public DateTimeOffset? DeletedAt { get; set; }
|
||||||
[MaxLength(128)] public required string Title { get; set; }
|
[MaxLength(128)] public required string Title { get; set; }
|
||||||
|
|
||||||
|
[MaxLength(512)]public string? ThumbnailUrl { get; init; }
|
||||||
[MaxLength(2048)] public string Description { get; set; } = "";
|
[MaxLength(2048)] public string Description { get; set; } = "";
|
||||||
[MaxLength(2048)] public string? HtmlFileUrl { get; set; } = "";
|
[MaxLength(2048)] public string? HtmlFileUrl { get; set; } = "";
|
||||||
public IList<ContentReaction> Reactions { get; set; } = new List<ContentReaction>();
|
public IList<ContentReaction> Reactions { get; set; } = new List<ContentReaction>();
|
||||||
public string[]? Urls { get; init; }
|
public string[]? Urls { get; init; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,11 @@ public class ContentDbContext(
|
|||||||
.OwnsMany(c => c.Reactions)
|
.OwnsMany(c => c.Reactions)
|
||||||
.ToTable("Reactions");
|
.ToTable("Reactions");
|
||||||
|
|
||||||
|
modelBuilder
|
||||||
|
.Entity<Content>()
|
||||||
|
.Property(c => c.ThumbnailUrl);
|
||||||
|
|
||||||
|
|
||||||
modelBuilder
|
modelBuilder
|
||||||
.Entity<Creator>()
|
.Entity<Creator>()
|
||||||
.OwnsOne<Socials>(x => x.Socials)
|
.OwnsOne<Socials>(x => x.Socials)
|
||||||
@@ -44,5 +49,7 @@ public class ContentDbContext(
|
|||||||
.Entity<Creator>()
|
.Entity<Creator>()
|
||||||
.OwnsOne<Images>(x => x.Images)
|
.OwnsOne<Images>(x => x.Images)
|
||||||
.ToTable(nameof(Images));
|
.ToTable(nameof(Images));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ public record PostContentRequest(
|
|||||||
string Title,
|
string Title,
|
||||||
string Description,
|
string Description,
|
||||||
IFormFileCollection? Files,
|
IFormFileCollection? Files,
|
||||||
|
string ThumbnailUrl,
|
||||||
string[]? ExternalUrls);
|
string[]? ExternalUrls);
|
||||||
|
|
||||||
|
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public sealed class PostContentRequestValidator : Validator<PostContentRequest>
|
public sealed class PostContentRequestValidator : Validator<PostContentRequest>
|
||||||
{
|
{
|
||||||
@@ -40,6 +42,8 @@ public sealed class PostContentRequestValidator : Validator<PostContentRequest>
|
|||||||
RuleForEach(r => r.ExternalUrls)
|
RuleForEach(r => r.ExternalUrls)
|
||||||
.NotEmpty().WithMessage("External URL cannot be empty")
|
.NotEmpty().WithMessage("External URL cannot be empty")
|
||||||
.Must(url => Uri.IsWellFormedUriString(url, UriKind.Absolute)).WithMessage("External URL is not valid");
|
.Must(url => Uri.IsWellFormedUriString(url, UriKind.Absolute)).WithMessage("External URL is not valid");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +106,9 @@ public sealed class PostContent(
|
|||||||
CreatedBy = User.GetUserId(),
|
CreatedBy = User.GetUserId(),
|
||||||
Title = req.Title,
|
Title = req.Title,
|
||||||
Description = req.Description,
|
Description = req.Description,
|
||||||
Urls = urls.IsEmpty ? null : urls.ToArray()
|
Urls = urls.IsEmpty ? null : urls.ToArray(),
|
||||||
|
ThumbnailUrl = req.ThumbnailUrl,
|
||||||
|
|
||||||
},
|
},
|
||||||
ct);
|
ct);
|
||||||
|
|
||||||
@@ -122,6 +128,7 @@ public sealed class PostContent(
|
|||||||
Title = c.Title,
|
Title = c.Title,
|
||||||
Description = c.Description,
|
Description = c.Description,
|
||||||
Urls = c.Urls,
|
Urls = c.Urls,
|
||||||
|
ThumbnailUrl = c.ThumbnailUrl,
|
||||||
})
|
})
|
||||||
.SingleOrDefaultAsync(
|
.SingleOrDefaultAsync(
|
||||||
c => c.Id == req.Id,
|
c => c.Id == req.Id,
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public sealed class PostContentHtml(
|
|||||||
Title = c.Title,
|
Title = c.Title,
|
||||||
Description = c.Description,
|
Description = c.Description,
|
||||||
Urls = c.Urls,
|
Urls = c.Urls,
|
||||||
|
ThumbnailUrl = c.ThumbnailUrl,
|
||||||
HtmlFileUrl = htmlFileUrl
|
HtmlFileUrl = htmlFileUrl
|
||||||
})
|
})
|
||||||
.SingleOrDefaultAsync(
|
.SingleOrDefaultAsync(
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ public class GetContent(
|
|||||||
Title = c.Title,
|
Title = c.Title,
|
||||||
Description = c.Description,
|
Description = c.Description,
|
||||||
Urls = c.Urls,
|
Urls = c.Urls,
|
||||||
|
ThumbnailUrl = c.ThumbnailUrl,
|
||||||
HtmlFileUrl = c.HtmlFileUrl ?? "",
|
HtmlFileUrl = c.HtmlFileUrl ?? "",
|
||||||
Reactions = c.Reactions.Select(x => new ReactionModel
|
Reactions = c.Reactions.Select(x => new ReactionModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ public class GetContentsByCreatorHandler(
|
|||||||
Title = c.Title,
|
Title = c.Title,
|
||||||
Description = c.Description,
|
Description = c.Description,
|
||||||
Urls = c.Urls,
|
Urls = c.Urls,
|
||||||
|
ThumbnailUrl = c.ThumbnailUrl,
|
||||||
HtmlFileUrl = c.HtmlFileUrl ?? "",
|
HtmlFileUrl = c.HtmlFileUrl ?? "",
|
||||||
Reactions = c.Reactions.Select(x => new ReactionModel
|
Reactions = c.Reactions.Select(x => new ReactionModel
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class GetFeaturedContentsHandler(
|
|||||||
Title = c.Title,
|
Title = c.Title,
|
||||||
Description = c.Description,
|
Description = c.Description,
|
||||||
Urls = c.Urls,
|
Urls = c.Urls,
|
||||||
|
ThumbnailUrl = c.ThumbnailUrl,
|
||||||
Reactions = c.Reactions.Select(x => new ReactionModel
|
Reactions = c.Reactions.Select(x => new ReactionModel
|
||||||
{
|
{
|
||||||
Reaction = x.Reaction.FromEnum(),
|
Reaction = x.Reaction.FromEnum(),
|
||||||
|
|||||||
@@ -14,5 +14,6 @@ public class ContentModel
|
|||||||
public required string Description { get; init; }
|
public required string Description { get; init; }
|
||||||
public string HtmlFileUrl { get; init; } = "";
|
public string HtmlFileUrl { get; init; } = "";
|
||||||
public required string[]? Urls { get; init; }
|
public required string[]? Urls { get; init; }
|
||||||
|
public string? ThumbnailUrl { get; init; }
|
||||||
public IList<ReactionModel>? Reactions { get; set; } = new List<ReactionModel>();
|
public IList<ReactionModel>? Reactions { get; set; } = new List<ReactionModel>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user