89 lines
2.4 KiB
C#
89 lines
2.4 KiB
C#
using ManagerService.Data.SubSection;
|
|
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]
|
|
public string Id { get; set; }
|
|
|
|
[Required]
|
|
public string Label { get; set; } // Use in manager
|
|
|
|
[Required]
|
|
[Column(TypeName = "jsonb")]
|
|
public List<Translation> Title { get; set; }
|
|
|
|
[Column(TypeName = "jsonb")]
|
|
public List<Translation> Description { get; set; }
|
|
|
|
public int Order { get; set; }
|
|
|
|
[Required]
|
|
public string ConfigurationId { get; set; } // Parent id
|
|
|
|
public string ImageId { get; set; }
|
|
|
|
public string ImageSource { get; set; }
|
|
|
|
[Required]
|
|
public SectionType Type { get; set; }
|
|
|
|
[Required]
|
|
public bool IsSubSection { get; set; }
|
|
|
|
public string ParentId { get; set; } // only if it's an subsection
|
|
|
|
public DateTime DateCreation { get; set; }
|
|
|
|
[Required]
|
|
public string InstanceId { get; set; }
|
|
|
|
public bool IsBeacon { get; set; }
|
|
|
|
public int? BeaconId { get; set; }
|
|
|
|
public string Latitude { get; set; }
|
|
|
|
public string Longitude { get; set; }
|
|
|
|
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,
|
|
dateCreation = DateCreation,
|
|
instanceId = InstanceId,
|
|
isBeacon = IsBeacon,
|
|
beaconId = BeaconId,
|
|
latitude = Latitude,
|
|
longitude = Longitude,
|
|
meterZoneGPS = MeterZoneGPS,
|
|
};
|
|
}
|
|
}
|
|
}
|