Update service DTOs
This commit is contained in:
parent
53cf5509d4
commit
9f1740c129
@ -28,8 +28,10 @@ namespace Manager.Interfaces.DTO
|
||||
|
||||
public class CategorieDTO
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string icon { get; set; }
|
||||
public List<TranslationDTO> name { get; set; }
|
||||
public string icon { get; set; } // icon material
|
||||
public string iconResourceId { get; set; } // icon point geo
|
||||
public string iconUrl { get; set; } // url to firebase storage or on internet
|
||||
}
|
||||
|
||||
public class ContentGeoPoint
|
||||
|
||||
@ -18,6 +18,9 @@ namespace Manager.Interfaces.DTO
|
||||
{
|
||||
public List<TranslationDTO> label { get; set; }
|
||||
public List<ResponseDTO> responses { get; set; }
|
||||
public string imageBackgroundResourceId { get; set; } // question image background
|
||||
public ResourceType imageBackgroundResourceType { get; set; }
|
||||
public string imageBackgroundResourceUrl { get; set; } // url to firebase storage or on internet
|
||||
public string resourceId { get; set; } // question image, audio or video
|
||||
public ResourceType resourceType { get; set; }
|
||||
public string resourceUrl { get; set; } // url to firebase storage or on internet
|
||||
|
||||
@ -365,7 +365,15 @@ namespace ManagerService.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (var categorie in mapDTO.categories)
|
||||
{
|
||||
if (categorie.iconResourceId != null)
|
||||
{
|
||||
addResourceToList(resourceDTOs, categorie.iconResourceId);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case SectionType.Slider:
|
||||
SliderDTO sliderDTO = JsonConvert.DeserializeObject<SliderDTO>(section.data);
|
||||
@ -385,6 +393,17 @@ namespace ManagerService.Controllers
|
||||
{
|
||||
addResourceToList(resourceDTOs, question.resourceId);
|
||||
}
|
||||
if (question.imageBackgroundResourceId != null)
|
||||
{
|
||||
addResourceToList(resourceDTOs, question.imageBackgroundResourceId);
|
||||
}
|
||||
foreach (var response in question.responses)
|
||||
{
|
||||
if (response.resourceId != null)
|
||||
{
|
||||
addResourceToList(resourceDTOs, response.resourceId);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (quizzDTO.bad_level != null)
|
||||
{
|
||||
@ -574,6 +593,14 @@ namespace ManagerService.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var categorie in mapDTO.categories)
|
||||
{
|
||||
if (categorie.iconResourceId != null)
|
||||
{
|
||||
createResource(exportConfiguration.resources.Where(r => r.id == categorie.iconResourceId).FirstOrDefault());
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case SectionType.Slider:
|
||||
SliderDTO sliderDTO = JsonConvert.DeserializeObject<SliderDTO>(section.data);
|
||||
@ -593,6 +620,17 @@ namespace ManagerService.Controllers
|
||||
{
|
||||
createResource(exportConfiguration.resources.Where(r => r.id == question.resourceId).FirstOrDefault());
|
||||
}
|
||||
if (question.imageBackgroundResourceId != null)
|
||||
{
|
||||
createResource(exportConfiguration.resources.Where(r => r.id == question.imageBackgroundResourceId).FirstOrDefault());
|
||||
}
|
||||
foreach (var response in question.responses)
|
||||
{
|
||||
if (response.resourceId != null)
|
||||
{
|
||||
createResource(exportConfiguration.resources.Where(r => r.id == response.resourceId).FirstOrDefault());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (quizzDTO.bad_level != null)
|
||||
{
|
||||
|
||||
@ -431,6 +431,12 @@ namespace ManagerService.Controllers
|
||||
content.resourceId = content.resourceId == id ? null : content.resourceId;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var categorie in mapDTO.categories)
|
||||
{
|
||||
categorie.iconUrl = categorie.iconResourceId == id ? null : categorie.iconUrl;
|
||||
categorie.iconResourceId = categorie.iconResourceId == id ? null : categorie.iconResourceId;
|
||||
}
|
||||
section.Data = JsonConvert.SerializeObject(mapDTO);
|
||||
break;
|
||||
case SectionType.Slider:
|
||||
@ -450,6 +456,13 @@ namespace ManagerService.Controllers
|
||||
{
|
||||
question.resourceUrl = question.resourceId == id ? null : question.resourceUrl;
|
||||
question.resourceId = question.resourceId == id ? null : question.resourceId;
|
||||
question.imageBackgroundResourceUrl = question.imageBackgroundResourceId == id ? null : question.imageBackgroundResourceUrl;
|
||||
question.imageBackgroundResourceId = question.imageBackgroundResourceId == id ? null : question.imageBackgroundResourceId;
|
||||
foreach (var response in question.responses)
|
||||
{
|
||||
response.resourceUrl = response.resourceId == id ? null : response.resourceUrl;
|
||||
response.resourceId = response.resourceId == id ? null : response.resourceId;
|
||||
}
|
||||
}
|
||||
if (quizzDTO.bad_level != null) {
|
||||
quizzDTO.bad_level.resourceUrl = quizzDTO.bad_level.resourceId == id ? null : quizzDTO.bad_level.resourceUrl;
|
||||
|
||||
@ -359,6 +359,7 @@ namespace ManagerService.Controllers
|
||||
mapDTO.zoom = 18;
|
||||
|
||||
mapDTO.points = new List<GeoPointDTO>();
|
||||
mapDTO.categories = new List<CategorieDTO>();
|
||||
|
||||
section.Data = JsonConvert.SerializeObject(mapDTO); // Include all info from specific section as JSON
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user