44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
using FileService.Domain.ValueObjects;
|
|
using IM.DomainCommons;
|
|
|
|
namespace FileService.Domain.Entities
|
|
{
|
|
public class UploadFile:AggregateRootEntity
|
|
{
|
|
public Guid OwnerId { get; private set; }
|
|
public FileName FileName { get; private set; }
|
|
public long FileSize { get;private set; }
|
|
public ContentType ContentType { get;private set; }
|
|
public FileState State { get; private set; } = FileState.Uploaded;
|
|
public StorageLocation StorageLocation { get; private set; } = new StorageLocation();
|
|
public CheckSum CheckSum { get; private set; }
|
|
public Guid? SourceTaskId { get; private set; }
|
|
public string? ChatType { get; private set; }
|
|
public Guid? TargetId { get; private set; }
|
|
public bool IsPublic { get; private set; }
|
|
|
|
private UploadFile() { }
|
|
|
|
public UploadFile(Guid ownerId, FileName fileName, long fileSize, ContentType contentType, StorageLocation? storageLocation, CheckSum checkSum, Guid? sourceTaskId = null, string? chatType = null, Guid? targetId = null, bool isPublic = false)
|
|
{
|
|
OwnerId = ownerId;
|
|
FileName = fileName;
|
|
FileSize = fileSize;
|
|
ContentType = contentType;
|
|
StorageLocation = storageLocation ?? new StorageLocation();
|
|
CheckSum = checkSum;
|
|
SourceTaskId = sourceTaskId;
|
|
ChatType = chatType?.ToUpperInvariant();
|
|
TargetId = targetId;
|
|
IsPublic = isPublic;
|
|
State = FileState.Uploaded;
|
|
}
|
|
|
|
public void Fail()
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
}
|