Реализация 5 лабораторной работы

This commit is contained in:
2026-11-27 20:06:14 +03:00
parent 276dbdad8a
commit 4fe4ab3432
116 changed files with 11883 additions and 25 deletions
+9
View File
@@ -0,0 +1,9 @@
namespace Messenger.Api.Models;
public sealed record Attachment(
Guid Id, Guid ChatId, Guid OwnerId, string Filename, string ContentType,
long SizeBytes, string Sha256, string Status, AttachmentVariant[] Variants,
string? ErrorCode, DateTimeOffset CreatedAt, DateTimeOffset UpdatedAt);
public sealed record AttachmentVariant(string Name, string ContentType, long SizeBytes,
int Width, int Height, string Sha256);
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Messenger.Api.Models
{
public sealed class Chat
{
public Guid Id { get; init; }
public string Title { get; init; } = String.Empty;
public List<Guid> MemberIds { get; init; } = new List<Guid>();
public DateTimeOffset CreatedAt { get; init; }
}
}
@@ -0,0 +1,6 @@
namespace Messenger.Api.Models
{
public sealed record CreateChatRequest(
[property: System.Text.Json.Serialization.JsonRequired] string Title,
[property: System.Text.Json.Serialization.JsonRequired] List<Guid> MemberIds);
}
@@ -0,0 +1,6 @@
namespace Messenger.Api.Models;
public sealed record CreateMessageRequest([property: System.Text.Json.Serialization.JsonRequired] string Text)
{
public Guid[] AttachmentIds { get; init; } = [];
}
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Messenger.Api.Models
{
public sealed record CreateUserRequest(
[property: System.Text.Json.Serialization.JsonRequired] string Username,
[property: System.Text.Json.Serialization.JsonRequired] string DisplayName,
[property: System.Text.Json.Serialization.JsonRequired] string Password);
}
+17
View File
@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Http.HttpResults;
using System;
using System.Collections.Generic;
using System.Text;
namespace Messenger.Api.Models
{
public sealed class Message
{
public Guid Id { get; init; }
public Guid ChatId { get; init; }
public Guid SenderId { get; init; }
public string Text { get; init; } = String.Empty;
public DateTimeOffset CreatedAt { get; init; }
public Guid[] AttachmentIds { get; init; } = [];
}
}
@@ -0,0 +1,7 @@
namespace Messenger.Api.Models;
public sealed record SessionResponse(
string Token,
string TokenType,
DateTimeOffset ExpiresAt,
User User);
+14
View File
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Messenger.Api.Models
{
public sealed class User
{
public Guid Id { get; init; }
public string Username { get; init; } = string.Empty;
public string DisplayName { get; init; } = string.Empty;
public DateTimeOffset CreatedAt { get; init; }
}
}