Rename GetCreatorByAlias to GetCreatorBySlug
This commit is contained in:
@@ -3,13 +3,13 @@
|
|||||||
namespace Hutopy.Web.Features.Contents.Handlers;
|
namespace Hutopy.Web.Features.Contents.Handlers;
|
||||||
|
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public sealed class GetCreatorByAliasRequest
|
public sealed class GetCreatorBySlugRequest
|
||||||
{
|
{
|
||||||
public required string Name { get; set; }
|
public required string Name { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public class GetCreatorByAliasResponse(
|
public class GetCreatorBySlugResponse(
|
||||||
Guid id,
|
Guid id,
|
||||||
Guid createdBy,
|
Guid createdBy,
|
||||||
DateTimeOffset createdAt,
|
DateTimeOffset createdAt,
|
||||||
@@ -34,10 +34,10 @@ public class GetCreatorByAliasResponse(
|
|||||||
}
|
}
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class GetCreatorByAliasRequestValidator
|
public sealed class GetCreatorBySlugRequestValidator
|
||||||
: Validator<GetCreatorByAliasRequest>
|
: Validator<GetCreatorBySlugRequest>
|
||||||
{
|
{
|
||||||
public GetCreatorByAliasRequestValidator()
|
public GetCreatorBySlugRequestValidator()
|
||||||
{
|
{
|
||||||
RuleFor(r => r.Name)
|
RuleFor(r => r.Name)
|
||||||
.NotNull().WithMessage("You should specify the Name")
|
.NotNull().WithMessage("You should specify the Name")
|
||||||
@@ -46,9 +46,9 @@ public sealed class GetCreatorByAliasRequestValidator
|
|||||||
}
|
}
|
||||||
|
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public class GetCreatorByAliasHandler(
|
public class GetCreatorBySlugHandler(
|
||||||
ContentDbContext context)
|
ContentDbContext context)
|
||||||
: Endpoint<GetCreatorByAliasRequest, GetCreatorByAliasResponse>
|
: Endpoint<GetCreatorBySlugRequest, GetCreatorBySlugResponse>
|
||||||
{
|
{
|
||||||
public override void Configure()
|
public override void Configure()
|
||||||
{
|
{
|
||||||
@@ -58,7 +58,7 @@ public class GetCreatorByAliasHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override async Task HandleAsync(
|
public override async Task HandleAsync(
|
||||||
GetCreatorByAliasRequest req,
|
GetCreatorBySlugRequest req,
|
||||||
CancellationToken ct)
|
CancellationToken ct)
|
||||||
{
|
{
|
||||||
var creatorName = req.Name.ToLower();
|
var creatorName = req.Name.ToLower();
|
||||||
@@ -67,7 +67,7 @@ public class GetCreatorByAliasHandler(
|
|||||||
.Creators
|
.Creators
|
||||||
.Where(c => EF.Functions.ILike(c.Slugs.Name, creatorName))
|
.Where(c => EF.Functions.ILike(c.Slugs.Name, creatorName))
|
||||||
.AsNoTracking()
|
.AsNoTracking()
|
||||||
.Select(c => new GetCreatorByAliasResponse
|
.Select(c => new GetCreatorBySlugResponse
|
||||||
(
|
(
|
||||||
c.Id,
|
c.Id,
|
||||||
c.CreatedBy,
|
c.CreatedBy,
|
||||||
Reference in New Issue
Block a user