=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===
This commit is contained in:
@@ -45,6 +45,7 @@ public class AdminPanelService(
|
||||
/// <param name="patient">The patient to archive.</param>
|
||||
/// <returns><c>true</c> if the patient was archived successfully.</returns>
|
||||
/// <exception cref="System.Exception">Rethrows any exception thrown by the underlying patient service after logging it to the console.</exception>
|
||||
/// <!-- aidoc:v1 sig=5748d52 body=c9332aa -->
|
||||
public async Task<bool> ArchivePatient(Patient patient)
|
||||
{
|
||||
try
|
||||
@@ -66,6 +67,7 @@ public class AdminPanelService(
|
||||
/// </summary>
|
||||
/// <param name="admRequest">The ADMPanel request containing the data used to populate the new patient.</param>
|
||||
/// <returns>The newly created <see cref="Patient"/> with its generated identifier.</returns>
|
||||
/// <!-- aidoc:v1 sig=e3b8218 body=5262c4e -->
|
||||
public async Task<Patient?> CreatePatient(AdmPanelRequest admRequest)
|
||||
{
|
||||
var patient = new Patient
|
||||
@@ -88,6 +90,7 @@ public class AdminPanelService(
|
||||
/// <exception cref="Exception">Thrown when the target <c>PointOfCareId</c> is already occupied by another patient.</exception>
|
||||
/// <exception cref="NotFoundException">Thrown when the requested <c>PointOfCareId</c> does not exist.</exception>
|
||||
/// <returns>The asynchronous <see cref="Task"/> representing the update operation.</returns>
|
||||
/// <!-- aidoc:v1 sig=a5986e8 body=50adbb0 -->
|
||||
private async Task UpdateNewPatient(Patient patient, AdmPanelRequest admRequest)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(admRequest.PatientNumber)) patient.PatientNumber = admRequest.PatientNumber;
|
||||
@@ -159,6 +162,7 @@ public class AdminPanelService(
|
||||
/// <param name="id">The unique identifier of the patient to look up.</param>
|
||||
/// <returns>The patient matching the provided identifier.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no patient is found for the specified identifier.</exception>
|
||||
/// <!-- aidoc:v1 sig=4bd85a6 body=0e8a91a -->
|
||||
public async Task<Patient?> FindPatientById(ObjectId id)
|
||||
{
|
||||
return await patientService.FindById(id) ??
|
||||
@@ -171,6 +175,7 @@ public class AdminPanelService(
|
||||
/// </summary>
|
||||
/// <param name="location">The location to search for a patient at.</param>
|
||||
/// <returns>A <see cref="Patient"/> if one is found at the specified location; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=63de0aa body=2e39863 -->
|
||||
public async Task<Patient?> FindPatientByLocation(PatientLocation location)
|
||||
{
|
||||
return await patientService.FindByLocation(location);
|
||||
@@ -182,6 +187,7 @@ public class AdminPanelService(
|
||||
/// </summary>
|
||||
/// <param name="patientNumber">The unique patient number used to look up the patient.</param>
|
||||
/// <returns>A <see cref="Patient"/> if a match is found; otherwise, <c>null</c>.</returns>
|
||||
/// <!-- aidoc:v1 sig=b40610c body=3921bde -->
|
||||
public async Task<Patient?> FindPatientByPatientNumber(string patientNumber)
|
||||
{
|
||||
return await patientService.FindByPatientNumber(patientNumber);
|
||||
@@ -194,6 +200,7 @@ public class AdminPanelService(
|
||||
/// <param name="oldPatient">The existing patient record currently stored in the database that will be updated.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the patient data is successfully updated.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the request is missing the patient number, the patient payload is null, or the patient payload is empty.</exception>
|
||||
/// <!-- aidoc:v1 sig=5977876 body=627aa0c -->
|
||||
public async Task<bool> UpdatePatientData(AdmPanelRequest request, Patient oldPatient)
|
||||
{
|
||||
//traer el paciente que se quiere actualizar con los valores que tenga en la base de datos a una variable
|
||||
@@ -264,6 +271,7 @@ public class AdminPanelService(
|
||||
/// <param name="request">The admission panel request containing the patient identification data and optional location used to locate the patient.</param>
|
||||
/// <returns>The matching <see cref="Patient"/> if found.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no patient matches the provided request criteria.</exception>
|
||||
/// <!-- aidoc:v1 sig=7119165 body=2f82189 -->
|
||||
public async Task<Patient?> FindPatient(AdmPanelRequest request)
|
||||
{
|
||||
var findByLocation = !request.Location?.IsFullEmpty();
|
||||
@@ -278,6 +286,7 @@ public class AdminPanelService(
|
||||
/// <param name="location">The location used to look up the patient.</param>
|
||||
/// <returns>The patient found at the specified location.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no patient is found for the given location.</exception>
|
||||
/// <!-- aidoc:v1 sig=f2942f8 body=9a2d8fd -->
|
||||
public async Task<Patient?> FindByLocation(PatientLocation location)
|
||||
{
|
||||
return await patientService.FindByLocation(location) ??
|
||||
@@ -295,6 +304,7 @@ public class AdminPanelService(
|
||||
/// <param name="configObservation">The configuration observation containing the data to persist.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the configuration is created successfully.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the configuration creation fails, indicated by a null result from the service call.</exception>
|
||||
/// <!-- aidoc:v1 sig=78b448d body=4fbc231 -->
|
||||
public async Task<bool> CreateConfig(ConfigObservation configObservation)
|
||||
{
|
||||
_ = await configObservationService.CreateConfig(configObservation) ??
|
||||
@@ -308,6 +318,7 @@ public class AdminPanelService(
|
||||
/// <param name="configObservation">The configuration observation to update.</param>
|
||||
/// <returns>A task that resolves to <c>true</c> when the configuration is successfully updated.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the underlying update operation fails, as indicated by a null result from the service.</exception>
|
||||
/// <!-- aidoc:v1 sig=255c09c body=3656b65 -->
|
||||
public async Task<bool> UpdateConfig(ConfigObservation configObservation)
|
||||
{
|
||||
_ = await configObservationService.UpdateConfig(configObservation) ??
|
||||
@@ -321,6 +332,7 @@ public class AdminPanelService(
|
||||
/// <param name="id">The unique identifier of the config observation item to delete.</param>
|
||||
/// <returns><c>true</c> when the config observation item is successfully removed.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the removal operation returns a null result, signaling a conflict with the delete request.</exception>
|
||||
/// <!-- aidoc:v1 sig=ffc4d11 body=62f915b -->
|
||||
public async Task<bool> DeleteConfigObservationItem(ObjectId id)
|
||||
{
|
||||
_ = await configObservationService.RemoveConfigItem(id) ??
|
||||
@@ -338,6 +350,7 @@ public class AdminPanelService(
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit to be inserted.</param>
|
||||
/// <returns>The inserted unit with its associated Point of Care identifiers, or null if the unit could not be inserted.</returns>
|
||||
/// <!-- aidoc:v1 sig=500cf23 body=7ff2f54 -->
|
||||
public async Task<Unit?> InsertUnit(Unit unit)
|
||||
{
|
||||
//Insertamos la unidad y creamos los PoCs por defecto para esa unidad
|
||||
@@ -375,6 +388,7 @@ public class AdminPanelService(
|
||||
/// </summary>
|
||||
/// <param name="unit">The unit for which to build the dependency information DTO.</param>
|
||||
/// <returns>A task that resolves to a <see cref="UnitInfoDto"/> containing the unit's dependency counts, or <c>null</c> if an error occurs while retrieving the counts.</returns>
|
||||
/// <!-- aidoc:v1 sig=709a3b7 body=bcab092 -->
|
||||
public async Task<UnitInfoDto?> GetUnitDependencyDto(Unit unit)
|
||||
{
|
||||
try
|
||||
@@ -405,6 +419,12 @@ public class AdminPanelService(
|
||||
/// <returns><c>true</c> if the unit and its related resources were successfully deleted; otherwise, <c>false</c> when an error is caught and logged.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no unit is found for the specified <paramref name="unitId"/>.</exception>
|
||||
/// <exception cref="ConflictException">Thrown when the unit has patients assigned to it, preventing deletion.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_exception
|
||||
/// "NotFoundException is caught by the surrounding catch (Exception e) block and never escapes the method; the method returns false instead." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_exception
|
||||
/// "ConflictException is caught by the surrounding catch (Exception e) block and never escapes the method; the method returns false instead." -->
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_summary
|
||||
/// "Summary states the method 'Throws' NotFoundException and ConflictException, but the catch-all handler swallows them and converts errors into a false return value." -->
|
||||
public async Task<bool> DeleteUnitById(ObjectId unitId)
|
||||
{
|
||||
try
|
||||
@@ -455,6 +475,7 @@ public class AdminPanelService(
|
||||
/// <param name="medicineId">The unique identifier of the medicine to retrieve.</param>
|
||||
/// <returns>The medicine matching the specified identifier.</returns>
|
||||
/// <exception cref="NotFoundException">Thrown when no medicine is found with the specified identifier.</exception>
|
||||
/// <!-- aidoc:v1 sig=be77265 body=6784aa2 -->
|
||||
public async Task<Medicine?> GetMedicineById(ObjectId medicineId)
|
||||
{
|
||||
return await medicineService.GetMedicineById(medicineId) ??
|
||||
@@ -467,6 +488,7 @@ public class AdminPanelService(
|
||||
/// <param name="medicine">The medicine to be created.</param>
|
||||
/// <returns>The created <see cref="Medicine"/>.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the medicine service fails to create the medicine.</exception>
|
||||
/// <!-- aidoc:v1 sig=25564e2 body=595b03f -->
|
||||
public async Task<Medicine?> PostMedicine(Medicine medicine)
|
||||
{
|
||||
var newMedicine = await medicineService.PostMedicine(medicine) ??
|
||||
@@ -481,6 +503,7 @@ public class AdminPanelService(
|
||||
/// <param name="medicine">The medicine entity containing the updated information to persist.</param>
|
||||
/// <returns>The updated <see cref="Medicine"/> returned by the service.</returns>
|
||||
/// <exception cref="ConflictException">Thrown when the update operation fails and the service returns a null result.</exception>
|
||||
/// <!-- aidoc:v1 sig=baa8582 body=8e7d69d -->
|
||||
public async Task<Medicine?> UpdateMedicine(Medicine medicine)
|
||||
{
|
||||
var updatedMedicine = await medicineService.UpdateMedicine(medicine) ??
|
||||
@@ -495,6 +518,8 @@ public class AdminPanelService(
|
||||
/// <returns>A task that resolves to <c>true</c> when the medicine has been successfully deleted.</returns>
|
||||
/// <exception cref="BadRequestException">Thrown when <paramref name="medicineId"/> is not a valid ObjectId format.</exception>
|
||||
/// <exception cref="ConflictException">Thrown when the medicine still exists after the delete operation, indicating the deletion failed.</exception>
|
||||
/// <!-- aidoc-review:v1 severity=high kind=wrong_exception
|
||||
/// "Documentation states ConflictException is thrown when the medicine still exists after deletion, but the code (`_ = await ... ?? throw new ConflictException(...)`) actually throws when GetMedicineById returns null, i.e., when the medicine does NOT exist after deletion." -->
|
||||
public async Task<bool> DeleteMedicineById(string medicineId)
|
||||
{
|
||||
if (!ObjectId.TryParse(medicineId, out var objectId))
|
||||
|
||||
Reference in New Issue
Block a user