Change DTOs to use underlying nullable numerical values instead of nullable enumerations as they're not supported by Kiota.

This commit is contained in:
2025-11-16 02:12:29 +00:00
parent 195b23f755
commit 497251be86
24 changed files with 516 additions and 2255 deletions

View File

@@ -279,7 +279,7 @@ namespace Marechai.App
ApiClientBuilder.RegisterDefaultDeserializer<FormParseNodeFactory>();
if (string.IsNullOrEmpty(RequestAdapter.BaseUrl))
{
RequestAdapter.BaseUrl = "http://localhost:5023";
RequestAdapter.BaseUrl = "https://localhost:7163";
}
PathParameters.TryAdd("baseurl", RequestAdapter.BaseUrl);
}

View File

@@ -33,13 +33,7 @@ namespace Marechai.App.Models
/// <summary>The book_id property</summary>
public long? BookId { get; set; }
/// <summary>The colorspace property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.BookScanDto.BookScanDto_colorspace? Colorspace { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.BookScanDto.BookScanDto_colorspace Colorspace { get; set; }
#endif
public int? Colorspace { get; set; }
/// <summary>The comments property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
@@ -73,13 +67,7 @@ namespace Marechai.App.Models
/// <summary>The page property</summary>
public int? Page { get; set; }
/// <summary>The resolution_unit property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.BookScanDto.BookScanDto_resolution_unit? ResolutionUnit { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.BookScanDto.BookScanDto_resolution_unit ResolutionUnit { get; set; }
#endif
public int? ResolutionUnit { get; set; }
/// <summary>The scanner_manufacturer property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
@@ -146,7 +134,7 @@ namespace Marechai.App.Models
{ "author", n => { Author = n.GetStringValue(); } },
{ "book", n => { Book = n.GetStringValue(); } },
{ "book_id", n => { BookId = n.GetLongValue(); } },
{ "colorspace", n => { Colorspace = n.GetObjectValue<global::Marechai.App.Models.BookScanDto.BookScanDto_colorspace>(global::Marechai.App.Models.BookScanDto.BookScanDto_colorspace.CreateFromDiscriminatorValue); } },
{ "colorspace", n => { Colorspace = n.GetIntValue(); } },
{ "comments", n => { Comments = n.GetStringValue(); } },
{ "creation_date", n => { CreationDate = n.GetDateTimeOffsetValue(); } },
{ "exif_version", n => { ExifVersion = n.GetStringValue(); } },
@@ -154,7 +142,7 @@ namespace Marechai.App.Models
{ "id", n => { Id = n.GetGuidValue(); } },
{ "original_extension", n => { OriginalExtension = n.GetStringValue(); } },
{ "page", n => { Page = n.GetIntValue(); } },
{ "resolution_unit", n => { ResolutionUnit = n.GetObjectValue<global::Marechai.App.Models.BookScanDto.BookScanDto_resolution_unit>(global::Marechai.App.Models.BookScanDto.BookScanDto_resolution_unit.CreateFromDiscriminatorValue); } },
{ "resolution_unit", n => { ResolutionUnit = n.GetIntValue(); } },
{ "scanner_manufacturer", n => { ScannerManufacturer = n.GetStringValue(); } },
{ "scanner_model", n => { ScannerModel = n.GetStringValue(); } },
{ "software", n => { Software = n.GetStringValue(); } },
@@ -174,7 +162,7 @@ namespace Marechai.App.Models
writer.WriteStringValue("author", Author);
writer.WriteStringValue("book", Book);
writer.WriteLongValue("book_id", BookId);
writer.WriteObjectValue<global::Marechai.App.Models.BookScanDto.BookScanDto_colorspace>("colorspace", Colorspace);
writer.WriteIntValue("colorspace", Colorspace);
writer.WriteStringValue("comments", Comments);
writer.WriteDateTimeOffsetValue("creation_date", CreationDate);
writer.WriteStringValue("exif_version", ExifVersion);
@@ -182,7 +170,7 @@ namespace Marechai.App.Models
writer.WriteGuidValue("id", Id);
writer.WriteStringValue("original_extension", OriginalExtension);
writer.WriteIntValue("page", Page);
writer.WriteObjectValue<global::Marechai.App.Models.BookScanDto.BookScanDto_resolution_unit>("resolution_unit", ResolutionUnit);
writer.WriteIntValue("resolution_unit", ResolutionUnit);
writer.WriteStringValue("scanner_manufacturer", ScannerManufacturer);
writer.WriteStringValue("scanner_model", ScannerModel);
writer.WriteStringValue("software", Software);
@@ -192,156 +180,6 @@ namespace Marechai.App.Models
writer.WriteDoubleValue("vertical_resolution", VerticalResolution);
writer.WriteAdditionalData(AdditionalData);
}
/// <summary>
/// Composed type wrapper for classes <see cref="global::Marechai.App.Models.BookScanDto_colorspaceMember1"/>, <see cref="global::Marechai.App.Models.ColorSpace"/>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class BookScanDto_colorspace : IComposedTypeWrapper, IParsable
{
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.BookScanDto_colorspaceMember1"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.BookScanDto_colorspaceMember1? BookScanDtoColorspaceMember1 { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.BookScanDto_colorspaceMember1 BookScanDtoColorspaceMember1 { get; set; }
#endif
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.ColorSpace"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.ColorSpace? ColorSpace { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.ColorSpace ColorSpace { get; set; }
#endif
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// </summary>
/// <returns>A <see cref="global::Marechai.App.Models.BookScanDto.BookScanDto_colorspace"/></returns>
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
public static global::Marechai.App.Models.BookScanDto.BookScanDto_colorspace CreateFromDiscriminatorValue(IParseNode parseNode)
{
if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode));
var mappingValue = parseNode.GetChildNode("")?.GetStringValue();
var result = new global::Marechai.App.Models.BookScanDto.BookScanDto_colorspace();
if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.BookScanDtoColorspaceMember1 = new global::Marechai.App.Models.BookScanDto_colorspaceMember1();
}
else if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.ColorSpace = new global::Marechai.App.Models.ColorSpace();
}
return result;
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
{
if(BookScanDtoColorspaceMember1 != null)
{
return BookScanDtoColorspaceMember1.GetFieldDeserializers();
}
else if(ColorSpace != null)
{
return ColorSpace.GetFieldDeserializers();
}
return new Dictionary<string, Action<IParseNode>>();
}
/// <summary>
/// Serializes information the current object
/// </summary>
/// <param name="writer">Serialization writer to use to serialize this model</param>
public virtual void Serialize(ISerializationWriter writer)
{
if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer));
if(BookScanDtoColorspaceMember1 != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.BookScanDto_colorspaceMember1>(null, BookScanDtoColorspaceMember1);
}
else if(ColorSpace != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.ColorSpace>(null, ColorSpace);
}
}
}
/// <summary>
/// Composed type wrapper for classes <see cref="global::Marechai.App.Models.BookScanDto_resolution_unitMember1"/>, <see cref="global::Marechai.App.Models.ResolutionUnit"/>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class BookScanDto_resolution_unit : IComposedTypeWrapper, IParsable
{
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.BookScanDto_resolution_unitMember1"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.BookScanDto_resolution_unitMember1? BookScanDtoResolutionUnitMember1 { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.BookScanDto_resolution_unitMember1 BookScanDtoResolutionUnitMember1 { get; set; }
#endif
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.ResolutionUnit"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.ResolutionUnit? ResolutionUnit { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.ResolutionUnit ResolutionUnit { get; set; }
#endif
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// </summary>
/// <returns>A <see cref="global::Marechai.App.Models.BookScanDto.BookScanDto_resolution_unit"/></returns>
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
public static global::Marechai.App.Models.BookScanDto.BookScanDto_resolution_unit CreateFromDiscriminatorValue(IParseNode parseNode)
{
if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode));
var mappingValue = parseNode.GetChildNode("")?.GetStringValue();
var result = new global::Marechai.App.Models.BookScanDto.BookScanDto_resolution_unit();
if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.BookScanDtoResolutionUnitMember1 = new global::Marechai.App.Models.BookScanDto_resolution_unitMember1();
}
else if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.ResolutionUnit = new global::Marechai.App.Models.ResolutionUnit();
}
return result;
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
{
if(BookScanDtoResolutionUnitMember1 != null)
{
return BookScanDtoResolutionUnitMember1.GetFieldDeserializers();
}
else if(ResolutionUnit != null)
{
return ResolutionUnit.GetFieldDeserializers();
}
return new Dictionary<string, Action<IParseNode>>();
}
/// <summary>
/// Serializes information the current object
/// </summary>
/// <param name="writer">Serialization writer to use to serialize this model</param>
public virtual void Serialize(ISerializationWriter writer)
{
if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer));
if(BookScanDtoResolutionUnitMember1 != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.BookScanDto_resolution_unitMember1>(null, BookScanDtoResolutionUnitMember1);
}
else if(ResolutionUnit != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.ResolutionUnit>(null, ResolutionUnit);
}
}
}
}
}
#pragma warning restore CS0618

View File

@@ -23,13 +23,7 @@ namespace Marechai.App.Models
public string Author { get; set; }
#endif
/// <summary>The colorspace property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_colorspace? Colorspace { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_colorspace Colorspace { get; set; }
#endif
public int? Colorspace { get; set; }
/// <summary>The comments property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
@@ -73,13 +67,7 @@ namespace Marechai.App.Models
/// <summary>The page property</summary>
public int? Page { get; set; }
/// <summary>The resolution_unit property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_resolution_unit? ResolutionUnit { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_resolution_unit ResolutionUnit { get; set; }
#endif
public int? ResolutionUnit { get; set; }
/// <summary>The scanner_manufacturer property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
@@ -144,7 +132,7 @@ namespace Marechai.App.Models
return new Dictionary<string, Action<IParseNode>>
{
{ "author", n => { Author = n.GetStringValue(); } },
{ "colorspace", n => { Colorspace = n.GetObjectValue<global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_colorspace>(global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_colorspace.CreateFromDiscriminatorValue); } },
{ "colorspace", n => { Colorspace = n.GetIntValue(); } },
{ "comments", n => { Comments = n.GetStringValue(); } },
{ "creation_date", n => { CreationDate = n.GetDateTimeOffsetValue(); } },
{ "document", n => { Document = n.GetStringValue(); } },
@@ -154,7 +142,7 @@ namespace Marechai.App.Models
{ "id", n => { Id = n.GetGuidValue(); } },
{ "original_extension", n => { OriginalExtension = n.GetStringValue(); } },
{ "page", n => { Page = n.GetIntValue(); } },
{ "resolution_unit", n => { ResolutionUnit = n.GetObjectValue<global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_resolution_unit>(global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_resolution_unit.CreateFromDiscriminatorValue); } },
{ "resolution_unit", n => { ResolutionUnit = n.GetIntValue(); } },
{ "scanner_manufacturer", n => { ScannerManufacturer = n.GetStringValue(); } },
{ "scanner_model", n => { ScannerModel = n.GetStringValue(); } },
{ "software", n => { Software = n.GetStringValue(); } },
@@ -172,7 +160,7 @@ namespace Marechai.App.Models
{
if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer));
writer.WriteStringValue("author", Author);
writer.WriteObjectValue<global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_colorspace>("colorspace", Colorspace);
writer.WriteIntValue("colorspace", Colorspace);
writer.WriteStringValue("comments", Comments);
writer.WriteDateTimeOffsetValue("creation_date", CreationDate);
writer.WriteStringValue("document", Document);
@@ -182,7 +170,7 @@ namespace Marechai.App.Models
writer.WriteGuidValue("id", Id);
writer.WriteStringValue("original_extension", OriginalExtension);
writer.WriteIntValue("page", Page);
writer.WriteObjectValue<global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_resolution_unit>("resolution_unit", ResolutionUnit);
writer.WriteIntValue("resolution_unit", ResolutionUnit);
writer.WriteStringValue("scanner_manufacturer", ScannerManufacturer);
writer.WriteStringValue("scanner_model", ScannerModel);
writer.WriteStringValue("software", Software);
@@ -192,156 +180,6 @@ namespace Marechai.App.Models
writer.WriteDoubleValue("vertical_resolution", VerticalResolution);
writer.WriteAdditionalData(AdditionalData);
}
/// <summary>
/// Composed type wrapper for classes <see cref="global::Marechai.App.Models.ColorSpace"/>, <see cref="global::Marechai.App.Models.DocumentScanDto_colorspaceMember1"/>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class DocumentScanDto_colorspace : IComposedTypeWrapper, IParsable
{
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.ColorSpace"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.ColorSpace? ColorSpace { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.ColorSpace ColorSpace { get; set; }
#endif
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.DocumentScanDto_colorspaceMember1"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.DocumentScanDto_colorspaceMember1? DocumentScanDtoColorspaceMember1 { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.DocumentScanDto_colorspaceMember1 DocumentScanDtoColorspaceMember1 { get; set; }
#endif
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// </summary>
/// <returns>A <see cref="global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_colorspace"/></returns>
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
public static global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_colorspace CreateFromDiscriminatorValue(IParseNode parseNode)
{
if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode));
var mappingValue = parseNode.GetChildNode("")?.GetStringValue();
var result = new global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_colorspace();
if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.ColorSpace = new global::Marechai.App.Models.ColorSpace();
}
else if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.DocumentScanDtoColorspaceMember1 = new global::Marechai.App.Models.DocumentScanDto_colorspaceMember1();
}
return result;
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
{
if(ColorSpace != null)
{
return ColorSpace.GetFieldDeserializers();
}
else if(DocumentScanDtoColorspaceMember1 != null)
{
return DocumentScanDtoColorspaceMember1.GetFieldDeserializers();
}
return new Dictionary<string, Action<IParseNode>>();
}
/// <summary>
/// Serializes information the current object
/// </summary>
/// <param name="writer">Serialization writer to use to serialize this model</param>
public virtual void Serialize(ISerializationWriter writer)
{
if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer));
if(ColorSpace != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.ColorSpace>(null, ColorSpace);
}
else if(DocumentScanDtoColorspaceMember1 != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.DocumentScanDto_colorspaceMember1>(null, DocumentScanDtoColorspaceMember1);
}
}
}
/// <summary>
/// Composed type wrapper for classes <see cref="global::Marechai.App.Models.DocumentScanDto_resolution_unitMember1"/>, <see cref="global::Marechai.App.Models.ResolutionUnit"/>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class DocumentScanDto_resolution_unit : IComposedTypeWrapper, IParsable
{
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.DocumentScanDto_resolution_unitMember1"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.DocumentScanDto_resolution_unitMember1? DocumentScanDtoResolutionUnitMember1 { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.DocumentScanDto_resolution_unitMember1 DocumentScanDtoResolutionUnitMember1 { get; set; }
#endif
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.ResolutionUnit"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.ResolutionUnit? ResolutionUnit { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.ResolutionUnit ResolutionUnit { get; set; }
#endif
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// </summary>
/// <returns>A <see cref="global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_resolution_unit"/></returns>
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
public static global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_resolution_unit CreateFromDiscriminatorValue(IParseNode parseNode)
{
if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode));
var mappingValue = parseNode.GetChildNode("")?.GetStringValue();
var result = new global::Marechai.App.Models.DocumentScanDto.DocumentScanDto_resolution_unit();
if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.DocumentScanDtoResolutionUnitMember1 = new global::Marechai.App.Models.DocumentScanDto_resolution_unitMember1();
}
else if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.ResolutionUnit = new global::Marechai.App.Models.ResolutionUnit();
}
return result;
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
{
if(DocumentScanDtoResolutionUnitMember1 != null)
{
return DocumentScanDtoResolutionUnitMember1.GetFieldDeserializers();
}
else if(ResolutionUnit != null)
{
return ResolutionUnit.GetFieldDeserializers();
}
return new Dictionary<string, Action<IParseNode>>();
}
/// <summary>
/// Serializes information the current object
/// </summary>
/// <param name="writer">Serialization writer to use to serialize this model</param>
public virtual void Serialize(ISerializationWriter writer)
{
if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer));
if(DocumentScanDtoResolutionUnitMember1 != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.DocumentScanDto_resolution_unitMember1>(null, DocumentScanDtoResolutionUnitMember1);
}
else if(ResolutionUnit != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.ResolutionUnit>(null, ResolutionUnit);
}
}
}
}
}
#pragma warning restore CS0618

File diff suppressed because it is too large Load Diff

View File

@@ -23,13 +23,7 @@ namespace Marechai.App.Models
public string Author { get; set; }
#endif
/// <summary>The colorspace property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_colorspace? Colorspace { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_colorspace Colorspace { get; set; }
#endif
public int? Colorspace { get; set; }
/// <summary>The comments property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
@@ -73,13 +67,7 @@ namespace Marechai.App.Models
/// <summary>The page property</summary>
public int? Page { get; set; }
/// <summary>The resolution_unit property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_resolution_unit? ResolutionUnit { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_resolution_unit ResolutionUnit { get; set; }
#endif
public int? ResolutionUnit { get; set; }
/// <summary>The scanner_manufacturer property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
@@ -144,7 +132,7 @@ namespace Marechai.App.Models
return new Dictionary<string, Action<IParseNode>>
{
{ "author", n => { Author = n.GetStringValue(); } },
{ "colorspace", n => { Colorspace = n.GetObjectValue<global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_colorspace>(global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_colorspace.CreateFromDiscriminatorValue); } },
{ "colorspace", n => { Colorspace = n.GetIntValue(); } },
{ "comments", n => { Comments = n.GetStringValue(); } },
{ "creation_date", n => { CreationDate = n.GetDateTimeOffsetValue(); } },
{ "exif_version", n => { ExifVersion = n.GetStringValue(); } },
@@ -154,7 +142,7 @@ namespace Marechai.App.Models
{ "magazine_id", n => { MagazineId = n.GetLongValue(); } },
{ "original_extension", n => { OriginalExtension = n.GetStringValue(); } },
{ "page", n => { Page = n.GetIntValue(); } },
{ "resolution_unit", n => { ResolutionUnit = n.GetObjectValue<global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_resolution_unit>(global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_resolution_unit.CreateFromDiscriminatorValue); } },
{ "resolution_unit", n => { ResolutionUnit = n.GetIntValue(); } },
{ "scanner_manufacturer", n => { ScannerManufacturer = n.GetStringValue(); } },
{ "scanner_model", n => { ScannerModel = n.GetStringValue(); } },
{ "software", n => { Software = n.GetStringValue(); } },
@@ -172,7 +160,7 @@ namespace Marechai.App.Models
{
if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer));
writer.WriteStringValue("author", Author);
writer.WriteObjectValue<global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_colorspace>("colorspace", Colorspace);
writer.WriteIntValue("colorspace", Colorspace);
writer.WriteStringValue("comments", Comments);
writer.WriteDateTimeOffsetValue("creation_date", CreationDate);
writer.WriteStringValue("exif_version", ExifVersion);
@@ -182,7 +170,7 @@ namespace Marechai.App.Models
writer.WriteLongValue("magazine_id", MagazineId);
writer.WriteStringValue("original_extension", OriginalExtension);
writer.WriteIntValue("page", Page);
writer.WriteObjectValue<global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_resolution_unit>("resolution_unit", ResolutionUnit);
writer.WriteIntValue("resolution_unit", ResolutionUnit);
writer.WriteStringValue("scanner_manufacturer", ScannerManufacturer);
writer.WriteStringValue("scanner_model", ScannerModel);
writer.WriteStringValue("software", Software);
@@ -192,156 +180,6 @@ namespace Marechai.App.Models
writer.WriteDoubleValue("vertical_resolution", VerticalResolution);
writer.WriteAdditionalData(AdditionalData);
}
/// <summary>
/// Composed type wrapper for classes <see cref="global::Marechai.App.Models.ColorSpace"/>, <see cref="global::Marechai.App.Models.MagazineScanDto_colorspaceMember1"/>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class MagazineScanDto_colorspace : IComposedTypeWrapper, IParsable
{
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.ColorSpace"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.ColorSpace? ColorSpace { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.ColorSpace ColorSpace { get; set; }
#endif
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.MagazineScanDto_colorspaceMember1"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.MagazineScanDto_colorspaceMember1? MagazineScanDtoColorspaceMember1 { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.MagazineScanDto_colorspaceMember1 MagazineScanDtoColorspaceMember1 { get; set; }
#endif
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// </summary>
/// <returns>A <see cref="global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_colorspace"/></returns>
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
public static global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_colorspace CreateFromDiscriminatorValue(IParseNode parseNode)
{
if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode));
var mappingValue = parseNode.GetChildNode("")?.GetStringValue();
var result = new global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_colorspace();
if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.ColorSpace = new global::Marechai.App.Models.ColorSpace();
}
else if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.MagazineScanDtoColorspaceMember1 = new global::Marechai.App.Models.MagazineScanDto_colorspaceMember1();
}
return result;
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
{
if(ColorSpace != null)
{
return ColorSpace.GetFieldDeserializers();
}
else if(MagazineScanDtoColorspaceMember1 != null)
{
return MagazineScanDtoColorspaceMember1.GetFieldDeserializers();
}
return new Dictionary<string, Action<IParseNode>>();
}
/// <summary>
/// Serializes information the current object
/// </summary>
/// <param name="writer">Serialization writer to use to serialize this model</param>
public virtual void Serialize(ISerializationWriter writer)
{
if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer));
if(ColorSpace != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.ColorSpace>(null, ColorSpace);
}
else if(MagazineScanDtoColorspaceMember1 != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.MagazineScanDto_colorspaceMember1>(null, MagazineScanDtoColorspaceMember1);
}
}
}
/// <summary>
/// Composed type wrapper for classes <see cref="global::Marechai.App.Models.MagazineScanDto_resolution_unitMember1"/>, <see cref="global::Marechai.App.Models.ResolutionUnit"/>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class MagazineScanDto_resolution_unit : IComposedTypeWrapper, IParsable
{
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.MagazineScanDto_resolution_unitMember1"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.MagazineScanDto_resolution_unitMember1? MagazineScanDtoResolutionUnitMember1 { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.MagazineScanDto_resolution_unitMember1 MagazineScanDtoResolutionUnitMember1 { get; set; }
#endif
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.ResolutionUnit"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.ResolutionUnit? ResolutionUnit { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.ResolutionUnit ResolutionUnit { get; set; }
#endif
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// </summary>
/// <returns>A <see cref="global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_resolution_unit"/></returns>
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
public static global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_resolution_unit CreateFromDiscriminatorValue(IParseNode parseNode)
{
if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode));
var mappingValue = parseNode.GetChildNode("")?.GetStringValue();
var result = new global::Marechai.App.Models.MagazineScanDto.MagazineScanDto_resolution_unit();
if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.MagazineScanDtoResolutionUnitMember1 = new global::Marechai.App.Models.MagazineScanDto_resolution_unitMember1();
}
else if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.ResolutionUnit = new global::Marechai.App.Models.ResolutionUnit();
}
return result;
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
{
if(MagazineScanDtoResolutionUnitMember1 != null)
{
return MagazineScanDtoResolutionUnitMember1.GetFieldDeserializers();
}
else if(ResolutionUnit != null)
{
return ResolutionUnit.GetFieldDeserializers();
}
return new Dictionary<string, Action<IParseNode>>();
}
/// <summary>
/// Serializes information the current object
/// </summary>
/// <param name="writer">Serialization writer to use to serialize this model</param>
public virtual void Serialize(ISerializationWriter writer)
{
if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer));
if(MagazineScanDtoResolutionUnitMember1 != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.MagazineScanDto_resolution_unitMember1>(null, MagazineScanDtoResolutionUnitMember1);
}
else if(ResolutionUnit != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.ResolutionUnit>(null, ResolutionUnit);
}
}
}
}
}
#pragma warning restore CS0618

View File

@@ -115,13 +115,7 @@ namespace Marechai.App.Models
/// <summary>The size property</summary>
public int? Size { get; set; }
/// <summary>The storage_interface property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.MediaDto.MediaDto_storage_interface? StorageInterface { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.MediaDto.MediaDto_storage_interface StorageInterface { get; set; }
#endif
public int? StorageInterface { get; set; }
/// <summary>The table_of_contents property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
@@ -189,7 +183,7 @@ namespace Marechai.App.Models
{ "sessions", n => { Sessions = n.GetIntValue(); } },
{ "sides", n => { Sides = n.GetIntValue(); } },
{ "size", n => { Size = n.GetIntValue(); } },
{ "storage_interface", n => { StorageInterface = n.GetObjectValue<global::Marechai.App.Models.MediaDto.MediaDto_storage_interface>(global::Marechai.App.Models.MediaDto.MediaDto_storage_interface.CreateFromDiscriminatorValue); } },
{ "storage_interface", n => { StorageInterface = n.GetIntValue(); } },
{ "table_of_contents", n => { TableOfContents = n.GetCollectionOfObjectValues<global::Marechai.App.Models.OpticalDiscTrack>(global::Marechai.App.Models.OpticalDiscTrack.CreateFromDiscriminatorValue)?.AsList(); } },
{ "title", n => { Title = n.GetStringValue(); } },
{ "tracks", n => { Tracks = n.GetIntValue(); } },
@@ -224,7 +218,7 @@ namespace Marechai.App.Models
writer.WriteIntValue("sessions", Sessions);
writer.WriteIntValue("sides", Sides);
writer.WriteIntValue("size", Size);
writer.WriteObjectValue<global::Marechai.App.Models.MediaDto.MediaDto_storage_interface>("storage_interface", StorageInterface);
writer.WriteIntValue("storage_interface", StorageInterface);
writer.WriteCollectionOfObjectValues<global::Marechai.App.Models.OpticalDiscTrack>("table_of_contents", TableOfContents);
writer.WriteStringValue("title", Title);
writer.WriteIntValue("tracks", Tracks);
@@ -232,81 +226,6 @@ namespace Marechai.App.Models
writer.WriteIntValue("write_offset", WriteOffset);
writer.WriteAdditionalData(AdditionalData);
}
/// <summary>
/// Composed type wrapper for classes <see cref="global::Marechai.App.Models.MediaDto_storage_interfaceMember1"/>, <see cref="global::Marechai.App.Models.StorageInterface"/>
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCode("Kiota", "1.0.0")]
public partial class MediaDto_storage_interface : IComposedTypeWrapper, IParsable
{
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.MediaDto_storage_interfaceMember1"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.MediaDto_storage_interfaceMember1? MediaDtoStorageInterfaceMember1 { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.MediaDto_storage_interfaceMember1 MediaDtoStorageInterfaceMember1 { get; set; }
#endif
/// <summary>Composed type representation for type <see cref="global::Marechai.App.Models.StorageInterface"/></summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public global::Marechai.App.Models.StorageInterface? StorageInterface { get; set; }
#nullable restore
#else
public global::Marechai.App.Models.StorageInterface StorageInterface { get; set; }
#endif
/// <summary>
/// Creates a new instance of the appropriate class based on discriminator value
/// </summary>
/// <returns>A <see cref="global::Marechai.App.Models.MediaDto.MediaDto_storage_interface"/></returns>
/// <param name="parseNode">The parse node to use to read the discriminator value and create the object</param>
public static global::Marechai.App.Models.MediaDto.MediaDto_storage_interface CreateFromDiscriminatorValue(IParseNode parseNode)
{
if(ReferenceEquals(parseNode, null)) throw new ArgumentNullException(nameof(parseNode));
var mappingValue = parseNode.GetChildNode("")?.GetStringValue();
var result = new global::Marechai.App.Models.MediaDto.MediaDto_storage_interface();
if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.MediaDtoStorageInterfaceMember1 = new global::Marechai.App.Models.MediaDto_storage_interfaceMember1();
}
else if("".Equals(mappingValue, StringComparison.OrdinalIgnoreCase))
{
result.StorageInterface = new global::Marechai.App.Models.StorageInterface();
}
return result;
}
/// <summary>
/// The deserialization information for the current model
/// </summary>
/// <returns>A IDictionary&lt;string, Action&lt;IParseNode&gt;&gt;</returns>
public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
{
if(MediaDtoStorageInterfaceMember1 != null)
{
return MediaDtoStorageInterfaceMember1.GetFieldDeserializers();
}
else if(StorageInterface != null)
{
return StorageInterface.GetFieldDeserializers();
}
return new Dictionary<string, Action<IParseNode>>();
}
/// <summary>
/// Serializes information the current object
/// </summary>
/// <param name="writer">Serialization writer to use to serialize this model</param>
public virtual void Serialize(ISerializationWriter writer)
{
if(ReferenceEquals(writer, null)) throw new ArgumentNullException(nameof(writer));
if(MediaDtoStorageInterfaceMember1 != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.MediaDto_storage_interfaceMember1>(null, MediaDtoStorageInterfaceMember1);
}
else if(StorageInterface != null)
{
writer.WriteObjectValue<global::Marechai.App.Models.StorageInterface>(null, StorageInterface);
}
}
}
}
}
#pragma warning restore CS0618

View File

@@ -1,5 +1,5 @@
{
"descriptionHash": "39D2BFA791223984F51F46A2A8EE34B01E19F393B14843E7AFDBAC674AA8AC7F97802ADCF8FFD9B23B0659CDE3B5B690F22FA1E2FC91DABFF4F240B60E17A574",
"descriptionHash": "ABDC74AB94257D5ED6BFBA4E57134BD2B3A4A2C3EC8EC2A514A70334900294CA4391DB5F7404A6055B8B63D0392BB28073F071E07F310F4E650779D5805ACBFF",
"descriptionLocation": "http://localhost:5023/openapi/v1.json",
"lockFileVersion": "1.0.0",
"kiotaVersion": "1.29.0",

View File

@@ -38,11 +38,11 @@ public class BasePhotoDto : BaseDto<Guid>
[JsonPropertyName("camera_model")]
public string? CameraModel { get; set; }
[JsonPropertyName("colorspace")]
public ColorSpace? ColorSpace { get; set; }
public ushort? ColorSpace { get; set; }
[JsonPropertyName("comments")]
public string? Comments { get; set; }
[JsonPropertyName("contrast")]
public Contrast? Contrast { get; set; }
public ushort? Contrast { get; set; }
[JsonPropertyName("creation_date")]
public DateTime? CreationDate { get; set; }
[JsonPropertyName("digital_zoom")]
@@ -52,11 +52,11 @@ public class BasePhotoDto : BaseDto<Guid>
[JsonPropertyName("exposure")]
public double? ExposureTime { get; set; }
[JsonPropertyName("exposure_method")]
public ExposureMode? ExposureMethod { get; set; }
public ushort? ExposureMethod { get; set; }
[JsonPropertyName("exposure_program")]
public ExposureProgram? ExposureProgram { get; set; }
public ushort? ExposureProgram { get; set; }
[JsonPropertyName("flash")]
public Flash? Flash { get; set; }
public ushort? Flash { get; set; }
[JsonPropertyName("focal")]
public double? Focal { get; set; }
[JsonPropertyName("focal_length")]
@@ -70,31 +70,31 @@ public class BasePhotoDto : BaseDto<Guid>
[JsonPropertyName("lens")]
public string? Lens { get; set; }
[JsonPropertyName("light_source")]
public LightSource? LightSource { get; set; }
public ushort? LightSource { get; set; }
[JsonPropertyName("metering_mode")]
public MeteringMode? MeteringMode { get; set; }
public ushort? MeteringMode { get; set; }
[JsonPropertyName("resolution_unit")]
public ResolutionUnit? ResolutionUnit { get; set; }
public ushort? ResolutionUnit { get; set; }
[JsonPropertyName("orientation")]
public Orientation? Orientation { get; set; }
public ushort? Orientation { get; set; }
[JsonPropertyName("saturation")]
public Saturation? Saturation { get; set; }
public ushort? Saturation { get; set; }
[JsonPropertyName("scene_capture_type")]
public SceneCaptureType? SceneCaptureType { get; set; }
public ushort? SceneCaptureType { get; set; }
[JsonPropertyName("sensing_method")]
public SensingMethod? SensingMethod { get; set; }
public ushort? SensingMethod { get; set; }
[JsonPropertyName("sharpness")]
public Sharpness? Sharpness { get; set; }
public ushort? Sharpness { get; set; }
[JsonPropertyName("software")]
public string? SoftwareUsed { get; set; }
[JsonPropertyName("subject_distance_range")]
public SubjectDistanceRange? SubjectDistanceRange { get; set; }
public byte? 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; }
public ushort? WhiteBalance { get; set; }
[JsonPropertyName("user_id")]
public string? UserId { get; set; }
[JsonPropertyName("license_name")]

View File

@@ -32,7 +32,7 @@ public class BaseScanDto : BaseDto<Guid>
[JsonPropertyName("author")]
public string? Author { get; set; }
[JsonPropertyName("colorspace")]
public ColorSpace? ColorSpace { get; set; }
public ushort? ColorSpace { get; set; }
[JsonPropertyName("comments")]
public string? Comments { get; set; }
[JsonPropertyName("creation_date")]
@@ -42,7 +42,7 @@ public class BaseScanDto : BaseDto<Guid>
[JsonPropertyName("horizontal_resolution")]
public double? HorizontalResolution { get; set; }
[JsonPropertyName("resolution_unit")]
public ResolutionUnit? ResolutionUnit { get; set; }
public ushort? ResolutionUnit { get; set; }
[JsonPropertyName("scanner_manufacturer")]
public string? ScannerManufacturer { get; set; }
[JsonPropertyName("scanner_model")]

View File

@@ -80,7 +80,7 @@ public class MediaDto : BaseDto<ulong>
[JsonPropertyName("block_sizes")]
public VariableBlockSize[]? BlockSizes { get; set; }
[JsonPropertyName("storage_interface")]
public StorageInterface? StorageInterface { get; set; }
public ushort? StorageInterface { get; set; }
[JsonPropertyName("table_of_contents")]
public OpticalDiscTrack[]? TableOfContents { get; set; }
}

View File

@@ -28,6 +28,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Marechai.Data;
using Marechai.Data.Dtos;
using Marechai.Database.Models;
using Microsoft.AspNetCore.Authorization;
@@ -57,13 +58,13 @@ public class BookScansController(MarechaiContext context) : ControllerBase
{
Author = p.Author,
BookId = p.Book.Id,
ColorSpace = p.ColorSpace,
ColorSpace = (ushort?)p.ColorSpace,
Comments = p.Comments,
CreationDate = p.CreationDate,
ExifVersion = p.ExifVersion,
HorizontalResolution = p.HorizontalResolution,
Id = p.Id,
ResolutionUnit = p.ResolutionUnit,
ResolutionUnit = (ushort?)p.ResolutionUnit,
Page = p.Page,
ScannerManufacturer = p.ScannerManufacturer,
ScannerModel = p.ScannerModel,
@@ -93,12 +94,12 @@ public class BookScansController(MarechaiContext context) : ControllerBase
if(model is null) return NotFound();
model.Author = dto.Author;
model.ColorSpace = dto.ColorSpace;
model.ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null;
model.Comments = dto.Comments;
model.CreationDate = dto.CreationDate;
model.ExifVersion = dto.ExifVersion;
model.HorizontalResolution = dto.HorizontalResolution;
model.ResolutionUnit = dto.ResolutionUnit;
model.ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null;
model.Page = dto.Page;
model.ScannerManufacturer = dto.ScannerManufacturer;
model.ScannerModel = dto.ScannerModel;
@@ -126,13 +127,13 @@ public class BookScansController(MarechaiContext context) : ControllerBase
{
Author = dto.Author,
BookId = dto.BookId,
ColorSpace = dto.ColorSpace,
ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null,
Comments = dto.Comments,
CreationDate = dto.CreationDate,
ExifVersion = dto.ExifVersion,
HorizontalResolution = dto.HorizontalResolution,
Id = dto.Id,
ResolutionUnit = dto.ResolutionUnit,
ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null,
Page = dto.Page,
ScannerManufacturer = dto.ScannerManufacturer,
ScannerModel = dto.ScannerModel,

View File

@@ -28,6 +28,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Marechai.Data;
using Marechai.Data.Dtos;
using Marechai.Database.Models;
using Microsoft.AspNetCore.Authorization;
@@ -59,13 +60,13 @@ public class DocumentScansController(MarechaiContext context) : ControllerBase
{
Author = p.Author,
DocumentId = p.Document.Id,
ColorSpace = p.ColorSpace,
ColorSpace = (ushort?)p.ColorSpace,
Comments = p.Comments,
CreationDate = p.CreationDate,
ExifVersion = p.ExifVersion,
HorizontalResolution = p.HorizontalResolution,
Id = p.Id,
ResolutionUnit = p.ResolutionUnit,
ResolutionUnit = (ushort?)p.ResolutionUnit,
Page = p.Page,
ScannerManufacturer = p.ScannerManufacturer,
ScannerModel = p.ScannerModel,
@@ -94,12 +95,12 @@ public class DocumentScansController(MarechaiContext context) : ControllerBase
if(model is null) return NotFound();
model.Author = dto.Author;
model.ColorSpace = dto.ColorSpace;
model.ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null;
model.Comments = dto.Comments;
model.CreationDate = dto.CreationDate;
model.ExifVersion = dto.ExifVersion;
model.HorizontalResolution = dto.HorizontalResolution;
model.ResolutionUnit = dto.ResolutionUnit;
model.ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null;
model.Page = dto.Page;
model.ScannerManufacturer = dto.ScannerManufacturer;
model.ScannerModel = dto.ScannerModel;
@@ -127,13 +128,13 @@ public class DocumentScansController(MarechaiContext context) : ControllerBase
{
Author = dto.Author,
DocumentId = dto.DocumentId,
ColorSpace = dto.ColorSpace,
ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null,
Comments = dto.Comments,
CreationDate = dto.CreationDate,
ExifVersion = dto.ExifVersion,
HorizontalResolution = dto.HorizontalResolution,
Id = dto.Id,
ResolutionUnit = dto.ResolutionUnit,
ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null,
Page = dto.Page,
ScannerManufacturer = dto.ScannerManufacturer,
ScannerModel = dto.ScannerModel,

View File

@@ -28,6 +28,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Marechai.Data;
using Marechai.Data.Dtos;
using Marechai.Database.Models;
using Microsoft.AspNetCore.Authorization;
@@ -61,16 +62,16 @@ public class MachinePhotosController(MarechaiContext context) : ControllerBase
Author = p.Author,
CameraManufacturer = p.CameraManufacturer,
CameraModel = p.CameraModel,
ColorSpace = p.ColorSpace,
ColorSpace = (ushort?)p.ColorSpace,
Comments = p.Comments,
Contrast = p.Contrast,
Contrast = (ushort?)p.Contrast,
CreationDate = p.CreationDate,
DigitalZoomRatio = p.DigitalZoomRatio,
ExifVersion = p.ExifVersion,
ExposureTime = p.ExposureTime,
ExposureMethod = p.ExposureMethod,
ExposureProgram = p.ExposureProgram,
Flash = p.Flash,
ExposureMethod = (ushort?)p.ExposureMethod,
ExposureProgram = (ushort?)p.ExposureProgram,
Flash = (ushort?)p.Flash,
Focal = p.Focal,
FocalLength = p.FocalLength,
FocalLengthEquivalent = p.FocalLengthEquivalent,
@@ -80,25 +81,27 @@ public class MachinePhotosController(MarechaiContext context) : ControllerBase
Lens = p.Lens,
LicenseId = p.LicenseId,
LicenseName = p.License.Name,
LightSource = p.LightSource,
MachineCompanyName = p.Machine.Company.Name,
MachineId = p.MachineId,
MachineName = p.Machine.Name,
MeteringMode = p.MeteringMode,
ResolutionUnit = p.ResolutionUnit,
Orientation = p.Orientation,
Saturation = p.Saturation,
SceneCaptureType = p.SceneCaptureType,
SensingMethod = p.SensingMethod,
Sharpness = p.Sharpness,
SoftwareUsed = p.SoftwareUsed,
Source = p.Source,
SubjectDistanceRange = p.SubjectDistanceRange,
UploadDate = p.UploadDate,
UserId = p.UserId,
VerticalResolution = p.VerticalResolution,
WhiteBalance = p.WhiteBalance,
OriginalExtension = p.OriginalExtension
LightSource = p.LightSource.HasValue
? (ushort?)p.LightSource
: null,
MachineCompanyName = p.Machine.Company.Name,
MachineId = p.MachineId,
MachineName = p.Machine.Name,
MeteringMode = (ushort?)p.MeteringMode,
ResolutionUnit = (ushort?)p.ResolutionUnit,
Orientation = (ushort?)p.Orientation,
Saturation = (ushort?)p.Saturation,
SceneCaptureType = (ushort?)p.SceneCaptureType,
SensingMethod = (ushort?)p.SensingMethod,
Sharpness = (ushort?)p.Sharpness,
SoftwareUsed = p.SoftwareUsed,
Source = p.Source,
SubjectDistanceRange = (byte?)p.SubjectDistanceRange,
UploadDate = p.UploadDate,
UserId = p.UserId,
VerticalResolution = p.VerticalResolution,
WhiteBalance = (ushort?)p.WhiteBalance,
OriginalExtension = p.OriginalExtension
})
.FirstOrDefaultAsync();
@@ -117,40 +120,44 @@ public class MachinePhotosController(MarechaiContext context) : ControllerBase
if(model is null) return NotFound();
model.Aperture = dto.Aperture;
model.Author = dto.Author;
model.CameraManufacturer = dto.CameraManufacturer;
model.CameraModel = dto.CameraModel;
model.ColorSpace = dto.ColorSpace;
model.Comments = dto.Comments;
model.Contrast = dto.Contrast;
model.CreationDate = dto.CreationDate;
model.DigitalZoomRatio = dto.DigitalZoomRatio;
model.ExifVersion = dto.ExifVersion;
model.ExposureTime = dto.ExposureTime;
model.ExposureMethod = dto.ExposureMethod;
model.ExposureProgram = dto.ExposureProgram;
model.Flash = dto.Flash;
model.Focal = dto.Focal;
model.FocalLength = dto.FocalLength;
model.Aperture = dto.Aperture;
model.Author = dto.Author;
model.CameraManufacturer = dto.CameraManufacturer;
model.CameraModel = dto.CameraModel;
model.ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null;
model.Comments = dto.Comments;
model.Contrast = dto.Contrast.HasValue ? (Contrast)dto.Contrast.Value : null;
model.CreationDate = dto.CreationDate;
model.DigitalZoomRatio = dto.DigitalZoomRatio;
model.ExifVersion = dto.ExifVersion;
model.ExposureTime = dto.ExposureTime;
model.ExposureMethod = dto.ExposureMethod.HasValue ? (ExposureMode)dto.ExposureMethod.Value : null;
model.ExposureProgram = dto.ExposureProgram.HasValue ? (ExposureProgram)dto.ExposureProgram.Value : null;
model.Flash = dto.Flash.HasValue ? (Flash)dto.Flash.Value : null;
model.Focal = dto.Focal;
model.FocalLength = dto.FocalLength;
model.FocalLengthEquivalent = dto.FocalLengthEquivalent;
model.HorizontalResolution = dto.HorizontalResolution;
model.IsoRating = dto.IsoRating;
model.Lens = dto.Lens;
model.LicenseId = dto.LicenseId;
model.LightSource = dto.LightSource;
model.MeteringMode = dto.MeteringMode;
model.ResolutionUnit = dto.ResolutionUnit;
model.Orientation = dto.Orientation;
model.Saturation = dto.Saturation;
model.SceneCaptureType = dto.SceneCaptureType;
model.SensingMethod = dto.SensingMethod;
model.Sharpness = dto.Sharpness;
model.SoftwareUsed = dto.SoftwareUsed;
model.Source = dto.Source;
model.SubjectDistanceRange = dto.SubjectDistanceRange;
model.VerticalResolution = dto.VerticalResolution;
model.WhiteBalance = dto.WhiteBalance;
model.HorizontalResolution = dto.HorizontalResolution;
model.IsoRating = dto.IsoRating;
model.Lens = dto.Lens;
model.LicenseId = dto.LicenseId;
model.LightSource = dto.LightSource.HasValue ? (LightSource?)dto.LightSource : null;
model.MeteringMode = dto.MeteringMode.HasValue ? (MeteringMode)dto.MeteringMode.Value : null;
model.ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null;
model.Orientation = dto.Orientation.HasValue ? (Orientation)dto.Orientation.Value : null;
model.Saturation = dto.Saturation.HasValue ? (Saturation)dto.Saturation.Value : null;
model.SceneCaptureType = dto.SceneCaptureType.HasValue ? (SceneCaptureType)dto.SceneCaptureType.Value : null;
model.SensingMethod = dto.SensingMethod.HasValue ? (SensingMethod)dto.SensingMethod.Value : null;
model.Sharpness = dto.Sharpness.HasValue ? (Sharpness)dto.Sharpness.Value : null;
model.SoftwareUsed = dto.SoftwareUsed;
model.Source = dto.Source;
model.SubjectDistanceRange = dto.SubjectDistanceRange.HasValue
? (SubjectDistanceRange)dto.SubjectDistanceRange.Value
: null;
model.VerticalResolution = dto.VerticalResolution;
model.WhiteBalance = dto.WhiteBalance.HasValue ? (WhiteBalance)dto.WhiteBalance.Value : null;
await context.SaveChangesWithUserAsync(userId);
@@ -174,16 +181,16 @@ public class MachinePhotosController(MarechaiContext context) : ControllerBase
Author = dto.Author,
CameraManufacturer = dto.CameraManufacturer,
CameraModel = dto.CameraModel,
ColorSpace = dto.ColorSpace,
ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null,
Comments = dto.Comments,
Contrast = dto.Contrast,
Contrast = dto.Contrast.HasValue ? (Contrast)dto.Contrast.Value : null,
CreationDate = dto.CreationDate,
DigitalZoomRatio = dto.DigitalZoomRatio,
ExifVersion = dto.ExifVersion,
ExposureTime = dto.ExposureTime,
ExposureMethod = dto.ExposureMethod,
ExposureProgram = dto.ExposureProgram,
Flash = dto.Flash,
ExposureMethod = dto.ExposureMethod.HasValue ? (ExposureMode)dto.ExposureMethod.Value : null,
ExposureProgram = dto.ExposureProgram.HasValue ? (ExposureProgram)dto.ExposureProgram.Value : null,
Flash = dto.Flash.HasValue ? (Flash)dto.Flash.Value : null,
Focal = dto.Focal,
FocalLength = dto.FocalLength,
FocalLengthEquivalent = dto.FocalLengthEquivalent,
@@ -192,23 +199,24 @@ public class MachinePhotosController(MarechaiContext context) : ControllerBase
IsoRating = dto.IsoRating,
Lens = dto.Lens,
LicenseId = dto.LicenseId,
LightSource = dto.LightSource,
LightSource = dto.LightSource.HasValue ? (LightSource?)dto.LightSource : null,
MachineId = dto.MachineId,
MeteringMode = dto.MeteringMode,
ResolutionUnit = dto.ResolutionUnit,
Orientation = dto.Orientation,
Saturation = dto.Saturation,
SceneCaptureType = dto.SceneCaptureType,
SensingMethod = dto.SensingMethod,
Sharpness = dto.Sharpness,
MeteringMode = dto.MeteringMode.HasValue ? (MeteringMode)dto.MeteringMode.Value : null,
ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null,
Orientation = dto.Orientation.HasValue ? (Orientation)dto.Orientation.Value : null,
Saturation = dto.Saturation.HasValue ? (Saturation)dto.Saturation.Value : null,
SceneCaptureType = dto.SceneCaptureType.HasValue ? (SceneCaptureType)dto.SceneCaptureType.Value : null,
SensingMethod = dto.SensingMethod.HasValue ? (SensingMethod)dto.SensingMethod.Value : null,
Sharpness = dto.Sharpness.HasValue ? (Sharpness)dto.Sharpness.Value : null,
SoftwareUsed = dto.SoftwareUsed,
Source = dto.Source,
SubjectDistanceRange = dto.SubjectDistanceRange,
UploadDate = dto.UploadDate,
UserId = dto.UserId,
VerticalResolution = dto.VerticalResolution,
WhiteBalance = dto.WhiteBalance,
OriginalExtension = dto.OriginalExtension
SubjectDistanceRange =
dto.SubjectDistanceRange.HasValue ? (SubjectDistanceRange)dto.SubjectDistanceRange.Value : null,
UploadDate = dto.UploadDate,
UserId = dto.UserId,
VerticalResolution = dto.VerticalResolution,
WhiteBalance = dto.WhiteBalance.HasValue ? (WhiteBalance)dto.WhiteBalance.Value : null,
OriginalExtension = dto.OriginalExtension
};
await context.MachinePhotos.AddAsync(model);

View File

@@ -28,6 +28,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Marechai.Data;
using Marechai.Data.Dtos;
using Marechai.Database.Models;
using Microsoft.AspNetCore.Authorization;
@@ -59,13 +60,13 @@ public class MagazineScansController(MarechaiContext context) : ControllerBase
{
Author = p.Author,
MagazineId = p.Magazine.Id,
ColorSpace = p.ColorSpace,
ColorSpace = (ushort?)p.ColorSpace,
Comments = p.Comments,
CreationDate = p.CreationDate,
ExifVersion = p.ExifVersion,
HorizontalResolution = p.HorizontalResolution,
Id = p.Id,
ResolutionUnit = p.ResolutionUnit,
ResolutionUnit = (ushort?)p.ResolutionUnit,
Page = p.Page,
ScannerManufacturer = p.ScannerManufacturer,
ScannerModel = p.ScannerModel,
@@ -94,12 +95,12 @@ public class MagazineScansController(MarechaiContext context) : ControllerBase
if(model is null) return NotFound();
model.Author = dto.Author;
model.ColorSpace = dto.ColorSpace;
model.ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null;
model.Comments = dto.Comments;
model.CreationDate = dto.CreationDate;
model.ExifVersion = dto.ExifVersion;
model.HorizontalResolution = dto.HorizontalResolution;
model.ResolutionUnit = dto.ResolutionUnit;
model.ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null;
model.Page = dto.Page;
model.ScannerManufacturer = dto.ScannerManufacturer;
model.ScannerModel = dto.ScannerModel;
@@ -127,13 +128,13 @@ public class MagazineScansController(MarechaiContext context) : ControllerBase
{
Author = dto.Author,
MagazineId = dto.MagazineId,
ColorSpace = dto.ColorSpace,
ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null,
Comments = dto.Comments,
CreationDate = dto.CreationDate,
ExifVersion = dto.ExifVersion,
HorizontalResolution = dto.HorizontalResolution,
Id = dto.Id,
ResolutionUnit = dto.ResolutionUnit,
ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null,
Page = dto.Page,
ScannerManufacturer = dto.ScannerManufacturer,
ScannerModel = dto.ScannerModel,

View File

@@ -27,6 +27,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Marechai.Data;
using Marechai.Data.Dtos;
using Marechai.Database.Models;
using Microsoft.AspNetCore.Authorization;
@@ -71,7 +72,7 @@ public class MediaController(MarechaiContext context) : ControllerBase
PhysicalBlockSize = d.PhysicalBlockSize,
LogicalBlockSize = d.LogicalBlockSize,
BlockSizes = d.BlockSizes,
StorageInterface = d.StorageInterface,
StorageInterface = (ushort?)d.StorageInterface,
TableOfContents = d.TableOfContents
})
.ToListAsync();
@@ -119,7 +120,7 @@ public class MediaController(MarechaiContext context) : ControllerBase
PhysicalBlockSize = d.PhysicalBlockSize,
LogicalBlockSize = d.LogicalBlockSize,
BlockSizes = d.BlockSizes,
StorageInterface = d.StorageInterface,
StorageInterface = (ushort?)d.StorageInterface,
TableOfContents = d.TableOfContents
})
.FirstOrDefaultAsync();
@@ -162,7 +163,7 @@ public class MediaController(MarechaiContext context) : ControllerBase
model.PhysicalBlockSize = dto.PhysicalBlockSize;
model.LogicalBlockSize = dto.LogicalBlockSize;
model.BlockSizes = dto.BlockSizes;
model.StorageInterface = dto.StorageInterface;
model.StorageInterface = dto.StorageInterface.HasValue ? (StorageInterface)dto.StorageInterface.Value : null;
model.TableOfContents = dto.TableOfContents;
await context.SaveChangesWithUserAsync(userId);
@@ -205,7 +206,7 @@ public class MediaController(MarechaiContext context) : ControllerBase
PhysicalBlockSize = dto.PhysicalBlockSize,
LogicalBlockSize = dto.LogicalBlockSize,
BlockSizes = dto.BlockSizes,
StorageInterface = dto.StorageInterface,
StorageInterface = dto.StorageInterface.HasValue ? (StorageInterface)dto.StorageInterface.Value : null,
TableOfContents = dto.TableOfContents
};

View File

@@ -90,23 +90,23 @@ public class Exif
model.SoftwareUsed = Software;
model.VerticalResolution = YResolution;
model.Aperture = ApertureValue;
model.ColorSpace = ColorSpace;
model.Contrast = Contrast;
model.ExposureMethod = ExposureMode;
model.ExposureProgram = ExposureProgram;
model.Flash = Flash;
model.ColorSpace = (ushort?)ColorSpace;
model.Contrast = (ushort?)Contrast;
model.ExposureMethod = (ushort?)ExposureMode;
model.ExposureProgram = (ushort?)ExposureProgram;
model.Flash = (ushort?)Flash;
model.FocalLength = FocalLength;
model.FocalLengthEquivalent = FocalLengthIn35mmFormat;
model.LightSource = LightSource;
model.MeteringMode = MeteringMode;
model.ResolutionUnit = ResolutionUnit;
model.Orientation = Orientation;
model.Saturation = Saturation;
model.SceneCaptureType = SceneCaptureType;
model.SensingMethod = SensingMethod;
model.Sharpness = Sharpness;
model.SubjectDistanceRange = SubjectDistanceRange;
model.WhiteBalance = WhiteBalance;
model.LightSource = (ushort?)LightSource;
model.MeteringMode = (ushort?)MeteringMode;
model.ResolutionUnit = (ushort?)ResolutionUnit;
model.Orientation = (ushort?)Orientation;
model.Saturation = (ushort?)Saturation;
model.SceneCaptureType = (ushort?)SceneCaptureType;
model.SensingMethod = (ushort?)SensingMethod;
model.Sharpness = (ushort?)Sharpness;
model.SubjectDistanceRange = (byte?)SubjectDistanceRange;
model.WhiteBalance = (ushort?)WhiteBalance;
model.Comments = Description;
}
@@ -120,8 +120,8 @@ public class Exif
model.HorizontalResolution = XResolution;
model.SoftwareUsed = Software;
model.VerticalResolution = YResolution;
model.ColorSpace = ColorSpace;
model.ResolutionUnit = ResolutionUnit;
model.ColorSpace = (ushort?)ColorSpace;
model.ResolutionUnit = (ushort?)ResolutionUnit;
model.Comments = Description;
}
}

View File

@@ -166,7 +166,7 @@ public partial class Book
return (ushort)_selectedScan.ColorSpace;
}
set => _selectedScan.ColorSpace = (ColorSpace)value;
set => _selectedScan.ColorSpace = value;
}
ushort ScanResolutionUnit
@@ -177,7 +177,7 @@ public partial class Book
return (ushort)_selectedScan.ResolutionUnit;
}
set => _selectedScan.ResolutionUnit = (ResolutionUnit)value;
set => _selectedScan.ResolutionUnit = value;
}
uint ScanType

View File

@@ -163,7 +163,7 @@ public partial class Document
return (ushort)_selectedScan.ColorSpace;
}
set => _selectedScan.ColorSpace = (ColorSpace)value;
set => _selectedScan.ColorSpace = value;
}
ushort ScanResolutionUnit
@@ -174,7 +174,7 @@ public partial class Document
return (ushort)_selectedScan.ResolutionUnit;
}
set => _selectedScan.ResolutionUnit = (ResolutionUnit)value;
set => _selectedScan.ResolutionUnit = value;
}
uint ScanType

View File

@@ -27,13 +27,11 @@ using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Blazorise;
using Marechai.Data;
using Marechai.Data.Dtos;
using Marechai.Database.Models;
using Marechai.Shared;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Orientation = Marechai.Data.Orientation;
namespace Marechai.Pages.Admin.Details;
@@ -92,7 +90,7 @@ public partial class MachinePhoto
return (ushort)_model.ColorSpace;
}
set => _model.ColorSpace = (ColorSpace)value;
set => _model.ColorSpace = value;
}
ushort Contrast
@@ -103,7 +101,7 @@ public partial class MachinePhoto
return (ushort)_model.Contrast;
}
set => _model.Contrast = (Contrast)value;
set => _model.Contrast = value;
}
ushort ExposureMode
@@ -114,7 +112,7 @@ public partial class MachinePhoto
return (ushort)_model.ExposureMethod;
}
set => _model.ExposureMethod = (ExposureMode)value;
set => _model.ExposureMethod = value;
}
ushort ExposureProgram
@@ -125,7 +123,7 @@ public partial class MachinePhoto
return (ushort)_model.ExposureProgram;
}
set => _model.ExposureProgram = (ExposureProgram)value;
set => _model.ExposureProgram = value;
}
ushort Flash
@@ -136,7 +134,7 @@ public partial class MachinePhoto
return (ushort)_model.Flash;
}
set => _model.Flash = (Flash)value;
set => _model.Flash = value;
}
ushort LightSource
@@ -147,7 +145,7 @@ public partial class MachinePhoto
return (ushort)_model.LightSource;
}
set => _model.LightSource = (LightSource)value;
set => _model.LightSource = value;
}
ushort MeteringMode
@@ -158,7 +156,7 @@ public partial class MachinePhoto
return (ushort)_model.MeteringMode;
}
set => _model.MeteringMode = (MeteringMode)value;
set => _model.MeteringMode = value;
}
ushort ResolutionUnit
@@ -169,7 +167,7 @@ public partial class MachinePhoto
return (ushort)_model.ResolutionUnit;
}
set => _model.ResolutionUnit = (ResolutionUnit)value;
set => _model.ResolutionUnit = value;
}
ushort Orientation
@@ -180,7 +178,7 @@ public partial class MachinePhoto
return (ushort)_model.Orientation;
}
set => _model.Orientation = (Orientation)value;
set => _model.Orientation = value;
}
ushort Saturation
@@ -191,7 +189,7 @@ public partial class MachinePhoto
return (ushort)_model.Saturation;
}
set => _model.Saturation = (Saturation)value;
set => _model.Saturation = value;
}
ushort SceneCaptureType
@@ -202,7 +200,7 @@ public partial class MachinePhoto
return (ushort)_model.SceneCaptureType;
}
set => _model.SceneCaptureType = (SceneCaptureType)value;
set => _model.SceneCaptureType = value;
}
ushort SensingMethod
@@ -213,7 +211,7 @@ public partial class MachinePhoto
return (ushort)_model.SensingMethod;
}
set => _model.SensingMethod = (SensingMethod)value;
set => _model.SensingMethod = value;
}
ushort Sharpness
@@ -224,7 +222,7 @@ public partial class MachinePhoto
return (ushort)_model.Sharpness;
}
set => _model.Sharpness = (Sharpness)value;
set => _model.Sharpness = value;
}
ushort SubjectDistanceRange
@@ -235,7 +233,7 @@ public partial class MachinePhoto
return (ushort)_model.SubjectDistanceRange;
}
set => _model.SubjectDistanceRange = (SubjectDistanceRange)value;
set => _model.SubjectDistanceRange = (byte?)value;
}
ushort WhiteBalance
@@ -246,7 +244,7 @@ public partial class MachinePhoto
return (ushort)_model.WhiteBalance;
}
set => _model.WhiteBalance = (WhiteBalance)value;
set => _model.WhiteBalance = value;
}
protected override async Task OnAfterRenderAsync(bool firstRender)

View File

@@ -27,6 +27,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Marechai.Data;
using Marechai.Data.Dtos;
using Marechai.Database.Models;
using Microsoft.EntityFrameworkCore;
@@ -39,33 +40,29 @@ public class BookScansService(MarechaiContext context)
await context.BookScans.Where(p => p.BookId == bookId).Select(p => p.Id).ToListAsync();
public async Task<BookScanDto> GetAsync(Guid id) => await context.BookScans.Where(p => p.Id == id)
.Select(p => new BookScanDto
{
Author = p.Author,
BookId = p.Book.Id,
ColorSpace = p.ColorSpace,
Comments = p.Comments,
CreationDate = p.CreationDate,
ExifVersion = p.ExifVersion,
HorizontalResolution =
p.HorizontalResolution,
Id = p.Id,
ResolutionUnit =
p.ResolutionUnit,
Page = p.Page,
ScannerManufacturer =
p.ScannerManufacturer,
ScannerModel = p.ScannerModel,
SoftwareUsed = p.SoftwareUsed,
Type = p.Type,
UploadDate = p.UploadDate,
UserId = p.UserId,
VerticalResolution =
p.VerticalResolution,
OriginalExtension =
p.OriginalExtension
})
.FirstOrDefaultAsync();
.Select(p => new BookScanDto
{
Author = p.Author,
BookId = p.Book.Id,
ColorSpace = (ushort?)p.ColorSpace,
Comments = p.Comments,
CreationDate = p.CreationDate,
ExifVersion = p.ExifVersion,
HorizontalResolution = p.HorizontalResolution,
Id = p.Id,
ResolutionUnit =
(ushort?)p.ResolutionUnit,
Page = p.Page,
ScannerManufacturer = p.ScannerManufacturer,
ScannerModel = p.ScannerModel,
SoftwareUsed = p.SoftwareUsed,
Type = p.Type,
UploadDate = p.UploadDate,
UserId = p.UserId,
VerticalResolution = p.VerticalResolution,
OriginalExtension = p.OriginalExtension
})
.FirstOrDefaultAsync();
public async Task UpdateAsync(BookScanDto dto, string userId)
{
@@ -74,12 +71,12 @@ public class BookScansService(MarechaiContext context)
if(model is null) return;
model.Author = dto.Author;
model.ColorSpace = dto.ColorSpace;
model.ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null;
model.Comments = dto.Comments;
model.CreationDate = dto.CreationDate;
model.ExifVersion = dto.ExifVersion;
model.HorizontalResolution = dto.HorizontalResolution;
model.ResolutionUnit = dto.ResolutionUnit;
model.ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null;
model.Page = dto.Page;
model.ScannerManufacturer = dto.ScannerManufacturer;
model.ScannerModel = dto.ScannerModel;
@@ -96,13 +93,13 @@ public class BookScansService(MarechaiContext context)
{
Author = dto.Author,
BookId = dto.BookId,
ColorSpace = dto.ColorSpace,
ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null,
Comments = dto.Comments,
CreationDate = dto.CreationDate,
ExifVersion = dto.ExifVersion,
HorizontalResolution = dto.HorizontalResolution,
Id = dto.Id,
ResolutionUnit = dto.ResolutionUnit,
ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null,
Page = dto.Page,
ScannerManufacturer = dto.ScannerManufacturer,
ScannerModel = dto.ScannerModel,

View File

@@ -27,6 +27,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Marechai.Data;
using Marechai.Data.Dtos;
using Marechai.Database.Models;
using Microsoft.EntityFrameworkCore;
@@ -39,28 +40,33 @@ public class DocumentScansService(MarechaiContext context)
await context.DocumentScans.Where(p => p.DocumentId == bookId).Select(p => p.Id).ToListAsync();
public async Task<DocumentScanDto> GetAsync(Guid id) => await context.DocumentScans.Where(p => p.Id == id)
.Select(p => new DocumentScanDto
{
Author = p.Author,
DocumentId = p.Document.Id,
ColorSpace = p.ColorSpace,
Comments = p.Comments,
CreationDate = p.CreationDate,
ExifVersion = p.ExifVersion,
HorizontalResolution = p.HorizontalResolution,
Id = p.Id,
ResolutionUnit = p.ResolutionUnit,
Page = p.Page,
ScannerManufacturer = p.ScannerManufacturer,
ScannerModel = p.ScannerModel,
SoftwareUsed = p.SoftwareUsed,
Type = p.Type,
UploadDate = p.UploadDate,
UserId = p.UserId,
VerticalResolution = p.VerticalResolution,
OriginalExtension = p.OriginalExtension
})
.FirstOrDefaultAsync();
.Select(p => new DocumentScanDto
{
Author = p.Author,
DocumentId = p.Document.Id,
ColorSpace =
(ushort?)p.ColorSpace,
Comments = p.Comments,
CreationDate = p.CreationDate,
ExifVersion = p.ExifVersion,
HorizontalResolution =
p.HorizontalResolution,
Id = p.Id,
ResolutionUnit =
(ushort?)p.ResolutionUnit,
Page = p.Page,
ScannerManufacturer =
p.ScannerManufacturer,
ScannerModel = p.ScannerModel,
SoftwareUsed = p.SoftwareUsed,
Type = p.Type,
UploadDate = p.UploadDate,
UserId = p.UserId,
VerticalResolution =
p.VerticalResolution,
OriginalExtension = p.OriginalExtension
})
.FirstOrDefaultAsync();
public async Task UpdateAsync(DocumentScanDto dto, string userId)
{
@@ -69,12 +75,12 @@ public class DocumentScansService(MarechaiContext context)
if(model is null) return;
model.Author = dto.Author;
model.ColorSpace = dto.ColorSpace;
model.ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null;
model.Comments = dto.Comments;
model.CreationDate = dto.CreationDate;
model.ExifVersion = dto.ExifVersion;
model.HorizontalResolution = dto.HorizontalResolution;
model.ResolutionUnit = dto.ResolutionUnit;
model.ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null;
model.Page = dto.Page;
model.ScannerManufacturer = dto.ScannerManufacturer;
model.ScannerModel = dto.ScannerModel;
@@ -91,13 +97,13 @@ public class DocumentScansService(MarechaiContext context)
{
Author = dto.Author,
DocumentId = dto.DocumentId,
ColorSpace = dto.ColorSpace,
ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null,
Comments = dto.Comments,
CreationDate = dto.CreationDate,
ExifVersion = dto.ExifVersion,
HorizontalResolution = dto.HorizontalResolution,
Id = dto.Id,
ResolutionUnit = dto.ResolutionUnit,
ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null,
Page = dto.Page,
ScannerManufacturer = dto.ScannerManufacturer,
ScannerModel = dto.ScannerModel,

View File

@@ -27,6 +27,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Marechai.Data;
using Marechai.Data.Dtos;
using Marechai.Database.Models;
using Microsoft.EntityFrameworkCore;
@@ -40,56 +41,73 @@ public class MachinePhotosService(MarechaiContext context)
// TODO: Get only the needed parts of ApplicationUser
public async Task<MachinePhotoDto> GetAsync(Guid id) => await context.MachinePhotos.Where(p => p.Id == id)
.Select(p => new MachinePhotoDto
{
Aperture = p.Aperture,
Author = p.Author,
CameraManufacturer = p.CameraManufacturer,
CameraModel = p.CameraModel,
ColorSpace = p.ColorSpace,
Comments = p.Comments,
Contrast = p.Contrast,
CreationDate = p.CreationDate,
DigitalZoomRatio = p.DigitalZoomRatio,
ExifVersion = p.ExifVersion,
ExposureTime = p.ExposureTime,
ExposureMethod = p.ExposureMethod,
ExposureProgram = p.ExposureProgram,
Flash = p.Flash,
Focal = p.Focal,
FocalLength = p.FocalLength,
FocalLengthEquivalent =
p.FocalLengthEquivalent,
HorizontalResolution =
p.HorizontalResolution,
Id = p.Id,
IsoRating = p.IsoRating,
Lens = p.Lens,
LicenseId = p.LicenseId,
LicenseName = p.License.Name,
LightSource = p.LightSource,
MachineCompanyName =
p.Machine.Company.Name,
MachineId = p.MachineId,
MachineName = p.Machine.Name,
MeteringMode = p.MeteringMode,
ResolutionUnit = p.ResolutionUnit,
Orientation = p.Orientation,
Saturation = p.Saturation,
SceneCaptureType = p.SceneCaptureType,
SensingMethod = p.SensingMethod,
Sharpness = p.Sharpness,
SoftwareUsed = p.SoftwareUsed,
Source = p.Source,
SubjectDistanceRange =
p.SubjectDistanceRange,
UploadDate = p.UploadDate,
UserId = p.UserId,
VerticalResolution = p.VerticalResolution,
WhiteBalance = p.WhiteBalance,
OriginalExtension = p.OriginalExtension
})
.FirstOrDefaultAsync();
.Select(p => new MachinePhotoDto
{
Aperture = p.Aperture,
Author = p.Author,
CameraManufacturer =
p.CameraManufacturer,
CameraModel = p.CameraModel,
ColorSpace =
(ushort?)p.ColorSpace,
Comments = p.Comments,
Contrast =
(ushort?)p.Contrast,
CreationDate = p.CreationDate,
DigitalZoomRatio =
p.DigitalZoomRatio,
ExifVersion = p.ExifVersion,
ExposureTime = p.ExposureTime,
ExposureMethod =
(ushort?)p.ExposureMethod,
ExposureProgram =
(ushort?)p.ExposureProgram,
Flash = (ushort?)p.Flash,
Focal = p.Focal,
FocalLength = p.FocalLength,
FocalLengthEquivalent =
p.FocalLengthEquivalent,
HorizontalResolution =
p.HorizontalResolution,
Id = p.Id,
IsoRating = p.IsoRating,
Lens = p.Lens,
LicenseId = p.LicenseId,
LicenseName = p.License.Name,
LightSource =
(ushort?)p.LightSource,
MachineCompanyName =
p.Machine.Company.Name,
MachineId = p.MachineId,
MachineName = p.Machine.Name,
MeteringMode =
(ushort?)p.MeteringMode,
ResolutionUnit =
(ushort?)p.ResolutionUnit,
Orientation =
(ushort?)p.Orientation,
Saturation =
(ushort?)p.Saturation,
SceneCaptureType =
(ushort?)p.SceneCaptureType,
SensingMethod =
(ushort?)p.SensingMethod,
Sharpness =
(ushort?)p.Sharpness,
SoftwareUsed = p.SoftwareUsed,
Source = p.Source,
SubjectDistanceRange =
(byte?)p.SubjectDistanceRange,
UploadDate = p.UploadDate,
UserId = p.UserId,
VerticalResolution =
p.VerticalResolution,
WhiteBalance =
(ushort?)p.WhiteBalance,
OriginalExtension =
p.OriginalExtension
})
.FirstOrDefaultAsync();
public async Task UpdateAsync(MachinePhotoDto dto, string userId)
{
@@ -97,40 +115,44 @@ public class MachinePhotosService(MarechaiContext context)
if(model is null) return;
model.Aperture = dto.Aperture;
model.Author = dto.Author;
model.CameraManufacturer = dto.CameraManufacturer;
model.CameraModel = dto.CameraModel;
model.ColorSpace = dto.ColorSpace;
model.Comments = dto.Comments;
model.Contrast = dto.Contrast;
model.CreationDate = dto.CreationDate;
model.DigitalZoomRatio = dto.DigitalZoomRatio;
model.ExifVersion = dto.ExifVersion;
model.ExposureTime = dto.ExposureTime;
model.ExposureMethod = dto.ExposureMethod;
model.ExposureProgram = dto.ExposureProgram;
model.Flash = dto.Flash;
model.Focal = dto.Focal;
model.FocalLength = dto.FocalLength;
model.Aperture = dto.Aperture;
model.Author = dto.Author;
model.CameraManufacturer = dto.CameraManufacturer;
model.CameraModel = dto.CameraModel;
model.ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null;
model.Comments = dto.Comments;
model.Contrast = dto.Contrast.HasValue ? (Contrast)dto.Contrast.Value : null;
model.CreationDate = dto.CreationDate;
model.DigitalZoomRatio = dto.DigitalZoomRatio;
model.ExifVersion = dto.ExifVersion;
model.ExposureTime = dto.ExposureTime;
model.ExposureMethod = dto.ExposureMethod.HasValue ? (ExposureMode)dto.ExposureMethod.Value : null;
model.ExposureProgram = dto.ExposureProgram.HasValue ? (ExposureProgram)dto.ExposureProgram.Value : null;
model.Flash = dto.Flash.HasValue ? (Flash)dto.Flash.Value : null;
model.Focal = dto.Focal;
model.FocalLength = dto.FocalLength;
model.FocalLengthEquivalent = dto.FocalLengthEquivalent;
model.HorizontalResolution = dto.HorizontalResolution;
model.IsoRating = dto.IsoRating;
model.Lens = dto.Lens;
model.LicenseId = dto.LicenseId;
model.LightSource = dto.LightSource;
model.MeteringMode = dto.MeteringMode;
model.ResolutionUnit = dto.ResolutionUnit;
model.Orientation = dto.Orientation;
model.Saturation = dto.Saturation;
model.SceneCaptureType = dto.SceneCaptureType;
model.SensingMethod = dto.SensingMethod;
model.Sharpness = dto.Sharpness;
model.SoftwareUsed = dto.SoftwareUsed;
model.Source = dto.Source;
model.SubjectDistanceRange = dto.SubjectDistanceRange;
model.VerticalResolution = dto.VerticalResolution;
model.WhiteBalance = dto.WhiteBalance;
model.HorizontalResolution = dto.HorizontalResolution;
model.IsoRating = dto.IsoRating;
model.Lens = dto.Lens;
model.LicenseId = dto.LicenseId;
model.LightSource = dto.LightSource.HasValue ? (LightSource)dto.LightSource.Value : null;
model.MeteringMode = dto.MeteringMode.HasValue ? (MeteringMode)dto.MeteringMode.Value : null;
model.ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null;
model.Orientation = dto.Orientation.HasValue ? (Orientation)dto.Orientation.Value : null;
model.Saturation = dto.Saturation.HasValue ? (Saturation)dto.Saturation.Value : null;
model.SceneCaptureType = dto.SceneCaptureType.HasValue ? (SceneCaptureType)dto.SceneCaptureType.Value : null;
model.SensingMethod = dto.SensingMethod.HasValue ? (SensingMethod)dto.SensingMethod.Value : null;
model.Sharpness = dto.Sharpness.HasValue ? (Sharpness)dto.Sharpness.Value : null;
model.SoftwareUsed = dto.SoftwareUsed;
model.Source = dto.Source;
model.SubjectDistanceRange = dto.SubjectDistanceRange.HasValue
? (SubjectDistanceRange)dto.SubjectDistanceRange.Value
: null;
model.VerticalResolution = dto.VerticalResolution;
model.WhiteBalance = dto.WhiteBalance.HasValue ? (WhiteBalance)dto.WhiteBalance.Value : null;
await context.SaveChangesWithUserAsync(userId);
}
@@ -143,16 +165,16 @@ public class MachinePhotosService(MarechaiContext context)
Author = dto.Author,
CameraManufacturer = dto.CameraManufacturer,
CameraModel = dto.CameraModel,
ColorSpace = dto.ColorSpace,
ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null,
Comments = dto.Comments,
Contrast = dto.Contrast,
Contrast = dto.Contrast.HasValue ? (Contrast)dto.Contrast.Value : null,
CreationDate = dto.CreationDate,
DigitalZoomRatio = dto.DigitalZoomRatio,
ExifVersion = dto.ExifVersion,
ExposureTime = dto.ExposureTime,
ExposureMethod = dto.ExposureMethod,
ExposureProgram = dto.ExposureProgram,
Flash = dto.Flash,
ExposureMethod = dto.ExposureMethod.HasValue ? (ExposureMode)dto.ExposureMethod.Value : null,
ExposureProgram = dto.ExposureProgram.HasValue ? (ExposureProgram)dto.ExposureProgram.Value : null,
Flash = dto.Flash.HasValue ? (Flash)dto.Flash.Value : null,
Focal = dto.Focal,
FocalLength = dto.FocalLength,
FocalLengthEquivalent = dto.FocalLengthEquivalent,
@@ -161,23 +183,24 @@ public class MachinePhotosService(MarechaiContext context)
IsoRating = dto.IsoRating,
Lens = dto.Lens,
LicenseId = dto.LicenseId,
LightSource = dto.LightSource,
LightSource = dto.LightSource.HasValue ? (LightSource)dto.LightSource.Value : null,
MachineId = dto.MachineId,
MeteringMode = dto.MeteringMode,
ResolutionUnit = dto.ResolutionUnit,
Orientation = dto.Orientation,
Saturation = dto.Saturation,
SceneCaptureType = dto.SceneCaptureType,
SensingMethod = dto.SensingMethod,
Sharpness = dto.Sharpness,
MeteringMode = dto.MeteringMode.HasValue ? (MeteringMode)dto.MeteringMode.Value : null,
ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null,
Orientation = dto.Orientation.HasValue ? (Orientation)dto.Orientation.Value : null,
Saturation = dto.Saturation.HasValue ? (Saturation)dto.Saturation.Value : null,
SceneCaptureType = dto.SceneCaptureType.HasValue ? (SceneCaptureType)dto.SceneCaptureType.Value : null,
SensingMethod = dto.SensingMethod.HasValue ? (SensingMethod)dto.SensingMethod.Value : null,
Sharpness = dto.Sharpness.HasValue ? (Sharpness)dto.Sharpness.Value : null,
SoftwareUsed = dto.SoftwareUsed,
Source = dto.Source,
SubjectDistanceRange = dto.SubjectDistanceRange,
UploadDate = dto.UploadDate,
UserId = dto.UserId,
VerticalResolution = dto.VerticalResolution,
WhiteBalance = dto.WhiteBalance,
OriginalExtension = dto.OriginalExtension
SubjectDistanceRange =
dto.SubjectDistanceRange.HasValue ? (SubjectDistanceRange)dto.SubjectDistanceRange.Value : null,
UploadDate = dto.UploadDate,
UserId = dto.UserId,
VerticalResolution = dto.VerticalResolution,
WhiteBalance = dto.WhiteBalance.HasValue ? (WhiteBalance)dto.WhiteBalance.Value : null,
OriginalExtension = dto.OriginalExtension
};
await context.MachinePhotos.AddAsync(model);

View File

@@ -27,6 +27,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Marechai.Data;
using Marechai.Data.Dtos;
using Marechai.Database.Models;
using Microsoft.EntityFrameworkCore;
@@ -39,28 +40,33 @@ public class MagazineScansService(MarechaiContext context)
await context.MagazineScans.Where(p => p.MagazineId == bookId).Select(p => p.Id).ToListAsync();
public async Task<MagazineScanDto> GetAsync(Guid id) => await context.MagazineScans.Where(p => p.Id == id)
.Select(p => new MagazineScanDto
{
Author = p.Author,
MagazineId = p.Magazine.Id,
ColorSpace = p.ColorSpace,
Comments = p.Comments,
CreationDate = p.CreationDate,
ExifVersion = p.ExifVersion,
HorizontalResolution = p.HorizontalResolution,
Id = p.Id,
ResolutionUnit = p.ResolutionUnit,
Page = p.Page,
ScannerManufacturer = p.ScannerManufacturer,
ScannerModel = p.ScannerModel,
SoftwareUsed = p.SoftwareUsed,
Type = p.Type,
UploadDate = p.UploadDate,
UserId = p.UserId,
VerticalResolution = p.VerticalResolution,
OriginalExtension = p.OriginalExtension
})
.FirstOrDefaultAsync();
.Select(p => new MagazineScanDto
{
Author = p.Author,
MagazineId = p.Magazine.Id,
ColorSpace =
(ushort?)p.ColorSpace,
Comments = p.Comments,
CreationDate = p.CreationDate,
ExifVersion = p.ExifVersion,
HorizontalResolution =
p.HorizontalResolution,
Id = p.Id,
ResolutionUnit =
(ushort?)p.ResolutionUnit,
Page = p.Page,
ScannerManufacturer =
p.ScannerManufacturer,
ScannerModel = p.ScannerModel,
SoftwareUsed = p.SoftwareUsed,
Type = p.Type,
UploadDate = p.UploadDate,
UserId = p.UserId,
VerticalResolution =
p.VerticalResolution,
OriginalExtension = p.OriginalExtension
})
.FirstOrDefaultAsync();
public async Task UpdateAsync(MagazineScanDto dto, string userId)
{
@@ -69,12 +75,12 @@ public class MagazineScansService(MarechaiContext context)
if(model is null) return;
model.Author = dto.Author;
model.ColorSpace = dto.ColorSpace;
model.ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null;
model.Comments = dto.Comments;
model.CreationDate = dto.CreationDate;
model.ExifVersion = dto.ExifVersion;
model.HorizontalResolution = dto.HorizontalResolution;
model.ResolutionUnit = dto.ResolutionUnit;
model.ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null;
model.Page = dto.Page;
model.ScannerManufacturer = dto.ScannerManufacturer;
model.ScannerModel = dto.ScannerModel;
@@ -91,13 +97,13 @@ public class MagazineScansService(MarechaiContext context)
{
Author = dto.Author,
MagazineId = dto.MagazineId,
ColorSpace = dto.ColorSpace,
ColorSpace = dto.ColorSpace.HasValue ? (ColorSpace)dto.ColorSpace.Value : null,
Comments = dto.Comments,
CreationDate = dto.CreationDate,
ExifVersion = dto.ExifVersion,
HorizontalResolution = dto.HorizontalResolution,
Id = dto.Id,
ResolutionUnit = dto.ResolutionUnit,
ResolutionUnit = dto.ResolutionUnit.HasValue ? (ResolutionUnit)dto.ResolutionUnit.Value : null,
Page = dto.Page,
ScannerManufacturer = dto.ScannerManufacturer,
ScannerModel = dto.ScannerModel,

View File

@@ -26,6 +26,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Marechai.Data;
using Marechai.Data.Dtos;
using Marechai.Database.Models;
using Microsoft.EntityFrameworkCore;
@@ -35,76 +36,76 @@ namespace Marechai.Services;
public class MediaService(MarechaiContext context)
{
public async Task<List<MediaDto>> GetAsync() => await context.Media.OrderBy(d => d.Title)
.Select(d => new MediaDto
{
Id = d.Id,
Title = d.Title,
Sequence = d.Sequence,
LastSequence = d.LastSequence,
Type = d.Type,
WriteOffset = d.WriteOffset,
Sides = d.Sides,
Layers = d.Layers,
Sessions = d.Sessions,
Tracks = d.Tracks,
Sectors = d.Sectors,
Size = d.Size,
CopyProtection = d.CopyProtection,
PartNumber = d.PartNumber,
SerialNumber = d.SerialNumber,
Barcode = d.Barcode,
CatalogueNumber = d.CatalogueNumber,
Manufacturer = d.Manufacturer,
Model = d.Model,
Revision = d.Revision,
Firmware = d.Firmware,
PhysicalBlockSize = d.PhysicalBlockSize,
LogicalBlockSize = d.LogicalBlockSize,
BlockSizes = d.BlockSizes,
StorageInterface = (ushort?)d.StorageInterface,
TableOfContents = d.TableOfContents
})
.ToListAsync();
public async Task<List<MediaDto>> GetTitlesAsync() => await context.Media.OrderBy(d => d.Title)
.Select(d => new MediaDto
{
Id = d.Id,
Title = d.Title,
Sequence = d.Sequence,
LastSequence = d.LastSequence,
Type = d.Type,
WriteOffset = d.WriteOffset,
Sides = d.Sides,
Layers = d.Layers,
Sessions = d.Sessions,
Tracks = d.Tracks,
Sectors = d.Sectors,
Size = d.Size,
CopyProtection = d.CopyProtection,
PartNumber = d.PartNumber,
SerialNumber = d.SerialNumber,
Barcode = d.Barcode,
CatalogueNumber = d.CatalogueNumber,
Manufacturer = d.Manufacturer,
Model = d.Model,
Revision = d.Revision,
Firmware = d.Firmware,
PhysicalBlockSize = d.PhysicalBlockSize,
LogicalBlockSize = d.LogicalBlockSize,
BlockSizes = d.BlockSizes,
StorageInterface = d.StorageInterface,
TableOfContents = d.TableOfContents
Id = d.Id,
Title = d.Title
})
.ToListAsync();
public async Task<List<MediaDto>> GetTitlesAsync() => await context.Media.OrderBy(d => d.Title)
.Select(d => new MediaDto
{
Id = d.Id,
Title = d.Title
})
.ToListAsync();
public async Task<MediaDto> GetAsync(ulong id) => await context.Media.Where(d => d.Id == id)
.Select(d => new MediaDto
{
Id = d.Id,
Title = d.Title,
Sequence = d.Sequence,
LastSequence = d.LastSequence,
Type = d.Type,
WriteOffset = d.WriteOffset,
Sides = d.Sides,
Layers = d.Layers,
Sessions = d.Sessions,
Tracks = d.Tracks,
Sectors = d.Sectors,
Size = d.Size,
CopyProtection = d.CopyProtection,
PartNumber = d.PartNumber,
SerialNumber = d.SerialNumber,
Barcode = d.Barcode,
CatalogueNumber = d.CatalogueNumber,
Manufacturer = d.Manufacturer,
Model = d.Model,
Revision = d.Revision,
Firmware = d.Firmware,
PhysicalBlockSize = d.PhysicalBlockSize,
LogicalBlockSize = d.LogicalBlockSize,
BlockSizes = d.BlockSizes,
StorageInterface = d.StorageInterface,
TableOfContents = d.TableOfContents
})
.FirstOrDefaultAsync();
.Select(d => new MediaDto
{
Id = d.Id,
Title = d.Title,
Sequence = d.Sequence,
LastSequence = d.LastSequence,
Type = d.Type,
WriteOffset = d.WriteOffset,
Sides = d.Sides,
Layers = d.Layers,
Sessions = d.Sessions,
Tracks = d.Tracks,
Sectors = d.Sectors,
Size = d.Size,
CopyProtection = d.CopyProtection,
PartNumber = d.PartNumber,
SerialNumber = d.SerialNumber,
Barcode = d.Barcode,
CatalogueNumber = d.CatalogueNumber,
Manufacturer = d.Manufacturer,
Model = d.Model,
Revision = d.Revision,
Firmware = d.Firmware,
PhysicalBlockSize = d.PhysicalBlockSize,
LogicalBlockSize = d.LogicalBlockSize,
BlockSizes = d.BlockSizes,
StorageInterface = (ushort?)d.StorageInterface,
TableOfContents = d.TableOfContents
})
.FirstOrDefaultAsync();
public async Task UpdateAsync(MediaDto dto, string userId)
{
@@ -135,7 +136,7 @@ public class MediaService(MarechaiContext context)
model.PhysicalBlockSize = dto.PhysicalBlockSize;
model.LogicalBlockSize = dto.LogicalBlockSize;
model.BlockSizes = dto.BlockSizes;
model.StorageInterface = dto.StorageInterface;
model.StorageInterface = dto.StorageInterface.HasValue ? (StorageInterface)dto.StorageInterface.Value : null;
model.TableOfContents = dto.TableOfContents;
await context.SaveChangesWithUserAsync(userId);
}
@@ -167,7 +168,7 @@ public class MediaService(MarechaiContext context)
PhysicalBlockSize = dto.PhysicalBlockSize,
LogicalBlockSize = dto.LogicalBlockSize,
BlockSizes = dto.BlockSizes,
StorageInterface = dto.StorageInterface,
StorageInterface = dto.StorageInterface.HasValue ? (StorageInterface)dto.StorageInterface.Value : null,
TableOfContents = dto.TableOfContents
};