chore(codebase): full cleanup pass
This commit is contained in:
@@ -17,5 +17,5 @@ public class Tip : Entity
|
||||
public enum TipStatus : short
|
||||
{
|
||||
Pending = 0,
|
||||
Paid = 1,
|
||||
Paid = 1
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user