Stable server

was added removing messages
many fixes bugs and moving to result pattern from throwing exceptions
This commit is contained in:
Artemy
2026-08-22 19:28:42 +07:00
parent 27fdcf85da
commit 3ec61fa2c0
36 changed files with 452 additions and 278 deletions
+1 -1
View File
@@ -11,6 +11,6 @@ public record Error(string Code, string Message, ErrorType Type, Dictionary<stri
public static Error Unauthorized(string code, string message) => new(code, message, ErrorType.Unauthorized);
public static Error Forbidden(string code, string message) => new(code, message, ErrorType.Forbidden);
public static Error Failure(string code, string message) => new(code, message, ErrorType.Failure);
public static Error ServerError(string code, string message) => new(code, message, ErrorType.ServerError);
public override string ToString() => $"{Code}: {Message}";
}
+2 -1
View File
@@ -7,5 +7,6 @@ public enum ErrorType
NotFound = 2, // (404 Not Found)
Conflict = 3, // (409 Conflict)
Unauthorized = 4, // (401 Unauthorized)
Forbidden = 5 // (403 Forbidden)
Forbidden = 5, // (403 Forbidden)
ServerError = 6 // (500 Server Error)
}
@@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace Govor.Domain.Migrations
{
[DbContext(typeof(GovorDbContext))]
[Migration("20260716110338_InitialCreate")]
[Migration("20260727130055_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
@@ -20,7 +20,7 @@ namespace Govor.Domain.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("ProductVersion", "10.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@@ -202,6 +202,9 @@ namespace Govor.Domain.Migrations
b.Property<int>("MaxParticipants")
.HasColumnType("integer");
b.Property<int>("Participants")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Invitations");
@@ -38,7 +38,8 @@ namespace Govor.Domain.Migrations
Description = table.Column<string>(type: "text", nullable: false),
DateCreated = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
EndDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
MaxParticipants = table.Column<int>(type: "integer", nullable: false)
MaxParticipants = table.Column<int>(type: "integer", nullable: false),
Participants = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
@@ -17,7 +17,7 @@ namespace Govor.Domain.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("ProductVersion", "10.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@@ -199,6 +199,9 @@ namespace Govor.Domain.Migrations
b.Property<int>("MaxParticipants")
.HasColumnType("integer");
b.Property<int>("Participants")
.HasColumnType("integer");
b.HasKey("Id");
b.ToTable("Invitations");
+1
View File
@@ -12,6 +12,7 @@ public class Invitation
public DateTime DateCreated { get; set; }
public DateTime EndDate { get; set; }
public int MaxParticipants { get; set; }
public int Participants { get; set; } = 0;
public List<User> Users { get; set; } = new List<User>();
public override bool Equals(object? obj)