forked from ddrilling/AsbCloudServer
refactor IFileService. Rename DeletedAsync method to DeleteAsync
This commit is contained in:
parent
1a36609d19
commit
4cec602678
@ -23,7 +23,7 @@ namespace AsbCloudApp.Services
|
|||||||
Task<int> MarkAsDeletedAsync(int idFile,
|
Task<int> MarkAsDeletedAsync(int idFile,
|
||||||
CancellationToken token = default);
|
CancellationToken token = default);
|
||||||
Task<IEnumerable<FileInfoDto>> GetInfosByCategoryAsync(int idWell, int idCategory, CancellationToken token = default);
|
Task<IEnumerable<FileInfoDto>> GetInfosByCategoryAsync(int idWell, int idCategory, CancellationToken token = default);
|
||||||
Task<int> DeletedAsync(int id, CancellationToken token);
|
Task<int> DeleteAsync(int id, CancellationToken token);
|
||||||
string GetUrl(FileInfoDto fileInfo);
|
string GetUrl(FileInfoDto fileInfo);
|
||||||
string GetUrl(int idFile);
|
string GetUrl(int idFile);
|
||||||
string GetUrl(int idWell, int idCategory, int idFile, string dotExtention);
|
string GetUrl(int idWell, int idCategory, int idFile, string dotExtention);
|
||||||
|
@ -43,13 +43,13 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
matchFilesIterator.MoveNext();
|
matchFilesIterator.MoveNext();
|
||||||
var matchFile = matchFilesIterator.Current;
|
var matchFile = matchFilesIterator.Current;
|
||||||
while (matchFilesIterator.MoveNext())
|
while (matchFilesIterator.MoveNext())
|
||||||
await fileService.DeletedAsync(matchFilesIterator.Current.Id, token)
|
await fileService.DeleteAsync(matchFilesIterator.Current.Id, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
if (filesInfos.All(f => f.UploadDate <= matchFile.UploadDate))
|
if (filesInfos.All(f => f.UploadDate <= matchFile.UploadDate))
|
||||||
return matchFile;
|
return matchFile;
|
||||||
else
|
else
|
||||||
await fileService.DeletedAsync(matchFile.Id, token)
|
await fileService.DeleteAsync(matchFile.Id, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,13 +41,13 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
matchFilesIterator.MoveNext();
|
matchFilesIterator.MoveNext();
|
||||||
var matchFile = matchFilesIterator.Current;
|
var matchFile = matchFilesIterator.Current;
|
||||||
while (matchFilesIterator.MoveNext())
|
while (matchFilesIterator.MoveNext())
|
||||||
await fileService.DeletedAsync(matchFilesIterator.Current.Id, token)
|
await fileService.DeleteAsync(matchFilesIterator.Current.Id, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
if (filesInfos.All(f => f.UploadDate <= matchFile.UploadDate))
|
if (filesInfos.All(f => f.UploadDate <= matchFile.UploadDate))
|
||||||
return matchFile;
|
return matchFile;
|
||||||
else
|
else
|
||||||
await fileService.DeletedAsync(matchFile.Id, token)
|
await fileService.DeleteAsync(matchFile.Id, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return await db.SaveChangesAsync(token).ConfigureAwait(false);
|
return await db.SaveChangesAsync(token).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> DeletedAsync(int idFile, CancellationToken token)
|
public async Task<int> DeleteAsync(int idFile, CancellationToken token)
|
||||||
{
|
{
|
||||||
var fileInfo = await db.Files
|
var fileInfo = await db.Files
|
||||||
.FirstOrDefaultAsync(f => f.Id == idFile, token)
|
.FirstOrDefaultAsync(f => f.Id == idFile, token)
|
||||||
|
Loading…
Reference in New Issue
Block a user