Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop

This commit is contained in:
jrojas
2026-06-26 09:52:35 +02:00
commit 319fd3dfb0
746 changed files with 106610 additions and 0 deletions
@@ -0,0 +1,67 @@
using adas_core.Application.Repositories.Interfaces;
using adas_core.Domain.Models.AppSettings;
using adas_core.Domain.Models.MongoModels;
using Microsoft.Extensions.Options;
using MongoDB.Bson;
using MongoDB.Driver;
namespace adas_core.Infrastructure.Repositories;
public class PatientCarePlanRepository : MongoRepository<PatientCarePlan>, IPatientCarePlanRepository
{
#region Properties
private readonly ApiSettings _apiSettings;
#endregion
#region Update
public async Task UpdateManyObjectId(string patientid, ObjectId patientId, ObjectId oldId)
{
await UpdateManyObjectIdAsync(patientid, patientId, oldId);
}
#endregion
#region Constructor
public PatientCarePlanRepository(
IOptions<ApiSettings> apiSettings,
IMongoDatabase database
) : base(database)
{
_apiSettings = apiSettings.Value;
}
#endregion
#region Read
public override string GetCollectionName()
{
return _apiSettings.PatientCarePlan ?? "patients_care_plan";
}
public async Task<List<PatientCarePlan>> FindByPatientId(ObjectId patientId)
{
var result = await Collection.FindAsync(Builders<PatientCarePlan>.Filter.Eq(p => p.PatientId, patientId));
return result.ToList();
}
public async Task<List<PatientCarePlan>> FindByUserId(ObjectId userId)
{
var result = await Collection.FindAsync(Builders<PatientCarePlan>.Filter.Eq(p => p.UserId, userId));
return result.ToList();
}
public async Task<List<PatientCarePlan>> FindAll()
{
var result = await Collection.Find(Builders<PatientCarePlan>.Filter.Empty).ToListAsync();
return result;
}
#endregion
}