mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-08-11 11:42:03 +00:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ec2a756bf5 | |||
| b2bb60a4a3 | |||
| cc8e8cdfc6 | |||
| fb25b8aba6 | |||
| 1b478cd7ba | |||
| 5517924259 | |||
| c79bda3960 | |||
| 9906f015fc | |||
| 10ca133a7a | |||
| 85678f5742 | |||
| 69da029156 | |||
| 087d94cbd9 | |||
| 33f59fd7f8 | |||
| 775d64ef9e | |||
| 4a479283da | |||
| 757a51997f | |||
| ddd90aa5a5 | |||
| c2c48b4cb1 | |||
| 137f9ee669 | |||
| fc44790c96 | |||
| 2eaa8723d0 | |||
| 0d2e049e69 | |||
| 656ccd7d52 | |||
| 7dcc366393 | |||
| 8b0a90d2e5 | |||
| f5efccea40 | |||
| be5260547b | |||
| 9374ad53e3 | |||
| 34d421719c | |||
| d15701a50b | |||
| 92afaafe7b | |||
| 854c55b7e0 | |||
| 3b07318e34 | |||
| 161a73cbb7 | |||
| 65df987f62 | |||
| 29e9302d8e | |||
| 8289936d3f | |||
| 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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("20260719204137_changedOrderToJob")]
|
||||
partial class changedOrderToJob
|
||||
{
|
||||
/// <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.JobItems", 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<int?>("JobsId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("jobs_id");
|
||||
|
||||
b.Property<string>("OrderId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("order_id");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("quantity");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_items");
|
||||
|
||||
b.HasIndex("JobsId")
|
||||
.HasDatabaseName("ix_job_items_jobs_id");
|
||||
|
||||
b.ToTable("job_items", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.JobStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_status");
|
||||
|
||||
b.ToTable("job_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", 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_jobs");
|
||||
|
||||
b.HasIndex("StatusId")
|
||||
.HasDatabaseName("ix_jobs_status_id");
|
||||
|
||||
b.ToTable("jobs", (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.JobItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.Jobs", null)
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("JobsId")
|
||||
.HasConstraintName("fk_job_items_jobs_jobs_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.JobStatus", "Status")
|
||||
.WithMany()
|
||||
.HasForeignKey("StatusId")
|
||||
.HasConstraintName("fk_jobs_job_status_status_id");
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class changedOrderToJob : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "order_items");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "orders");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "order_status");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "job_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_job_status", x => x.id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "jobs",
|
||||
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_jobs", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_jobs_job_status_status_id",
|
||||
column: x => x.status_id,
|
||||
principalTable: "job_status",
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "job_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),
|
||||
jobs_id = table.Column<int>(type: "integer", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_job_items", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_job_items_jobs_jobs_id",
|
||||
column: x => x.jobs_id,
|
||||
principalTable: "jobs",
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_job_items_jobs_id",
|
||||
table: "job_items",
|
||||
column: "jobs_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_jobs_status_id",
|
||||
table: "jobs",
|
||||
column: "status_id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "job_items");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "jobs");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "job_status");
|
||||
|
||||
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),
|
||||
status_id = table.Column<string>(type: "text", nullable: true),
|
||||
address = table.Column<string>(type: "text", nullable: true),
|
||||
customer_id = table.Column<string>(type: "text", nullable: false),
|
||||
end_date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
name = table.Column<string>(type: "text", nullable: false),
|
||||
notes = table.Column<string>(type: "text", nullable: true),
|
||||
start_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)
|
||||
},
|
||||
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),
|
||||
item_id = table.Column<string>(type: "text", nullable: false),
|
||||
order_id = table.Column<string>(type: "text", nullable: false),
|
||||
orders_id = table.Column<int>(type: "integer", nullable: true),
|
||||
quantity = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
// <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("20260723200239_maybethisworks")]
|
||||
partial class maybethisworks
|
||||
{
|
||||
/// <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.JobItems", 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<int?>("JobsId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("jobs_id");
|
||||
|
||||
b.Property<string>("OrderId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("order_id");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("quantity");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_items");
|
||||
|
||||
b.HasIndex("JobsId")
|
||||
.HasDatabaseName("ix_job_items_jobs_id");
|
||||
|
||||
b.ToTable("job_items", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.JobStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_status");
|
||||
|
||||
b.ToTable("job_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", 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<int>("CustomerId")
|
||||
.HasColumnType("integer")
|
||||
.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_jobs");
|
||||
|
||||
b.HasIndex("StatusId")
|
||||
.HasDatabaseName("ix_jobs_status_id");
|
||||
|
||||
b.ToTable("jobs", (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.JobItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.Jobs", null)
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("JobsId")
|
||||
.HasConstraintName("fk_job_items_jobs_jobs_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.JobStatus", "Status")
|
||||
.WithMany()
|
||||
.HasForeignKey("StatusId")
|
||||
.HasConstraintName("fk_jobs_job_status_status_id");
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class maybethisworks : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
// <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("20260723200547_changedordertojobpt2")]
|
||||
partial class changedordertojobpt2
|
||||
{
|
||||
/// <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.JobItems", 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>("JobId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("job_id");
|
||||
|
||||
b.Property<int?>("JobsId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("jobs_id");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("quantity");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_items");
|
||||
|
||||
b.HasIndex("JobsId")
|
||||
.HasDatabaseName("ix_job_items_jobs_id");
|
||||
|
||||
b.ToTable("job_items", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.JobStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_status");
|
||||
|
||||
b.ToTable("job_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", 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<int>("CustomerId")
|
||||
.HasColumnType("integer")
|
||||
.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_jobs");
|
||||
|
||||
b.HasIndex("StatusId")
|
||||
.HasDatabaseName("ix_jobs_status_id");
|
||||
|
||||
b.ToTable("jobs", (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.JobItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.Jobs", null)
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("JobsId")
|
||||
.HasConstraintName("fk_job_items_jobs_jobs_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.JobStatus", "Status")
|
||||
.WithMany()
|
||||
.HasForeignKey("StatusId")
|
||||
.HasConstraintName("fk_jobs_job_status_status_id");
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class changedordertojobpt2 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "order_id",
|
||||
table: "job_items",
|
||||
newName: "job_id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "job_id",
|
||||
table: "job_items",
|
||||
newName: "order_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,294 @@
|
||||
// <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("20260725204039_FixJobsCustomerIdType")]
|
||||
partial class FixJobsCustomerIdType
|
||||
{
|
||||
/// <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.JobItems", 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>("JobId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("job_id");
|
||||
|
||||
b.Property<int?>("JobsId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("jobs_id");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("quantity");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_items");
|
||||
|
||||
b.HasIndex("JobsId")
|
||||
.HasDatabaseName("ix_job_items_jobs_id");
|
||||
|
||||
b.ToTable("job_items", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.JobStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_status");
|
||||
|
||||
b.ToTable("job_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", 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<int>("CustomerId")
|
||||
.HasColumnType("integer")
|
||||
.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_jobs");
|
||||
|
||||
b.HasIndex("StatusId")
|
||||
.HasDatabaseName("ix_jobs_status_id");
|
||||
|
||||
b.ToTable("jobs", (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.JobItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.Jobs", null)
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("JobsId")
|
||||
.HasConstraintName("fk_job_items_jobs_jobs_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.JobStatus", "Status")
|
||||
.WithMany()
|
||||
.HasForeignKey("StatusId")
|
||||
.HasConstraintName("fk_jobs_job_status_status_id");
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixJobsCustomerIdType : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(
|
||||
"ALTER TABLE jobs ALTER COLUMN customer_id TYPE integer USING customer_id::integer;");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(
|
||||
"ALTER TABLE jobs ALTER COLUMN customer_id TYPE text USING customer_id::text;");
|
||||
}
|
||||
}
|
||||
}
|
||||
+294
@@ -0,0 +1,294 @@
|
||||
// <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("20260725205242_change_datetimeoffset_to_datetime")]
|
||||
partial class change_datetimeoffset_to_datetime
|
||||
{
|
||||
/// <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.JobItems", 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>("JobId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("job_id");
|
||||
|
||||
b.Property<int?>("JobsId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("jobs_id");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("quantity");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_items");
|
||||
|
||||
b.HasIndex("JobsId")
|
||||
.HasDatabaseName("ix_job_items_jobs_id");
|
||||
|
||||
b.ToTable("job_items", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.JobStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_status");
|
||||
|
||||
b.ToTable("job_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", 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<int>("CustomerId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("customer_id");
|
||||
|
||||
b.Property<DateTime>("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<DateTime>("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_jobs");
|
||||
|
||||
b.HasIndex("StatusId")
|
||||
.HasDatabaseName("ix_jobs_status_id");
|
||||
|
||||
b.ToTable("jobs", (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.JobItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.Jobs", null)
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("JobsId")
|
||||
.HasConstraintName("fk_job_items_jobs_jobs_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.JobStatus", "Status")
|
||||
.WithMany()
|
||||
.HasForeignKey("StatusId")
|
||||
.HasConstraintName("fk_jobs_job_status_status_id");
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class change_datetimeoffset_to_datetime : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
@@ -144,6 +145,114 @@ namespace barkmanapi.Migrations
|
||||
b.ToTable("item_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.JobItems", 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>("JobId")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("job_id");
|
||||
|
||||
b.Property<int?>("JobsId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("jobs_id");
|
||||
|
||||
b.Property<int>("Quantity")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("quantity");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_items");
|
||||
|
||||
b.HasIndex("JobsId")
|
||||
.HasDatabaseName("ix_job_items_jobs_id");
|
||||
|
||||
b.ToTable("job_items", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.JobStatus", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("id");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_job_status");
|
||||
|
||||
b.ToTable("job_status", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", 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<int>("CustomerId")
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("customer_id");
|
||||
|
||||
b.Property<DateTime>("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<DateTime>("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_jobs");
|
||||
|
||||
b.HasIndex("StatusId")
|
||||
.HasDatabaseName("ix_jobs_status_id");
|
||||
|
||||
b.ToTable("jobs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.InventoryItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.ItemStatus", "Status")
|
||||
@@ -153,6 +262,29 @@ namespace barkmanapi.Migrations
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.JobItems", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.Jobs", null)
|
||||
.WithMany("Items")
|
||||
.HasForeignKey("JobsId")
|
||||
.HasConstraintName("fk_job_items_jobs_jobs_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.HasOne("barkmanapi.JobStatus", "Status")
|
||||
.WithMany()
|
||||
.HasForeignKey("StatusId")
|
||||
.HasConstraintName("fk_jobs_job_status_status_id");
|
||||
|
||||
b.Navigation("Status");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("barkmanapi.Jobs", b =>
|
||||
{
|
||||
b.Navigation("Items");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
|
||||
+231
-1
@@ -47,6 +47,22 @@ var itemStatusGroup = app.MapGroup(prefix: "/itemstatus")
|
||||
.WithTags("Item Status")
|
||||
.WithDescription("Endpoints for managing item status");
|
||||
|
||||
var customerGroup = app.MapGroup(prefix: "/customers")
|
||||
.WithTags("Customers")
|
||||
.WithDescription("Endpoints for managing customers");
|
||||
|
||||
var jobGroup = app.MapGroup(prefix: "/jobs")
|
||||
.WithTags("Jobs")
|
||||
.WithDescription("Endpoints for managing jobs");
|
||||
|
||||
var jobStatusGroup = app.MapGroup(prefix: "/jobstatus")
|
||||
.WithTags("Job Status")
|
||||
.WithDescription("Endpoints for managing job status");
|
||||
|
||||
var jobItemGroup = app.MapGroup(prefix: "/jobitems")
|
||||
.WithTags("Job Items")
|
||||
.WithDescription("Endpoints for managing job items");
|
||||
|
||||
inventoryGroup.MapGet("", async (BarkContext db) =>
|
||||
await db.Inventory.OrderBy(item => item.Barcode).ToListAsync());
|
||||
|
||||
@@ -140,7 +156,7 @@ itemStatusGroup.MapPut("/{id}", async (string id, ItemStatus updatedStatus, Bark
|
||||
var existingStatus = await db.ItemStatus.FindAsync(id);
|
||||
if (existingStatus == null)
|
||||
{
|
||||
return Results.NotFound(new { Message = "Inventory item not found" });
|
||||
return Results.NotFound(new { Message = "Item status not found" });
|
||||
}
|
||||
|
||||
existingStatus.Id = updatedStatus.Id;
|
||||
@@ -163,6 +179,220 @@ itemStatusGroup.MapDelete("/{id}", async (string id, BarkContext db) =>
|
||||
return Results.Ok(new { Message = "Item status deleted successfully" });
|
||||
});
|
||||
|
||||
customerGroup.MapGet("", async (BarkContext db) =>
|
||||
await db.Customers.OrderBy(customer => customer.Id).ToListAsync());
|
||||
|
||||
customerGroup.MapGet("/{id}", async (int id, BarkContext db) =>
|
||||
{
|
||||
var customer = await db.Customers
|
||||
.FirstOrDefaultAsync(i => i.Id == id);
|
||||
|
||||
if (customer == null)
|
||||
{
|
||||
return Results.NotFound(new { Message = "Customer not found" });
|
||||
}
|
||||
|
||||
return Results.Ok(customer);
|
||||
});
|
||||
|
||||
customerGroup.MapPut("/{id}", async (int id, Customers updatedCustomer, BarkContext db) =>
|
||||
{
|
||||
var existingCustomer = await db.Customers.FindAsync(id);
|
||||
if (existingCustomer == null)
|
||||
{
|
||||
return Results.NotFound(new { Message = "Customer not found" });
|
||||
}
|
||||
|
||||
existingCustomer.Name = updatedCustomer.Name;
|
||||
existingCustomer.Company = updatedCustomer.Company;
|
||||
existingCustomer.Email = updatedCustomer.Email;
|
||||
existingCustomer.PhoneNumber = updatedCustomer.PhoneNumber;
|
||||
existingCustomer.Address = updatedCustomer.Address;
|
||||
existingCustomer.BillingTerms = updatedCustomer.BillingTerms;
|
||||
existingCustomer.Notes = updatedCustomer.Notes;
|
||||
|
||||
await db.SaveChangesAsync();
|
||||
return Results.Ok(existingCustomer);
|
||||
});
|
||||
|
||||
customerGroup.MapPost("", async (Customers newCustomerInput, BarkContext db) =>
|
||||
{
|
||||
var newCustomer = new Customers()
|
||||
{
|
||||
Name = newCustomerInput.Name,
|
||||
Email = newCustomerInput.Email,
|
||||
Company = newCustomerInput.Company,
|
||||
PhoneNumber = newCustomerInput.PhoneNumber,
|
||||
Address = newCustomerInput.Address,
|
||||
};
|
||||
|
||||
db.Customers.Add(newCustomer);
|
||||
await db.SaveChangesAsync();
|
||||
return Results.Created($"/customers/{newCustomer.Id}", newCustomer);
|
||||
});
|
||||
|
||||
customerGroup.MapDelete("/{id}", async (int id, BarkContext db) =>
|
||||
{
|
||||
var customer = await db.Customers.FindAsync(id);
|
||||
if (customer == null)
|
||||
{
|
||||
return Results.NotFound(new { Message = "Customer not found" });
|
||||
}
|
||||
|
||||
db.Customers.Remove(customer);
|
||||
await db.SaveChangesAsync();
|
||||
return Results.Ok(new { Message = "Customer deleted successfully" });
|
||||
});
|
||||
|
||||
jobGroup.MapGet("", async (BarkContext db) =>
|
||||
await db.Jobs.OrderBy(jobs => jobs.Id).ToListAsync());
|
||||
|
||||
jobGroup.MapGet("/{id}", async (int id, BarkContext db) =>
|
||||
{
|
||||
var job = await db.Jobs
|
||||
.FirstOrDefaultAsync(i => i.Id == id);
|
||||
|
||||
if (job == null)
|
||||
{
|
||||
return Results.NotFound(new { Message = "Job not found" });
|
||||
}
|
||||
|
||||
return Results.Ok(job);
|
||||
});
|
||||
|
||||
jobGroup.MapPut("/{id}", async (int id, Jobs updatedJob, BarkContext db) =>
|
||||
{
|
||||
var existingJob = await db.Jobs.FindAsync(id);
|
||||
if (existingJob == null)
|
||||
{
|
||||
return Results.NotFound(new { Message = "Job not found" });
|
||||
}
|
||||
|
||||
existingJob.Name = updatedJob.Name;
|
||||
existingJob.StartDate = updatedJob.StartDate;
|
||||
existingJob.EndDate = updatedJob.EndDate;
|
||||
existingJob.TotalPrice = updatedJob.TotalPrice;
|
||||
existingJob.Venue = updatedJob.Venue;
|
||||
existingJob.Address = updatedJob.Address;
|
||||
existingJob.Notes = updatedJob.Notes;
|
||||
|
||||
await db.SaveChangesAsync();
|
||||
return Results.Ok(existingJob);
|
||||
});
|
||||
|
||||
jobGroup.MapPost("", async (Jobs newJobInput, BarkContext db) =>
|
||||
{
|
||||
var newJob = new Jobs()
|
||||
{
|
||||
CustomerId = newJobInput.CustomerId,
|
||||
Name = newJobInput.Name,
|
||||
StartDate = newJobInput.StartDate,
|
||||
EndDate = newJobInput.EndDate,
|
||||
Venue = newJobInput.Venue,
|
||||
Address = newJobInput.Address,
|
||||
Notes = newJobInput.Notes,
|
||||
};
|
||||
|
||||
db.Jobs.Add(newJob);
|
||||
await db.SaveChangesAsync();
|
||||
return Results.Created($"/jobs/{newJob.Id}", newJob);
|
||||
});
|
||||
|
||||
jobStatusGroup.MapGet("/", async (BarkContext db) =>
|
||||
await db.JobStatus.ToListAsync());
|
||||
|
||||
jobStatusGroup.MapPost("/", async (JobStatus newJobStatus, BarkContext db) =>
|
||||
{
|
||||
db.JobStatus.Add(newJobStatus);
|
||||
await db.SaveChangesAsync();
|
||||
return Results.Created($"/jobstatus/{newJobStatus.Id}", newJobStatus);
|
||||
});
|
||||
|
||||
jobStatusGroup.MapGet("/{id}", async (string id, BarkContext db) =>
|
||||
{
|
||||
var jobStatus = await db.JobStatus.FindAsync(id);
|
||||
if (jobStatus == null)
|
||||
{
|
||||
return Results.NotFound(new { Message = "Job Status not found" });
|
||||
}
|
||||
|
||||
return Results.Ok(jobStatus);
|
||||
});
|
||||
|
||||
jobStatusGroup.MapPut("/{id}", async (string id, JobStatus updatedStatus, BarkContext db) =>
|
||||
{
|
||||
var existingStatus = await db.JobStatus.FindAsync(id);
|
||||
if (existingStatus == null)
|
||||
{
|
||||
return Results.NotFound(new { Message = "Job status not found" });
|
||||
}
|
||||
|
||||
existingStatus.Id = updatedStatus.Id;
|
||||
existingStatus.Name = updatedStatus.Name;
|
||||
|
||||
await db.SaveChangesAsync();
|
||||
return Results.Ok(existingStatus);
|
||||
});
|
||||
|
||||
jobStatusGroup.MapDelete("/{id}", async (string id, BarkContext db) =>
|
||||
{
|
||||
var jobStatus = await db.JobStatus.FindAsync(id);
|
||||
if (jobStatus == null)
|
||||
{
|
||||
return Results.NotFound(new { Message = "Job status not found" });
|
||||
}
|
||||
|
||||
db.JobStatus.Remove(jobStatus);
|
||||
await db.SaveChangesAsync();
|
||||
return Results.Ok(new { Message = "Job status deleted successfully" });
|
||||
});
|
||||
|
||||
jobItemGroup.MapGet("", async (BarkContext db) =>
|
||||
await db.JobItems.OrderBy(items => items.Id).ToListAsync());
|
||||
|
||||
jobItemGroup.MapGet("/{id}", async (int id, BarkContext db) =>
|
||||
{
|
||||
var jobItems = await db.JobItems
|
||||
.FirstOrDefaultAsync(i => i.Id == id);
|
||||
|
||||
if (jobItems == null)
|
||||
{
|
||||
return Results.NotFound(new { Message = "Job Items not found" });
|
||||
}
|
||||
|
||||
return Results.Ok(jobItems);
|
||||
});
|
||||
|
||||
jobItemGroup.MapPut("/{id}", async (int id, JobItems updatedJobItems, BarkContext db) =>
|
||||
{
|
||||
var existingJobItems = await db.JobItems.FindAsync(id);
|
||||
if (existingJobItems == null)
|
||||
{
|
||||
return Results.NotFound(new { Message = "Job Items not found" });
|
||||
}
|
||||
|
||||
existingJobItems.JobId = updatedJobItems.JobId;
|
||||
existingJobItems.ItemId = updatedJobItems.ItemId;
|
||||
existingJobItems.Quantity = updatedJobItems.Quantity;
|
||||
|
||||
await db.SaveChangesAsync();
|
||||
return Results.Ok(existingJobItems);
|
||||
});
|
||||
|
||||
jobItemGroup.MapPost("", async (JobItems newJobItemsInput, BarkContext db) =>
|
||||
{
|
||||
var newJobItem = new JobItems()
|
||||
{
|
||||
JobId = newJobItemsInput.JobId,
|
||||
ItemId = newJobItemsInput.ItemId,
|
||||
Quantity = newJobItemsInput.Quantity,
|
||||
};
|
||||
|
||||
db.JobItems.Add(newJobItem);
|
||||
await db.SaveChangesAsync();
|
||||
return Results.Created($"/jobItems/{newJobItem.Id}", newJobItem);
|
||||
});
|
||||
|
||||
using (var serviceScope = app.Services.CreateScope())
|
||||
{
|
||||
var dbContext = serviceScope.ServiceProvider.GetRequiredService<BarkContext>();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Runtime.InteropServices.JavaScript;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace barkmanapi;
|
||||
@@ -7,6 +8,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<Jobs> Jobs { get; set; }
|
||||
public DbSet<JobItems> JobItems { get; set; }
|
||||
public DbSet<JobStatus> JobStatus { get; set; }
|
||||
}
|
||||
|
||||
[Index(nameof(Barcode), IsUnique = true)]
|
||||
@@ -41,4 +45,34 @@ public class Customers
|
||||
public string? Address { get; set; }
|
||||
public string? BillingTerms { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class Jobs
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public required int CustomerId { get; set; }
|
||||
public required string Name { get; set; }
|
||||
public JobStatus Status { get; set; }
|
||||
public string? StatusId { get; set; }
|
||||
public DateTime StartDate { get; set; }
|
||||
public DateTime EndDate { get; set; }
|
||||
public decimal TotalPrice { get; set; }
|
||||
public string? Venue { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public JobItems[] Items { get; set; }
|
||||
public string? Notes { get; set; }
|
||||
}
|
||||
|
||||
public class JobItems
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public required string JobId { get; set; }
|
||||
public required string ItemId { get; set; }
|
||||
public int Quantity { get; set; }
|
||||
}
|
||||
|
||||
public class JobStatus
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
22.22.1
|
||||
Generated
+1334
-1802
File diff suppressed because it is too large
Load Diff
+27
-26
@@ -10,34 +10,35 @@
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mantine/core": "^7.16.0",
|
||||
"@mantine/form": "^7.16.0",
|
||||
"@mantine/hooks": "^7.16.0",
|
||||
"@mantine/notifications": "^7.16.2",
|
||||
"@tabler/icons-react": "^3.29.0",
|
||||
"@tanstack/react-query": "^5.64.1",
|
||||
"@tanstack/react-query-devtools": "^5.64.1",
|
||||
"axios": "^1.7.9",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-router": "^7.1.1",
|
||||
"react-router-dom": "^7.1.1"
|
||||
"@mantine/core": "^9.4.2",
|
||||
"@mantine/dates": "^9.4.2",
|
||||
"@mantine/form": "^9.4.2",
|
||||
"@mantine/hooks": "^9.4.2",
|
||||
"@mantine/notifications": "^9.4.2",
|
||||
"@tabler/icons-react": "^3.45.0",
|
||||
"@tanstack/react-query": "^5.101.4",
|
||||
"@tanstack/react-query-devtools": "^5.101.4",
|
||||
"axios": "^1.18.1",
|
||||
"react": "^19.2.8",
|
||||
"react-dom": "^19.2.8",
|
||||
"react-router": "^8.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.17.0",
|
||||
"@tanstack/eslint-plugin-query": "^5.62.16",
|
||||
"@types/react": "^18.3.18",
|
||||
"@types/react-dom": "^18.3.5",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"eslint": "^9.17.0",
|
||||
"eslint-plugin-react-hooks": "^5.0.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.16",
|
||||
"globals": "^15.14.0",
|
||||
"postcss": "^8.5.1",
|
||||
"postcss-preset-mantine": "^1.17.0",
|
||||
"@eslint/js": "^9.39.5",
|
||||
"@tanstack/eslint-plugin-query": "^5.101.4",
|
||||
"@types/node": "^26.1.1",
|
||||
"@types/react": "^19.2.17",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@vitejs/plugin-react": "^6.0.4",
|
||||
"eslint": "^9.39.5",
|
||||
"eslint-plugin-react-hooks": "^7.1.1",
|
||||
"eslint-plugin-react-refresh": "^0.5.3",
|
||||
"globals": "^17.7.0",
|
||||
"postcss": "^8.5.22",
|
||||
"postcss-preset-mantine": "^1.18.0",
|
||||
"postcss-simple-vars": "^7.0.1",
|
||||
"typescript": "~5.6.2",
|
||||
"typescript-eslint": "^8.18.2",
|
||||
"vite": "^6.0.5"
|
||||
"typescript": "^6.0.3",
|
||||
"typescript-eslint": "^8.65.0",
|
||||
"vite": "^8.1.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,13 @@ import {BarkHeader} from "./common/components/BarkHeader.tsx";
|
||||
import AddItem from "./features/inventory/AddItem.tsx";
|
||||
import { Notifications } from '@mantine/notifications';
|
||||
import '@mantine/notifications/styles.css';
|
||||
import CustomerList from "@/features/customers/CustomerList.tsx";
|
||||
import AddCustomer from "@/features/customers/AddCustomer.tsx";
|
||||
import CustomerDetail from "@/features/customers/CustomerDetail.tsx";
|
||||
import EditCustomer from "@/features/customers/EditCustomer.tsx";
|
||||
import AddJob from "@/features/jobs/AddJob.tsx";
|
||||
import JobList from "@/features/jobs/JobList.tsx";
|
||||
import JobDetail from "@/features/jobs/JobDetail.tsx";
|
||||
|
||||
// Create a client
|
||||
const queryClient = new QueryClient()
|
||||
@@ -46,6 +53,14 @@ function App() {
|
||||
<Route path="inventory/itemDetail/:itemId" element={<ItemDetail/>}/>
|
||||
<Route path="inventory/editItem/:itemId" element={<EditItem/>}/>
|
||||
<Route path="inventory/addItem" element={<AddItem/>}/>
|
||||
<Route path="customers" element={<CustomerList/>}/>
|
||||
<Route path="customers/addCustomer" element={<AddCustomer/>}/>
|
||||
<Route path="customers/customerDetail/:customerId" element={<CustomerDetail/>}/>
|
||||
<Route path="customers/editCustomer/:customerId" element={<EditCustomer/>}/>
|
||||
<Route path="jobs" element={<JobList/>}/>
|
||||
<Route path="jobs/addJob" element={<AddJob/>}/>
|
||||
<Route path="jobs/jobDetail/:jobId" element={<JobDetail/>}/>
|
||||
|
||||
</Routes>
|
||||
</>
|
||||
</QueryClientProvider>
|
||||
|
||||
@@ -7,6 +7,8 @@ import BarkLogo from '@/assets/barklogo.png';
|
||||
|
||||
const links = [
|
||||
{ link: '/', label: 'Home' },
|
||||
{ link: '/customers', label: 'Customers' },
|
||||
{ link: '/jobs', label: 'Jobs' },
|
||||
{ link: '/inventory', label: 'Inventory' },
|
||||
];
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
import {Button, Group, TextInput, Container, Title, Flex} from '@mantine/core';
|
||||
import {useForm} from '@mantine/form';
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import {NewCustomer} from "./types.ts";
|
||||
import {useNavigate} from "react-router";
|
||||
import {IconX, IconCheck} from '@tabler/icons-react';
|
||||
import {notifications} from '@mantine/notifications';
|
||||
import useCustomerList from "./hooks/useCustomerList.tsx";
|
||||
|
||||
|
||||
function AddCustomer() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const customerQuery = useCustomerList();
|
||||
|
||||
const newCustomerForm = useForm<NewCustomer>({
|
||||
mode: 'uncontrolled',
|
||||
initialValues: {
|
||||
name: "",
|
||||
company: "",
|
||||
email: "",
|
||||
phone: "",
|
||||
address: "",
|
||||
},
|
||||
|
||||
validate: {},
|
||||
});
|
||||
|
||||
const updateCustomer = useMutation({
|
||||
mutationFn: async (values: NewCustomer) => {
|
||||
|
||||
const result = await fetch(import.meta.env.VITE_API_URL + '/customers', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(values),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
if (result.ok) {
|
||||
notifications.show({
|
||||
icon: <IconCheck size={20}/>,
|
||||
color: "teal",
|
||||
title: "All good!",
|
||||
message: "Customer Created",
|
||||
position: 'top-center',
|
||||
});
|
||||
navigate("/customers");
|
||||
|
||||
}
|
||||
|
||||
if (!result.ok) {
|
||||
notifications.show({
|
||||
icon: <IconX size={20}/>,
|
||||
color: "red",
|
||||
title: "Bummer!",
|
||||
message: "Something went wrong",
|
||||
position: 'top-center',
|
||||
});
|
||||
throw new Error('Failed to create customer');
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
})
|
||||
|
||||
if (customerQuery.isPending) return 'Loading...'
|
||||
if (customerQuery.error) return 'An error has occurred: ' + customerQuery.error.message
|
||||
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<form onSubmit={newCustomerForm.onSubmit(async (values) => await
|
||||
updateCustomer.mutateAsync(values))}>
|
||||
<Container m="lg">
|
||||
<Flex mih={50}
|
||||
gap="md"
|
||||
justify="flex-start"
|
||||
align="flex-start"
|
||||
direction="column"
|
||||
wrap="wrap">
|
||||
|
||||
<Title order={1}>Add Item</Title>
|
||||
<TextInput withAsterisk key={newCustomerForm.key('name')} size="md" label="Name"
|
||||
placeholder="Name" {...newCustomerForm.getInputProps('name')}/>
|
||||
<TextInput size="md" key={newCustomerForm.key('company')} label="Company"
|
||||
placeholder="Company"{...newCustomerForm.getInputProps('company')}/>
|
||||
<TextInput withAsterisk size="md" key={newCustomerForm.key('email')} label="Email"
|
||||
placeholder="Email" {...newCustomerForm.getInputProps('email')}/>
|
||||
<TextInput size="md" key={newCustomerForm.key('phone')} label="Phone"
|
||||
placeholder="Phone" {...newCustomerForm.getInputProps('phone')}/>
|
||||
<TextInput size="md" key={newCustomerForm.key('address')} label="Address"
|
||||
placeholder="Address" {...newCustomerForm.getInputProps('address')}/>
|
||||
|
||||
<Group justify="flex-end" mt="md">
|
||||
<Button type="submit">Submit</Button>
|
||||
</Group>
|
||||
</Flex>
|
||||
</Container>
|
||||
</form>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default AddCustomer;
|
||||
@@ -0,0 +1,45 @@
|
||||
import {Container, Text, Title} from "@mantine/core";
|
||||
import {Link, useParams} from "react-router";
|
||||
import {Customer} from "./types.ts";
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
|
||||
|
||||
function CustomerDetail() {
|
||||
const params = useParams();
|
||||
|
||||
const {isPending, error, data, isFetching} = useQuery({
|
||||
queryKey: ['customers', params.customerId],
|
||||
queryFn: async (): Promise<Customer> => {
|
||||
const response = await fetch(
|
||||
import.meta.env.VITE_API_URL + '/customers/' + params.customerId,
|
||||
)
|
||||
|
||||
if (!response.ok) throw new Error('Failed to fetch customer ' + response.statusText)
|
||||
|
||||
return await response.json()
|
||||
},
|
||||
});
|
||||
|
||||
if (isPending) return 'Loading...'
|
||||
|
||||
if (error) return 'An error has occurred: ' + error.message
|
||||
|
||||
return (
|
||||
<>
|
||||
<Container m="lg">
|
||||
<Title order={1}>Customer Detail</Title>
|
||||
<div>{isFetching ? 'Updating...' : ''}</div>
|
||||
<Text>Name: {data.name}</Text>
|
||||
<Text>Company: {data.company}</Text>
|
||||
<Text>Email: {data.email}</Text>
|
||||
<Text>Phone Number: {data.phone}</Text>
|
||||
<Text>Address: ${data.address}</Text>
|
||||
<Text>Notes: {data.notes}</Text>
|
||||
|
||||
<Link to={`/customers/editCustomer/${data.id}`}>Edit</Link>
|
||||
</Container>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default CustomerDetail
|
||||
@@ -0,0 +1,54 @@
|
||||
import {Flex, Table} from '@mantine/core';
|
||||
import BarkButton from "../../common/components/BarkButton.tsx";
|
||||
import {Link, NavLink} from "react-router";
|
||||
import useCustomerList from "./hooks/useCustomerList.tsx";
|
||||
|
||||
|
||||
function CustomerList() {
|
||||
|
||||
const customerQuery = useCustomerList();
|
||||
|
||||
if (customerQuery.isPending) return 'Loading...'
|
||||
|
||||
if (customerQuery.error) return 'An error has occurred: ' + customerQuery.error.message
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex
|
||||
mih={50}
|
||||
gap="xl"
|
||||
justify="center"
|
||||
align="center"
|
||||
direction="row"
|
||||
wrap="wrap"
|
||||
>
|
||||
<p>
|
||||
ARFF ARFF BARK BARK
|
||||
</p>
|
||||
<NavLink to={'/customers/AddCustomer'}><BarkButton>Add Customer</BarkButton></NavLink>
|
||||
</Flex>
|
||||
|
||||
<Table striped>
|
||||
<Table.Thead>
|
||||
<Table.Tr>
|
||||
<Table.Th c="red">Name</Table.Th>
|
||||
<Table.Th c="red">Company</Table.Th>
|
||||
</Table.Tr>
|
||||
</Table.Thead>
|
||||
<Table.Tbody>
|
||||
{customerQuery.data?.map((data) => (
|
||||
<Table.Tr key={data.id}>
|
||||
<Table.Td>{data.name}</Table.Td>
|
||||
<Table.Td>{data.company}</Table.Td>
|
||||
<Table.Td>
|
||||
<Link to={`/customers/customerDetail/${data.id}`}>Details</Link>
|
||||
</Table.Td>
|
||||
</Table.Tr>
|
||||
))}
|
||||
</Table.Tbody>
|
||||
</Table>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default CustomerList;
|
||||
@@ -0,0 +1,134 @@
|
||||
import {Button, Group, TextInput, Container, Title, Flex} from '@mantine/core';
|
||||
import {useForm} from '@mantine/form';
|
||||
import {useNavigate, useParams} from "react-router";
|
||||
import {useMutation, useQuery, useQueryClient} from "@tanstack/react-query";
|
||||
import {Customer} from "./types.ts";
|
||||
import {useEffect} from "react";
|
||||
import {notifications} from "@mantine/notifications";
|
||||
import {IconCheck, IconX} from "@tabler/icons-react";
|
||||
|
||||
type EditableCustomer= Omit<Customer, 'id'>;
|
||||
|
||||
function EditCustomer() {
|
||||
const params = useParams();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const editCustomerForm = useForm<EditableCustomer>({
|
||||
mode: 'uncontrolled',
|
||||
initialValues: {
|
||||
name: "",
|
||||
company: "",
|
||||
email: "",
|
||||
phone: "",
|
||||
address: "",
|
||||
billingTerms: "",
|
||||
notes: "",
|
||||
},
|
||||
|
||||
validate: {},
|
||||
});
|
||||
|
||||
const {isPending, error, data, isFetching} = useQuery({
|
||||
queryKey: ['customer', params.customerId],
|
||||
queryFn: async (): Promise<Customer> => {
|
||||
const response = await fetch(
|
||||
import.meta.env.VITE_API_URL + '/customers/' + params.customerId,
|
||||
)
|
||||
|
||||
if (!response.ok) throw new Error('Failed to fetch customer ' + response.statusText)
|
||||
|
||||
return await response.json()
|
||||
},
|
||||
});
|
||||
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
const updateCustomer = useMutation({
|
||||
mutationFn: async (values: EditableCustomer) => {
|
||||
|
||||
// await <call the api, do the things>
|
||||
const result = await fetch(import.meta.env.VITE_API_URL + '/customers/' + params.customerId, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify(values),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
if (result.ok) {
|
||||
notifications.show({
|
||||
icon: <IconCheck size={20} />,
|
||||
color:"teal",
|
||||
title: "All good!",
|
||||
message: "Customer Updated",
|
||||
position: 'top-center',
|
||||
});
|
||||
navigate("/customers");
|
||||
|
||||
}
|
||||
|
||||
if (!result.ok) {
|
||||
notifications.show({
|
||||
icon: <IconX size={20} />,
|
||||
color:"red",
|
||||
title: "Bummer!",
|
||||
message: "Something went wrong",
|
||||
position: 'top-center',
|
||||
});
|
||||
throw new Error('Failed to update customer');
|
||||
}
|
||||
|
||||
// invalidate the queries so they pull updated information
|
||||
// this is a prefix, so it covers both the query that pulls a list, and also `['customers', customerId]` in this file
|
||||
await queryClient.invalidateQueries({
|
||||
queryKey: ['customers']
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (data) {
|
||||
// Even if query.data changes, form will be initialized only once
|
||||
editCustomerForm.initialize(data);
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [data]);
|
||||
|
||||
if (isPending) return 'Loading...'
|
||||
|
||||
if (error) return 'An error has occurred: ' + error.message
|
||||
|
||||
return (
|
||||
<form onSubmit={editCustomerForm.onSubmit(async (values) => await
|
||||
updateCustomer.mutateAsync(values))}>
|
||||
<Container m="lg">
|
||||
<Flex mih={50}
|
||||
gap="md"
|
||||
justify="flex-start"
|
||||
align="flex-start"
|
||||
direction="column"
|
||||
wrap="wrap">
|
||||
|
||||
<div>{isFetching ? 'Updating...' : ''}</div>
|
||||
<Title order={1}>Edit Customer</Title>
|
||||
<TextInput withAsterisk key={editCustomerForm.key('name')} size="md" label="Name"
|
||||
placeholder="Name" {...editCustomerForm.getInputProps('name')}/>
|
||||
<TextInput size="md" key={editCustomerForm.key('company')} label="Company"
|
||||
placeholder="Company"{...editCustomerForm.getInputProps('company')}/>
|
||||
<TextInput withAsterisk size="md" key={editCustomerForm.key('email')} label="Email"
|
||||
placeholder="Email" {...editCustomerForm.getInputProps('email')}/>
|
||||
<TextInput size="md" key={editCustomerForm.key('phone')} label="Phone"
|
||||
placeholder="Phone" {...editCustomerForm.getInputProps('phone')}/>
|
||||
<TextInput size="md" key={editCustomerForm.key('address')} label="Address"
|
||||
placeholder="Address" {...editCustomerForm.getInputProps('address')}/>
|
||||
|
||||
<Group justify="flex-end" mt="md">
|
||||
<Button type="submit">Submit</Button>
|
||||
</Group>
|
||||
</Flex>
|
||||
</Container>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export default EditCustomer;
|
||||
@@ -0,0 +1,17 @@
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
import {Customer} from "../types.ts";
|
||||
|
||||
const useCustomerList = () => useQuery({
|
||||
queryKey: ['customer'],
|
||||
queryFn: async (): Promise<Customer[]> => {
|
||||
const response = await fetch(
|
||||
import.meta.env.VITE_API_URL + '/customers',
|
||||
)
|
||||
|
||||
if (!response.ok) throw new Error('Failed to fetch customers ' + response.statusText)
|
||||
|
||||
return await response.json()
|
||||
},
|
||||
});
|
||||
|
||||
export default useCustomerList;
|
||||
@@ -0,0 +1,17 @@
|
||||
export interface Customer {
|
||||
id: number,
|
||||
name: string,
|
||||
company: string,
|
||||
email: string,
|
||||
phone: string,
|
||||
address: string,
|
||||
billingTerms: string,
|
||||
notes: string,
|
||||
}
|
||||
export interface NewCustomer {
|
||||
name: string,
|
||||
company: string,
|
||||
email: string,
|
||||
phone: string,
|
||||
address: string,
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
import {Button, Group, TextInput, NumberInput, Container, Title, Flex} from '@mantine/core';
|
||||
import { DateTimePicker } from '@mantine/dates';
|
||||
import {useForm} from '@mantine/form';
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import {NewJob} from "./types.ts";
|
||||
import {useNavigate} from "react-router";
|
||||
import {IconX, IconCheck} from '@tabler/icons-react';
|
||||
import {notifications} from '@mantine/notifications';
|
||||
import useJobList from "./hooks/useJobList.tsx";
|
||||
|
||||
|
||||
function AddJob() {
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const customerQuery = useJobList();
|
||||
|
||||
const newJobForm = useForm<NewJob>({
|
||||
mode: 'uncontrolled',
|
||||
initialValues: {
|
||||
customerId: 0,
|
||||
name: "",
|
||||
startDate: "",
|
||||
endDate: "",
|
||||
address: "",
|
||||
venue: "",
|
||||
notes: "",
|
||||
},
|
||||
|
||||
validate: {},
|
||||
});
|
||||
|
||||
const updateJob = useMutation({
|
||||
mutationFn: async (values: NewJob) => {
|
||||
|
||||
const result = await fetch(import.meta.env.VITE_API_URL + '/jobs', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
...values,
|
||||
startDate: new Date(values.startDate).toISOString(),
|
||||
endDate: new Date(values.endDate).toISOString(),
|
||||
}),
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
|
||||
if (result.ok) {
|
||||
notifications.show({
|
||||
icon: <IconCheck size={20}/>,
|
||||
color: "teal",
|
||||
title: "All good!",
|
||||
message: "Job Created",
|
||||
position: 'top-center',
|
||||
});
|
||||
navigate("/jobs");
|
||||
|
||||
}
|
||||
|
||||
if (!result.ok) {
|
||||
notifications.show({
|
||||
icon: <IconX size={20}/>,
|
||||
color: "red",
|
||||
title: "Bummer!",
|
||||
message: "Something went wrong",
|
||||
position: 'top-center',
|
||||
});
|
||||
throw new Error('Failed to create job');
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
})
|
||||
|
||||
if (customerQuery.isPending) return 'Loading...'
|
||||
if (customerQuery.error) return 'An error has occurred: ' + customerQuery.error.message
|
||||
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<form onSubmit={newJobForm.onSubmit(async (values) => await
|
||||
updateJob.mutateAsync(values))}>
|
||||
<Container m="lg">
|
||||
<Flex mih={50}
|
||||
gap="md"
|
||||
justify="flex-start"
|
||||
align="flex-start"
|
||||
direction="column"
|
||||
wrap="wrap">
|
||||
|
||||
<Title order={1}>Add Item</Title>
|
||||
<NumberInput withAsterisk key={newJobForm.key('customerId')} size="md" label="Customer ID"
|
||||
placeholder="Customer ID" {...newJobForm.getInputProps('customerId')}/>
|
||||
<TextInput withAsterisk key={newJobForm.key('name')} size="md" label="Name"
|
||||
placeholder="Name" {...newJobForm.getInputProps('name')}/>
|
||||
<DateTimePicker withAsterisk key={newJobForm.key('startDate')} size="md" label="Start Date"
|
||||
placeholder="Start Date" {...newJobForm.getInputProps('startDate')}/>
|
||||
<DateTimePicker withAsterisk key={newJobForm.key('endDate')} size="md" label="End Date"
|
||||
placeholder="End Date" {...newJobForm.getInputProps('endDate')}/>
|
||||
<TextInput size="md" key={newJobForm.key('address')} label="Address"
|
||||
placeholder="Address" {...newJobForm.getInputProps('address')}/>
|
||||
<TextInput size="md" key={newJobForm.key('venue')} label="Venue"
|
||||
placeholder="Venue"{...newJobForm.getInputProps('venue')}/>
|
||||
<TextInput size="md" key={newJobForm.key('notes')} label="Notes"
|
||||
placeholder="Notes" {...newJobForm.getInputProps('notes')}/>
|
||||
|
||||
<Group justify="flex-end" mt="md">
|
||||
<Button type="submit">Submit</Button>
|
||||
</Group>
|
||||
</Flex>
|
||||
</Container>
|
||||
</form>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default AddJob;
|
||||
@@ -0,0 +1,47 @@
|
||||
import {Container, Text, Title} from "@mantine/core";
|
||||
import {Link, useParams} from "react-router";
|
||||
import {Job} from "./types.ts";
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
|
||||
|
||||
function JobDetail() {
|
||||
const params = useParams();
|
||||
|
||||
const {isPending, error, data, isFetching} = useQuery({
|
||||
queryKey: ['jobs', params.jobId],
|
||||
queryFn: async (): Promise<Job> => {
|
||||
const response = await fetch(
|
||||
import.meta.env.VITE_API_URL + '/jobs/' + params.jobId,
|
||||
)
|
||||
|
||||
if (!response.ok) throw new Error('Failed to fetch jobs ' + response.statusText)
|
||||
|
||||
return await response.json()
|
||||
},
|
||||
});
|
||||
|
||||
if (isPending) return 'Loading...'
|
||||
|
||||
if (error) return 'An error has occurred: ' + error.message
|
||||
|
||||
return (
|
||||
<>
|
||||
<Container m="lg">
|
||||
<Title order={1}>Job Detail</Title>
|
||||
<div>{isFetching ? 'Updating...' : ''}</div>
|
||||
<Text>Customer ID: {data.customerId}</Text>
|
||||
<Text>Name: {data.name}</Text>
|
||||
{/*<Text>Status: {data.status.name}</Text>*/}
|
||||
<Text>Start Date: {data.startDate}</Text>
|
||||
<Text>End Date: {data.endDate}</Text>
|
||||
<Text>Venue: {data.venue}</Text>
|
||||
<Text>Address: {data.address}</Text>
|
||||
<Text>Notes: {data.notes}</Text>
|
||||
|
||||
<Link to={`/inventory/editItem/${data.id}`}>Edit</Link>
|
||||
</Container>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default JobDetail
|
||||
@@ -0,0 +1,60 @@
|
||||
import {Flex, Table} from '@mantine/core';
|
||||
import BarkButton from "../../common/components/BarkButton.tsx";
|
||||
import {Link, NavLink} from "react-router";
|
||||
import useJobList from "./hooks/useJobList.tsx";
|
||||
|
||||
|
||||
function JobList() {
|
||||
|
||||
const jobQuery = useJobList();
|
||||
|
||||
if (jobQuery.isPending) return 'Loading...'
|
||||
|
||||
if (jobQuery.error) return 'An error has occurred: ' + jobQuery.error.message
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Flex
|
||||
mih={50}
|
||||
gap="xl"
|
||||
justify="center"
|
||||
align="center"
|
||||
direction="row"
|
||||
wrap="wrap"
|
||||
>
|
||||
<p>
|
||||
ARFF ARFF BARK BARK
|
||||
</p>
|
||||
<NavLink to={'/jobs/addJob'}><BarkButton>Add Job</BarkButton></NavLink>
|
||||
</Flex>
|
||||
|
||||
<Table striped>
|
||||
<Table.Thead>
|
||||
<Table.Tr>
|
||||
<Table.Th c="red">Customer ID</Table.Th>
|
||||
<Table.Th c="red">Name</Table.Th>
|
||||
<Table.Th c="red">Venue</Table.Th>
|
||||
<Table.Th c="red">Status</Table.Th>
|
||||
<Table.Th c="red">Start Date</Table.Th>
|
||||
</Table.Tr>
|
||||
</Table.Thead>
|
||||
<Table.Tbody>
|
||||
{jobQuery.data?.map((data) => (
|
||||
<Table.Tr key={data.id}>
|
||||
<Table.Td>{data.customerId}</Table.Td>
|
||||
<Table.Td>{data.name}</Table.Td>
|
||||
<Table.Td>{data.venue}</Table.Td>
|
||||
<Table.Td>{data.status?.name ?? '—'}</Table.Td>
|
||||
<Table.Td>{new Date(data.startDate).toLocaleDateString()}</Table.Td>
|
||||
<Table.Td>
|
||||
<Link to={`/jobs/jobDetail/${data.id}`}>Details</Link>
|
||||
</Table.Td>
|
||||
</Table.Tr>
|
||||
))}
|
||||
</Table.Tbody>
|
||||
</Table>
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default JobList;
|
||||
@@ -0,0 +1,17 @@
|
||||
import {useQuery} from "@tanstack/react-query";
|
||||
import {Job} from "../types.ts";
|
||||
|
||||
const useJobList = () => useQuery({
|
||||
queryKey: ['job'],
|
||||
queryFn: async (): Promise<Job[]> => {
|
||||
const response = await fetch(
|
||||
import.meta.env.VITE_API_URL + '/jobs',
|
||||
)
|
||||
|
||||
if (!response.ok) throw new Error('Failed to fetch jobs ' + response.statusText)
|
||||
|
||||
return await response.json()
|
||||
},
|
||||
});
|
||||
|
||||
export default useJobList;
|
||||
@@ -0,0 +1,23 @@
|
||||
export interface Job {
|
||||
id: number,
|
||||
customerId: number,
|
||||
name: string,
|
||||
status: {id: string; name: string} | null,
|
||||
statusId: string | null;
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
totalPrice: string,
|
||||
venue: string,
|
||||
address: string,
|
||||
notes: string,
|
||||
}
|
||||
|
||||
export interface NewJob {
|
||||
customerId: number,
|
||||
name: string,
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
venue: string,
|
||||
address: string,
|
||||
notes: string,
|
||||
}
|
||||
@@ -21,8 +21,7 @@
|
||||
"noUnusedParameters": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"noUncheckedSideEffectImports": true,
|
||||
|
||||
"baseUrl": ".",
|
||||
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user