138 lines
3.6 KiB
C#
138 lines
3.6 KiB
C#
using ManagerService.DTOs;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
|
|
|
|
namespace ManagerService.Data
|
|
{
|
|
/// <summary>
|
|
/// Section Information
|
|
/// </summary>
|
|
public class Section
|
|
{
|
|
[Key]
|
|
[Required]
|
|
/*[BsonId]
|
|
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]*/
|
|
public string Id { get; set; }
|
|
|
|
//[BsonElement("Label")]
|
|
//[BsonRequired]
|
|
[Required]
|
|
public string Label { get; set; } // Use in manager
|
|
|
|
//[BsonElement("Title")]
|
|
//[BsonRequired]
|
|
[Required]
|
|
[Column(TypeName = "jsonb")]
|
|
public List<Translation> Title { get; set; }
|
|
|
|
//[BsonElement("Description")]
|
|
[Column(TypeName = "jsonb")]
|
|
public List<Translation> Description { get; set; }
|
|
|
|
//[BsonElement("Order")]
|
|
public int Order { get; set; }
|
|
|
|
//[BsonElement("ConfigurationId")]
|
|
//[BsonRequired]
|
|
[Required]
|
|
public string ConfigurationId { get; set; } // Parent id
|
|
|
|
//[BsonElement("ImageId")]
|
|
//[BsonRequired]
|
|
[Required]
|
|
public string ImageId { get; set; }
|
|
|
|
//[BsonElement("ImageSource")]
|
|
//[BsonRequired]
|
|
[Required]
|
|
public string ImageSource { get; set; }
|
|
|
|
//[BsonElement("Type")]
|
|
//[BsonRequired]
|
|
[Required]
|
|
public SectionType Type { get; set; }
|
|
|
|
//[BsonElement("IsSubSection")]
|
|
//[BsonRequired]
|
|
[Required]
|
|
public bool IsSubSection { get; set; }
|
|
|
|
//[BsonElement("ParentId")]
|
|
public string ParentId { get; set; } // only if it's an subsection
|
|
|
|
//[BsonElement("DateCreation")]
|
|
public DateTime DateCreation { get; set; }
|
|
|
|
//[BsonElement("Data")]
|
|
//[BsonRequired]
|
|
[Required]
|
|
public string Data { get; set; } // Json encapsulated section info
|
|
|
|
//[BsonElement("InstanceId")]
|
|
//[BsonRequired]
|
|
[Required]
|
|
public string InstanceId { get; set; }
|
|
|
|
//[BsonElement("IsBeacon")]
|
|
public bool IsBeacon { get; set; }
|
|
|
|
//[BsonElement("BeaconId")]
|
|
public int? 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()
|
|
{
|
|
return new SectionDTO()
|
|
{
|
|
id = Id,
|
|
label = Label,
|
|
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
|
|
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
|
|
order = Order,
|
|
type = Type,
|
|
imageId = ImageId,
|
|
imageSource = ImageSource,
|
|
configurationId = ConfigurationId,
|
|
isSubSection = IsSubSection,
|
|
parentId = ParentId,
|
|
data = Data,
|
|
dateCreation = DateCreation,
|
|
instanceId = InstanceId,
|
|
isBeacon = IsBeacon,
|
|
beaconId = BeaconId,
|
|
latitude = Latitude,
|
|
longitude = Longitude,
|
|
meterZoneGPS = MeterZoneGPS,
|
|
};
|
|
}
|
|
}
|
|
|
|
public enum SectionType
|
|
{
|
|
Map,
|
|
Slider,
|
|
Video,
|
|
Web,
|
|
Menu,
|
|
Quizz,
|
|
Article,
|
|
PDF,
|
|
Puzzle,
|
|
Agenda,
|
|
Weather
|
|
}
|
|
}
|