修改
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
f781027388
commit
71e797cf7d
|
@ -262,24 +262,29 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task<IResponseOutput> MovieFileOrFolder(MovieFileOrFolderInDto inDto)
|
public async Task<IResponseOutput> MovieFileOrFolder(MovieFileOrFolderInDto inDto)
|
||||||
{
|
{
|
||||||
foreach (var id in inDto.Ids)
|
|
||||||
{
|
|
||||||
var file = await _auditDocumentRepository.Where(x => x.Id == id).FirstNotNullAsync();
|
|
||||||
if (file.AuditDocumentTypeEnum == AuditDocumentType.Folder)
|
|
||||||
{
|
|
||||||
var data = await _auditDocumentRepository.Select(x => new DeleteAudit()
|
var data = await _auditDocumentRepository.Select(x => new DeleteAudit()
|
||||||
{
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
ParentId = x.ParentId,
|
ParentId = x.ParentId,
|
||||||
|
AuditDocumentTypeEnum = x.AuditDocumentTypeEnum,
|
||||||
MainFileId = x.MainFileId
|
MainFileId = x.MainFileId
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|
||||||
|
foreach (var id in inDto.Ids)
|
||||||
|
{
|
||||||
|
var file = data.Where(x => x.Id == id).FirstOrDefault();
|
||||||
|
if (file.AuditDocumentTypeEnum == AuditDocumentType.Folder)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
if (finChild(new List<Guid> { id }, inDto.ParentId, data))
|
if (finChild(new List<Guid> { id }, inDto.ParentId, data))
|
||||||
{
|
{
|
||||||
throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotMove"]);
|
throw new BusinessValidationFailedException(_localizer["AuditDocument_CanNotMove"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool finChild(List<Guid> ids, Guid ChildId, List<DeleteAudit> data)
|
bool finChild(List<Guid> ids, Guid ChildId, List<DeleteAudit> data)
|
||||||
{
|
{
|
||||||
|
@ -301,6 +306,12 @@ public class AuditDocumentService(IRepository<AuditDocument> _auditDocumentRepos
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var id in inDto.Ids)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await _auditDocumentRepository.UpdatePartialFromQueryAsync(id, x => new AuditDocument()
|
await _auditDocumentRepository.UpdatePartialFromQueryAsync(id, x => new AuditDocument()
|
||||||
{
|
{
|
||||||
ParentId = inDto.ParentId
|
ParentId = inDto.ParentId
|
||||||
|
|
|
@ -13,6 +13,7 @@ public class DeleteAudit
|
||||||
{
|
{
|
||||||
public Guid Id { get; set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public AuditDocumentType AuditDocumentTypeEnum { get; set; }
|
||||||
public Guid? ParentId { get; set; }
|
public Guid? ParentId { get; set; }
|
||||||
|
|
||||||
public Guid? MainFileId { get; set; }
|
public Guid? MainFileId { get; set; }
|
||||||
|
|
Loading…
Reference in New Issue