From f17f883ec1671a505d5ad0aca12be4ea5122a55e Mon Sep 17 00:00:00 2001 From: Ronaldo Macapobre Date: Fri, 13 Dec 2024 18:18:51 +0000 Subject: [PATCH] Limit the Court File Search and Case Details endpoint to Provincial files only --- api/Controllers/FilesController.cs | 8 ++++---- api/Services/Files/CivilFilesService.cs | 15 ++++++++------- api/Services/Files/CriminalFilesService.cs | 12 ++++++------ 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/api/Controllers/FilesController.cs b/api/Controllers/FilesController.cs index fd917f96..e2df85d4 100644 --- a/api/Controllers/FilesController.cs +++ b/api/Controllers/FilesController.cs @@ -101,7 +101,7 @@ public async Task> GetCivilFileDet if (User.IsVcUser() && civilFileDetailResponse.SealedYN != "N") return Forbid(); - if (User.IsSupremeUser() && civilFileDetailResponse.CourtLevelCd != CivilFileDetailResponseCourtLevelCd.S) + if (User.IsSupremeUser() && civilFileDetailResponse.CourtLevelCd != CivilFileDetailResponseCourtLevelCd.P) return Forbid(); return Ok(civilFileDetailResponse); @@ -133,7 +133,7 @@ public async Task> GetCivilAppearanceDetails if (civilAppearanceDetail == null) throw new NotFoundException("Couldn't find appearance detail with the provided file id and appearance id."); - if (User.IsSupremeUser() && civilAppearanceDetail.CourtLevelCd != CivilFileDetailResponseCourtLevelCd.S) + if (User.IsSupremeUser() && civilAppearanceDetail.CourtLevelCd != CivilFileDetailResponseCourtLevelCd.P) return Forbid(); return Ok(civilAppearanceDetail); @@ -223,7 +223,7 @@ public async Task> GetCriminalF if (redactedCriminalFileDetailResponse?.JustinNo == null) throw new NotFoundException("Couldn't find criminal file with this id."); - if (User.IsSupremeUser() && redactedCriminalFileDetailResponse.CourtLevelCd != CriminalFileDetailResponseCourtLevelCd.S) + if (User.IsSupremeUser() && redactedCriminalFileDetailResponse.CourtLevelCd != CriminalFileDetailResponseCourtLevelCd.P) return Forbid(); return Ok(redactedCriminalFileDetailResponse); @@ -244,7 +244,7 @@ public async Task> GetCriminalAppearanceD if (appearanceDetail == null) throw new NotFoundException("Couldn't find appearance details with the provided parameters."); - if (User.IsSupremeUser() && appearanceDetail.CourtLevelCd != CriminalFileDetailResponseCourtLevelCd.S) + if (User.IsSupremeUser() && appearanceDetail.CourtLevelCd != CriminalFileDetailResponseCourtLevelCd.P) return Forbid(); diff --git a/api/Services/Files/CivilFilesService.cs b/api/Services/Files/CivilFilesService.cs index 7885edb6..12141606 100644 --- a/api/Services/Files/CivilFilesService.cs +++ b/api/Services/Files/CivilFilesService.cs @@ -74,7 +74,7 @@ public async Task SearchAsync(FilesCivilQuery fcq) "[\"A\", \"Y\", \"T\", \"F\", \"C\", \"M\", \"L\", \"R\", \"B\", \"D\", \"E\", \"G\", \"H\", \"N\", \"O\", \"P\", \"S\", \"V\"]"; // for now, use all types - TODO: determine proper list of types? return await _filesClient.FilesCivilGetAsync(_requestAgencyIdentifierId, _requestPartId, _applicationCode, fcq.SearchMode, fcq.FileHomeAgencyId, fcq.FileNumber, fcq.FilePrefix, - fcq.FilePermissions, fcq.FileSuffixNumber, fcq.MDocReferenceTypeCode, fcq.CourtClass, fcq.CourtLevel, + fcq.FilePermissions, fcq.FileSuffixNumber, fcq.MDocReferenceTypeCode, fcq.CourtClass, CourtLevelCd.P, fcq.NameSearchType, fcq.LastName, fcq.OrgName, fcq.GivenName, fcq.Birth?.ToString("yyyy-MM-dd"), fcq.SearchByCrownPartId, fcq.SearchByCrownActiveOnly, fcq.SearchByCrownFileDesignation, fcq.MdocJustinNumberSet, fcq.PhysicalFileIdSet); @@ -109,7 +109,7 @@ public async Task> GetFilesByAgencyIdCodeA //Return the basic entry without doing a lookup. if (fileIdAndAppearanceDate.Count == 1) - return new List { new RedactedCivilFileDetailResponse { PhysicalFileId = fileIdAndAppearanceDate.First().PhysicalFileId }} ; + return new List { new RedactedCivilFileDetailResponse { PhysicalFileId = fileIdAndAppearanceDate.First().PhysicalFileId } }; var fileDetailTasks = new List>(); foreach (var fileId in fileIdAndAppearanceDate) @@ -152,7 +152,7 @@ public async Task FileIdAsync(string fileId, bo foreach (var document in PopulateDetailCsrsDocuments(fileDetail.Appearance)) if (!isVcUser) detail.Document.Add(document); - + detail = await PopulateBaseDetail(detail); detail.Appearances = appearances; @@ -160,7 +160,8 @@ public async Task FileIdAsync(string fileId, bo detail.Party = await PopulateDetailParties(detail.Party); detail.Document = await PopulateDetailDocuments(detail.Document, fileContentCivilFile, isVcUser, isStaff); detail.HearingRestriction = await PopulateDetailHearingRestrictions(fileDetail.HearingRestriction); - if (isVcUser) { + if (isVcUser) + { //SCV-266 - Disable comments for VC Users. foreach (var document in detail.Document) document.CommentTxt = ""; @@ -427,7 +428,7 @@ private async Task> PopulateDetailedAppe party.Representative = _mapper.Map>(courtListParty.Representative); foreach (var representative in party.Representative) { - representative.AttendanceMethodDesc = await _lookupService.GetCivilAssetsDescription(representative.AttendanceMethodCd); + representative.AttendanceMethodDesc = await _lookupService.GetCivilAssetsDescription(representative.AttendanceMethodCd); } party.LegalRepresentative = courtListParty.LegalRepresentative; } @@ -449,7 +450,7 @@ private async Task> PopulateDetailedAppe if (!counsel.AdditionalProperties.ContainsKey("counselName")) continue; - + var targetCounsel = party.Counsel?.FirstOrDefault(c => c.CounselFullName == counsel.CounselName); if (targetCounsel == null) continue; @@ -473,7 +474,7 @@ private async Task> PopulateDetailedAppeara { document.Category = _lookupService.GetDocumentCategory(document.DocumentTypeCd); document.DocumentTypeDescription = await _lookupService.GetDocumentDescriptionAsync(document.DocumentTypeCd); - document.ImageId = document.SealedYN != "N" ? null : document.ImageId; + document.ImageId = document.SealedYN != "N" ? null : document.ImageId; foreach (var issue in document.Issue) { issue.IssueTypeDesc = await _lookupService.GetCivilDocumentIssueType(issue.IssueTypeCd); diff --git a/api/Services/Files/CriminalFilesService.cs b/api/Services/Files/CriminalFilesService.cs index c7bfd4ba..5951a7c7 100644 --- a/api/Services/Files/CriminalFilesService.cs +++ b/api/Services/Files/CriminalFilesService.cs @@ -65,7 +65,7 @@ public async Task SearchAsync(FilesCriminalQuery fcq) return await _filesClient.FilesCriminalGetAsync(_requestAgencyIdentifierId, _requestPartId, _applicationCode, fcq.SearchMode, fcq.FileHomeAgencyId, fcq.FileNumberTxt, fcq.FilePrefixTxt, fcq.FilePermissions, fcq.FileSuffixNo, fcq.MdocRefTypeCode, fcq.CourtClass, - fcq.CourtLevel, fcq.NameSearchTypeCd, fcq.LastName, fcq.OrgName, fcq.GivenName, + CourtLevelCd.P, fcq.NameSearchTypeCd, fcq.LastName, fcq.OrgName, fcq.GivenName, fcq.Birth?.ToString("yyyy-MM-dd"), fcq.SearchByCrownPartId, fcq.SearchByCrownActiveOnly, fcq.SearchByCrownFileDesignation, fcq.MdocJustinNoSet, fcq.PhysicalFileIdSet); } @@ -86,14 +86,14 @@ public async Task> GetFilesByAgencyIdCo }); var fileIdAndAppearanceDate = fileSearchResponse?.FileDetail?.Where(fd => mdocSequenceNumber == null || fd.MdocSeqNo == mdocSequenceNumber) - .SelectToList(fd => new { fd.MdocJustinNo , fd.NextApprDt }); + .SelectToList(fd => new { fd.MdocJustinNo, fd.NextApprDt }); if (fileIdAndAppearanceDate == null || fileIdAndAppearanceDate.Count == 0) return fileDetails; //Return the basic entry without doing a lookup. if (fileIdAndAppearanceDate.Count == 1) - return new List {new RedactedCriminalFileDetailResponse {JustinNo = fileIdAndAppearanceDate.First().MdocJustinNo}}; + return new List { new RedactedCriminalFileDetailResponse { JustinNo = fileIdAndAppearanceDate.First().MdocJustinNo } }; //It seems the fileSearch and the FileDetails/FileContent bring up two different participant lists //The fileSearch seems to include have extra participants. @@ -220,7 +220,7 @@ public async Task AppearanceDetailAsync(string fileId, private List GetInitiatingDocuments(ICollection documents) { return documents?.Where(doc => doc?.DocmClassification == "Initiating" && !string.IsNullOrEmpty(doc.ImageId)) - .Select(a => new CriminalDocument {IssueDate = a.IssueDate, ImageId = a.ImageId}).ToList(); + .Select(a => new CriminalDocument { IssueDate = a.IssueDate, ImageId = a.ImageId }).ToList(); } private async Task PopulateDetailsAppearancesAsync(string fileId, FutureYN? future, HistoryYN? history) @@ -379,12 +379,12 @@ private async Task PopulateAppearanceCriminalAccused(string ful FullName = fullName, PartId = partId, //partyAppearanceMethod, doesn't always have a partId on DEV at least. PartyAppearanceMethod = partyAppearanceMethod?.PartyAppearanceMethod, - PartyAppearanceMethodDesc = await _lookupService.GetCriminalAccusedAttend(partyAppearanceMethod?.PartyAppearanceMethod), + PartyAppearanceMethodDesc = await _lookupService.GetCriminalAccusedAttend(partyAppearanceMethod?.PartyAppearanceMethod), AttendanceMethodCd = attendanceMethod?.AttendanceMethodCd, AttendanceMethodDesc = await _lookupService.GetCriminalAssetsDescriptions(attendanceMethod?.AttendanceMethodCd), AppearanceMethodCd = appearanceMethod?.AppearanceMethodCd, AppearanceMethodDesc = await _lookupService.GetCriminalAssetsDescriptions(appearanceMethod?.AppearanceMethodCd) - }; + }; } private async Task PopulateAppearanceDetailAdjudicator(CfcAppearance appearanceFromAccused, ICollection attendanceMethods, ICollection appearanceMethods)