Stable run on Notification creation
This commit is contained in:
@@ -4,11 +4,11 @@ public class NotificationConfiguration : IEntityTypeConfiguration<Notification>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Notification> builder)
|
||||
{
|
||||
builder.ToTable(nameof(Notification));
|
||||
builder.ToTable("Notification");
|
||||
|
||||
builder.HasKey(f => f.Id);
|
||||
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd().HasDefaultValueSql("now()");
|
||||
builder.Property(f => f.UpdatedAt).IsRequired(false);
|
||||
builder.Property(f => f.UpdatedAt).IsRequired(false).HasDefaultValueSql(null);
|
||||
builder.Property(f => f.Direction).IsRequired().HasConversion<int>();
|
||||
builder.Property(f => f.Platform).IsRequired().HasConversion<int>();
|
||||
builder.Property(f => f.Priority).IsRequired().HasConversion<int>();
|
||||
|
||||
@@ -4,9 +4,9 @@ public class Notification
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTime CreatedAt { get; set; }
|
||||
|
||||
public DateTimeOffset? UpdatedAt { get; set; }
|
||||
public DateTime? UpdatedAt { get; set; }
|
||||
|
||||
public NotificationDirection Direction { get; set; }
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class NotificationService(IDbContextFactory<ShopDbContext> contextFactory
|
||||
Processed = false
|
||||
});
|
||||
|
||||
return newNotification is not null
|
||||
return await context.SaveChangesAsync(cancellationToken) > 0
|
||||
? Result.Ok(newNotification.Entity.Id)
|
||||
: Result.Fail(new Error("Failed to create notification"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user