diff --git a/Directory.Packages.props b/Directory.Packages.props
index 00e2212..438dfe2 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -15,6 +15,7 @@
+
diff --git a/src/Web/Common/GuidExtensions.cs b/src/Web/Common/GuidExtensions.cs
index 0c71da8..c91b23f 100644
--- a/src/Web/Common/GuidExtensions.cs
+++ b/src/Web/Common/GuidExtensions.cs
@@ -2,7 +2,7 @@
///
/// Adapted from https://raw.githubusercontent.com/uuidjs/uuid/main/src/v7.ts.
-/// to match the uuidv7 generated on the client
+/// to match the uuid v7 generated on the client
///
public static class GuidHelper
{
@@ -27,14 +27,14 @@ public static class GuidHelper
var values = V7Bytes(randomValues, State.Msecs, State.Seq);
- return new(values);
+ return new Guid(values);
}
- private static void UpdateV7State(V7State state, long now, byte[] rnds)
+ private static void UpdateV7State(V7State state, long now, byte[] randomBytes)
{
if (now > state.Msecs)
{
- state.Seq = (rnds[6] << 23) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
+ state.Seq = (randomBytes[6] << 23) | (randomBytes[7] << 16) | (randomBytes[8] << 8) | randomBytes[9];
state.Msecs = now;
}
else
@@ -47,7 +47,7 @@ public static class GuidHelper
}
}
- private static byte[] V7Bytes(byte[] rnds, long? msecs = null, int? seq = null, byte[] buf = null, int offset = 0)
+ private static byte[] V7Bytes(byte[] randomBytes, long? msecs = null, int? seq = null, byte[]? buf = null, int offset = 0)
{
if (buf == null)
{
@@ -57,7 +57,7 @@ public static class GuidHelper
// Defaults
msecs ??= DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
- seq ??= ((rnds[6] & 0x7f) << 24) | (rnds[7] << 16) | (rnds[8] << 8) | rnds[9];
+ seq ??= ((randomBytes[6] & 0x7f) << 24) | (randomBytes[7] << 16) | (randomBytes[8] << 8) | randomBytes[9];
// byte 0-5: timestamp (48 bits)
buf[offset++] = (byte)((msecs.Value / 0x10000000000) & 0xff);
@@ -80,14 +80,14 @@ public static class GuidHelper
buf[offset++] = (byte)((seq.Value >> 6) & 0xff);
// byte 10: sequence bits 0-5 (6 bits) | random (2 bits)
- buf[offset++] = (byte)(((seq.Value << 2) & 0xff) | (rnds[10] & 0x03));
+ buf[offset++] = (byte)(((seq.Value << 2) & 0xff) | (randomBytes[10] & 0x03));
// bytes 11-15: random (40 bits)
- buf[offset++] = rnds[11];
- buf[offset++] = rnds[12];
- buf[offset++] = rnds[13];
- buf[offset++] = rnds[14];
- buf[offset++] = rnds[15];
+ buf[offset++] = randomBytes[11];
+ buf[offset++] = randomBytes[12];
+ buf[offset++] = randomBytes[13];
+ buf[offset++] = randomBytes[14];
+ buf[offset] = randomBytes[15];
return buf;
}
diff --git a/src/Web/Common/MissingClaimException.cs b/src/Web/Common/MissingClaimException.cs
index 266d109..258fbcd 100644
--- a/src/Web/Common/MissingClaimException.cs
+++ b/src/Web/Common/MissingClaimException.cs
@@ -1,3 +1,5 @@
namespace Hutopy.Web.Common;
-public class MissingClaimException(string claimName) : Exception;
+public class MissingClaimException(
+ string claimName)
+ : Exception;
diff --git a/src/Web/Controllers/FacebookController.cs b/src/Web/Controllers/FacebookController.cs
index 3178b5f..9efee0b 100644
--- a/src/Web/Controllers/FacebookController.cs
+++ b/src/Web/Controllers/FacebookController.cs
@@ -10,7 +10,7 @@ namespace Hutopy.Web.Controllers;
public class FacebookController(IIdentityService identityService) : Controller
{
- [HttpGet("/api/facebook/sign-in")]
+ [Microsoft.AspNetCore.Mvc.HttpGet("/api/facebook/sign-in")]
public async Task SignIn()
{
await HttpContext.ChallengeAsync(FacebookDefaults.AuthenticationScheme,
diff --git a/src/Web/Controllers/GoogleController.cs b/src/Web/Controllers/GoogleController.cs
index 1030f43..34609ab 100644
--- a/src/Web/Controllers/GoogleController.cs
+++ b/src/Web/Controllers/GoogleController.cs
@@ -16,8 +16,8 @@ public class GoogleController(
IOptionsSnapshot jwtOptions)
: Controller
{
- [HttpPost("/api/google/sign-in")]
- public async Task SignIn([FromBody] GoogleSignInRequest request)
+ [Microsoft.AspNetCore.Mvc.HttpPost("/api/google/sign-in")]
+ public async Task SignIn([Microsoft.AspNetCore.Mvc.FromBody] GoogleSignInRequest request)
{
using var httpClient = httpClientFactory.CreateClient();
diff --git a/src/Web/DependencyInjection.cs b/src/Web/DependencyInjection.cs
index e1ca536..4161aad 100644
--- a/src/Web/DependencyInjection.cs
+++ b/src/Web/DependencyInjection.cs
@@ -2,6 +2,7 @@
using Azure.Identity;
using Hutopy.Application.Common.Interfaces;
using Hutopy.Infrastructure.Data;
+using Hutopy.Web.Infrastructure;
using Hutopy.Web.Services;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.Facebook;
diff --git a/src/Web/Endpoints/GetMyUser.cs b/src/Web/Endpoints/GetMyUser.cs
index 4d88e2b..e891a2e 100644
--- a/src/Web/Endpoints/GetMyUser.cs
+++ b/src/Web/Endpoints/GetMyUser.cs
@@ -1,4 +1,5 @@
using Hutopy.Application.Users.Queries.GetCurrentUser;
+using Hutopy.Web.Infrastructure;
namespace Hutopy.Web.Endpoints;
diff --git a/src/Web/Endpoints/JoinUs.cs b/src/Web/Endpoints/JoinUs.cs
index 2f1d1a5..8353ba1 100644
--- a/src/Web/Endpoints/JoinUs.cs
+++ b/src/Web/Endpoints/JoinUs.cs
@@ -1,6 +1,7 @@
using Hutopy.Application.Common.Models;
using Hutopy.Application.FutureCreators.Commands;
using Hutopy.Application.FutureCreators.Queries;
+using Hutopy.Web.Infrastructure;
namespace Hutopy.Web.Endpoints;
diff --git a/src/Web/Endpoints/Stripe.cs b/src/Web/Endpoints/Stripe.cs
index 2eb01dc..be76a0b 100644
--- a/src/Web/Endpoints/Stripe.cs
+++ b/src/Web/Endpoints/Stripe.cs
@@ -1,5 +1,6 @@
using Hutopy.Application.Stripe.Commands;
using Hutopy.Application.Stripe.Queries;
+using Hutopy.Web.Infrastructure;
namespace Hutopy.Web.Endpoints;
diff --git a/src/Web/Endpoints/UpdateMyUser.cs b/src/Web/Endpoints/UpdateMyUser.cs
index 3416dfd..072152f 100644
--- a/src/Web/Endpoints/UpdateMyUser.cs
+++ b/src/Web/Endpoints/UpdateMyUser.cs
@@ -1,4 +1,5 @@
using Hutopy.Application.Users.Commands;
+using Hutopy.Web.Infrastructure;
namespace Hutopy.Web.Endpoints;
diff --git a/src/Web/Endpoints/Users.cs b/src/Web/Endpoints/Users.cs
index 4757789..820aa37 100644
--- a/src/Web/Endpoints/Users.cs
+++ b/src/Web/Endpoints/Users.cs
@@ -1,5 +1,6 @@
using Hutopy.Application.Users.Commands;
using Hutopy.Application.Users.Queries.GetUser;
+using Hutopy.Web.Infrastructure;
namespace Hutopy.Web.Endpoints;
diff --git a/src/Web/Features/Contents/Data/ContentDbContext.cs b/src/Web/Features/Contents/Data/ContentDbContext.cs
index 994d6e7..c47a453 100644
--- a/src/Web/Features/Contents/Data/ContentDbContext.cs
+++ b/src/Web/Features/Contents/Data/ContentDbContext.cs
@@ -1,6 +1,4 @@
-using Microsoft.EntityFrameworkCore;
-
-namespace Hutopy.Web.Features.Contents.Data;
+namespace Hutopy.Web.Features.Contents.Data;
public class ContentDbContext(
DbContextOptions options)
diff --git a/src/Web/Features/Contents/DependencyInjection.cs b/src/Web/Features/Contents/DependencyInjection.cs
index 8cac7cb..77c7c40 100644
--- a/src/Web/Features/Contents/DependencyInjection.cs
+++ b/src/Web/Features/Contents/DependencyInjection.cs
@@ -1,5 +1,4 @@
using Hutopy.Web.Features.Contents.Data;
-using Microsoft.EntityFrameworkCore;
namespace Hutopy.Web.Features.Contents;
diff --git a/src/Web/Features/Contents/Handlers/ChangeAbout.cs b/src/Web/Features/Contents/Handlers/ChangeAbout.cs
index 0cbe19c..6098e80 100644
--- a/src/Web/Features/Contents/Handlers/ChangeAbout.cs
+++ b/src/Web/Features/Contents/Handlers/ChangeAbout.cs
@@ -1,14 +1,14 @@
-using FastEndpoints;
-using Hutopy.Web.Features.Contents.Data;
-using Microsoft.EntityFrameworkCore;
+using Hutopy.Web.Features.Contents.Data;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public record ChangeAboutRequest(
Guid CreatorId,
string? Title,
string? Description);
+[PublicAPI]
public class ChangeAboutHandler(
ContentDbContext context)
: Endpoint
diff --git a/src/Web/Features/Contents/Handlers/ChangeBanner.cs b/src/Web/Features/Contents/Handlers/ChangeBanner.cs
index 0a4f8d8..9081cb6 100644
--- a/src/Web/Features/Contents/Handlers/ChangeBanner.cs
+++ b/src/Web/Features/Contents/Handlers/ChangeBanner.cs
@@ -1,17 +1,16 @@
-using FastEndpoints;
-using Hutopy.Application.AzureBlobStorage.Constants;
+using Hutopy.Application.AzureBlobStorage.Constants;
using Hutopy.Application.Common.Interfaces;
using Hutopy.Web.Features.Contents.Data;
-using Microsoft.EntityFrameworkCore;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public record ChangeBannerRequest(
Guid CreatorId,
IFormFile File);
+[PublicAPI]
public class ChangeBannerHandler(
- IHttpContextAccessor contextAccessor,
ContentDbContext context,
IBlobStorage blobStorage)
: Endpoint
@@ -22,7 +21,7 @@ public class ChangeBannerHandler(
Options(o => o.WithTags("Contents"));
AllowFileUploads();
}
-
+
public override async Task HandleAsync(ChangeBannerRequest request, CancellationToken ct)
{
var creator = await context
@@ -37,7 +36,7 @@ public class ChangeBannerHandler(
await SendNotFoundAsync(ct);
return;
}
-
+
// TODO: this upload should be done to the Creators container
var blobUrl = await blobStorage.UploadFileAsync(
ContainerNames.Users,
@@ -45,11 +44,11 @@ public class ChangeBannerHandler(
request.File.OpenReadStream(),
request.File.ContentType,
ct);
-
+
creator.Images.Banner = blobUrl;
-
+
await context.SaveChangesAsync(ct);
-
+
await SendOkAsync(blobUrl, ct);
}
}
diff --git a/src/Web/Features/Contents/Handlers/ChangeColors.cs b/src/Web/Features/Contents/Handlers/ChangeColors.cs
index d08aaf0..40b45fe 100644
--- a/src/Web/Features/Contents/Handlers/ChangeColors.cs
+++ b/src/Web/Features/Contents/Handlers/ChangeColors.cs
@@ -1,10 +1,8 @@
-using FastEndpoints;
-using FluentValidation;
-using Hutopy.Web.Features.Contents.Data;
-using Microsoft.EntityFrameworkCore;
+using Hutopy.Web.Features.Contents.Data;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public record ChangeColorsRequest(
Guid CreatorId,
string? BannerTop,
@@ -12,7 +10,8 @@ public record ChangeColorsRequest(
string? Accent,
string? Menu);
-public sealed class ChangeColorsRequestValidator
+[PublicAPI]
+public sealed class ChangeColorsRequestValidator
: Validator
{
public ChangeColorsRequestValidator()
diff --git a/src/Web/Features/Contents/Handlers/ChangeLogo.cs b/src/Web/Features/Contents/Handlers/ChangeLogo.cs
index 4fda059..6d4d839 100644
--- a/src/Web/Features/Contents/Handlers/ChangeLogo.cs
+++ b/src/Web/Features/Contents/Handlers/ChangeLogo.cs
@@ -1,17 +1,16 @@
-using FastEndpoints;
-using Hutopy.Application.AzureBlobStorage.Constants;
+using Hutopy.Application.AzureBlobStorage.Constants;
using Hutopy.Application.Common.Interfaces;
using Hutopy.Web.Features.Contents.Data;
-using Microsoft.EntityFrameworkCore;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public record ChangeLogoRequest(
Guid CreatorId,
IFormFile File);
+[PublicAPI]
public class ChangeLogoHandler(
- IHttpContextAccessor contextAccessor,
ContentDbContext context,
IBlobStorage blobStorage)
: Endpoint
@@ -22,7 +21,7 @@ public class ChangeLogoHandler(
Options(o => o.WithTags("Contents"));
AllowFileUploads();
}
-
+
public override async Task HandleAsync(ChangeLogoRequest request, CancellationToken ct)
{
var creator = await context
@@ -37,7 +36,7 @@ public class ChangeLogoHandler(
await SendNotFoundAsync(ct);
return;
}
-
+
// TODO: this upload should be done to the Creators container
var blobUrl = await blobStorage.UploadFileAsync(
ContainerNames.Users,
@@ -45,11 +44,11 @@ public class ChangeLogoHandler(
request.File.OpenReadStream(),
request.File.ContentType,
ct);
-
+
creator.Images.Logo = blobUrl;
-
+
await context.SaveChangesAsync(ct);
-
+
await SendOkAsync(blobUrl, ct);
}
}
diff --git a/src/Web/Features/Contents/Handlers/ChangeSocials.cs b/src/Web/Features/Contents/Handlers/ChangeSocials.cs
index 8c11aa4..ab8a5e8 100644
--- a/src/Web/Features/Contents/Handlers/ChangeSocials.cs
+++ b/src/Web/Features/Contents/Handlers/ChangeSocials.cs
@@ -1,9 +1,8 @@
-using FastEndpoints;
-using Hutopy.Web.Features.Contents.Data;
-using Microsoft.EntityFrameworkCore;
+using Hutopy.Web.Features.Contents.Data;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public record ChangeSocialsRequest(
Guid CreatorId,
string? FacebookUrl,
@@ -15,6 +14,7 @@ public record ChangeSocialsRequest(
string? RedditUrl,
string? WebsiteUrl);
+[PublicAPI]
public class ChangeSocialsHandler(
ContentDbContext context)
: Endpoint
diff --git a/src/Web/Features/Contents/Handlers/CreateContent.cs b/src/Web/Features/Contents/Handlers/CreateContent.cs
index 14496f0..964e507 100644
--- a/src/Web/Features/Contents/Handlers/CreateContent.cs
+++ b/src/Web/Features/Contents/Handlers/CreateContent.cs
@@ -1,6 +1,4 @@
using System.Collections.Concurrent;
-using FastEndpoints;
-using FluentValidation;
using Hutopy.Application.AzureBlobStorage.Constants;
using Hutopy.Application.Common.Interfaces;
using Hutopy.Web.Common;
@@ -8,6 +6,7 @@ using Hutopy.Web.Features.Contents.Data;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public record PostContentRequest(
Guid Id,
Guid CreatorId,
@@ -15,6 +14,7 @@ public record PostContentRequest(
string Description,
IFormFileCollection Files);
+[PublicAPI]
public sealed class PostContentRequestValidator : Validator
{
public PostContentRequestValidator()
diff --git a/src/Web/Features/Contents/Handlers/CreateCreator.cs b/src/Web/Features/Contents/Handlers/CreateCreator.cs
index f68e96b..a70bd27 100644
--- a/src/Web/Features/Contents/Handlers/CreateCreator.cs
+++ b/src/Web/Features/Contents/Handlers/CreateCreator.cs
@@ -1,14 +1,14 @@
-using FastEndpoints;
-using FluentValidation;
-using Hutopy.Web.Common;
+using Hutopy.Web.Common;
using Hutopy.Web.Features.Contents.Data;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public record CreateCreatorRequest(
Guid CreatorId,
string Name);
+[UsedImplicitly]
public sealed class CreateCreatorRequestValidator : Validator
{
public CreateCreatorRequestValidator()
@@ -23,6 +23,7 @@ public sealed class CreateCreatorRequestValidator : Validator
diff --git a/src/Web/Features/Contents/Handlers/GetContent.cs b/src/Web/Features/Contents/Handlers/GetContent.cs
index 7e79021..398d9c0 100644
--- a/src/Web/Features/Contents/Handlers/GetContent.cs
+++ b/src/Web/Features/Contents/Handlers/GetContent.cs
@@ -1,14 +1,14 @@
-using FastEndpoints;
-using Hutopy.Web.Features.Contents.Data;
-using Microsoft.EntityFrameworkCore;
+using Hutopy.Web.Features.Contents.Data;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public sealed class GetContentRequest
{
public Guid ContentId { get; set; }
}
+[PublicAPI]
public class GetContent(
ContentDbContext context)
: Endpoint
diff --git a/src/Web/Features/Contents/Handlers/GetContentsByCreator.cs b/src/Web/Features/Contents/Handlers/GetContentsByCreator.cs
index 8e2f5fd..910eaa3 100644
--- a/src/Web/Features/Contents/Handlers/GetContentsByCreator.cs
+++ b/src/Web/Features/Contents/Handlers/GetContentsByCreator.cs
@@ -1,11 +1,9 @@
-using System.Linq.Expressions;
-using FastEndpoints;
-using Hutopy.Web.Features.Contents.Data;
+using Hutopy.Web.Features.Contents.Data;
using Hutopy.Web.Features.Contents.Handlers.Models;
-using Microsoft.EntityFrameworkCore;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public sealed class GetContentsByCreatorRequest
{
public Guid UserId { get; set; }
@@ -13,6 +11,7 @@ public sealed class GetContentsByCreatorRequest
[BindFrom("last_id")] public Guid? LastId { get; set; }
}
+[PublicAPI]
public class GetContentsByCreatorHandler(
ContentDbContext context)
: Endpoint>
diff --git a/src/Web/Features/Contents/Handlers/GetCreatorByAlias.cs b/src/Web/Features/Contents/Handlers/GetCreatorByAlias.cs
index 0287b4e..87ca6ec 100644
--- a/src/Web/Features/Contents/Handlers/GetCreatorByAlias.cs
+++ b/src/Web/Features/Contents/Handlers/GetCreatorByAlias.cs
@@ -1,16 +1,15 @@
-using FastEndpoints;
-using FluentValidation;
-using Hutopy.Web.Features.Contents.Data;
+using Hutopy.Web.Features.Contents.Data;
using Hutopy.Web.Features.Contents.Handlers.Models;
-using Microsoft.EntityFrameworkCore;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public sealed class GetCreatorByAliasRequest
{
public required string Name { get; set; }
}
+[UsedImplicitly]
public sealed class GetCreatorByAliasRequestValidator
: Validator
{
@@ -22,6 +21,7 @@ public sealed class GetCreatorByAliasRequestValidator
}
}
+[PublicAPI]
public class GetCreatorByAliasHandler(
ContentDbContext context)
: Endpoint
@@ -54,18 +54,16 @@ public class GetCreatorByAliasHandler(
s => s.CreatorId == creator.Id,
cancellationToken: ct);
- var model = new CreatorModel
- {
- Id = creator.Id,
- CreatedBy = creator.CreatedBy,
- CreatedAt = creator.CreatedAt,
- Name = creator.Name,
- About = creator.About,
- Socials = creator.Socials,
- Colors = creator.Colors,
- Images = creator.Images,
- SubscriberCount = subscriberCount,
- };
+ var model = new CreatorModel(
+ creator.Id,
+ creator.CreatedBy,
+ creator.CreatedAt,
+ creator.Name,
+ creator.About,
+ creator.Socials,
+ creator.Colors,
+ creator.Images,
+ subscriberCount);
await SendAsync(model, cancellation: ct);
}
diff --git a/src/Web/Features/Contents/Handlers/GetCreatorById.cs b/src/Web/Features/Contents/Handlers/GetCreatorById.cs
index 0022515..ae167e0 100644
--- a/src/Web/Features/Contents/Handlers/GetCreatorById.cs
+++ b/src/Web/Features/Contents/Handlers/GetCreatorById.cs
@@ -1,14 +1,14 @@
-using FastEndpoints;
-using FluentValidation;
-using Hutopy.Web.Features.Contents.Data;
+using Hutopy.Web.Features.Contents.Data;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public sealed class GetCreatorByIdRequest
{
public required Guid CreatorId { get; set; }
}
+[UsedImplicitly]
public sealed class GetCreatorByIdRequestValidator
: Validator
{
@@ -20,6 +20,7 @@ public sealed class GetCreatorByIdRequestValidator
}
}
+[PublicAPI]
public class GetCreatorByIdHandler(
ContentDbContext context)
: Endpoint
diff --git a/src/Web/Features/Contents/Handlers/GetSubscriptions.cs b/src/Web/Features/Contents/Handlers/GetSubscriptions.cs
index 035cb87..545a469 100644
--- a/src/Web/Features/Contents/Handlers/GetSubscriptions.cs
+++ b/src/Web/Features/Contents/Handlers/GetSubscriptions.cs
@@ -1,11 +1,10 @@
-using FastEndpoints;
-using Hutopy.Web.Common;
+using Hutopy.Web.Common;
using Hutopy.Web.Features.Contents.Data;
using Hutopy.Web.Features.Contents.Handlers.Models;
-using Microsoft.EntityFrameworkCore;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public class GetSubscriptionsHandler(
ContentDbContext context)
: EndpointWithoutRequest>
@@ -25,7 +24,7 @@ public class GetSubscriptionsHandler(
.Subscriptions
.Where(s => s.CreatedBy == userId)
.Select(s => new SubscriptionModel(
- s.CreatorId,
+ s.CreatorId,
s.Creator!.Name,
s.Creator.Images.Logo))
.ToListAsync(cancellationToken: ct);
diff --git a/src/Web/Features/Contents/Handlers/Models/ContentModel.cs b/src/Web/Features/Contents/Handlers/Models/ContentModel.cs
index 0d1439e..56eccf5 100644
--- a/src/Web/Features/Contents/Handlers/Models/ContentModel.cs
+++ b/src/Web/Features/Contents/Handlers/Models/ContentModel.cs
@@ -2,6 +2,7 @@
namespace Hutopy.Web.Features.Contents.Handlers.Models;
+[PublicAPI]
public record struct ContentModel(
Guid Id,
Guid CreatedBy,
diff --git a/src/Web/Features/Contents/Handlers/Models/CreatorModel.cs b/src/Web/Features/Contents/Handlers/Models/CreatorModel.cs
index b53bcea..5502231 100644
--- a/src/Web/Features/Contents/Handlers/Models/CreatorModel.cs
+++ b/src/Web/Features/Contents/Handlers/Models/CreatorModel.cs
@@ -2,15 +2,14 @@
namespace Hutopy.Web.Features.Contents.Handlers.Models;
-public class CreatorModel
-{
- public Guid Id { get; set; }
- public Guid CreatedBy { get; set; }
- public DateTimeOffset CreatedAt { get; set; }
- public string Name { get; set; }
- public About About { get; set; }
- public Socials Socials { get; set; }
- public Colors Colors { get; set; }
- public Images Images { get; set; }
- public int SubscriberCount { get; set; }
-}
+[PublicAPI]
+public record struct CreatorModel(
+ Guid Id,
+ Guid CreatedBy,
+ DateTimeOffset CreatedAt,
+ string Name,
+ About About,
+ Socials Socials,
+ Colors Colors,
+ Images Images,
+ int SubscriberCount);
diff --git a/src/Web/Features/Contents/Handlers/Models/SubscriptionModel.cs b/src/Web/Features/Contents/Handlers/Models/SubscriptionModel.cs
index 7c3df21..7c748aa 100644
--- a/src/Web/Features/Contents/Handlers/Models/SubscriptionModel.cs
+++ b/src/Web/Features/Contents/Handlers/Models/SubscriptionModel.cs
@@ -1,5 +1,6 @@
namespace Hutopy.Web.Features.Contents.Handlers.Models;
+[PublicAPI]
public record SubscriptionModel(
Guid CreatorId,
string CreatorName,
diff --git a/src/Web/Features/Contents/Handlers/SubscribeToCreator.cs b/src/Web/Features/Contents/Handlers/SubscribeToCreator.cs
index 9c37d3b..50614c7 100644
--- a/src/Web/Features/Contents/Handlers/SubscribeToCreator.cs
+++ b/src/Web/Features/Contents/Handlers/SubscribeToCreator.cs
@@ -1,16 +1,16 @@
-using FastEndpoints;
-using Hutopy.Web.Common;
+using Hutopy.Web.Common;
using Hutopy.Web.Features.Contents.Data;
using Hutopy.Web.Features.Contents.Handlers.Models;
-using Microsoft.EntityFrameworkCore;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public sealed class SubscribeToCreatorRequest
{
public Guid CreatorId { get; set; }
}
+[PublicAPI]
public sealed class SubscribeToCreatorHandler(
ContentDbContext context)
: Endpoint
diff --git a/src/Web/Features/Contents/Handlers/UnsubscribeFromCreator.cs b/src/Web/Features/Contents/Handlers/UnsubscribeFromCreator.cs
index 87c4855..3b181fe 100644
--- a/src/Web/Features/Contents/Handlers/UnsubscribeFromCreator.cs
+++ b/src/Web/Features/Contents/Handlers/UnsubscribeFromCreator.cs
@@ -1,14 +1,15 @@
-using FastEndpoints;
-using Hutopy.Web.Common;
+using Hutopy.Web.Common;
using Hutopy.Web.Features.Contents.Data;
namespace Hutopy.Web.Features.Contents.Handlers;
+[PublicAPI]
public sealed class UnsubscribeFromCreatorRequest
{
public Guid CreatorId { get; set; }
}
+[PublicAPI]
public class UnsubscribeFromCreatorHandler(
ContentDbContext context)
: Endpoint
diff --git a/src/Web/Features/Messages/Data/MessagingDbContext.cs b/src/Web/Features/Messages/Data/MessagingDbContext.cs
index 2d59e52..a7b2028 100644
--- a/src/Web/Features/Messages/Data/MessagingDbContext.cs
+++ b/src/Web/Features/Messages/Data/MessagingDbContext.cs
@@ -1,5 +1,4 @@
using Hutopy.Web.Features.Messages.Handlers.Models;
-using Microsoft.EntityFrameworkCore;
namespace Hutopy.Web.Features.Messages.Data;
diff --git a/src/Web/Features/Messages/DependencyInjection.cs b/src/Web/Features/Messages/DependencyInjection.cs
index 0693a3e..6f4bf3c 100644
--- a/src/Web/Features/Messages/DependencyInjection.cs
+++ b/src/Web/Features/Messages/DependencyInjection.cs
@@ -1,5 +1,4 @@
using Hutopy.Web.Features.Messages.Data;
-using Microsoft.EntityFrameworkCore;
namespace Hutopy.Web.Features.Messages;
diff --git a/src/Web/Features/Messages/Handlers/AddMessage.cs b/src/Web/Features/Messages/Handlers/AddMessage.cs
index 81c12b8..84131a4 100644
--- a/src/Web/Features/Messages/Handlers/AddMessage.cs
+++ b/src/Web/Features/Messages/Handlers/AddMessage.cs
@@ -1,6 +1,4 @@
-using FastEndpoints;
-using FluentValidation;
-using Hutopy.Web.Common;
+using Hutopy.Web.Common;
using Hutopy.Web.Features.Messages.Data;
namespace Hutopy.Web.Features.Messages.Handlers;
diff --git a/src/Web/Features/Messages/Handlers/AddReply.cs b/src/Web/Features/Messages/Handlers/AddReply.cs
index 8b2ea91..b1c7aa8 100644
--- a/src/Web/Features/Messages/Handlers/AddReply.cs
+++ b/src/Web/Features/Messages/Handlers/AddReply.cs
@@ -1,6 +1,4 @@
-using FastEndpoints;
-using FluentValidation;
-using Hutopy.Web.Common;
+using Hutopy.Web.Common;
using Hutopy.Web.Features.Messages.Data;
namespace Hutopy.Web.Features.Messages.Handlers;
diff --git a/src/Web/Features/Messages/Handlers/GetMessages.cs b/src/Web/Features/Messages/Handlers/GetMessages.cs
index de98a5e..1fb7236 100644
--- a/src/Web/Features/Messages/Handlers/GetMessages.cs
+++ b/src/Web/Features/Messages/Handlers/GetMessages.cs
@@ -1,5 +1,4 @@
-using FastEndpoints;
-using Hutopy.Web.Features.Messages.Data;
+using Hutopy.Web.Features.Messages.Data;
using Hutopy.Web.Features.Messages.Handlers.Models;
namespace Hutopy.Web.Features.Messages.Handlers;
diff --git a/src/Web/Features/Messages/Handlers/GetMessagesByUser.cs b/src/Web/Features/Messages/Handlers/GetMessagesByUser.cs
index db611a0..bdd5105 100644
--- a/src/Web/Features/Messages/Handlers/GetMessagesByUser.cs
+++ b/src/Web/Features/Messages/Handlers/GetMessagesByUser.cs
@@ -1,7 +1,5 @@
-using FastEndpoints;
-using Hutopy.Web.Features.Messages.Data;
+using Hutopy.Web.Features.Messages.Data;
using Hutopy.Web.Features.Messages.Handlers.Models;
-using Microsoft.EntityFrameworkCore;
namespace Hutopy.Web.Features.Messages.Handlers;
diff --git a/src/Web/Features/Messages/Handlers/GetReplies.cs b/src/Web/Features/Messages/Handlers/GetReplies.cs
index 9c39fef..40b5f5f 100644
--- a/src/Web/Features/Messages/Handlers/GetReplies.cs
+++ b/src/Web/Features/Messages/Handlers/GetReplies.cs
@@ -1,5 +1,4 @@
-using FastEndpoints;
-using Hutopy.Web.Features.Messages.Data;
+using Hutopy.Web.Features.Messages.Data;
using Hutopy.Web.Features.Messages.Handlers.Models;
namespace Hutopy.Web.Features.Messages.Handlers;
diff --git a/src/Web/GlobalUsings.cs b/src/Web/GlobalUsings.cs
index a69805b..4f99808 100644
--- a/src/Web/GlobalUsings.cs
+++ b/src/Web/GlobalUsings.cs
@@ -1,3 +1,6 @@
global using Ardalis.GuardClauses;
-global using Hutopy.Web.Infrastructure;
+global using FastEndpoints;
+global using FluentValidation;
+global using JetBrains.Annotations;
global using MediatR;
+global using Microsoft.EntityFrameworkCore;
diff --git a/src/Web/Infrastructure/CustomExceptionHandler.cs b/src/Web/Infrastructure/CustomExceptionHandler.cs
index a94d865..6f321cb 100644
--- a/src/Web/Infrastructure/CustomExceptionHandler.cs
+++ b/src/Web/Infrastructure/CustomExceptionHandler.cs
@@ -1,6 +1,8 @@
using Hutopy.Application.Common.Exceptions;
using Microsoft.AspNetCore.Diagnostics;
using Microsoft.AspNetCore.Mvc;
+using ProblemDetails = Microsoft.AspNetCore.Mvc.ProblemDetails;
+using ValidationException = Hutopy.Application.Common.Exceptions.ValidationException;
namespace Hutopy.Web.Infrastructure;
diff --git a/src/Web/Pages/Shared/_LoginPartial.cshtml b/src/Web/Pages/Shared/_LoginPartial.cshtml
index b8197de..252b86b 100644
--- a/src/Web/Pages/Shared/_LoginPartial.cshtml
+++ b/src/Web/Pages/Shared/_LoginPartial.cshtml
@@ -1,5 +1,6 @@
@using Hutopy.Infrastructure.Identity
@using Microsoft.AspNetCore.Identity
+@using Microsoft.AspNetCore.Mvc.TagHelpers
@inject SignInManager SignInManager
@{
diff --git a/src/Web/Program.cs b/src/Web/Program.cs
index f44349a..575d391 100644
--- a/src/Web/Program.cs
+++ b/src/Web/Program.cs
@@ -1,5 +1,4 @@
using Azure.Identity;
-using FastEndpoints;
using Hutopy.Application;
using Hutopy.Infrastructure;
using Hutopy.Infrastructure.Data;
@@ -9,8 +8,8 @@ using Hutopy.Web.Features.Contents;
using Hutopy.Web.Features.Contents.Data;
using Hutopy.Web.Features.Messages;
using Hutopy.Web.Features.Messages.Data;
+using Hutopy.Web.Infrastructure;
using Microsoft.AspNetCore.HttpOverrides;
-using Microsoft.EntityFrameworkCore;
using NSwag;
using NSwag.Generation.AspNetCore.Processors;
using NSwag.Generation.Processors.Security;
diff --git a/src/Web/Web.csproj b/src/Web/Web.csproj
index 605e476..97eb60a 100644
--- a/src/Web/Web.csproj
+++ b/src/Web/Web.csproj
@@ -16,6 +16,7 @@
+