first commit

This commit is contained in:
2026-03-09 22:09:10 +01:00
commit 7b6b294b0f
269 changed files with 10338 additions and 0 deletions

View File

@@ -0,0 +1,274 @@
// <auto-generated />
using System;
using BookHive;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BookHive.Migrations
{
[DbContext(typeof(BookHiveDbContext))]
[Migration("20260309112221_InitialDatabase")]
partial class InitialDatabase
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.20")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BookHive.Models.Author", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Biography")
.HasMaxLength(2000)
.HasColumnType("nvarchar(2000)");
b.Property<DateOnly>("BirthDate")
.HasColumnType("date");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Nationality")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.HasKey("Id");
b.ToTable("Authors");
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AuthorId")
.HasColumnType("int");
b.Property<string>("Genre")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Isbn")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("PageCount")
.HasColumnType("int");
b.Property<DateOnly>("PublishedDate")
.HasColumnType("date");
b.Property<string>("Summary")
.HasMaxLength(3000)
.HasColumnType("nvarchar(3000)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.ToTable("Books");
});
modelBuilder.Entity("BookHive.Models.Loan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BookId")
.HasColumnType("int");
b.Property<DateOnly>("DueDate")
.HasColumnType("date");
b.Property<DateOnly>("LoanDate")
.HasColumnType("date");
b.Property<int>("MemberId")
.HasColumnType("int");
b.Property<DateOnly?>("ReturnDate")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("BookId");
b.HasIndex("MemberId");
b.ToTable("Loans");
});
modelBuilder.Entity("BookHive.Models.Member", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateOnly>("MembershipDate")
.HasColumnType("date");
b.HasKey("Id");
b.ToTable("Members");
});
modelBuilder.Entity("BookHive.Models.Review", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BookId")
.HasColumnType("int");
b.Property<string>("Comment")
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<DateTime?>("CreatedAt")
.IsRequired()
.HasColumnType("datetime2");
b.Property<int>("MemberId")
.HasColumnType("int");
b.Property<int>("Rating")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("BookId");
b.HasIndex("MemberId");
b.ToTable("Reviews");
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.HasOne("BookHive.Models.Author", "Author")
.WithMany("Books")
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
});
modelBuilder.Entity("BookHive.Models.Loan", b =>
{
b.HasOne("BookHive.Models.Book", "Book")
.WithMany("Loans")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookHive.Models.Member", "Member")
.WithMany("Loans")
.HasForeignKey("MemberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Book");
b.Navigation("Member");
});
modelBuilder.Entity("BookHive.Models.Review", b =>
{
b.HasOne("BookHive.Models.Book", "Book")
.WithMany("Reviews")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookHive.Models.Member", "Member")
.WithMany("Reviews")
.HasForeignKey("MemberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Book");
b.Navigation("Member");
});
modelBuilder.Entity("BookHive.Models.Author", b =>
{
b.Navigation("Books");
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.Navigation("Loans");
b.Navigation("Reviews");
});
modelBuilder.Entity("BookHive.Models.Member", b =>
{
b.Navigation("Loans");
b.Navigation("Reviews");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,176 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BookHive.Migrations
{
/// <inheritdoc />
public partial class InitialDatabase : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Authors",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FirstName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
LastName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
Biography = table.Column<string>(type: "nvarchar(2000)", maxLength: 2000, nullable: true),
BirthDate = table.Column<DateOnly>(type: "date", nullable: false),
Nationality = table.Column<string>(type: "nvarchar(60)", maxLength: 60, nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Authors", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Members",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
FirstName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
LastName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
MembershipDate = table.Column<DateOnly>(type: "date", nullable: false),
IsActive = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Members", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Books",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Isbn = table.Column<string>(type: "nvarchar(max)", nullable: false),
Summary = table.Column<string>(type: "nvarchar(3000)", maxLength: 3000, nullable: true),
PageCount = table.Column<int>(type: "int", nullable: false),
PublishedDate = table.Column<DateOnly>(type: "date", nullable: false),
Genre = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false),
AuthorId = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Books", x => x.Id);
table.ForeignKey(
name: "FK_Books_Authors_AuthorId",
column: x => x.AuthorId,
principalTable: "Authors",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Loans",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
BookId = table.Column<int>(type: "int", nullable: false),
MemberId = table.Column<int>(type: "int", nullable: false),
LoanDate = table.Column<DateOnly>(type: "date", nullable: false),
DueDate = table.Column<DateOnly>(type: "date", nullable: false),
ReturnDate = table.Column<DateOnly>(type: "date", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Loans", x => x.Id);
table.ForeignKey(
name: "FK_Loans_Books_BookId",
column: x => x.BookId,
principalTable: "Books",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Loans_Members_MemberId",
column: x => x.MemberId,
principalTable: "Members",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Reviews",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
BookId = table.Column<int>(type: "int", nullable: false),
MemberId = table.Column<int>(type: "int", nullable: false),
Rating = table.Column<int>(type: "int", nullable: false),
Comment = table.Column<string>(type: "nvarchar(1000)", maxLength: 1000, nullable: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Reviews", x => x.Id);
table.ForeignKey(
name: "FK_Reviews_Books_BookId",
column: x => x.BookId,
principalTable: "Books",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Reviews_Members_MemberId",
column: x => x.MemberId,
principalTable: "Members",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Books_AuthorId",
table: "Books",
column: "AuthorId");
migrationBuilder.CreateIndex(
name: "IX_Loans_BookId",
table: "Loans",
column: "BookId");
migrationBuilder.CreateIndex(
name: "IX_Loans_MemberId",
table: "Loans",
column: "MemberId");
migrationBuilder.CreateIndex(
name: "IX_Reviews_BookId",
table: "Reviews",
column: "BookId");
migrationBuilder.CreateIndex(
name: "IX_Reviews_MemberId",
table: "Reviews",
column: "MemberId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Loans");
migrationBuilder.DropTable(
name: "Reviews");
migrationBuilder.DropTable(
name: "Books");
migrationBuilder.DropTable(
name: "Members");
migrationBuilder.DropTable(
name: "Authors");
}
}
}

View File

@@ -0,0 +1,275 @@
// <auto-generated />
using System;
using BookHive;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BookHive.Migrations
{
[DbContext(typeof(BookHiveDbContext))]
[Migration("20260309132259_AddedContraint")]
partial class AddedContraint
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.20")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BookHive.Models.Author", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Biography")
.HasMaxLength(2000)
.HasColumnType("nvarchar(2000)");
b.Property<DateOnly>("BirthDate")
.HasColumnType("date");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Nationality")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.HasKey("Id");
b.ToTable("Authors");
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AuthorId")
.HasColumnType("int");
b.Property<string>("Genre")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Isbn")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("PageCount")
.HasColumnType("int");
b.Property<DateOnly>("PublishedDate")
.HasColumnType("date");
b.Property<string>("Summary")
.HasMaxLength(3000)
.HasColumnType("nvarchar(3000)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.ToTable("Books");
});
modelBuilder.Entity("BookHive.Models.Loan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BookId")
.HasColumnType("int");
b.Property<DateOnly>("DueDate")
.HasColumnType("date");
b.Property<DateOnly>("LoanDate")
.HasColumnType("date");
b.Property<int>("MemberId")
.HasColumnType("int");
b.Property<DateOnly?>("ReturnDate")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("BookId");
b.HasIndex("MemberId");
b.ToTable("Loans");
});
modelBuilder.Entity("BookHive.Models.Member", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateOnly>("MembershipDate")
.HasColumnType("date");
b.HasKey("Id");
b.ToTable("Members");
});
modelBuilder.Entity("BookHive.Models.Review", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BookId")
.HasColumnType("int");
b.Property<string>("Comment")
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<DateTime?>("CreatedAt")
.IsRequired()
.HasColumnType("datetime2");
b.Property<int>("MemberId")
.HasColumnType("int");
b.Property<int>("Rating")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("MemberId");
b.HasIndex("BookId", "MemberId")
.IsUnique();
b.ToTable("Reviews");
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.HasOne("BookHive.Models.Author", "Author")
.WithMany("Books")
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
});
modelBuilder.Entity("BookHive.Models.Loan", b =>
{
b.HasOne("BookHive.Models.Book", "Book")
.WithMany("Loans")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookHive.Models.Member", "Member")
.WithMany("Loans")
.HasForeignKey("MemberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Book");
b.Navigation("Member");
});
modelBuilder.Entity("BookHive.Models.Review", b =>
{
b.HasOne("BookHive.Models.Book", "Book")
.WithMany("Reviews")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookHive.Models.Member", "Member")
.WithMany("Reviews")
.HasForeignKey("MemberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Book");
b.Navigation("Member");
});
modelBuilder.Entity("BookHive.Models.Author", b =>
{
b.Navigation("Books");
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.Navigation("Loans");
b.Navigation("Reviews");
});
modelBuilder.Entity("BookHive.Models.Member", b =>
{
b.Navigation("Loans");
b.Navigation("Reviews");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BookHive.Migrations
{
/// <inheritdoc />
public partial class AddedContraint : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Reviews_BookId",
table: "Reviews");
migrationBuilder.CreateIndex(
name: "IX_Reviews_BookId_MemberId",
table: "Reviews",
columns: new[] { "BookId", "MemberId" },
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Reviews_BookId_MemberId",
table: "Reviews");
migrationBuilder.CreateIndex(
name: "IX_Reviews_BookId",
table: "Reviews",
column: "BookId");
}
}
}

View File

@@ -0,0 +1,272 @@
// <auto-generated />
using System;
using BookHive;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BookHive.Migrations
{
[DbContext(typeof(BookHiveDbContext))]
partial class BookHiveDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.20")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BookHive.Models.Author", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Biography")
.HasMaxLength(2000)
.HasColumnType("nvarchar(2000)");
b.Property<DateOnly>("BirthDate")
.HasColumnType("date");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<string>("Nationality")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("nvarchar(60)");
b.HasKey("Id");
b.ToTable("Authors");
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("AuthorId")
.HasColumnType("int");
b.Property<string>("Genre")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Isbn")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("PageCount")
.HasColumnType("int");
b.Property<DateOnly>("PublishedDate")
.HasColumnType("date");
b.Property<string>("Summary")
.HasMaxLength(3000)
.HasColumnType("nvarchar(3000)");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.HasIndex("AuthorId");
b.ToTable("Books");
});
modelBuilder.Entity("BookHive.Models.Loan", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BookId")
.HasColumnType("int");
b.Property<DateOnly>("DueDate")
.HasColumnType("date");
b.Property<DateOnly>("LoanDate")
.HasColumnType("date");
b.Property<int>("MemberId")
.HasColumnType("int");
b.Property<DateOnly?>("ReturnDate")
.HasColumnType("date");
b.HasKey("Id");
b.HasIndex("BookId");
b.HasIndex("MemberId");
b.ToTable("Loans");
});
modelBuilder.Entity("BookHive.Models.Member", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<bool>("IsActive")
.HasColumnType("bit");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("nvarchar(100)");
b.Property<DateOnly>("MembershipDate")
.HasColumnType("date");
b.HasKey("Id");
b.ToTable("Members");
});
modelBuilder.Entity("BookHive.Models.Review", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("BookId")
.HasColumnType("int");
b.Property<string>("Comment")
.HasMaxLength(1000)
.HasColumnType("nvarchar(1000)");
b.Property<DateTime?>("CreatedAt")
.IsRequired()
.HasColumnType("datetime2");
b.Property<int>("MemberId")
.HasColumnType("int");
b.Property<int>("Rating")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("MemberId");
b.HasIndex("BookId", "MemberId")
.IsUnique();
b.ToTable("Reviews");
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.HasOne("BookHive.Models.Author", "Author")
.WithMany("Books")
.HasForeignKey("AuthorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Author");
});
modelBuilder.Entity("BookHive.Models.Loan", b =>
{
b.HasOne("BookHive.Models.Book", "Book")
.WithMany("Loans")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookHive.Models.Member", "Member")
.WithMany("Loans")
.HasForeignKey("MemberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Book");
b.Navigation("Member");
});
modelBuilder.Entity("BookHive.Models.Review", b =>
{
b.HasOne("BookHive.Models.Book", "Book")
.WithMany("Reviews")
.HasForeignKey("BookId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BookHive.Models.Member", "Member")
.WithMany("Reviews")
.HasForeignKey("MemberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Book");
b.Navigation("Member");
});
modelBuilder.Entity("BookHive.Models.Author", b =>
{
b.Navigation("Books");
});
modelBuilder.Entity("BookHive.Models.Book", b =>
{
b.Navigation("Loans");
b.Navigation("Reviews");
});
modelBuilder.Entity("BookHive.Models.Member", b =>
{
b.Navigation("Loans");
b.Navigation("Reviews");
});
#pragma warning restore 612, 618
}
}
}