Clean code + add Beacon handling

This commit is contained in:
Fransolet Thomas 2022-12-27 21:47:52 +01:00
parent fc9d38c3c1
commit 9e8109225a
5 changed files with 41 additions and 1 deletions

View File

@ -21,5 +21,10 @@ namespace Manager.Interfaces.DTO
public DateTime dateCreation { get; set; } // == Include section type info public DateTime dateCreation { get; set; } // == Include section type info
public int order { get; set; } // Order to show public int order { get; set; } // Order to show
public string instanceId { get; set; } public string instanceId { get; set; }
public string latitude { get; set; } // MyVisit - Use to launch automatic content when current location is near
public string longitude { get; set; } // MyVisit - Use to launch automatic content when current location is near
public int? meterZoneGPS { get; set; } // MyVisit - Nbr of meters of the zone to launch content
public bool isBeacon { get; set; } // MyVisit - True if section use beacon, false otherwise
public string beaconId { get; set; } // MyVisit - Beacon' identifier
} }
} }

View File

@ -8,7 +8,6 @@ namespace Manager.Interfaces.DTO
public class ArticleDTO public class ArticleDTO
{ {
public List<TranslationDTO> content { get; set; } public List<TranslationDTO> content { get; set; }
public string qrCode { get; set; } // MyVisit - QR code identifier int ? String ?
public bool isContentTop { get; set; } // MyVisit - True if content is displayed at top, false otherwise public bool isContentTop { get; set; } // MyVisit - True if content is displayed at top, false otherwise
public List<TranslationDTO> audioIds { get; set; } public List<TranslationDTO> audioIds { get; set; }
public bool isReadAudioAuto { get; set; } // MyVisit - True for audio play when open the article / false otherwise public bool isReadAudioAuto { get; set; } // MyVisit - True for audio play when open the article / false otherwise

View File

@ -65,6 +65,21 @@ namespace Manager.Interfaces.Models
[BsonRequired] [BsonRequired]
public string InstanceId { get; set; } public string InstanceId { get; set; }
[BsonElement("IsBeacon")]
public bool IsBeacon { get; set; }
[BsonElement("BeaconId")]
public string BeaconId { get; set; }
[BsonElement("Latitude")]
public string Latitude { get; set; }
[BsonElement("Longitude")]
public string Longitude { get; set; }
[BsonElement("MeterZoneGPS")]
public int? MeterZoneGPS { get; set; }
public SectionDTO ToDTO() public SectionDTO ToDTO()
{ {
return new SectionDTO() return new SectionDTO()
@ -83,6 +98,11 @@ namespace Manager.Interfaces.Models
data = Data, data = Data,
dateCreation = DateCreation, dateCreation = DateCreation,
instanceId = InstanceId, instanceId = InstanceId,
isBeacon = IsBeacon,
beaconId = BeaconId,
latitude = Latitude,
longitude = Longitude,
meterZoneGPS = MeterZoneGPS,
}; };
} }
} }

View File

@ -463,6 +463,11 @@ namespace ManagerService.Controllers
newSection.ParentId = section.parentId; newSection.ParentId = section.parentId;
newSection.Data = section.data; newSection.Data = section.data;
newSection.DateCreation = section.dateCreation; newSection.DateCreation = section.dateCreation;
newSection.IsBeacon = section.isBeacon;
newSection.BeaconId = section.beaconId;
newSection.Latitude = section.latitude;
newSection.Longitude = section.longitude;
newSection.MeterZoneGPS = section.meterZoneGPS;
if (newSection.ImageId != null) if (newSection.ImageId != null)
{ {

View File

@ -266,6 +266,12 @@ namespace ManagerService.Controllers
section.Title = new List<TranslationDTO>(); section.Title = new List<TranslationDTO>();
section.Description = new List<TranslationDTO>(); section.Description = new List<TranslationDTO>();
section.Order = _sectionService.GetAllFromConfiguration(newSection.configurationId).Count; section.Order = _sectionService.GetAllFromConfiguration(newSection.configurationId).Count;
section.IsBeacon = newSection.isBeacon;
section.BeaconId = newSection.beaconId;
section.Latitude = newSection.latitude;
section.Longitude = newSection.longitude;
section.MeterZoneGPS = newSection.meterZoneGPS;
// Preparation // Preparation
List<string> languages = _configuration.GetSection("SupportedLanguages").Get<List<string>>(); List<string> languages = _configuration.GetSection("SupportedLanguages").Get<List<string>>();
@ -490,6 +496,11 @@ namespace ManagerService.Controllers
section.IsSubSection = updatedSection.isSubSection; section.IsSubSection = updatedSection.isSubSection;
section.ParentId = updatedSection.parentId; section.ParentId = updatedSection.parentId;
section.Data = updatedSection.data; section.Data = updatedSection.data;
section.IsBeacon = updatedSection.isBeacon;
section.BeaconId = updatedSection.beaconId;
section.Latitude = updatedSection.latitude;
section.Longitude = updatedSection.longitude;
section.MeterZoneGPS = updatedSection.meterZoneGPS;
Section sectionModified = _sectionService.Update(updatedSection.id, section); Section sectionModified = _sectionService.Update(updatedSection.id, section);