Add JsonPropertyName attributes to DTO properties for serialization

This commit is contained in:
2025-11-13 16:19:14 +00:00
parent 10017850f8
commit 0bbf821489
59 changed files with 915 additions and 397 deletions

View File

@@ -23,9 +23,14 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class BaseDto<TKey> public class BaseDto<TKey>
{ {
public TKey Id; [JsonPropertyName("id")]
[Required]
public TKey Id { get; set; }
} }

View File

@@ -23,47 +23,85 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
using Marechai.Database; using Marechai.Database;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class BasePhotoDto : BaseDto<Guid> public class BasePhotoDto : BaseDto<Guid>
{ {
public double? Aperture { get; set; } [JsonPropertyName("aperture")]
public string Author { get; set; } public double? Aperture { get; set; }
public string CameraManufacturer { get; set; } [JsonPropertyName("author")]
public string CameraModel { get; set; } public string Author { get; set; }
public ColorSpace? ColorSpace { get; set; } [JsonPropertyName("camera_manufacturer")]
public string Comments { get; set; } public string CameraManufacturer { get; set; }
public Contrast? Contrast { get; set; } [JsonPropertyName("camera_model")]
public DateTime? CreationDate { get; set; } public string CameraModel { get; set; }
public double? DigitalZoomRatio { get; set; } [JsonPropertyName("colorspace")]
public string ExifVersion { get; set; } public ColorSpace? ColorSpace { get; set; }
public double? ExposureTime { get; set; } [JsonPropertyName("comments")]
public ExposureMode? ExposureMethod { get; set; } public string Comments { get; set; }
public ExposureProgram? ExposureProgram { get; set; } [JsonPropertyName("contrast")]
public Flash? Flash { get; set; } public Contrast? Contrast { get; set; }
public double? Focal { get; set; } [JsonPropertyName("creation_date")]
public double? FocalLength { get; set; } public DateTime? CreationDate { get; set; }
public double? FocalLengthEquivalent { get; set; } [JsonPropertyName("digital_zoom")]
public double? HorizontalResolution { get; set; } public double? DigitalZoomRatio { get; set; }
public ushort? IsoRating { get; set; } [JsonPropertyName("exif_version")]
public string Lens { get; set; } public string ExifVersion { get; set; }
public LightSource? LightSource { get; set; } [JsonPropertyName("exposure")]
public MeteringMode? MeteringMode { get; set; } public double? ExposureTime { get; set; }
public ResolutionUnit? ResolutionUnit { get; set; } [JsonPropertyName("exposure_method")]
public Orientation? Orientation { get; set; } public ExposureMode? ExposureMethod { get; set; }
public Saturation? Saturation { get; set; } [JsonPropertyName("exposure_program")]
public SceneCaptureType? SceneCaptureType { get; set; } public ExposureProgram? ExposureProgram { get; set; }
public SensingMethod? SensingMethod { get; set; } [JsonPropertyName("flash")]
public Sharpness? Sharpness { get; set; } public Flash? Flash { get; set; }
public string SoftwareUsed { get; set; } [JsonPropertyName("focal")]
public SubjectDistanceRange? SubjectDistanceRange { get; set; } public double? Focal { get; set; }
public DateTime UploadDate { get; set; } [JsonPropertyName("focal_length")]
public double? VerticalResolution { get; set; } public double? FocalLength { get; set; }
public WhiteBalance? WhiteBalance { get; set; } [JsonPropertyName("focal_equivalent")]
public string UserId { get; set; } public double? FocalLengthEquivalent { get; set; }
public string LicenseName { get; set; } [JsonPropertyName("horizontal_resolution")]
public int LicenseId { get; set; } public double? HorizontalResolution { get; set; }
public string OriginalExtension { get; set; } [JsonPropertyName("iso")]
public ushort? IsoRating { get; set; }
[JsonPropertyName("lens")]
public string Lens { get; set; }
[JsonPropertyName("light_source")]
public LightSource? LightSource { get; set; }
[JsonPropertyName("metering_mode")]
public MeteringMode? MeteringMode { get; set; }
[JsonPropertyName("resolution_unit")]
public ResolutionUnit? ResolutionUnit { get; set; }
[JsonPropertyName("orientation")]
public Orientation? Orientation { get; set; }
[JsonPropertyName("saturation")]
public Saturation? Saturation { get; set; }
[JsonPropertyName("scene_capture_type")]
public SceneCaptureType? SceneCaptureType { get; set; }
[JsonPropertyName("sensing_method")]
public SensingMethod? SensingMethod { get; set; }
[JsonPropertyName("sharpness")]
public Sharpness? Sharpness { get; set; }
[JsonPropertyName("software")]
public string SoftwareUsed { get; set; }
[JsonPropertyName("subject_distance_range")]
public SubjectDistanceRange? SubjectDistanceRange { get; set; }
[JsonPropertyName("upload_date")]
public DateTime UploadDate { get; set; }
[JsonPropertyName("vertical_resolution")]
public double? VerticalResolution { get; set; }
[JsonPropertyName("white_balance")]
public WhiteBalance? WhiteBalance { get; set; }
[JsonPropertyName("user_id")]
public string UserId { get; set; }
[JsonPropertyName("license_name")]
public string LicenseName { get; set; }
[JsonPropertyName("license_id")]
public int LicenseId { get; set; }
[JsonPropertyName("original_extension")]
public string OriginalExtension { get; set; }
} }

View File

@@ -23,24 +23,39 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
using Marechai.Database; using Marechai.Database;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class BaseScanDto : BaseDto<Guid> public class BaseScanDto : BaseDto<Guid>
{ {
public string Author { get; set; } [JsonPropertyName("author")]
public ColorSpace? ColorSpace { get; set; } public string Author { get; set; }
public string Comments { get; set; } [JsonPropertyName("colorspace")]
public DateTime? CreationDate { get; set; } public ColorSpace? ColorSpace { get; set; }
public string ExifVersion { get; set; } [JsonPropertyName("comments")]
public double? HorizontalResolution { get; set; } public string Comments { get; set; }
public ResolutionUnit? ResolutionUnit { get; set; } [JsonPropertyName("creation_date")]
public string ScannerManufacturer { get; set; } public DateTime? CreationDate { get; set; }
public string ScannerModel { get; set; } [JsonPropertyName("exif_version")]
public string SoftwareUsed { get; set; } public string ExifVersion { get; set; }
public DateTime UploadDate { get; set; } [JsonPropertyName("horizontal_resolution")]
public double? VerticalResolution { get; set; } public double? HorizontalResolution { get; set; }
public string OriginalExtension { get; set; } [JsonPropertyName("resolution_unit")]
public string UserId { get; set; } public ResolutionUnit? ResolutionUnit { get; set; }
[JsonPropertyName("scanner_manufacturer")]
public string ScannerManufacturer { get; set; }
[JsonPropertyName("scanner_model")]
public string ScannerModel { get; set; }
[JsonPropertyName("software")]
public string SoftwareUsed { get; set; }
[JsonPropertyName("upload_date")]
public DateTime UploadDate { get; set; }
[JsonPropertyName("vertical_resolution")]
public double? VerticalResolution { get; set; }
[JsonPropertyName("original_extension")]
public string OriginalExtension { get; set; }
[JsonPropertyName("user_id")]
public string UserId { get; set; }
} }

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class BookByMachineDto : BaseDto<long> public class BookByMachineDto : BaseDto<long>
{ {
public long BookId { get; set; } [JsonPropertyName("book_id")]
public string Book { get; set; } public long BookId { get; set; }
public int MachineId { get; set; } [JsonPropertyName("book")]
public string Machine { get; set; } public string Book { get; set; }
[JsonPropertyName("machine_id")]
public int MachineId { get; set; }
[JsonPropertyName("machine")]
public string Machine { get; set; }
} }

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class BookByMachineFamilyDto : BaseDto<long> public class BookByMachineFamilyDto : BaseDto<long>
{ {
public long BookId { get; set; } [JsonPropertyName("book_id")]
public string Book { get; set; } public long BookId { get; set; }
public int MachineFamilyId { get; set; } [JsonPropertyName("book")]
public string MachineFamily { get; set; } public string Book { get; set; }
[JsonPropertyName("machine_family_id")]
public int MachineFamilyId { get; set; }
[JsonPropertyName("machine_family")]
public string MachineFamily { get; set; }
} }

View File

@@ -1,10 +1,17 @@
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class BookDto : DocumentBaseDto public class BookDto : DocumentBaseDto
{ {
public string Isbn { get; set; } [JsonPropertyName("isbn")]
public short? Pages { get; set; } public string Isbn { get; set; }
public int? Edition { get; set; } [JsonPropertyName("pages")]
public long? PreviousId { get; set; } public short? Pages { get; set; }
public long? SourceId { get; set; } [JsonPropertyName("edition")]
public int? Edition { get; set; }
[JsonPropertyName("previous_id")]
public long? PreviousId { get; set; }
[JsonPropertyName("source_id")]
public long? SourceId { get; set; }
} }

View File

@@ -23,10 +23,14 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class BookScanDto : DocumentScanBaseDto public class BookScanDto : DocumentScanBaseDto
{ {
public long BookId { get; set; } [JsonPropertyName("book_id")]
public string Book { get; set; } public long BookId { get; set; }
[JsonPropertyName("book")]
public string Book { get; set; }
} }

View File

@@ -23,13 +23,20 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class CompanyByBookDto : BaseDto<long> public class CompanyByBookDto : BaseDto<long>
{ {
public int CompanyId { get; set; } [JsonPropertyName("company_id")]
public long BookId { get; set; } public int CompanyId { get; set; }
public string RoleId { get; set; } [JsonPropertyName("book_id")]
public string Company { get; set; } public long BookId { get; set; }
public string Role { get; set; } [JsonPropertyName("role_id")]
public string RoleId { get; set; }
[JsonPropertyName("company")]
public string Company { get; set; }
[JsonPropertyName("role")]
public string Role { get; set; }
} }

View File

@@ -23,13 +23,20 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class CompanyByDocumentDto : BaseDto<long> public class CompanyByDocumentDto : BaseDto<long>
{ {
public int CompanyId { get; set; } [JsonPropertyName("company_id")]
public long DocumentId { get; set; } public int CompanyId { get; set; }
public string RoleId { get; set; } [JsonPropertyName("document_id")]
public string Company { get; set; } public long DocumentId { get; set; }
public string Role { get; set; } [JsonPropertyName("role_id")]
public string RoleId { get; set; }
[JsonPropertyName("company")]
public string Company { get; set; }
[JsonPropertyName("role")]
public string Role { get; set; }
} }

View File

@@ -23,13 +23,20 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class CompanyByMagazineDto : BaseDto<long> public class CompanyByMagazineDto : BaseDto<long>
{ {
public int CompanyId { get; set; } [JsonPropertyName("company_id")]
public long MagazineId { get; set; } public int CompanyId { get; set; }
public string RoleId { get; set; } [JsonPropertyName("magazine_id")]
public string Company { get; set; } public long MagazineId { get; set; }
public string Role { get; set; } [JsonPropertyName("role_id")]
public string RoleId { get; set; }
[JsonPropertyName("company")]
public string Company { get; set; }
[JsonPropertyName("role")]
public string Role { get; set; }
} }

View File

@@ -23,13 +23,20 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class CompanyBySoftwareFamilyDto : BaseDto<ulong> public class CompanyBySoftwareFamilyDto : BaseDto<ulong>
{ {
public int CompanyId { get; set; } [JsonPropertyName("company_id")]
public ulong SoftwareFamilyId { get; set; } public int CompanyId { get; set; }
public string RoleId { get; set; } [JsonPropertyName("software_family_id")]
public string Company { get; set; } public ulong SoftwareFamilyId { get; set; }
public string Role { get; set; } [JsonPropertyName("role_id")]
public string RoleId { get; set; }
[JsonPropertyName("company")]
public string Company { get; set; }
[JsonPropertyName("role")]
public string Role { get; set; }
} }

View File

@@ -23,13 +23,20 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class CompanyBySoftwareVariantDto : BaseDto<ulong> public class CompanyBySoftwareVariantDto : BaseDto<ulong>
{ {
public int CompanyId { get; set; } [JsonPropertyName("company_id")]
public ulong SoftwareVariantId { get; set; } public int CompanyId { get; set; }
public string RoleId { get; set; } [JsonPropertyName("software_variant_id")]
public string Company { get; set; } public ulong SoftwareVariantId { get; set; }
public string Role { get; set; } [JsonPropertyName("role_id")]
public string RoleId { get; set; }
[JsonPropertyName("company")]
public string Company { get; set; }
[JsonPropertyName("role")]
public string Role { get; set; }
} }

View File

@@ -23,13 +23,20 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class CompanyBySoftwareVersionDto : BaseDto<ulong> public class CompanyBySoftwareVersionDto : BaseDto<ulong>
{ {
public int CompanyId { get; set; } [JsonPropertyName("company_id")]
public ulong SoftwareVersionId { get; set; } public int CompanyId { get; set; }
public string RoleId { get; set; } [JsonPropertyName("software_version_id")]
public string Company { get; set; } public ulong SoftwareVersionId { get; set; }
public string Role { get; set; } [JsonPropertyName("role_id")]
public string RoleId { get; set; }
[JsonPropertyName("company")]
public string Company { get; set; }
[JsonPropertyName("role")]
public string Role { get; set; }
} }

View File

@@ -23,11 +23,16 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class CompanyDescriptionDto : BaseDto<int> public class CompanyDescriptionDto : BaseDto<int>
{ {
public string Markdown { get; set; } [JsonPropertyName("markdown")]
public string Html { get; set; } public string Markdown { get; set; }
public int CompanyId { get; set; } [JsonPropertyName("html")]
public string Html { get; set; }
[JsonPropertyName("company_id")]
public int CompanyId { get; set; }
} }

View File

@@ -23,34 +23,58 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using Marechai.Database; using Marechai.Database;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class CompanyDto : BaseDto<int> public class CompanyDto : BaseDto<int>
{ {
public string Name { get; set; } [JsonPropertyName("name")]
public DateTime? Founded { get; set; } [Required]
public string Website { get; set; } public string Name { get; set; }
public string Twitter { get; set; } [JsonPropertyName("founded")]
public string Facebook { get; set; } public DateTime? Founded { get; set; }
public DateTime? Sold { get; set; } [JsonPropertyName("website")]
public int? SoldToId { get; set; } public string Website { get; set; }
public string Address { get; set; } [JsonPropertyName("twitter")]
public string City { get; set; } public string Twitter { get; set; }
public string Province { get; set; } [JsonPropertyName("facebook")]
public string PostalCode { get; set; } public string Facebook { get; set; }
public short? CountryId { get; set; } [JsonPropertyName("sold")]
public CompanyStatus Status { get; set; } public DateTime? Sold { get; set; }
public Guid? LastLogo { get; set; } [JsonPropertyName("sold_to_id")]
public string SoldTo { get; set; } public int? SoldToId { get; set; }
public string Country { get; set; } [JsonPropertyName("address")]
public bool FoundedDayIsUnknown { get; set; } public string Address { get; set; }
public bool FoundedMonthIsUnknown { get; set; } [JsonPropertyName("city")]
public bool SoldDayIsUnknown { get; set; } public string City { get; set; }
public bool SoldMonthIsUnknown { get; set; } [JsonPropertyName("province")]
public string LegalName { get; set; } public string Province { get; set; }
[JsonPropertyName("postal_code")]
public string PostalCode { get; set; }
[JsonPropertyName("country_id")]
public short? CountryId { get; set; }
[JsonPropertyName("status")]
public CompanyStatus Status { get; set; }
[JsonPropertyName("last_logo")]
public Guid? LastLogo { get; set; }
[JsonPropertyName("sold_to")]
public string SoldTo { get; set; }
[JsonPropertyName("country")]
public string Country { get; set; }
[JsonPropertyName("founded_day_is_unknown")]
public bool FoundedDayIsUnknown { get; set; }
[JsonPropertyName("founded_month_is_unknown")]
public bool FoundedMonthIsUnknown { get; set; }
[JsonPropertyName("sold_day_is_unknown")]
public bool SoldDayIsUnknown { get; set; }
[JsonPropertyName("sold_month_is_unknown")]
public bool SoldMonthIsUnknown { get; set; }
[JsonPropertyName("legal_name")]
public string LegalName { get; set; }
[JsonIgnore]
public string SoldView => Status != CompanyStatus.Active && Status != CompanyStatus.Unknown public string SoldView => Status != CompanyStatus.Active && Status != CompanyStatus.Unknown
? Sold?.ToShortDateString() ?? "Unknown" ? Sold?.ToShortDateString() ?? "Unknown"
: Sold?.ToShortDateString() ?? (SoldTo is null ? "" : "Unknown"); : Sold?.ToShortDateString() ?? (SoldTo is null ? "" : "Unknown");

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class CurrencyInflationDto : BaseDto<int> public class CurrencyInflationDto : BaseDto<int>
{ {
[JsonPropertyName("code")]
public string CurrencyCode { get; set; } public string CurrencyCode { get; set; }
[JsonPropertyName("name")]
public string CurrencyName { get; set; } public string CurrencyName { get; set; }
public uint Year { get; set; } [JsonPropertyName("year")]
public float Inflation { get; set; } public uint Year { get; set; }
[JsonPropertyName("inflation")]
public float Inflation { get; set; }
} }

View File

@@ -23,15 +23,24 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class CurrencyPeggingDto : BaseDto<int> public class CurrencyPeggingDto : BaseDto<int>
{ {
public string SourceCode { get; set; } [JsonPropertyName("source_code")]
public string DestinationCode { get; set; } public string SourceCode { get; set; }
public string SourceName { get; set; } [JsonPropertyName("destination_code")]
public string DestinationName { get; set; } public string DestinationCode { get; set; }
public float Ratio { get; set; } [JsonPropertyName("source_name")]
public DateTime Start { get; set; } public string SourceName { get; set; }
public DateTime? End { get; set; } [JsonPropertyName("destination_name")]
public string DestinationName { get; set; }
[JsonPropertyName("ratio")]
public float Ratio { get; set; }
[JsonPropertyName("start")]
public DateTime Start { get; set; }
[JsonPropertyName("end")]
public DateTime? End { get; set; }
} }

View File

@@ -1,11 +1,19 @@
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public abstract class DocumentBaseDto : BaseDto<long> public abstract class DocumentBaseDto : BaseDto<long>
{ {
public string Title { get; set; } [JsonPropertyName("title")]
public string NativeTitle { get; set; } public string Title { get; set; }
public DateTime? Published { get; set; } [JsonPropertyName("native_title")]
public short? CountryId { get; set; } public string NativeTitle { get; set; }
public string Country { get; set; } [JsonPropertyName("published")]
public string Synopsis { get; set; } public DateTime? Published { get; set; }
[JsonPropertyName("country_id")]
public short? CountryId { get; set; }
[JsonPropertyName("country")]
public string Country { get; set; }
[JsonPropertyName("synopsis")]
public string Synopsis { get; set; }
} }

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class DocumentByMachineDto : BaseDto<long> public class DocumentByMachineDto : BaseDto<long>
{ {
public long DocumentId { get; set; } [JsonPropertyName("document_id")]
public string Document { get; set; } public long DocumentId { get; set; }
public int MachineId { get; set; } [JsonPropertyName("document")]
public string Machine { get; set; } public string Document { get; set; }
[JsonPropertyName("machine_id")]
public int MachineId { get; set; }
[JsonPropertyName("machine")]
public string Machine { get; set; }
} }

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class DocumentByMachineFamilyDto : BaseDto<long> public class DocumentByMachineFamilyDto : BaseDto<long>
{ {
public long DocumentId { get; set; } [JsonPropertyName("document_id")]
public string Document { get; set; } public long DocumentId { get; set; }
public int MachineFamilyId { get; set; } [JsonPropertyName("document")]
public string MachineFamily { get; set; } public string Document { get; set; }
[JsonPropertyName("machine_family_id")]
public int MachineFamilyId { get; set; }
[JsonPropertyName("machine_family")]
public string MachineFamily { get; set; }
} }

View File

@@ -24,13 +24,17 @@
*******************************************************************************/ *******************************************************************************/
using System.ComponentModel; using System.ComponentModel;
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class DocumentCompanyDto : BaseDto<int> public class DocumentCompanyDto : BaseDto<int>
{ {
[JsonPropertyName("name")]
public string Name { get; set; } public string Name { get; set; }
[DisplayName("Linked company")] [DisplayName("Linked company")]
[JsonPropertyName("company")]
public string Company { get; set; } public string Company { get; set; }
[JsonPropertyName("company_id")]
public int? CompanyId { get; set; } public int? CompanyId { get; set; }
} }

View File

@@ -23,16 +23,25 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class DocumentPersonDto : BaseDto<int> public class DocumentPersonDto : BaseDto<int>
{ {
public string Name { get; set; } [JsonPropertyName("name")]
public string Person { get; set; } public string Name { get; set; }
public int? PersonId { get; set; } [JsonPropertyName("person")]
public string Alias { get; set; } public string Person { get; set; }
public string Surname { get; set; } [JsonPropertyName("person_id")]
public int? PersonId { get; set; }
[JsonPropertyName("alias")]
public string Alias { get; set; }
[JsonPropertyName("surname")]
public string Surname { get; set; }
[JsonPropertyName("display_name")]
public string DisplayName { get; set; } public string DisplayName { get; set; }
[JsonIgnore]
public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}"; public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}";
} }

View File

@@ -23,10 +23,14 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class DocumentRoleDto : BaseDto<string> public class DocumentRoleDto : BaseDto<string>
{ {
public string Name { get; set; } [JsonPropertyName("name")]
public bool Enabled { get; set; } public string Name { get; set; }
[JsonPropertyName("enabled")]
public bool Enabled { get; set; }
} }

View File

@@ -23,12 +23,15 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
using Marechai.Database; using Marechai.Database;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class DocumentScanBaseDto : BaseScanDto public class DocumentScanBaseDto : BaseScanDto
{ {
[JsonPropertyName("type")]
public DocumentScanType Type { get; set; } public DocumentScanType Type { get; set; }
public uint? Page { get; set; } [JsonPropertyName("page")]
public uint? Page { get; set; }
} }

View File

@@ -23,10 +23,14 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class DocumentScanDto : DocumentScanBaseDto public class DocumentScanDto : DocumentScanBaseDto
{ {
public long DocumentId { get; set; } [JsonPropertyName("document_id")]
public string Document { get; set; } public long DocumentId { get; set; }
[JsonPropertyName("document")]
public string Document { get; set; }
} }

View File

@@ -23,16 +23,26 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class DumpDto : BaseDto<ulong> public class DumpDto : BaseDto<ulong>
{ {
public string Dumper { get; set; } [JsonPropertyName("dumper")]
public string UserId { get; set; } public string Dumper { get; set; }
public string DumpingGroup { get; set; } [JsonPropertyName("user_id")]
public DateTime? DumpDate { get; set; } public string UserId { get; set; }
public string UserName { get; set; } [JsonPropertyName("dumping_group")]
public ulong MediaId { get; set; } public string DumpingGroup { get; set; }
public string MediaTitle { get; set; } [JsonPropertyName("dump_date")]
public ulong MediaDumpId { get; set; } public DateTime? DumpDate { get; set; }
[JsonPropertyName("username")]
public string UserName { get; set; }
[JsonPropertyName("media_id")]
public ulong MediaId { get; set; }
[JsonPropertyName("media_title")]
public string MediaTitle { get; set; }
[JsonPropertyName("media_dump_id")]
public ulong MediaDumpId { get; set; }
} }

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class GpuByMachineDto : BaseDto<long> public class GpuByMachineDto : BaseDto<long>
{ {
public int GpuId { get; set; } [JsonPropertyName("gpu_id")]
public int MachineId { get; set; } public int GpuId { get; set; }
[JsonPropertyName("machine_id")]
public int MachineId { get; set; }
[JsonPropertyName("company")]
public string CompanyName { get; set; } public string CompanyName { get; set; }
public string Name { get; set; } [JsonPropertyName("name")]
public string Name { get; set; }
} }

View File

@@ -23,20 +23,32 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class GpuDto : BaseDto<int> public class GpuDto : BaseDto<int>
{ {
public string Name { get; set; } [JsonPropertyName("name")]
public int? CompanyId { get; set; } public string Name { get; set; }
public string Company { get; set; } [JsonPropertyName("company_id")]
public string ModelCode { get; set; } public int? CompanyId { get; set; }
public DateTime? Introduced { get; set; } [JsonPropertyName("company")]
public string Package { get; set; } public string Company { get; set; }
public string Process { get; set; } [JsonPropertyName("model_code")]
public float? ProcessNm { get; set; } public string ModelCode { get; set; }
public float? DieSize { get; set; } [JsonPropertyName("introduced")]
public long? Transistors { get; set; } public DateTime? Introduced { get; set; }
[JsonPropertyName("package")]
public string Package { get; set; }
[JsonPropertyName("process")]
public string Process { get; set; }
[JsonPropertyName("process_nm")]
public float? ProcessNm { get; set; }
[JsonPropertyName("die_size")]
public float? DieSize { get; set; }
[JsonPropertyName("transistors")]
public long? Transistors { get; set; }
[JsonIgnore]
public string IntroducedView => Introduced?.ToShortDateString() ?? "Unknown"; public string IntroducedView => Introduced?.ToShortDateString() ?? "Unknown";
} }

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class InstructionSetExtensionByProcessorDto : BaseDto<int> public class InstructionSetExtensionByProcessorDto : BaseDto<int>
{ {
public string Extension { get; set; } [JsonPropertyName("extensions")]
public string Processor { get; set; } public string Extension { get; set; }
public int ProcessorId { get; set; } [JsonPropertyName("processor")]
public int ExtensionId { get; set; } public string Processor { get; set; }
[JsonPropertyName("processor_id")]
public int ProcessorId { get; set; }
[JsonPropertyName("extension_id")]
public int ExtensionId { get; set; }
} }

View File

@@ -23,27 +23,39 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
using Marechai.Database; using Marechai.Database;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class MachineDto : BaseDto<int> public class MachineDto : BaseDto<int>
{ {
public string Name { get; set; } [JsonPropertyName("name")]
public string Model { get; set; } public string Name { get; set; }
public int CompanyId { get; set; } [JsonPropertyName("model")]
public Guid? CompanyLogo { get; set; } public string Model { get; set; }
public DateTime? Introduced { get; set; } [JsonPropertyName("company_id")]
public int? FamilyId { get; set; } public int CompanyId { get; set; }
public string FamilyName { get; set; } [JsonPropertyName("company_logo")]
public Guid? CompanyLogo { get; set; }
[JsonPropertyName("introduced")]
public DateTime? Introduced { get; set; }
[JsonPropertyName("family_id")]
public int? FamilyId { get; set; }
[JsonPropertyName("family_name")]
public string FamilyName { get; set; }
public List<GpuDto> Gpus { get; set; } public List<GpuDto> Gpus { get; set; }
public List<MemoryDto> Memory { get; set; } public List<MemoryDto> Memory { get; set; }
public List<ProcessorDto> Processors { get; set; } public List<ProcessorDto> Processors { get; set; }
public List<SoundSynthDto> SoundSynthesizers { get; set; } public List<SoundSynthDto> SoundSynthesizers { get; set; }
public List<StorageDto> Storage { get; set; } public List<StorageDto> Storage { get; set; }
public string Company { get; set; } [JsonPropertyName("company")]
public MachineType Type { get; set; } public string Company { get; set; }
public string Family { get; set; } [JsonPropertyName("type")]
public MachineType Type { get; set; }
[JsonPropertyName("family")]
public string Family { get; set; }
[JsonIgnore]
public string IntroducedView => public string IntroducedView =>
Introduced?.Year == 1000 ? "Prototype" : Introduced?.ToShortDateString() ?? "Unknown"; Introduced?.Year == 1000 ? "Prototype" : Introduced?.ToShortDateString() ?? "Unknown";
} }

View File

@@ -23,11 +23,16 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class MachineFamilyDto : BaseDto<int> public class MachineFamilyDto : BaseDto<int>
{ {
public string Company { get; set; } [JsonPropertyName("company")]
public string Name { get; set; } public string Company { get; set; }
public int CompanyId { get; set; } [JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("company_id")]
public int CompanyId { get; set; }
} }

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class MachinePhotoDto : BasePhotoDto public class MachinePhotoDto : BasePhotoDto
{ {
public string Source { get; set; } [JsonPropertyName("source")]
public string MachineName { get; set; } public string Source { get; set; }
[JsonPropertyName("machine_name")]
public string MachineName { get; set; }
[JsonPropertyName("machine_company_name")]
public string MachineCompanyName { get; set; } public string MachineCompanyName { get; set; }
public int MachineId { get; set; } [JsonPropertyName("machine_id")]
public int MachineId { get; set; }
} }

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class MagazineByMachineDto : BaseDto<long> public class MagazineByMachineDto : BaseDto<long>
{ {
public long MagazineId { get; set; } [JsonPropertyName("magazine_id")]
public string Magazine { get; set; } public long MagazineId { get; set; }
public int MachineId { get; set; } [JsonPropertyName("magazine")]
public string Machine { get; set; } public string Magazine { get; set; }
[JsonPropertyName("machine_id")]
public int MachineId { get; set; }
[JsonPropertyName("machine")]
public string Machine { get; set; }
} }

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class MagazineByMachineFamilyDto : BaseDto<long> public class MagazineByMachineFamilyDto : BaseDto<long>
{ {
public long MagazineId { get; set; } [JsonPropertyName("magazine_id")]
public string Magazine { get; set; } public long MagazineId { get; set; }
public int MachineFamilyId { get; set; } [JsonPropertyName("magazine")]
public string MachineFamily { get; set; } public string Magazine { get; set; }
[JsonPropertyName("machine_family_id")]
public int MachineFamilyId { get; set; }
[JsonPropertyName("machine_family")]
public string MachineFamily { get; set; }
} }

View File

@@ -23,10 +23,14 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class MagazineDto : DocumentBaseDto public class MagazineDto : DocumentBaseDto
{ {
public string Issn { get; set; } [JsonPropertyName("issn")]
public string Issn { get; set; }
[JsonPropertyName("first_publication")]
public DateTime? FirstPublication { get; set; } public DateTime? FirstPublication { get; set; }
} }

View File

@@ -23,16 +23,26 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class MagazineIssueDto : BaseDto<long> public class MagazineIssueDto : BaseDto<long>
{ {
public long MagazineId { get; set; } [JsonPropertyName("magazine_id")]
public string MagazineTitle { get; set; } public long MagazineId { get; set; }
public string Caption { get; set; } [JsonPropertyName("magazine_title")]
public string NativeCaption { get; set; } public string MagazineTitle { get; set; }
public DateTime? Published { get; set; } [JsonPropertyName("caption")]
public string ProductCode { get; set; } public string Caption { get; set; }
public short? Pages { get; set; } [JsonPropertyName("native_caption")]
public uint? IssueNumber { get; set; } public string NativeCaption { get; set; }
[JsonPropertyName("published")]
public DateTime? Published { get; set; }
[JsonPropertyName("product_code")]
public string ProductCode { get; set; }
[JsonPropertyName("pages")]
public short? Pages { get; set; }
[JsonPropertyName("issue_number")]
public uint? IssueNumber { get; set; }
} }

View File

@@ -23,10 +23,14 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class MagazineScanDto : DocumentScanBaseDto public class MagazineScanDto : DocumentScanBaseDto
{ {
public long MagazineId { get; set; } [JsonPropertyName("magazine_id")]
public string Magazine { get; set; } public long MagazineId { get; set; }
[JsonPropertyName("magazine")]
public string Magazine { get; set; }
} }

View File

@@ -23,6 +23,7 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
using Aaru.CommonTypes; using Aaru.CommonTypes;
using Marechai.Database; using Marechai.Database;
using Marechai.Database.Models; using Marechai.Database.Models;
@@ -31,29 +32,54 @@ namespace Marechai.Data.Dtos;
public class MediaDto : BaseDto<ulong> public class MediaDto : BaseDto<ulong>
{ {
public string Title { get; set; } [JsonPropertyName("title")]
public ushort? Sequence { get; set; } public string Title { get; set; }
public ushort? LastSequence { get; set; } [JsonPropertyName("sequence")]
public MediaType Type { get; set; } public ushort? Sequence { get; set; }
public int? WriteOffset { get; set; } [JsonPropertyName("last_sequence")]
public ushort? Sides { get; set; } public ushort? LastSequence { get; set; }
public ushort? Layers { get; set; } [JsonPropertyName("type")]
public ushort? Sessions { get; set; } public MediaType Type { get; set; }
public ushort? Tracks { get; set; } [JsonPropertyName("write_offset")]
public ulong Sectors { get; set; } public int? WriteOffset { get; set; }
public ulong Size { get; set; } [JsonPropertyName("sides")]
public string CopyProtection { get; set; } public ushort? Sides { get; set; }
public string PartNumber { get; set; } [JsonPropertyName("layers")]
public string SerialNumber { get; set; } public ushort? Layers { get; set; }
public string Barcode { get; set; } [JsonPropertyName("sessions")]
public string CatalogueNumber { get; set; } public ushort? Sessions { get; set; }
public string Manufacturer { get; set; } [JsonPropertyName("tracks")]
public string Model { get; set; } public ushort? Tracks { get; set; }
public string Revision { get; set; } [JsonPropertyName("sectors")]
public string Firmware { get; set; } public ulong Sectors { get; set; }
public int? PhysicalBlockSize { get; set; } [JsonPropertyName("size")]
public int? LogicalBlockSize { get; set; } public ulong Size { get; set; }
public VariableBlockSize[] BlockSizes { get; set; } [JsonPropertyName("copy_protection")]
public StorageInterface? StorageInterface { get; set; } public string CopyProtection { get; set; }
public OpticalDiscTrack[] TableOfContents { get; set; } [JsonPropertyName("part_number")]
public string PartNumber { get; set; }
[JsonPropertyName("serial_number")]
public string SerialNumber { get; set; }
[JsonPropertyName("barcode")]
public string Barcode { get; set; }
[JsonPropertyName("catalogue_number")]
public string CatalogueNumber { get; set; }
[JsonPropertyName("manufacturer")]
public string Manufacturer { get; set; }
[JsonPropertyName("model")]
public string Model { get; set; }
[JsonPropertyName("revision")]
public string Revision { get; set; }
[JsonPropertyName("firmware")]
public string Firmware { get; set; }
[JsonPropertyName("physical_block_size")]
public int? PhysicalBlockSize { get; set; }
[JsonPropertyName("logical_block_size")]
public int? LogicalBlockSize { get; set; }
[JsonPropertyName("block_sizes")]
public VariableBlockSize[] BlockSizes { get; set; }
[JsonPropertyName("storage_interface")]
public StorageInterface? StorageInterface { get; set; }
[JsonPropertyName("table_of_contents")]
public OpticalDiscTrack[] TableOfContents { get; set; }
} }

View File

@@ -23,15 +23,21 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
using Marechai.Database; using Marechai.Database;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class MemoryByMachineDto : BaseDto<long> public class MemoryByMachineDto : BaseDto<long>
{ {
public int MachineId { get; set; } [JsonPropertyName("machine_id")]
public MemoryType Type { get; set; } public int MachineId { get; set; }
public MemoryUsage Usage { get; set; } [JsonPropertyName("type")]
public long? Size { get; set; } public MemoryType Type { get; set; }
public double? Speed { get; set; } [JsonPropertyName("usage")]
public MemoryUsage Usage { get; set; }
[JsonPropertyName("size")]
public long? Size { get; set; }
[JsonPropertyName("speed")]
public double? Speed { get; set; }
} }

View File

@@ -23,14 +23,19 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
using Marechai.Database; using Marechai.Database;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class MemoryDto public class MemoryDto
{ {
public MemoryType Type { get; set; } [JsonPropertyName("type")]
public MemoryType Type { get; set; }
[JsonPropertyName("usage")]
public MemoryUsage Usage { get; set; } public MemoryUsage Usage { get; set; }
public long? Size { get; set; } [JsonPropertyName("size")]
public double? Speed { get; set; } public long? Size { get; set; }
[JsonPropertyName("speed")]
public double? Speed { get; set; }
} }

View File

@@ -23,6 +23,7 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
using Marechai.Database; using Marechai.Database;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
@@ -40,10 +41,16 @@ public sealed class NewsDto : BaseDto<int>
ItemName = itemName; ItemName = itemName;
} }
public NewsType Type { get; set; } [JsonPropertyName("type")]
public int AffectedId { get; set; } public NewsType Type { get; set; }
public string Controller { get; } [JsonPropertyName("affected_id")]
public string ItemName { get; } public int AffectedId { get; set; }
public string Text { get; } [JsonPropertyName("controller")]
public DateTime Timestamp { get; set; } public string Controller { get; }
[JsonPropertyName("item_name")]
public string ItemName { get; }
[JsonPropertyName("text")]
public string Text { get; }
[JsonPropertyName("timestamp")]
public DateTime Timestamp { get; set; }
} }

View File

@@ -23,18 +23,28 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class PersonByBookDto : BaseDto<long> public class PersonByBookDto : BaseDto<long>
{ {
public int PersonId { get; set; } [JsonPropertyName("person_id")]
public long BookId { get; set; } public int PersonId { get; set; }
public string RoleId { get; set; } [JsonPropertyName("book_id")]
public string Role { get; set; } public long BookId { get; set; }
public string Name { get; set; } [JsonPropertyName("role_id")]
public string Alias { get; set; } public string RoleId { get; set; }
public string Surname { get; set; } [JsonPropertyName("role")]
public string Role { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("alias")]
public string Alias { get; set; }
[JsonPropertyName("surname")]
public string Surname { get; set; }
[JsonPropertyName("display_name")]
public string DisplayName { get; set; } public string DisplayName { get; set; }
[JsonIgnore]
public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}"; public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}";
} }

View File

@@ -23,18 +23,28 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class PersonByDocumentDto : BaseDto<long> public class PersonByDocumentDto : BaseDto<long>
{ {
public int PersonId { get; set; } [JsonPropertyName("person_id")]
public long DocumentId { get; set; } public int PersonId { get; set; }
public string RoleId { get; set; } [JsonPropertyName("document_id")]
public string Role { get; set; } public long DocumentId { get; set; }
public string Name { get; set; } [JsonPropertyName("role_id")]
public string Alias { get; set; } public string RoleId { get; set; }
public string Surname { get; set; } [JsonPropertyName("role")]
public string Role { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("alias")]
public string Alias { get; set; }
[JsonPropertyName("surname")]
public string Surname { get; set; }
[JsonPropertyName("display_name")]
public string DisplayName { get; set; } public string DisplayName { get; set; }
[JsonIgnore]
public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}"; public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}";
} }

View File

@@ -23,18 +23,28 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class PersonByMagazineDto : BaseDto<long> public class PersonByMagazineDto : BaseDto<long>
{ {
public int PersonId { get; set; } [JsonPropertyName("person_id")]
public long MagazineId { get; set; } public int PersonId { get; set; }
public string RoleId { get; set; } [JsonPropertyName("magazine_id")]
public string Role { get; set; } public long MagazineId { get; set; }
public string Name { get; set; } [JsonPropertyName("role_id")]
public string Alias { get; set; } public string RoleId { get; set; }
public string Surname { get; set; } [JsonPropertyName("role")]
public string Role { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("alias")]
public string Alias { get; set; }
[JsonPropertyName("surname")]
public string Surname { get; set; }
[JsonPropertyName("display_name")]
public string DisplayName { get; set; } public string DisplayName { get; set; }
[JsonIgnore]
public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}"; public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}";
} }

View File

@@ -23,22 +23,36 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class PersonDto : BaseDto<int> public class PersonDto : BaseDto<int>
{ {
public string Name { get; set; } [JsonPropertyName("name")]
public string Surname { get; set; } public string Name { get; set; }
public string CountryOfBirth { get; set; } [JsonPropertyName("surname")]
public DateTime BirthDate { get; set; } public string Surname { get; set; }
public DateTime? DeathDate { get; set; } [JsonPropertyName("country")]
public string Webpage { get; set; } public string CountryOfBirth { get; set; }
public string Twitter { get; set; } [JsonPropertyName("birthdate")]
public string Facebook { get; set; } public DateTime BirthDate { get; set; }
public Guid Photo { get; set; } [JsonPropertyName("death_date")]
public string Alias { get; set; } public DateTime? DeathDate { get; set; }
public string DisplayName { get; set; } [JsonPropertyName("webpage")]
public short? CountryOfBirthId { get; set; } public string Webpage { get; set; }
[JsonPropertyName("twitter")]
public string Twitter { get; set; }
[JsonPropertyName("facebook")]
public string Facebook { get; set; }
[JsonPropertyName("photo")]
public Guid Photo { get; set; }
[JsonPropertyName("alias")]
public string Alias { get; set; }
[JsonPropertyName("display_name")]
public string DisplayName { get; set; }
[JsonPropertyName("country_id")]
public short? CountryOfBirthId { get; set; }
[JsonIgnore]
public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}"; public string FullName => DisplayName ?? Alias ?? $"{Name} {Surname}";
} }

View File

@@ -23,13 +23,20 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class ProcessorByMachineDto : BaseDto<long> public class ProcessorByMachineDto : BaseDto<long>
{ {
public int ProcessorId { get; set; } [JsonPropertyName("processor_id")]
public int MachineId { get; set; } public int ProcessorId { get; set; }
[JsonPropertyName("machine_id")]
public int MachineId { get; set; }
[JsonPropertyName("company")]
public string CompanyName { get; set; } public string CompanyName { get; set; }
public string Name { get; set; } [JsonPropertyName("name")]
public float? Speed { get; set; } public string Name { get; set; }
[JsonPropertyName("speed")]
public float? Speed { get; set; }
} }

View File

@@ -23,38 +23,68 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class ProcessorDto : BaseDto<int> public class ProcessorDto : BaseDto<int>
{ {
public string Name { get; set; } [JsonPropertyName("name")]
public string CompanyName { get; set; } public string Name { get; set; }
public string ModelCode { get; set; } [JsonPropertyName("company")]
public DateTime? Introduced { get; set; } public string CompanyName { get; set; }
public double? Speed { get; set; } [JsonPropertyName("model_code")]
public string Package { get; set; } public string ModelCode { get; set; }
public int? Gprs { get; set; } [JsonPropertyName("introduced")]
public int? GprSize { get; set; } public DateTime? Introduced { get; set; }
public int? Fprs { get; set; } [JsonPropertyName("speed")]
public int? FprSize { get; set; } public double? Speed { get; set; }
public int? Cores { get; set; } [JsonPropertyName("package")]
public int? ThreadsPerCore { get; set; } public string Package { get; set; }
public string Process { get; set; } [JsonPropertyName("gprs")]
public float? ProcessNm { get; set; } public int? Gprs { get; set; }
public float? DieSize { get; set; } [JsonPropertyName("gpr_size")]
public long? Transistors { get; set; } public int? GprSize { get; set; }
public int? DataBus { get; set; } [JsonPropertyName("fprs")]
public int? AddrBus { get; set; } public int? Fprs { get; set; }
public int? SimdRegisters { get; set; } [JsonPropertyName("fpr_size")]
public int? SimdSize { get; set; } public int? FprSize { get; set; }
public float? L1Instruction { get; set; } [JsonPropertyName("cores")]
public float? L1Data { get; set; } public int? Cores { get; set; }
public float? L2 { get; set; } [JsonPropertyName("threads_per_core")]
public float? L3 { get; set; } public int? ThreadsPerCore { get; set; }
public string InstructionSet { get; set; } [JsonPropertyName("process")]
public string Process { get; set; }
[JsonPropertyName("process_nm")]
public float? ProcessNm { get; set; }
[JsonPropertyName("die_size")]
public float? DieSize { get; set; }
[JsonPropertyName("transistors")]
public long? Transistors { get; set; }
[JsonPropertyName("data_bus")]
public int? DataBus { get; set; }
[JsonPropertyName("address_bus")]
public int? AddrBus { get; set; }
[JsonPropertyName("simd_registers")]
public int? SimdRegisters { get; set; }
[JsonPropertyName("simd_size")]
public int? SimdSize { get; set; }
[JsonPropertyName("l1_instruction")]
public float? L1Instruction { get; set; }
[JsonPropertyName("l1_data")]
public float? L1Data { get; set; }
[JsonPropertyName("l2")]
public float? L2 { get; set; }
[JsonPropertyName("l3")]
public float? L3 { get; set; }
[JsonPropertyName("instruction_set")]
public string InstructionSet { get; set; }
[JsonPropertyName("instruction_set_extensions")]
public List<string> InstructionSetExtensions { get; set; } public List<string> InstructionSetExtensions { get; set; }
public int? CompanyId { get; set; } [JsonPropertyName("company_id")]
public int? InstructionSetId { get; set; } public int? CompanyId { get; set; }
[JsonPropertyName("instruction_set_id")]
public int? InstructionSetId { get; set; }
[JsonIgnore]
public string IntroducedView => Introduced?.ToShortDateString() ?? "Unknown"; public string IntroducedView => Introduced?.ToShortDateString() ?? "Unknown";
} }

View File

@@ -23,11 +23,16 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class ResolutionByGpuDto : BaseDto<long> public class ResolutionByGpuDto : BaseDto<long>
{ {
public int ResolutionId { get; set; } [JsonPropertyName("resolution_id")]
public int GpuId { get; set; } public int ResolutionId { get; set; }
public ResolutionDto Resolution { get; set; } [JsonPropertyName("gpu_id")]
public int GpuId { get; set; }
[JsonPropertyName("resolution")]
public ResolutionDto Resolution { get; set; }
} }

View File

@@ -23,11 +23,16 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class ResolutionByScreenDto : BaseDto<long> public class ResolutionByScreenDto : BaseDto<long>
{ {
public int ResolutionId { get; set; } [JsonPropertyName("resolution_id")]
public int ScreenId { get; set; } public int ResolutionId { get; set; }
public ResolutionDto Resolution { get; set; } [JsonPropertyName("screen_id")]
public int ScreenId { get; set; }
[JsonPropertyName("resolution")]
public ResolutionDto Resolution { get; set; }
} }

View File

@@ -23,17 +23,25 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class ResolutionDto : BaseDto<int> public class ResolutionDto : BaseDto<int>
{ {
public int Width { get; set; } [JsonPropertyName("width")]
public int Height { get; set; } public int Width { get; set; }
public long? Colors { get; set; } [JsonPropertyName("height")]
public long? Palette { get; set; } public int Height { get; set; }
public bool Chars { get; set; } [JsonPropertyName("colors")]
public bool Grayscale { get; set; } public long? Colors { get; set; }
[JsonPropertyName("palette")]
public long? Palette { get; set; }
[JsonPropertyName("chars")]
public bool Chars { get; set; }
[JsonPropertyName("grayscale")]
public bool Grayscale { get; set; }
[JsonIgnore]
public long? PaletteView => Palette ?? Colors; public long? PaletteView => Palette ?? Colors;
public override string ToString() public override string ToString()

View File

@@ -23,11 +23,16 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class ScreenByMachineDto : BaseDto<long> public class ScreenByMachineDto : BaseDto<long>
{ {
public int MachineId { get; set; } [JsonPropertyName("machine_id")]
public ScreenDto Screen { get; set; } public int MachineId { get; set; }
public int ScreenId { get; set; } [JsonPropertyName("screen")]
public ScreenDto Screen { get; set; }
[JsonPropertyName("screen_id")]
public int ScreenId { get; set; }
} }

View File

@@ -23,18 +23,27 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class ScreenDto : BaseDto<int> public class ScreenDto : BaseDto<int>
{ {
public double? Width { get; set; } [JsonPropertyName("width")]
public double? Height { get; set; } public double? Width { get; set; }
public double Diagonal { get; set; } [JsonPropertyName("height")]
public int NativeResolutionId { get; set; } public double? Height { get; set; }
public ResolutionDto NativeResolution { get; set; } [JsonPropertyName("diagonal")]
public long? EffectiveColors { get; set; } public double Diagonal { get; set; }
public string Type { get; set; } [JsonPropertyName("native_resolution_id")]
public int NativeResolutionId { get; set; }
[JsonPropertyName("native_resolution")]
public ResolutionDto NativeResolution { get; set; }
[JsonPropertyName("effective_colors")]
public long? EffectiveColors { get; set; }
[JsonPropertyName("type")]
public string Type { get; set; }
[JsonIgnore]
public long? Colors => EffectiveColors ?? NativeResolution.Colors; public long? Colors => EffectiveColors ?? NativeResolution.Colors;
public string Size public string Size

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class SoftwareFamilyDto : BaseDto<ulong> public class SoftwareFamilyDto : BaseDto<ulong>
{ {
public string Name { get; set; } [JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("introduced")]
public DateTime? Introduced { get; set; } public DateTime? Introduced { get; set; }
public string Parent { get; set; } [JsonPropertyName("parent")]
public ulong? ParentId { get; set; } public string Parent { get; set; }
[JsonPropertyName("parent_id")]
public ulong? ParentId { get; set; }
} }

View File

@@ -23,26 +23,43 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
using Marechai.Database; using Marechai.Database;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class SoftwareVariantDto : BaseDto<ulong> public class SoftwareVariantDto : BaseDto<ulong>
{ {
public string Name { get; set; } [JsonPropertyName("name")]
public string Version { get; set; } public string Name { get; set; }
public DateTime? Introduced { get; set; } [JsonPropertyName("version")]
public ulong? ParentId { get; set; } public string Version { get; set; }
public string Parent { get; set; } [JsonPropertyName("introduced")]
public ulong SoftwareVersionId { get; set; } public DateTime? Introduced { get; set; }
public string SoftwareVersion { get; set; } [JsonPropertyName("parent_id")]
public ulong? MinimumMemory { get; set; } public ulong? ParentId { get; set; }
public ulong? RecommendedMemory { get; set; } [JsonPropertyName("parent")]
public ulong? RequiredStorage { get; set; } public string Parent { get; set; }
public string PartNumber { get; set; } [JsonPropertyName("version_id")]
public string SerialNumber { get; set; } public ulong SoftwareVersionId { get; set; }
public string ProductCode { get; set; } [JsonPropertyName("version")]
public string CatalogueNumber { get; set; } public string SoftwareVersion { get; set; }
public DistributionMode DistributionMode { get; set; } [JsonPropertyName("minimum_memory")]
public string Family { get; set; } public ulong? MinimumMemory { get; set; }
[JsonPropertyName("recommended_memory")]
public ulong? RecommendedMemory { get; set; }
[JsonPropertyName("required_storage")]
public ulong? RequiredStorage { get; set; }
[JsonPropertyName("part_number")]
public string PartNumber { get; set; }
[JsonPropertyName("serial_number")]
public string SerialNumber { get; set; }
[JsonPropertyName("product_code")]
public string ProductCode { get; set; }
[JsonPropertyName("catalogue_number")]
public string CatalogueNumber { get; set; }
[JsonPropertyName("distribution_mode")]
public DistributionMode DistributionMode { get; set; }
[JsonPropertyName("family")]
public string Family { get; set; }
} }

View File

@@ -23,18 +23,30 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class SoftwareVersionDto : BaseDto<ulong> public class SoftwareVersionDto : BaseDto<ulong>
{ {
public string Family { get; set; } [JsonPropertyName("family")]
public string Name { get; set; } public string Family { get; set; }
public string Codename { get; set; } [JsonPropertyName("name")]
public string Version { get; set; } public string Name { get; set; }
[JsonPropertyName("codename")]
public string Codename { get; set; }
[JsonPropertyName("version")]
public string Version { get; set; }
[JsonPropertyName("introduced")]
public DateTime? Introduced { get; set; } public DateTime? Introduced { get; set; }
public string Previous { get; set; } [JsonPropertyName("previous")]
public string License { get; set; } public string Previous { get; set; }
public ulong FamilyId { get; set; } [JsonPropertyName("license")]
public int? LicenseId { get; set; } public string License { get; set; }
public ulong? PreviousId { get; set; } [JsonPropertyName("family_id")]
public ulong FamilyId { get; set; }
[JsonPropertyName("license_id")]
public int? LicenseId { get; set; }
[JsonPropertyName("previous_id")]
public ulong? PreviousId { get; set; }
} }

View File

@@ -23,12 +23,18 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class SoundSynthByMachineDto : BaseDto<long> public class SoundSynthByMachineDto : BaseDto<long>
{ {
public int SoundSynthId { get; set; } [JsonPropertyName("sound_synth_id")]
public int MachineId { get; set; } public int SoundSynthId { get; set; }
public string CompanyName { get; set; } [JsonPropertyName("machine_id")]
public string Name { get; set; } public int MachineId { get; set; }
[JsonPropertyName("company")]
public string CompanyName { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
} }

View File

@@ -23,21 +23,34 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class SoundSynthDto : BaseDto<int> public class SoundSynthDto : BaseDto<int>
{ {
public string Name { get; set; } [JsonPropertyName("name")]
public string CompanyName { get; set; } public string Name { get; set; }
public int? CompanyId { get; set; } [JsonPropertyName("company")]
public string ModelCode { get; set; } public string CompanyName { get; set; }
public DateTime? Introduced { get; set; } [JsonPropertyName("company_id")]
public int? Voices { get; set; } public int? CompanyId { get; set; }
public double? Frequency { get; set; } [JsonPropertyName("model_code")]
public int? Depth { get; set; } public string ModelCode { get; set; }
public int? SquareWave { get; set; } [JsonPropertyName("introduced")]
public int? WhiteNoise { get; set; } public DateTime? Introduced { get; set; }
public int? Type { get; set; } [JsonPropertyName("voices")]
public int? Voices { get; set; }
[JsonPropertyName("frequency")]
public double? Frequency { get; set; }
[JsonPropertyName("depth")]
public int? Depth { get; set; }
[JsonPropertyName("square_wave")]
public int? SquareWave { get; set; }
[JsonPropertyName("white_noise")]
public int? WhiteNoise { get; set; }
[JsonPropertyName("type")]
public int? Type { get; set; }
[JsonIgnore]
public string IntroducedView => Introduced?.ToShortDateString() ?? "Unknown"; public string IntroducedView => Introduced?.ToShortDateString() ?? "Unknown";
} }

View File

@@ -23,14 +23,19 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
using Marechai.Database; using Marechai.Database;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class StorageByMachineDto : BaseDto<long> public class StorageByMachineDto : BaseDto<long>
{ {
public int MachineId { get; set; } [JsonPropertyName("machine_id")]
public StorageType Type { get; set; } public int MachineId { get; set; }
[JsonPropertyName("type")]
public StorageType Type { get; set; }
[JsonPropertyName("interface")]
public StorageInterface Interface { get; set; } public StorageInterface Interface { get; set; }
public long? Capacity { get; set; } [JsonPropertyName("capacity")]
public long? Capacity { get; set; }
} }

View File

@@ -23,13 +23,17 @@
// Copyright © 2003-2021 Natalia Portillo // Copyright © 2003-2021 Natalia Portillo
*******************************************************************************/ *******************************************************************************/
using System.Text.Json.Serialization;
using Marechai.Database; using Marechai.Database;
namespace Marechai.Data.Dtos; namespace Marechai.Data.Dtos;
public class StorageDto public class StorageDto
{ {
public StorageType Type { get; set; } [JsonPropertyName("type")]
public StorageType Type { get; set; }
[JsonPropertyName("interface")]
public StorageInterface Interface { get; set; } public StorageInterface Interface { get; set; }
public long? Capacity { get; set; } [JsonPropertyName("capacity")]
public long? Capacity { get; set; }
} }