reverted doculinks grouping by linktype
This commit is contained in:
parent
7b7e5c0ce8
commit
499ac9248b
@ -16,7 +16,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
|
|||||||
{
|
{
|
||||||
var mockDocumentService = new Mock<IDoculinkProvider>();
|
var mockDocumentService = new Mock<IDoculinkProvider>();
|
||||||
var mockUploadService = new Mock<IUploadService>();
|
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);
|
mockDocumentService.Setup(service => service.GetdocumentsByLinkAsync("forms","en",null)).ReturnsAsync(mockResponse);
|
||||||
|
|
||||||
var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
|
var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
|
||||||
@ -30,7 +30,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
|
|||||||
{
|
{
|
||||||
var mockDocumentService = new Mock<IDoculinkProvider>();
|
var mockDocumentService = new Mock<IDoculinkProvider>();
|
||||||
var mockUploadService = new Mock<IUploadService>();
|
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);
|
mockDocumentService.Setup(service => service.GetdocumentsByLinkAsync("forms", "en", true)).ReturnsAsync(mockResponse);
|
||||||
|
|
||||||
var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
|
var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
|
||||||
@ -83,7 +83,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
|
|||||||
{
|
{
|
||||||
var mockDocumentService = new Mock<IDoculinkProvider>();
|
var mockDocumentService = new Mock<IDoculinkProvider>();
|
||||||
var mockUploadService = new Mock<IUploadService>();
|
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);
|
mockDocumentService.Setup(service => service.GetdocumentsByLinkTypeIdAsync(null, "en", true)).ReturnsAsync(mockResponse);
|
||||||
|
|
||||||
var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
|
var DocumentProvider = new DoculinkController(mockDocumentService.Object, mockUploadService.Object);
|
||||||
|
@ -11,7 +11,7 @@ namespace DamageAssesment.Api.DocuLinks.Test
|
|||||||
public class MockData
|
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>();
|
List<DocuLinks.Models.ResDoculink> list = new List<DocuLinks.Models.ResDoculink>();
|
||||||
|
|
||||||
@ -46,8 +46,8 @@ namespace DamageAssesment.Api.DocuLinks.Test
|
|||||||
doclinksAttachments= doclinksAttachments
|
doclinksAttachments= doclinksAttachments
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
List<ResDoculinks> doculinks = list.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
|
// List<ResDoculinks> doculinks = list.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
|
||||||
return (true, doculinks, null);
|
return (true, list, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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.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, 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.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.ResDoculink> 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)> 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)> 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, Models.ResDoculink Document, string ErrorMessage)> DeleteDocumentAsync(int id);
|
||||||
Task<(bool IsSuccess, int counter, string message)> GetDocumentCounter();
|
Task<(bool IsSuccess, int counter, string message)> GetDocumentCounter();
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers
|
|||||||
return MultiLanguage;
|
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
|
try
|
||||||
@ -195,8 +195,8 @@ namespace DamageAssesment.Api.DocuLinks.Providers
|
|||||||
item.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
|
item.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
|
||||||
DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == item.Id).ToList());
|
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();
|
// List<ResDoculinks> doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
|
||||||
return (true, doculinks, null);
|
return (true, result, null);
|
||||||
}
|
}
|
||||||
return (false, null, "Not found");
|
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
|
try
|
||||||
@ -231,8 +231,8 @@ namespace DamageAssesment.Api.DocuLinks.Providers
|
|||||||
item.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
|
item.doclinksAttachments = mapper.Map<List<Db.DoculinkAttachments>, List<Models.DoculinkAttachments>>(
|
||||||
DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == item.Id).ToList());
|
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();
|
//List<ResDoculinks> doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList();
|
||||||
return (true, doculinks, null);
|
return (true, result, null);
|
||||||
}
|
}
|
||||||
return (false, null, "Not found");
|
return (false, null, "Not found");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user