Fix photo fields type.

This commit is contained in:
2020-05-30 21:45:44 +01:00
parent 5d79afdfc3
commit 9aa44fb546
9 changed files with 3776 additions and 20 deletions

View File

@@ -342,12 +342,12 @@ namespace Marechai.Database
AdobeRgb = 2, [Display(Name = "Wide Gamut RGB")] AdobeRgb = 2, [Display(Name = "Wide Gamut RGB")]
WideGamutRgb = 4093, [Display(Name = "ICC Profile")] WideGamutRgb = 4093, [Display(Name = "ICC Profile")]
IccProfile = 65534, [Display(Name = "Uncalibrated")] IccProfile = 65534, [Display(Name = "Uncalibrated")]
Uncalibreated = 65535 Uncalibrated = 65535
} }
public enum Contrast : ushort public enum Contrast : ushort
{ {
Normal = 0, Low = 1, Hig = 2 Normal = 0, Low = 1, High = 2
} }
public enum ExposureMode : ushort public enum ExposureMode : ushort

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,71 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Marechai.Database.Migrations
{
public partial class FixPhotoFieldsType : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex("IX_OwnedMachinePhotos_Exposure", "OwnedMachinePhotos");
migrationBuilder.DropIndex("IX_MachinePhotos_Exposure", "MachinePhotos");
migrationBuilder.DropColumn("Exposure", "OwnedMachinePhotos");
migrationBuilder.DropColumn("Exposure", "MachinePhotos");
migrationBuilder.AddColumn<double>("Aperture", "OwnedMachinePhotos", nullable: true);
migrationBuilder.AddColumn<double>("ExposureTime", "OwnedMachinePhotos", nullable: true);
migrationBuilder.AddColumn<string>("OriginalExtension", "OwnedMachinePhotos", nullable: true);
migrationBuilder.AddColumn<double>("Aperture", "MachinePhotos", nullable: true);
migrationBuilder.AddColumn<double>("ExposureTime", "MachinePhotos", nullable: true);
migrationBuilder.AddColumn<string>("OriginalExtension", "MachinePhotos", nullable: true);
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Aperture", "OwnedMachinePhotos", "Aperture");
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_ExposureTime", "OwnedMachinePhotos", "ExposureTime");
migrationBuilder.CreateIndex("IX_MachinePhotos_Aperture", "MachinePhotos", "Aperture");
migrationBuilder.CreateIndex("IX_MachinePhotos_ExposureTime", "MachinePhotos", "ExposureTime");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex("IX_OwnedMachinePhotos_Aperture", "OwnedMachinePhotos");
migrationBuilder.DropIndex("IX_OwnedMachinePhotos_ExposureTime", "OwnedMachinePhotos");
migrationBuilder.DropIndex("IX_MachinePhotos_Aperture", "MachinePhotos");
migrationBuilder.DropIndex("IX_MachinePhotos_ExposureTime", "MachinePhotos");
migrationBuilder.DropColumn("Aperture", "OwnedMachinePhotos");
migrationBuilder.DropColumn("ExposureTime", "OwnedMachinePhotos");
migrationBuilder.DropColumn("OriginalExtension", "OwnedMachinePhotos");
migrationBuilder.DropColumn("Aperture", "MachinePhotos");
migrationBuilder.DropColumn("ExposureTime", "MachinePhotos");
migrationBuilder.DropColumn("OriginalExtension", "MachinePhotos");
migrationBuilder.AddColumn<string>("Exposure", "OwnedMachinePhotos", "varchar(255) CHARACTER SET utf8mb4",
nullable: true);
migrationBuilder.AddColumn<string>("Exposure", "MachinePhotos", "varchar(255) CHARACTER SET utf8mb4",
nullable: true);
migrationBuilder.CreateIndex("IX_OwnedMachinePhotos_Exposure", "OwnedMachinePhotos", "Exposure");
migrationBuilder.CreateIndex("IX_MachinePhotos_Exposure", "MachinePhotos", "Exposure");
}
}
}

View File

@@ -846,6 +846,8 @@ namespace Marechai.Database.Migrations
{ {
b.Property<Guid>("Id").ValueGeneratedOnAdd().HasColumnType("char(36)"); b.Property<Guid>("Id").ValueGeneratedOnAdd().HasColumnType("char(36)");
b.Property<double?>("Aperture").HasColumnType("double");
b.Property<string>("Author").HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("Author").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<string>("CameraManufacturer").HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("CameraManufacturer").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
@@ -864,12 +866,12 @@ namespace Marechai.Database.Migrations
b.Property<string>("ExifVersion").HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ExifVersion").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<string>("Exposure").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<ushort?>("ExposureMethod").HasColumnType("smallint unsigned"); b.Property<ushort?>("ExposureMethod").HasColumnType("smallint unsigned");
b.Property<ushort?>("ExposureProgram").HasColumnType("smallint unsigned"); b.Property<ushort?>("ExposureProgram").HasColumnType("smallint unsigned");
b.Property<double?>("ExposureTime").HasColumnType("double");
b.Property<ushort?>("Flash").HasColumnType("smallint unsigned"); b.Property<ushort?>("Flash").HasColumnType("smallint unsigned");
b.Property<double?>("Focal").HasColumnType("double"); b.Property<double?>("Focal").HasColumnType("double");
@@ -894,6 +896,8 @@ namespace Marechai.Database.Migrations
b.Property<ushort?>("Orientation").HasColumnType("smallint unsigned"); b.Property<ushort?>("Orientation").HasColumnType("smallint unsigned");
b.Property<string>("OriginalExtension").HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ushort?>("ResolutionUnit").HasColumnType("smallint unsigned"); b.Property<ushort?>("ResolutionUnit").HasColumnType("smallint unsigned");
b.Property<ushort?>("Saturation").HasColumnType("smallint unsigned"); b.Property<ushort?>("Saturation").HasColumnType("smallint unsigned");
@@ -921,6 +925,8 @@ namespace Marechai.Database.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Aperture");
b.HasIndex("Author"); b.HasIndex("Author");
b.HasIndex("CameraManufacturer"); b.HasIndex("CameraManufacturer");
@@ -939,12 +945,12 @@ namespace Marechai.Database.Migrations
b.HasIndex("ExifVersion"); b.HasIndex("ExifVersion");
b.HasIndex("Exposure");
b.HasIndex("ExposureMethod"); b.HasIndex("ExposureMethod");
b.HasIndex("ExposureProgram"); b.HasIndex("ExposureProgram");
b.HasIndex("ExposureTime");
b.HasIndex("Flash"); b.HasIndex("Flash");
b.HasIndex("Focal"); b.HasIndex("Focal");
@@ -1272,6 +1278,8 @@ namespace Marechai.Database.Migrations
{ {
b.Property<Guid>("Id").ValueGeneratedOnAdd().HasColumnType("char(36)"); b.Property<Guid>("Id").ValueGeneratedOnAdd().HasColumnType("char(36)");
b.Property<double?>("Aperture").HasColumnType("double");
b.Property<string>("Author").HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("Author").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<string>("CameraManufacturer").HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("CameraManufacturer").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
@@ -1290,12 +1298,12 @@ namespace Marechai.Database.Migrations
b.Property<string>("ExifVersion").HasColumnType("varchar(255) CHARACTER SET utf8mb4"); b.Property<string>("ExifVersion").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<string>("Exposure").HasColumnType("varchar(255) CHARACTER SET utf8mb4");
b.Property<ushort?>("ExposureMethod").HasColumnType("smallint unsigned"); b.Property<ushort?>("ExposureMethod").HasColumnType("smallint unsigned");
b.Property<ushort?>("ExposureProgram").HasColumnType("smallint unsigned"); b.Property<ushort?>("ExposureProgram").HasColumnType("smallint unsigned");
b.Property<double?>("ExposureTime").HasColumnType("double");
b.Property<ushort?>("Flash").HasColumnType("smallint unsigned"); b.Property<ushort?>("Flash").HasColumnType("smallint unsigned");
b.Property<double?>("Focal").HasColumnType("double"); b.Property<double?>("Focal").HasColumnType("double");
@@ -1318,6 +1326,8 @@ namespace Marechai.Database.Migrations
b.Property<ushort?>("Orientation").HasColumnType("smallint unsigned"); b.Property<ushort?>("Orientation").HasColumnType("smallint unsigned");
b.Property<string>("OriginalExtension").HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<long>("OwnedMachineId").HasColumnType("bigint"); b.Property<long>("OwnedMachineId").HasColumnType("bigint");
b.Property<ushort?>("ResolutionUnit").HasColumnType("smallint unsigned"); b.Property<ushort?>("ResolutionUnit").HasColumnType("smallint unsigned");
@@ -1345,6 +1355,8 @@ namespace Marechai.Database.Migrations
b.HasKey("Id"); b.HasKey("Id");
b.HasIndex("Aperture");
b.HasIndex("Author"); b.HasIndex("Author");
b.HasIndex("CameraManufacturer"); b.HasIndex("CameraManufacturer");
@@ -1363,12 +1375,12 @@ namespace Marechai.Database.Migrations
b.HasIndex("ExifVersion"); b.HasIndex("ExifVersion");
b.HasIndex("Exposure");
b.HasIndex("ExposureMethod"); b.HasIndex("ExposureMethod");
b.HasIndex("ExposureProgram"); b.HasIndex("ExposureProgram");
b.HasIndex("ExposureTime");
b.HasIndex("Flash"); b.HasIndex("Flash");
b.HasIndex("Focal"); b.HasIndex("Focal");

View File

@@ -6,6 +6,7 @@ namespace Marechai.Database.Models
{ {
public class BasePhoto : BaseModel<Guid> public class BasePhoto : BaseModel<Guid>
{ {
public double? Aperture { get; set; }
public string Author { get; set; } public string Author { get; set; }
[DisplayName("Camera manufacturer")] [DisplayName("Camera manufacturer")]
public string CameraManufacturer { get; set; } public string CameraManufacturer { get; set; }
@@ -23,7 +24,7 @@ namespace Marechai.Database.Models
[DisplayName("Exif version")] [DisplayName("Exif version")]
public string ExifVersion { get; set; } public string ExifVersion { get; set; }
[DisplayName("Exposure time")] [DisplayName("Exposure time")]
public string Exposure { get; set; } public double? ExposureTime { get; set; }
[DisplayName("Exposure mode")] [DisplayName("Exposure mode")]
public ExposureMode? ExposureMethod { get; set; } public ExposureMode? ExposureMethod { get; set; }
[DisplayName("Exposure Program")] [DisplayName("Exposure Program")]
@@ -64,6 +65,7 @@ namespace Marechai.Database.Models
public double? VerticalResolution { get; set; } public double? VerticalResolution { get; set; }
[DisplayName("White balance")] [DisplayName("White balance")]
public WhiteBalance? WhiteBalance { get; set; } public WhiteBalance? WhiteBalance { get; set; }
public string OriginalExtension { get; set; }
public virtual ApplicationUser User { get; set; } public virtual ApplicationUser User { get; set; }
[Required] [Required]

View File

@@ -103,7 +103,9 @@ namespace Marechai.Database.Models
return; return;
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http: //go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings. #warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http: //go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
optionsBuilder.UseMySql("server=zeus.claunia.com;port=3306;user=marechai;password=marechaipass;database=marechai"); optionsBuilder.
UseMySql("server=zeus.claunia.com;port=3306;user=marechai;password=marechaipass;database=marechai");
optionsBuilder.UseLazyLoadingProxies(); optionsBuilder.UseLazyLoadingProxies();
} }
@@ -735,6 +737,8 @@ namespace Marechai.Database.Models
modelBuilder.Entity<MachinePhoto>(entity => modelBuilder.Entity<MachinePhoto>(entity =>
{ {
entity.HasIndex(e => e.Aperture);
entity.HasIndex(e => e.Author); entity.HasIndex(e => e.Author);
entity.HasIndex(e => e.CameraManufacturer); entity.HasIndex(e => e.CameraManufacturer);
@@ -753,7 +757,7 @@ namespace Marechai.Database.Models
entity.HasIndex(e => e.ExifVersion); entity.HasIndex(e => e.ExifVersion);
entity.HasIndex(e => e.Exposure); entity.HasIndex(e => e.ExposureTime);
entity.HasIndex(e => e.ExposureMethod); entity.HasIndex(e => e.ExposureMethod);
@@ -808,6 +812,8 @@ namespace Marechai.Database.Models
modelBuilder.Entity<OwnedMachinePhoto>(entity => modelBuilder.Entity<OwnedMachinePhoto>(entity =>
{ {
entity.HasIndex(e => e.Aperture);
entity.HasIndex(e => e.Author); entity.HasIndex(e => e.Author);
entity.HasIndex(e => e.CameraManufacturer); entity.HasIndex(e => e.CameraManufacturer);
@@ -826,7 +832,7 @@ namespace Marechai.Database.Models
entity.HasIndex(e => e.ExifVersion); entity.HasIndex(e => e.ExifVersion);
entity.HasIndex(e => e.Exposure); entity.HasIndex(e => e.ExposureTime);
entity.HasIndex(e => e.ExposureMethod); entity.HasIndex(e => e.ExposureMethod);

View File

@@ -59,7 +59,7 @@ namespace Marechai.Areas.Admin.Controllers
Id = m.Id, CameraManufacturer = m.CameraManufacturer, CameraModel = m.CameraModel, Id = m.Id, CameraManufacturer = m.CameraManufacturer, CameraModel = m.CameraModel,
ColorSpace = m.ColorSpace, Comments = m.Comments, Contrast = m.Contrast, ColorSpace = m.ColorSpace, Comments = m.Comments, Contrast = m.Contrast,
CreationDate = m.CreationDate, DigitalZoomRatio = m.DigitalZoomRatio, ExifVersion = m.ExifVersion, CreationDate = m.CreationDate, DigitalZoomRatio = m.DigitalZoomRatio, ExifVersion = m.ExifVersion,
Exposure = m.Exposure, ExposureProgram = m.ExposureProgram, Flash = m.Flash, Focal = m.Focal, Exposure = m.ExposureTime, ExposureProgram = m.ExposureProgram, Flash = m.Flash, Focal = m.Focal,
FocalLength = m.FocalLength, FocalLengthEquivalent = m.FocalLengthEquivalent, FocalLength = m.FocalLength, FocalLengthEquivalent = m.FocalLengthEquivalent,
HorizontalResolution = m.HorizontalResolution, IsoRating = m.IsoRating, Lens = m.Lens, HorizontalResolution = m.HorizontalResolution, IsoRating = m.IsoRating, Lens = m.Lens,
LightSource = m.LightSource, MeteringMode = m.MeteringMode, ResolutionUnit = m.ResolutionUnit, LightSource = m.LightSource, MeteringMode = m.MeteringMode, ResolutionUnit = m.ResolutionUnit,

View File

@@ -24,7 +24,7 @@ namespace Marechai.Areas.Admin.Models
[DisplayName("Exif version")] [DisplayName("Exif version")]
public string ExifVersion { get; set; } public string ExifVersion { get; set; }
[DisplayName("Exposure time")] [DisplayName("Exposure time")]
public string Exposure { get; set; } public double? Exposure { get; set; }
[DisplayName("Exposure mode")] [DisplayName("Exposure mode")]
public ExposureMode? ExposureMethod { get; set; } public ExposureMode? ExposureMethod { get; set; }
[DisplayName("Exposure Program")] [DisplayName("Exposure Program")]

View File

@@ -80,10 +80,10 @@
</span> </span>
</div> </div>
<div class="form-group"> <div class="form-group">
<label asp-for="Exposure" class="control-label"> <label asp-for="ExposureTime" class="control-label">
</label> </label>
<input asp-for="Exposure" class="form-control" /> <input asp-for="ExposureTime" class="form-control" />
<span asp-validation-for="Exposure" class="text-danger"> <span asp-validation-for="ExposureTime" class="text-danger">
</span> </span>
</div> </div>
<div class="form-group"> <div class="form-group">