diff --git a/DTOs/CategoryShortDTO.cs b/DTOs/CategoryShortDTO.cs
new file mode 100644
index 0000000..9f41be3
--- /dev/null
+++ b/DTOs/CategoryShortDTO.cs
@@ -0,0 +1,9 @@
+namespace QuotifyBE.DTOs;
+public record class CategoryShortDTO
+{
+ public int Id { get; set; }
+ public string Name { get; set; } = string.Empty;
+ public string? Description { get; set; }
+ public DateTime? CreatedAt { get; set; } = DateTime.UtcNow;
+
+};
diff --git a/Entities/Category.cs b/Entities/Category.cs
index b168608..b4c3b7d 100644
--- a/Entities/Category.cs
+++ b/Entities/Category.cs
@@ -1,8 +1,10 @@
-namespace QuotifyBE.Entities
+namespace QuotifyBE.Entities
{
public class Category
{
public int Id { get; set; }
- public string? Name { get; set; }
+ required public string Name { get; set; } = string.Empty;
+ public string? Description { get; set; }
+ public DateTime? CreatedAt { get; set; } = DateTime.UtcNow;
}
}
diff --git a/Migrations/20250718084441_more_category_data.Designer.cs b/Migrations/20250718084441_more_category_data.Designer.cs
new file mode 100644
index 0000000..12b3cc4
--- /dev/null
+++ b/Migrations/20250718084441_more_category_data.Designer.cs
@@ -0,0 +1,190 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+using QuotifyBE.Data;
+
+#nullable disable
+
+namespace QuotifyBE.Migrations
+{
+ [DbContext(typeof(ApplicationDbContext))]
+ [Migration("20250718084441_more_category_data")]
+ partial class more_category_data
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "9.0.7")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("QuotifyBE.Entities.Category", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Description")
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Categories");
+ });
+
+ modelBuilder.Entity("QuotifyBE.Entities.Image", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Url")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Images");
+ });
+
+ modelBuilder.Entity("QuotifyBE.Entities.Quote", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Author")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ImageId")
+ .HasColumnType("integer");
+
+ b.Property("LastUpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Text")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("Quotes");
+ });
+
+ modelBuilder.Entity("QuotifyBE.Entities.QuoteCategory", b =>
+ {
+ b.Property("QuoteId")
+ .HasColumnType("integer");
+
+ b.Property("CategoryId")
+ .HasColumnType("integer");
+
+ b.HasKey("QuoteId", "CategoryId");
+
+ b.HasIndex("CategoryId");
+
+ b.ToTable("QuoteCategories");
+ });
+
+ modelBuilder.Entity("QuotifyBE.Entities.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("PasswordHash")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Role")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("Users");
+ });
+
+ modelBuilder.Entity("QuotifyBE.Entities.Quote", b =>
+ {
+ b.HasOne("QuotifyBE.Entities.Image", "Image")
+ .WithMany()
+ .HasForeignKey("ImageId");
+
+ b.HasOne("QuotifyBE.Entities.User", "User")
+ .WithMany()
+ .HasForeignKey("UserId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Image");
+
+ b.Navigation("User");
+ });
+
+ modelBuilder.Entity("QuotifyBE.Entities.QuoteCategory", b =>
+ {
+ b.HasOne("QuotifyBE.Entities.Category", "Category")
+ .WithMany()
+ .HasForeignKey("CategoryId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("QuotifyBE.Entities.Quote", "Quote")
+ .WithMany("QuoteCategories")
+ .HasForeignKey("QuoteId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Category");
+
+ b.Navigation("Quote");
+ });
+
+ modelBuilder.Entity("QuotifyBE.Entities.Quote", b =>
+ {
+ b.Navigation("QuoteCategories");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Migrations/20250718084441_more_category_data.cs b/Migrations/20250718084441_more_category_data.cs
new file mode 100644
index 0000000..7f8fcae
--- /dev/null
+++ b/Migrations/20250718084441_more_category_data.cs
@@ -0,0 +1,57 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace QuotifyBE.Migrations
+{
+ ///
+ public partial class more_category_data : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterColumn(
+ name: "Name",
+ table: "Categories",
+ type: "text",
+ nullable: false,
+ defaultValue: "",
+ oldClrType: typeof(string),
+ oldType: "text",
+ oldNullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "CreatedAt",
+ table: "Categories",
+ type: "timestamp with time zone",
+ nullable: true);
+
+ migrationBuilder.AddColumn(
+ name: "Description",
+ table: "Categories",
+ type: "text",
+ nullable: true);
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropColumn(
+ name: "CreatedAt",
+ table: "Categories");
+
+ migrationBuilder.DropColumn(
+ name: "Description",
+ table: "Categories");
+
+ migrationBuilder.AlterColumn(
+ name: "Name",
+ table: "Categories",
+ type: "text",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "text");
+ }
+ }
+}
diff --git a/Migrations/ApplicationDbContextModelSnapshot.cs b/Migrations/ApplicationDbContextModelSnapshot.cs
index 34f29bc..6b415fa 100644
--- a/Migrations/ApplicationDbContextModelSnapshot.cs
+++ b/Migrations/ApplicationDbContextModelSnapshot.cs
@@ -30,7 +30,14 @@ namespace QuotifyBE.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Description")
+ .HasColumnType("text");
+
b.Property("Name")
+ .IsRequired()
.HasColumnType("text");
b.HasKey("Id");