Add new subsection ArticleDTO + add offline and mobile option
This commit is contained in:
parent
820de792a5
commit
55a612fd0c
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -12,5 +12,9 @@ namespace Manager.Interfaces.DTO
|
|||||||
public string secondaryColor { get; set; }
|
public string secondaryColor { get; set; }
|
||||||
public List<string> languages { get; set; } // fr, en, de, nl => Sélection dans une liste déjà établie dans l'application !
|
public List<string> languages { get; set; } // fr, en, de, nl => Sélection dans une liste déjà établie dans l'application !
|
||||||
public DateTime dateCreation { get; set; }
|
public DateTime dateCreation { get; set; }
|
||||||
|
public bool isMobile { get; set; } // MyVisit - True if for mobile (MyVisit)
|
||||||
|
public bool isOffline { get; set; } // MyVisit - True if MyVisit is full offline
|
||||||
|
/*public string latitude { get; set; } // MyVisit - latitude of visit ? (MyVisit)
|
||||||
|
public string longitude { get; set; } // MyVisit - True if for mobile (MyVisit)*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
19
Manager.Interfaces/DTO/SubSection/ArticleDTO.cs
Normal file
19
Manager.Interfaces/DTO/SubSection/ArticleDTO.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using Manager.Interfaces.Models;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace Manager.Interfaces.DTO
|
||||||
|
{
|
||||||
|
public class ArticleDTO
|
||||||
|
{
|
||||||
|
public List<TranslationDTO> title { get; set; }
|
||||||
|
public List<TranslationDTO> description { 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 string audioId { get; set; } // MyVisit - Audio Identifier
|
||||||
|
public bool isReadAudioAuto { get; set; } // MyVisit - True for audio play when open the article / false otherwise
|
||||||
|
public List<ImageDTO> images { get; set; } // Will check if ok or if we need need type of image (simpler)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -31,6 +31,12 @@ namespace Manager.Interfaces.Models
|
|||||||
[BsonElement("DateCreation")]
|
[BsonElement("DateCreation")]
|
||||||
public DateTime DateCreation { get; set; }
|
public DateTime DateCreation { get; set; }
|
||||||
|
|
||||||
|
[BsonElement("IsMobile")]
|
||||||
|
public bool IsMobile { get; set; }
|
||||||
|
|
||||||
|
[BsonElement("IsOffline")]
|
||||||
|
public bool IsOffline { get; set; }
|
||||||
|
|
||||||
public ConfigurationDTO ToDTO()
|
public ConfigurationDTO ToDTO()
|
||||||
{
|
{
|
||||||
return new ConfigurationDTO()
|
return new ConfigurationDTO()
|
||||||
@ -40,7 +46,9 @@ namespace Manager.Interfaces.Models
|
|||||||
dateCreation = DateCreation,
|
dateCreation = DateCreation,
|
||||||
primaryColor = PrimaryColor,
|
primaryColor = PrimaryColor,
|
||||||
languages = Languages,
|
languages = Languages,
|
||||||
secondaryColor = SecondaryColor
|
secondaryColor = SecondaryColor,
|
||||||
|
isMobile = IsMobile,
|
||||||
|
isOffline = IsOffline
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +61,8 @@ namespace Manager.Interfaces.Models
|
|||||||
primaryColor = PrimaryColor,
|
primaryColor = PrimaryColor,
|
||||||
languages = Languages,
|
languages = Languages,
|
||||||
secondaryColor = SecondaryColor,
|
secondaryColor = SecondaryColor,
|
||||||
|
isMobile = IsMobile,
|
||||||
|
isOffline = IsOffline,
|
||||||
sections = sections,
|
sections = sections,
|
||||||
resources = resources
|
resources = resources
|
||||||
};
|
};
|
||||||
|
|||||||
@ -89,6 +89,7 @@ namespace Manager.Interfaces.Models
|
|||||||
Video,
|
Video,
|
||||||
Web,
|
Web,
|
||||||
Menu,
|
Menu,
|
||||||
Quizz
|
Quizz,
|
||||||
|
Article
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -111,6 +111,8 @@ namespace ManagerService.Controllers
|
|||||||
configuration.SecondaryColor = newConfiguration.secondaryColor;
|
configuration.SecondaryColor = newConfiguration.secondaryColor;
|
||||||
configuration.Languages = new List<string> { "FR", "NL", "EN", "DE" }; // by default all languages
|
configuration.Languages = new List<string> { "FR", "NL", "EN", "DE" }; // by default all languages
|
||||||
configuration.DateCreation = DateTime.Now;
|
configuration.DateCreation = DateTime.Now;
|
||||||
|
configuration.IsMobile = newConfiguration.isMobile;
|
||||||
|
configuration.IsOffline = newConfiguration.isOffline;
|
||||||
|
|
||||||
Configuration configurationCreated = _configurationService.Create(configuration);
|
Configuration configurationCreated = _configurationService.Create(configuration);
|
||||||
|
|
||||||
@ -157,6 +159,8 @@ namespace ManagerService.Controllers
|
|||||||
configuration.PrimaryColor = updatedConfiguration.primaryColor;
|
configuration.PrimaryColor = updatedConfiguration.primaryColor;
|
||||||
configuration.SecondaryColor = updatedConfiguration.secondaryColor;
|
configuration.SecondaryColor = updatedConfiguration.secondaryColor;
|
||||||
configuration.Languages = updatedConfiguration.languages;
|
configuration.Languages = updatedConfiguration.languages;
|
||||||
|
configuration.IsMobile = updatedConfiguration.isMobile;
|
||||||
|
configuration.IsOffline = updatedConfiguration.isOffline;
|
||||||
|
|
||||||
Configuration configurationModified = _configurationService.Update(updatedConfiguration.id, configuration);
|
Configuration configurationModified = _configurationService.Update(updatedConfiguration.id, configuration);
|
||||||
|
|
||||||
@ -326,6 +330,16 @@ namespace ManagerService.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SectionType.Article:
|
||||||
|
ArticleDTO articleDTO = JsonConvert.DeserializeObject<ArticleDTO>(section.data);
|
||||||
|
foreach (var image in articleDTO.images)
|
||||||
|
{
|
||||||
|
if (image.resourceId != null)
|
||||||
|
{
|
||||||
|
addResourceToList(resourceDTOs, image.resourceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SectionType.Menu:
|
case SectionType.Menu:
|
||||||
case SectionType.Web:
|
case SectionType.Web:
|
||||||
case SectionType.Video:
|
case SectionType.Video:
|
||||||
@ -388,6 +402,8 @@ namespace ManagerService.Controllers
|
|||||||
configuration.PrimaryColor = exportConfiguration.primaryColor;
|
configuration.PrimaryColor = exportConfiguration.primaryColor;
|
||||||
configuration.SecondaryColor = exportConfiguration.secondaryColor;
|
configuration.SecondaryColor = exportConfiguration.secondaryColor;
|
||||||
configuration.Languages = exportConfiguration.languages;
|
configuration.Languages = exportConfiguration.languages;
|
||||||
|
configuration.IsMobile = exportConfiguration.isMobile;
|
||||||
|
configuration.IsOffline = exportConfiguration.isOffline;
|
||||||
|
|
||||||
_configurationService.Create(configuration);
|
_configurationService.Create(configuration);
|
||||||
|
|
||||||
@ -484,6 +500,16 @@ namespace ManagerService.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SectionType.Article:
|
||||||
|
ArticleDTO articleDTO = JsonConvert.DeserializeObject<ArticleDTO>(section.data);
|
||||||
|
foreach (var image in articleDTO.images)
|
||||||
|
{
|
||||||
|
if (image.resourceId != null)
|
||||||
|
{
|
||||||
|
createResource(exportConfiguration.resources.Where(r => r.id == image.resourceId).FirstOrDefault());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SectionType.Menu:
|
case SectionType.Menu:
|
||||||
case SectionType.Web:
|
case SectionType.Web:
|
||||||
case SectionType.Video:
|
case SectionType.Video:
|
||||||
|
|||||||
@ -357,6 +357,17 @@ namespace ManagerService.Controllers
|
|||||||
}
|
}
|
||||||
section.Data = JsonConvert.SerializeObject(quizzDTO);
|
section.Data = JsonConvert.SerializeObject(quizzDTO);
|
||||||
break;
|
break;
|
||||||
|
case SectionType.Article:
|
||||||
|
ArticleDTO articleDTO = JsonConvert.DeserializeObject<ArticleDTO>(section.Data);
|
||||||
|
List<ImageDTO> imagesArticleToKeep = new List<ImageDTO>();
|
||||||
|
foreach (var image in articleDTO.images)
|
||||||
|
{
|
||||||
|
if (image.resourceId != id)
|
||||||
|
imagesArticleToKeep.Add(image);
|
||||||
|
}
|
||||||
|
articleDTO.images = imagesArticleToKeep;
|
||||||
|
section.Data = JsonConvert.SerializeObject(articleDTO);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_sectionService.Update(section.Id, section);
|
_sectionService.Update(section.Id, section);
|
||||||
|
|||||||
@ -621,5 +621,15 @@ namespace ManagerService.Controllers
|
|||||||
{
|
{
|
||||||
return new ObjectResult("QuizzDTO") { StatusCode = 200 };
|
return new ObjectResult("QuizzDTO") { StatusCode = 200 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Useless, just to generate dto code
|
||||||
|
/// </summary>
|
||||||
|
[ProducesResponseType(typeof(ArticleDTO), 200)]
|
||||||
|
[HttpGet("ArticleDTO")]
|
||||||
|
public ObjectResult GetArticleDTO()
|
||||||
|
{
|
||||||
|
return new ObjectResult("ArticleDTO") { StatusCode = 200 };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user