reverted doculinks grouping by linktype

This commit is contained in:
uppuv 2023-10-24 12:15:13 -04:00
parent 7b7e5c0ce8
commit 499ac9248b
4 changed files with 16 additions and 16 deletions

View File

@ -16,7 +16,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
{
var mockDocumentService = new Mock<IDoculinkProvider>();
var mockUploadService = new Mock<IUploadService>();
var mockResponse = await MockData.getNoContentResponses();
var mockResponse = await MockData.getNoContentResponse();
mockDocumentService.Setup(service => service.GetdocumentsByLinkAsync("forms","en",null)).ReturnsAsync(mockResponse);
var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
@ -30,7 +30,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
{
var mockDocumentService = new Mock<IDoculinkProvider>();
var mockUploadService = new Mock<IUploadService>();
var mockResponse = await MockData.getNoContentResponses();
var mockResponse = await MockData.getNoContentResponse();
mockDocumentService.Setup(service => service.GetdocumentsByLinkAsync("forms", "en", true)).ReturnsAsync(mockResponse);
var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
@ -83,7 +83,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
{
var mockDocumentService = new Mock<IDoculinkProvider>();
var mockUploadService = new Mock<IUploadService>();
var mockResponse = await MockData.getNoContentResponses();
var mockResponse = await MockData.getNoContentResponse();
mockDocumentService.Setup(service => service.GetdocumentsByLinkTypeIdAsync(null, "en", true)).ReturnsAsync(mockResponse);
var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);

View File

@ -11,7 +11,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
public class MockData
{
public static async Task<(bool, List<DocuLinks.Models.ResDoculinks>, string)> getOkResponses()
public static async Task<(bool, List<DocuLinks.Models.ResDoculink>, string)> getOkResponses()
{
List<DocuLinks.Models.ResDoculink> list = new List<DocuLinks.Models.ResDoculink>();
@ -46,8 +46,8 @@ namespace DamageAssesment.Api.DocuLinks.Test
doclinksAttachments= doclinksAttachments
});
}
List<ResDoculinks> doculinks = list.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
return (true, doculinks, null);
// List<ResDoculinks> doculinks = list.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
return (true, list, null);
}

View File

@ -7,10 +7,10 @@ namespace DamageAssesment.Api.DocuLinks.Interfaces
Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> GetDocumentAsync(int id, string? linktype, string? language);
Task<(bool IsSuccess, Models.Doculink Document, string ErrorMessage)> GetDocumentByidAsync(int id);
// Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetDocumnetsAsync(string? language);
Task<(bool IsSuccess, IEnumerable<Models.ResDoculinks> documents, string ErrorMessage)> GetdocumentsByLinkAsync(string? linkType, string? language, bool? isactive);
Task<(bool IsSuccess, IEnumerable<Models.ResDoculinks> documents, string ErrorMessage)> GetdocumentsByLinkTypeIdAsync(int? linkTypeId, string? language, bool? isactive);
Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkAsync(string? linkType, string? language, bool? isactive);
Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkTypeIdAsync(int? linkTypeId, string? language, bool? isactive);
Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> PostDocumentAsync(Models.Doculink Document);
Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> UpdateDocumentAsync(int id,Models.Doculink Document);
Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> UpdateDocumentAsync(int id, Models.Doculink Document);
Task<(bool IsSuccess, Models.ResDoculink Document, string ErrorMessage)> DeleteDocumentAsync(int id);
Task<(bool IsSuccess, int counter, string message)> GetDocumentCounter();

View File

@ -171,7 +171,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
return MultiLanguage;
}
public async Task<(bool IsSuccess, IEnumerable<Models.ResDoculinks> documents, string ErrorMessage)> GetdocumentsByLinkTypeIdAsync(int? linkTypeId, string? language, bool? isactive)
public async Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkTypeIdAsync(int? linkTypeId, string? language, bool? isactive)
{
try
@ -195,8 +195,8 @@ namespace DamageAssesment.Api.DocuLinks.Providers
item.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == item.Id).ToList());
}
List<ResDoculinks> doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
return (true, doculinks, null);
// List<ResDoculinks> doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
return (true, result, null);
}
return (false, null, "Not found");
}
@ -207,7 +207,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
}
}
public async Task<(bool IsSuccess, IEnumerable<Models.ResDoculinks> documents, string ErrorMessage)> GetdocumentsByLinkAsync(string? linkType, string? language, bool? isactive)
public async Task<(bool IsSuccess, IEnumerable<Models.ResDoculink> documents, string ErrorMessage)> GetdocumentsByLinkAsync(string? linkType, string? language, bool? isactive)
{
try
@ -231,8 +231,8 @@ namespace DamageAssesment.Api.DocuLinks.Providers
item.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == item.Id).ToList());
}
List<ResDoculinks> doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
return (true, doculinks, null);
//List<ResDoculinks> doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
return (true, result, null);
}
return (false, null, "Not found");
}