Creado apartir del commit b888de6c92056de294456f581a56e25e734d4ab7 de develop
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
using adas_core.Domain.Enums;
|
||||
using adas_core.Domain.Models;
|
||||
using adas_core.Infrastructure.Utils.MongoMaps.Interfaz;
|
||||
using MongoDB.Bson;
|
||||
using MongoDB.Bson.Serialization;
|
||||
using MongoDB.Bson.Serialization.Serializers;
|
||||
|
||||
namespace adas_core.Infrastructure.Utils.MongoMaps;
|
||||
|
||||
public class AppointmentMapContributor : IEntityMapContributor
|
||||
{
|
||||
public void RegisterMaps()
|
||||
{
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientAppointment)))
|
||||
BsonClassMap.RegisterClassMap<PatientAppointment>(cm =>
|
||||
{
|
||||
cm.AutoMap();
|
||||
|
||||
cm.MapIdMember(c => c.Id).SetElementName("_id");
|
||||
cm.MapMember(c => c.PatientId).SetSerializer(new ObjectIdSerializer(BsonType.String));
|
||||
cm.MapMember(c => c.Patient).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.Timings).SetDefaultValue(new List<Timing>());
|
||||
cm.MapMember(c => c.CreateTime).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.UpdateTime).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.PlacerOrder).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.FillerOrder).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.EventReason).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.AppointmentReason).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.AppointmentType).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.AppointmentOperationType)
|
||||
.SetIgnoreIfNull(true)
|
||||
.SetSerializer(
|
||||
new NullableSerializer<OperationType>(new EnumSerializer<OperationType>(BsonType.String)));
|
||||
cm.MapMember(c => c.AppointmentStatus)
|
||||
.SetIgnoreIfNull(true)
|
||||
.SetSerializer(
|
||||
new NullableSerializer<OperationType>(new EnumSerializer<OperationType>(BsonType.String)));
|
||||
cm.MapMember(c => c.Duration).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.VisitNumber).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.PatientClass).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.EpisodeActivation).SetDefaultValue(true);
|
||||
cm.MapMember(c => c.PlacerContact).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.FillerContact).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.ResourceGroups).SetDefaultValue(new List<PatientAppointmentResourceGroup>());
|
||||
cm.MapMember(c => c.Allergies).SetDefaultValue(new List<Allergies>());
|
||||
});
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(PatientAppointmentResourceGroup)))
|
||||
BsonClassMap.RegisterClassMap<PatientAppointmentResourceGroup>(cm =>
|
||||
{
|
||||
cm.AutoMap();
|
||||
|
||||
cm.MapMember(c => c.Services).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.Resources).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.Locations).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.Personnel).SetIgnoreIfNull(true);
|
||||
|
||||
cm.UnmapMember(c => c.ServicesActions);
|
||||
cm.UnmapMember(c => c.ResourcesActions);
|
||||
cm.UnmapMember(c => c.LocationsActions);
|
||||
cm.UnmapMember(c => c.PersonnelActions);
|
||||
});
|
||||
|
||||
if (!BsonClassMap.IsClassMapRegistered(typeof(Allergies)))
|
||||
BsonClassMap.RegisterClassMap<Allergies>(cm =>
|
||||
{
|
||||
cm.AutoMap();
|
||||
cm.MapMember(c => c.AllergenType).SetIgnoreIfNull(true);
|
||||
cm.MapMember(c => c.Allergen).SetIgnoreIfNull(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user