chore(codebase): full cleanup pass

This commit is contained in:
2025-06-21 01:58:48 -04:00
parent 8323477cd0
commit 81b5db34ef
92 changed files with 529 additions and 452 deletions

View File

@@ -17,5 +17,5 @@ public class Tip : Entity
public enum TipStatus : short
{
Pending = 0,
Paid = 1,
Paid = 1
}

View File

@@ -7,8 +7,8 @@ public sealed class TippingDbContext(
public const string SchemaName = "Tipping";
public DbSet<Tip> Tips => Set<Tip>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasDefaultSchema(SchemaName);

View File

@@ -13,7 +13,7 @@ public static class DependencyInjection
{
builder.Services.AddDbContext<TippingDbContext>(configureAction);
builder.Services.AddTransient<ITipPaymentNotifier, TipPaymentNotifier>();
return builder;
}
@@ -21,10 +21,10 @@ public static class DependencyInjection
this IApplicationBuilder app,
CancellationToken cancellationToken = default)
{
var scopeFactory = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>();
using var scope = scopeFactory.CreateScope();
await using var context = scope.ServiceProvider.GetRequiredService<MessagingDbContext>();
await context.Database.MigrateAsync(cancellationToken: cancellationToken);
IServiceScopeFactory scopeFactory = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>();
using IServiceScope scope = scopeFactory.CreateScope();
await using MessagingDbContext context = scope.ServiceProvider.GetRequiredService<MessagingDbContext>();
await context.Database.MigrateAsync(cancellationToken);
return app;
}

View File

@@ -24,16 +24,16 @@ public class GetReceivedTipsHandler(
public override async Task HandleAsync(
CancellationToken ct)
{
var tips = await dbContext
List<Tip> tips = await dbContext
.Tips
.Where(tip => tip.CreatorId == User.GetUserId())
.ToListAsync(ct);
var result = await Task.WhenAll(
TipReceivedModel[] result = await Task.WhenAll(
tips.Select(async tip =>
{
var tipper = await userLookup.GetUserAsync(tip.CreatorId, ct);
UserReference? tipper = await userLookup.GetUserAsync(tip.CreatorId, ct);
return new TipReceivedModel(
tip.Id,
tip.CreatedAt,