44 lines
1.2 KiB
C#
44 lines
1.2 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; }
|
|
public StorageLocation? StorageLocation { get; private set; }
|
|
public CheckSum CheckSum { get; private set; }
|
|
|
|
private UploadFile() { }
|
|
public UploadFile(Guid ownerId, string fileName, string contentType)
|
|
{
|
|
OwnerId = ownerId;
|
|
FileName = fileName;
|
|
ContentType = contentType;
|
|
State = FileState.Created;
|
|
}
|
|
|
|
public void StartUpload()
|
|
{
|
|
State = FileState.Uploading;
|
|
}
|
|
|
|
public void CompleteUpload(StorageLocation storage, CheckSum checkSum)
|
|
{
|
|
StorageLocation = storage;
|
|
CheckSum = checkSum;
|
|
State = FileState.Uploaded;
|
|
}
|
|
|
|
public void Fail()
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
}
|