mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-08-11 11:42:03 +00:00
Compare commits
7 Commits
f1f1f17d72
...
f11f13481b
| Author | SHA1 | Date | |
|---|---|---|---|
| f11f13481b | |||
| cf38713f92 | |||
| dd8db9c2d3 | |||
| dc8ce245bf | |||
| a6a536d44f | |||
| 92f25b6575 | |||
| bc72fb449b |
@@ -0,0 +1,295 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using barkmanapi;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
[DbContext(typeof(BarkContext))]
|
||||
[Migration("20260716020638_addoders")]
|
||||
partial class addoders
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "9.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Customers", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address");
|
||||
|
||||
b.Property<string>("BillingTerms")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("billing_terms");
|
||||
|
||||
b.Property<string>("Company")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("company");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("email");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<string>("PhoneNumber")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("phone_number");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_customers");
|
||||
|
||||
b.ToTable("customers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.InventoryItems", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Barcode")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("barcode");
|
||||
|
||||
b.Property<string>("Brand")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("brand");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<float?>("RentalPrice")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("rental_price");
|
||||
|
||||
b.Property<float?>("ReplacementCost")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("replacement_cost");
|
||||
|
||||
b.Property<string>("SerialNumber")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("serial_number");
|
||||
|
||||
b.Property<string>("StatusId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("status_id");
|
||||
|
||||
b.Property<float?>("Weight")
|
||||
.HasColumnType("real")
|
||||
.HasColumnName("weight");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_inventory");
|
||||
|
||||
b.HasIndex("Barcode")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("ix_inventory_barcode");
|
||||
|
||||
b.HasIndex("StatusId")
|
||||
.HasDatabaseName("ix_inventory_status_id");
|
||||
|
||||
b.ToTable("inventory", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.ItemStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_item_status");
|
||||
|
||||
b.ToTable("item_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.OrderItems", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ItemId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("item_id");
|
||||
|
||||
b.Property<string>("OrderId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("order_id");
|
||||
|
||||
b.Property<int?>("OrdersId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("orders_id");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("quantity");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_order_items");
|
||||
|
||||
b.HasIndex("OrdersId")
|
||||
.HasDatabaseName("ix_order_items_orders_id");
|
||||
|
||||
b.ToTable("order_items", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.OrderStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_order_status");
|
||||
|
||||
b.ToTable("order_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Orders", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address");
|
||||
|
||||
b.Property<string>("CustomerId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("customer_id");
|
||||
|
||||
b.Property<DateTimeOffset>("EndDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("end_date");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<DateTimeOffset>("StartDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("start_date");
|
||||
|
||||
b.Property<string>("StatusId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("status_id");
|
||||
|
||||
b.Property<decimal>("TotalPrice")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("total_price");
|
||||
|
||||
b.Property<string>("Venue")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("venue");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_orders");
|
||||
|
||||
b.HasIndex("StatusId")
|
||||
.HasDatabaseName("ix_orders_status_id");
|
||||
|
||||
b.ToTable("orders", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.InventoryItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.ItemStatus", "Status")
|
||||
.WithMany()
|
||||
.HasForeignKey("StatusId")
|
||||
.HasConstraintName("fk_inventory_item_status_status_id");
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.OrderItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.Orders", null)
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("OrdersId")
|
||||
.HasConstraintName("fk_order_items_orders_orders_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Orders", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.OrderStatus", "Status")
|
||||
.WithMany()
|
||||
.HasForeignKey("StatusId")
|
||||
.HasConstraintName("fk_orders_order_status_status_id");
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Orders", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addoders : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "order_status",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<string>(type: "text", nullable: false),
|
||||
name = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_order_status", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "orders",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
customer_id = table.Column<string>(type: "text", nullable: false),
|
||||
name = table.Column<string>(type: "text", nullable: false),
|
||||
status_id = table.Column<string>(type: "text", nullable: true),
|
||||
start_date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
end_date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
total_price = table.Column<decimal>(type: "numeric", nullable: false),
|
||||
venue = table.Column<string>(type: "text", nullable: true),
|
||||
address = table.Column<string>(type: "text", nullable: true),
|
||||
notes = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_orders", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_orders_order_status_status_id",
|
||||
column: x => x.status_id,
|
||||
principalTable: "order_status",
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "order_items",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
order_id = table.Column<string>(type: "text", nullable: false),
|
||||
item_id = table.Column<string>(type: "text", nullable: false),
|
||||
quantity = table.Column<int>(type: "integer", nullable: false),
|
||||
orders_id = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_order_items", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_order_items_orders_orders_id",
|
||||
column: x => x.orders_id,
|
||||
principalTable: "orders",
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_order_items_orders_id",
|
||||
table: "order_items",
|
||||
column: "orders_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_orders_status_id",
|
||||
table: "orders",
|
||||
column: "status_id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "order_items");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "orders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "order_status");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
@@ -144,6 +145,115 @@ namespace barkmanapi.Migrations
|
||||
b.ToTable("item_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.OrderItems", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ItemId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("item_id");
|
||||
|
||||
b.Property<string>("OrderId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("order_id");
|
||||
|
||||
b.Property<int?>("OrdersId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("orders_id");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("quantity");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_order_items");
|
||||
|
||||
b.HasIndex("OrdersId")
|
||||
.HasDatabaseName("ix_order_items_orders_id");
|
||||
|
||||
b.ToTable("order_items", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.OrderStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_order_status");
|
||||
|
||||
b.ToTable("order_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Orders", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("address");
|
||||
|
||||
b.Property<string>("CustomerId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("customer_id");
|
||||
|
||||
b.Property<DateTimeOffset>("EndDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("end_date");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<DateTimeOffset>("StartDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("start_date");
|
||||
|
||||
b.Property<string>("StatusId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("status_id");
|
||||
|
||||
b.Property<decimal>("TotalPrice")
|
||||
.HasColumnType("numeric")
|
||||
.HasColumnName("total_price");
|
||||
|
||||
b.Property<string>("Venue")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("venue");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_orders");
|
||||
|
||||
b.HasIndex("StatusId")
|
||||
.HasDatabaseName("ix_orders_status_id");
|
||||
|
||||
b.ToTable("orders", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.InventoryItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.ItemStatus", "Status")
|
||||
@@ -153,6 +263,29 @@ namespace barkmanapi.Migrations
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.OrderItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.Orders", null)
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("OrdersId")
|
||||
.HasConstraintName("fk_order_items_orders_orders_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Orders", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.OrderStatus", "Status")
|
||||
.WithMany()
|
||||
.HasForeignKey("StatusId")
|
||||
.HasConstraintName("fk_orders_order_status_status_id");
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Orders", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ public class BarkContext(DbContextOptions<BarkContext> options) : DbContext(opti
|
||||
public DbSet<InventoryItems> Inventory { get; set; }
|
||||
public DbSet<ItemStatus> ItemStatus { get; set; }
|
||||
public DbSet<Customers> Customers { get; set; }
|
||||
public DbSet<Orders> Orders { get; set; }
|
||||
public DbSet<OrderItems> OrderItems { get; set; }
|
||||
public DbSet<OrderStatus> OrderStatus { get; set; }
|
||||
}
|
||||
|
||||
[Index(nameof(Barcode), IsUnique = true)]
|
||||
@@ -42,3 +45,33 @@ public class Customers
|
||||
public string? BillingTerms { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
}
|
||||
|
||||
public class Orders
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public required string CustomerId { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public OrderStatus Status { get; set; }
|
||||
public string? StatusId { get; set; }
|
||||
public DateTimeOffset StartDate { get; set; }
|
||||
public DateTimeOffset EndDate { get; set; }
|
||||
public decimal TotalPrice { get; set; }
|
||||
public string? Venue { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public OrderItems[] Items { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
}
|
||||
|
||||
public class OrderItems
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public required string OrderId { get; set; }
|
||||
public required string ItemId { get; set; }
|
||||
public int Quantity { get; set; }
|
||||
}
|
||||
|
||||
public class OrderStatus
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user