summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Migrations/20220915235337_DropBookPublicationDate.Designer.cs57
-rw-r--r--Migrations/20220915235337_DropBookPublicationDate.cs27
-rw-r--r--Migrations/20220915235413_AddBookPublicationYear.Designer.cs60
-rw-r--r--Migrations/20220915235413_AddBookPublicationYear.cs26
-rw-r--r--Migrations/LibraryContextModelSnapshot.cs9
-rw-r--r--Models/Book.cs4
-rw-r--r--obj/LibraryAPI.csproj.nuget.dgspec.json10
-rw-r--r--obj/project.assets.json6
8 files changed, 187 insertions, 12 deletions
diff --git a/Migrations/20220915235337_DropBookPublicationDate.Designer.cs b/Migrations/20220915235337_DropBookPublicationDate.Designer.cs
new file mode 100644
index 0000000..e97f909
--- /dev/null
+++ b/Migrations/20220915235337_DropBookPublicationDate.Designer.cs
@@ -0,0 +1,57 @@
+// <auto-generated />
+using System;
+using LibraryAPI.Models;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace LibraryAPI.Migrations
+{
+ [DbContext(typeof(LibraryContext))]
+ [Migration("20220915235337_DropBookPublicationDate")]
+ partial class DropBookPublicationDate
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.9")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("LibraryAPI.Models.Book", b =>
+ {
+ b.Property<long>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
+
+ b.Property<int>("Edition")
+ .HasColumnType("integer");
+
+ b.Property<string[]>("Genres")
+ .IsRequired()
+ .HasColumnType("text[]");
+
+ b.Property<string>("ISBN")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property<string>("Title")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Books");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Migrations/20220915235337_DropBookPublicationDate.cs b/Migrations/20220915235337_DropBookPublicationDate.cs
new file mode 100644
index 0000000..4d16267
--- /dev/null
+++ b/Migrations/20220915235337_DropBookPublicationDate.cs
@@ -0,0 +1,27 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace LibraryAPI.Migrations
+{
+ public partial class DropBookPublicationDate : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "PublicationDate",
+ table: "Books");
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<DateTime>(
+ name: "PublicationDate",
+ table: "Books",
+ type: "timestamp with time zone",
+ nullable: false,
+ defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
+ }
+ }
+}
diff --git a/Migrations/20220915235413_AddBookPublicationYear.Designer.cs b/Migrations/20220915235413_AddBookPublicationYear.Designer.cs
new file mode 100644
index 0000000..072bb5c
--- /dev/null
+++ b/Migrations/20220915235413_AddBookPublicationYear.Designer.cs
@@ -0,0 +1,60 @@
+// <auto-generated />
+using System;
+using LibraryAPI.Models;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace LibraryAPI.Migrations
+{
+ [DbContext(typeof(LibraryContext))]
+ [Migration("20220915235413_AddBookPublicationYear")]
+ partial class AddBookPublicationYear
+ {
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "6.0.9")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("LibraryAPI.Models.Book", b =>
+ {
+ b.Property<long>("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
+
+ b.Property<int>("Edition")
+ .HasColumnType("integer");
+
+ b.Property<string[]>("Genres")
+ .IsRequired()
+ .HasColumnType("text[]");
+
+ b.Property<string>("ISBN")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property<int>("PublicationYear")
+ .HasColumnType("integer");
+
+ b.Property<string>("Title")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Books");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Migrations/20220915235413_AddBookPublicationYear.cs b/Migrations/20220915235413_AddBookPublicationYear.cs
new file mode 100644
index 0000000..12bf4b3
--- /dev/null
+++ b/Migrations/20220915235413_AddBookPublicationYear.cs
@@ -0,0 +1,26 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace LibraryAPI.Migrations
+{
+ public partial class AddBookPublicationYear : Migration
+ {
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AddColumn<int>(
+ name: "PublicationYear",
+ table: "Books",
+ type: "integer",
+ nullable: false,
+ defaultValue: 0);
+ }
+
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "PublicationYear",
+ table: "Books");
+ }
+ }
+}
diff --git a/Migrations/LibraryContextModelSnapshot.cs b/Migrations/LibraryContextModelSnapshot.cs
index 734dcc0..d340ff6 100644
--- a/Migrations/LibraryContextModelSnapshot.cs
+++ b/Migrations/LibraryContextModelSnapshot.cs
@@ -41,8 +41,13 @@ namespace LibraryAPI.Migrations
.IsRequired()
.HasColumnType("text");
- b.Property<DateTime>("PublicationDate")
- .HasColumnType("timestamp with time zone");
+ b.Property<int>("PublicationYear")
+ .IsRequired()
+ .HasColumnType("integer");
+
+ b.Property<string>("Title")
+ .IsRequired()
+ .HasColumnType("text");
b.HasKey("Id");
diff --git a/Models/Book.cs b/Models/Book.cs
index d648c12..bcf9ef7 100644
--- a/Models/Book.cs
+++ b/Models/Book.cs
@@ -6,10 +6,10 @@ namespace LibraryAPI.Models {
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id { get; set; }
- public DateTime PublicationDate { get; set; }
-
+ public int PublicationYear { get; set; }
public string[] Genres { get; set; }
public int Edition { get; set; }
public string ISBN { get; set; }
+ public string Title { get; set; }
}
} \ No newline at end of file
diff --git a/obj/LibraryAPI.csproj.nuget.dgspec.json b/obj/LibraryAPI.csproj.nuget.dgspec.json
index e6462cd..2740cb5 100644
--- a/obj/LibraryAPI.csproj.nuget.dgspec.json
+++ b/obj/LibraryAPI.csproj.nuget.dgspec.json
@@ -1,17 +1,17 @@
{
"format": 1,
"restore": {
- "/mnt/Personal/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj": {}
+ "/home/luis/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj": {}
},
"projects": {
- "/mnt/Personal/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj": {
+ "/home/luis/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj": {
"version": "1.0.0",
"restore": {
- "projectUniqueName": "/mnt/Personal/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj",
+ "projectUniqueName": "/home/luis/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj",
"projectName": "LibraryAPI",
- "projectPath": "/mnt/Personal/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj",
+ "projectPath": "/home/luis/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj",
"packagesPath": "/home/luis/.nuget/packages/",
- "outputPath": "/mnt/Personal/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/obj/",
+ "outputPath": "/home/luis/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/luis/.nuget/NuGet/NuGet.Config"
diff --git a/obj/project.assets.json b/obj/project.assets.json
index f7a430c..0e6df0a 100644
--- a/obj/project.assets.json
+++ b/obj/project.assets.json
@@ -9695,11 +9695,11 @@
"project": {
"version": "1.0.0",
"restore": {
- "projectUniqueName": "/mnt/Personal/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj",
+ "projectUniqueName": "/home/luis/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj",
"projectName": "LibraryAPI",
- "projectPath": "/mnt/Personal/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj",
+ "projectPath": "/home/luis/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/LibraryAPI.csproj",
"packagesPath": "/home/luis/.nuget/packages/",
- "outputPath": "/mnt/Personal/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/obj/",
+ "outputPath": "/home/luis/Documentos/LCC/7mo Semestre/BackEnd/LibraryAPI/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/luis/.nuget/NuGet/NuGet.Config"