From e8e649efd95932e4018c491c89f26135c4af0572 Mon Sep 17 00:00:00 2001 From: uppuv Date: Tue, 24 Oct 2023 11:42:28 -0400 Subject: [PATCH] reverted doculinks chages for linktype grouping --- .../DoculinkServiceTest.cs | 6 +++--- .../DamageAssesment.Api.DocuLinks.Test/MockData.cs | 6 +++--- .../Interfaces/IDoculinkProvider.cs | 4 ++-- .../Providers/DoculinkProvider.cs | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks.Test/DoculinkServiceTest.cs b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks.Test/DoculinkServiceTest.cs index 14ddaaa..a8f45d1 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks.Test/DoculinkServiceTest.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks.Test/DoculinkServiceTest.cs @@ -16,7 +16,7 @@ namespace DamageAssesment.Api.DocuLinks.Test { var mockDocumentService = new Mock(); var mockUploadService = new Mock(); - 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(); var mockUploadService = new Mock(); - 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(); var mockUploadService = new Mock(); - 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); diff --git a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks.Test/MockData.cs b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks.Test/MockData.cs index 23ffae4..843b4d3 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks.Test/MockData.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks.Test/MockData.cs @@ -11,7 +11,7 @@ namespace DamageAssesment.Api.DocuLinks.Test public class MockData { - public static async Task<(bool, List, string)> getOkResponses() + public static async Task<(bool, List, string)> getOkResponses() { List list = new List(); @@ -46,8 +46,8 @@ namespace DamageAssesment.Api.DocuLinks.Test doclinksAttachments= doclinksAttachments }); } - List doculinks = list.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList(); - return (true, doculinks, null); + // List doculinks = list.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList(); + return (true, list, null); } diff --git a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Interfaces/IDoculinkProvider.cs b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Interfaces/IDoculinkProvider.cs index 6d271fd..b1597b1 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Interfaces/IDoculinkProvider.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Interfaces/IDoculinkProvider.cs @@ -7,8 +7,8 @@ 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 documents, string ErrorMessage)> GetDocumnetsAsync(string? language); - Task<(bool IsSuccess, IEnumerable documents, string ErrorMessage)> GetdocumentsByLinkAsync(string? linkType, string? language, bool? isactive); - Task<(bool IsSuccess, IEnumerable documents, string ErrorMessage)> GetdocumentsByLinkTypeIdAsync(int? linkTypeId, string? language, bool? isactive); + Task<(bool IsSuccess, IEnumerable documents, string ErrorMessage)> GetdocumentsByLinkAsync(string? linkType, string? language, bool? isactive); + Task<(bool IsSuccess, IEnumerable 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)> DeleteDocumentAsync(int id); diff --git a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Providers/DoculinkProvider.cs b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Providers/DoculinkProvider.cs index 371b8b3..a2c4d0c 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Providers/DoculinkProvider.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.DocuLinks/Providers/DoculinkProvider.cs @@ -171,7 +171,7 @@ namespace DamageAssesment.Api.DocuLinks.Providers return MultiLanguage; } - public async Task<(bool IsSuccess, IEnumerable documents, string ErrorMessage)> GetdocumentsByLinkTypeIdAsync(int? linkTypeId, string? language, bool? isactive) + public async Task<(bool IsSuccess, IEnumerable 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>( DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == item.Id).ToList()); } - List doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList(); - return (true, doculinks, null); + //List 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 documents, string ErrorMessage)> GetdocumentsByLinkAsync(string? linkType, string? language, bool? isactive) + public async Task<(bool IsSuccess, IEnumerable 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>( DocumentDbContext.DoclinksAttachments.AsNoTracking().Where(a => a.DocumentId == item.Id).ToList()); } - List doculinks = result.GroupBy(a => a.linkTypeId).Select(a => new ResDoculinks() { linkTypeId = a.Key, doculinks = a.ToList() }).ToList(); - return (true, doculinks, null); + // List 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"); }