64 lines
2.1 KiB
C#
64 lines
2.1 KiB
C#
namespace GozareshgirProgramManager.Application.Modules.TaskChat.DTOs;
|
|
|
|
public class SendMessageDto
|
|
{
|
|
public Guid TaskId { get; set; }
|
|
public string MessageType { get; set; } = string.Empty; // "Text", "File", "Image", "Voice", "Video"
|
|
public string? TextContent { get; set; }
|
|
public Guid? FileId { get; set; }
|
|
public Guid? ReplyToMessageId { get; set; }
|
|
}
|
|
|
|
public class MessageDto
|
|
{
|
|
public Guid Id { get; set; }
|
|
public Guid TaskId { get; set; }
|
|
public long SenderUserId { get; set; }
|
|
public string SenderName { get; set; } = string.Empty;
|
|
public string MessageType { get; set; } = string.Empty;
|
|
public string? TextContent { get; set; }
|
|
public MessageFileDto? File { get; set; }
|
|
public Guid? ReplyToMessageId { get; set; }
|
|
public MessageDto? ReplyToMessage { get; set; }
|
|
public bool IsEdited { get; set; }
|
|
public DateTime? EditedDate { get; set; }
|
|
public bool IsPinned { get; set; }
|
|
public DateTime? PinnedDate { get; set; }
|
|
public long? PinnedByUserId { get; set; }
|
|
public DateTime CreationDate { get; set; }
|
|
public bool IsMine { get; set; }
|
|
}
|
|
|
|
public class MessageFileDto
|
|
{
|
|
public Guid Id { get; set; }
|
|
public string FileName { get; set; } = string.Empty;
|
|
public string FileUrl { get; set; } = string.Empty;
|
|
public long FileSizeBytes { get; set; }
|
|
public string FileType { get; set; } = string.Empty;
|
|
public string? ThumbnailUrl { get; set; }
|
|
public int? ImageWidth { get; set; }
|
|
public int? ImageHeight { get; set; }
|
|
public int? DurationSeconds { get; set; }
|
|
|
|
public string FileSizeFormatted
|
|
{
|
|
get
|
|
{
|
|
const long kb = 1024;
|
|
const long mb = kb * 1024;
|
|
const long gb = mb * 1024;
|
|
|
|
if (FileSizeBytes >= gb)
|
|
return $"{FileSizeBytes / (double)gb:F2} GB";
|
|
if (FileSizeBytes >= mb)
|
|
return $"{FileSizeBytes / (double)mb:F2} MB";
|
|
if (FileSizeBytes >= kb)
|
|
return $"{FileSizeBytes / (double)kb:F2} KB";
|
|
|
|
return $"{FileSizeBytes} Bytes";
|
|
}
|
|
}
|
|
}
|
|
|