Skip to content

Commit

Permalink
product type change
Browse files Browse the repository at this point in the history
  • Loading branch information
Tohirjon-Odilov committed Mar 6, 2024
1 parent ff4c8bb commit 1b8153d
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ public class RequestLogin
{
[Required]
[Email]
public string Email { get; set; }
public string? Email { get; set; }
[Required]
public string Password { get; set; }
public string? Password { get; set; }
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ namespace Exam.StockManagement.Domain.Entities.ViewModels
{
public class ProductViewModel : Auditable
{
public string ProductName { get; set; }
public string? ProductName { get; set; }
public int ProductPrice { get; set; }
public string? ProductDescription { get; set; }
public string? ProductPicture { get; set; }
public string CategoryName { get; set; }
public string? CategoryName { get; set; }
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Exam.StockManagement.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class producttypeupdate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ProductName",
table: "Products",
type: "character varying(150)",
maxLength: 150,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(100)",
oldMaxLength: 100);

migrationBuilder.AlterColumn<string>(
name: "ProductDescription",
table: "Products",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(100)",
oldMaxLength: 100,
oldNullable: true);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "ProductName",
table: "Products",
type: "character varying(100)",
maxLength: 100,
nullable: false,
oldClrType: typeof(string),
oldType: "character varying(150)",
oldMaxLength: 150);

migrationBuilder.AlterColumn<string>(
name: "ProductDescription",
table: "Products",
type: "character varying(100)",
maxLength: 100,
nullable: true,
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,12 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("timestamp with time zone");
b.Property<string>("ProductDescription")
.HasMaxLength(100)
.HasColumnType("character varying(100)");
.HasColumnType("text");
b.Property<string>("ProductName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("character varying(100)");
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("ProductPicture")
.HasColumnType("text");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ public class ProductConfig : IEntityTypeConfiguration<Product>
public void Configure(EntityTypeBuilder<Product> builder)
{
builder.Property(x => x.ProductName)
.HasMaxLength(100);

builder.Property(x => x.ProductDescription)
.HasMaxLength(100);
.HasMaxLength(150);
builder.Property(x => x.ProductPicture)
.HasMaxLength(250);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ public StockManagementDbContext(DbContextOptions<StockManagementDbContext> optio
{
Database.Migrate();
}

public virtual DbSet<User> Users { get; set; }
public virtual DbSet<Product> Products { get; set; }
public virtual DbSet<Category> Categories { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);

modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
}

public virtual DbSet<User> Users { get; set; }
public virtual DbSet<Product> Products { get; set; }
public virtual DbSet<Category> Categories { get; set; }

}
}

0 comments on commit 1b8153d

Please sign in to comment.