diff --git a/barkmanAPI/Migrations/20260723003407_fixedOrderCustomerID.cs b/barkmanAPI/Migrations/20260723003407_fixedOrderCustomerID.cs deleted file mode 100644 index 2ead996..0000000 --- a/barkmanAPI/Migrations/20260723003407_fixedOrderCustomerID.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace barkmanapi.Migrations -{ - /// - public partial class fixedOrderCustomerID : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "customer_id", - table: "orders", - type: "integer", - nullable: false, - oldClrType: typeof(string), - oldType: "text"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "customer_id", - table: "orders", - type: "text", - nullable: false, - oldClrType: typeof(int), - oldType: "integer"); - } - } -} diff --git a/barkmanAPI/Migrations/20260723004900_changedOrderToJob.cs b/barkmanAPI/Migrations/20260723004900_changedOrderToJob.cs deleted file mode 100644 index 81fde1b..0000000 --- a/barkmanAPI/Migrations/20260723004900_changedOrderToJob.cs +++ /dev/null @@ -1,176 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace barkmanapi.Migrations -{ - /// - public partial class changedOrderToJob : Migration - { - /// - 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(type: "text", nullable: false), - name = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_job_status", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "jobs", - columns: table => new - { - id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - customer_id = table.Column(type: "integer", nullable: false), - name = table.Column(type: "text", nullable: false), - status_id = table.Column(type: "text", nullable: true), - start_date = table.Column(type: "timestamp with time zone", nullable: false), - end_date = table.Column(type: "timestamp with time zone", nullable: false), - total_price = table.Column(type: "numeric", nullable: false), - venue = table.Column(type: "text", nullable: true), - address = table.Column(type: "text", nullable: true), - notes = table.Column(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(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - order_id = table.Column(type: "text", nullable: false), - item_id = table.Column(type: "text", nullable: false), - quantity = table.Column(type: "integer", nullable: false), - jobs_id = table.Column(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"); - } - - /// - 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(type: "text", nullable: false), - name = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("pk_order_status", x => x.id); - }); - - migrationBuilder.CreateTable( - name: "orders", - columns: table => new - { - id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - status_id = table.Column(type: "text", nullable: true), - address = table.Column(type: "text", nullable: true), - customer_id = table.Column(type: "integer", nullable: false), - end_date = table.Column(type: "timestamp with time zone", nullable: false), - name = table.Column(type: "text", nullable: false), - notes = table.Column(type: "text", nullable: true), - start_date = table.Column(type: "timestamp with time zone", nullable: false), - total_price = table.Column(type: "numeric", nullable: false), - venue = table.Column(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(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - item_id = table.Column(type: "text", nullable: false), - order_id = table.Column(type: "text", nullable: false), - orders_id = table.Column(type: "integer", nullable: true), - quantity = table.Column(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"); - } - } -} diff --git a/barkmanAPI/Migrations/20260723004900_changedOrderToJob.Designer.cs b/barkmanAPI/Migrations/20260723200239_maybethisworks.Designer.cs similarity index 99% rename from barkmanAPI/Migrations/20260723004900_changedOrderToJob.Designer.cs rename to barkmanAPI/Migrations/20260723200239_maybethisworks.Designer.cs index e39250b..a850a96 100644 --- a/barkmanAPI/Migrations/20260723004900_changedOrderToJob.Designer.cs +++ b/barkmanAPI/Migrations/20260723200239_maybethisworks.Designer.cs @@ -12,8 +12,8 @@ using barkmanapi; namespace barkmanapi.Migrations { [DbContext(typeof(BarkContext))] - [Migration("20260723004900_changedOrderToJob")] - partial class changedOrderToJob + [Migration("20260723200239_maybethisworks")] + partial class maybethisworks { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/barkmanAPI/Migrations/20260723200239_maybethisworks.cs b/barkmanAPI/Migrations/20260723200239_maybethisworks.cs new file mode 100644 index 0000000..c68f4d3 --- /dev/null +++ b/barkmanAPI/Migrations/20260723200239_maybethisworks.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace barkmanapi.Migrations +{ + /// + public partial class maybethisworks : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/barkmanAPI/Migrations/20260723003407_fixedOrderCustomerID.Designer.cs b/barkmanAPI/Migrations/20260723200547_changedordertojobpt2.Designer.cs similarity index 85% rename from barkmanAPI/Migrations/20260723003407_fixedOrderCustomerID.Designer.cs rename to barkmanAPI/Migrations/20260723200547_changedordertojobpt2.Designer.cs index a58cd7a..b54ebdc 100644 --- a/barkmanAPI/Migrations/20260723003407_fixedOrderCustomerID.Designer.cs +++ b/barkmanAPI/Migrations/20260723200547_changedordertojobpt2.Designer.cs @@ -12,8 +12,8 @@ using barkmanapi; namespace barkmanapi.Migrations { [DbContext(typeof(BarkContext))] - [Migration("20260723003407_fixedOrderCustomerID")] - partial class fixedOrderCustomerID + [Migration("20260723200547_changedordertojobpt2")] + partial class changedordertojobpt2 { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -148,7 +148,7 @@ namespace barkmanapi.Migrations b.ToTable("item_status", (string)null); }); - modelBuilder.Entity("barkmanapi.OrderItems", b => + modelBuilder.Entity("barkmanapi.JobItems", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -162,29 +162,29 @@ namespace barkmanapi.Migrations .HasColumnType("text") .HasColumnName("item_id"); - b.Property("OrderId") + b.Property("JobId") .IsRequired() .HasColumnType("text") - .HasColumnName("order_id"); + .HasColumnName("job_id"); - b.Property("OrdersId") + b.Property("JobsId") .HasColumnType("integer") - .HasColumnName("orders_id"); + .HasColumnName("jobs_id"); b.Property("Quantity") .HasColumnType("integer") .HasColumnName("quantity"); b.HasKey("Id") - .HasName("pk_order_items"); + .HasName("pk_job_items"); - b.HasIndex("OrdersId") - .HasDatabaseName("ix_order_items_orders_id"); + b.HasIndex("JobsId") + .HasDatabaseName("ix_job_items_jobs_id"); - b.ToTable("order_items", (string)null); + b.ToTable("job_items", (string)null); }); - modelBuilder.Entity("barkmanapi.OrderStatus", b => + modelBuilder.Entity("barkmanapi.JobStatus", b => { b.Property("Id") .HasColumnType("text") @@ -196,12 +196,12 @@ namespace barkmanapi.Migrations .HasColumnName("name"); b.HasKey("Id") - .HasName("pk_order_status"); + .HasName("pk_job_status"); - b.ToTable("order_status", (string)null); + b.ToTable("job_status", (string)null); }); - modelBuilder.Entity("barkmanapi.Orders", b => + modelBuilder.Entity("barkmanapi.Jobs", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -248,12 +248,12 @@ namespace barkmanapi.Migrations .HasColumnName("venue"); b.HasKey("Id") - .HasName("pk_orders"); + .HasName("pk_jobs"); b.HasIndex("StatusId") - .HasDatabaseName("ix_orders_status_id"); + .HasDatabaseName("ix_jobs_status_id"); - b.ToTable("orders", (string)null); + b.ToTable("jobs", (string)null); }); modelBuilder.Entity("barkmanapi.InventoryItems", b => @@ -266,25 +266,25 @@ namespace barkmanapi.Migrations b.Navigation("Status"); }); - modelBuilder.Entity("barkmanapi.OrderItems", b => + modelBuilder.Entity("barkmanapi.JobItems", b => { - b.HasOne("barkmanapi.Orders", null) + b.HasOne("barkmanapi.Jobs", null) .WithMany("Items") - .HasForeignKey("OrdersId") - .HasConstraintName("fk_order_items_orders_orders_id"); + .HasForeignKey("JobsId") + .HasConstraintName("fk_job_items_jobs_jobs_id"); }); - modelBuilder.Entity("barkmanapi.Orders", b => + modelBuilder.Entity("barkmanapi.Jobs", b => { - b.HasOne("barkmanapi.OrderStatus", "Status") + b.HasOne("barkmanapi.JobStatus", "Status") .WithMany() .HasForeignKey("StatusId") - .HasConstraintName("fk_orders_order_status_status_id"); + .HasConstraintName("fk_jobs_job_status_status_id"); b.Navigation("Status"); }); - modelBuilder.Entity("barkmanapi.Orders", b => + modelBuilder.Entity("barkmanapi.Jobs", b => { b.Navigation("Items"); }); diff --git a/barkmanAPI/Migrations/20260723200547_changedordertojobpt2.cs b/barkmanAPI/Migrations/20260723200547_changedordertojobpt2.cs new file mode 100644 index 0000000..eb35f8b --- /dev/null +++ b/barkmanAPI/Migrations/20260723200547_changedordertojobpt2.cs @@ -0,0 +1,28 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace barkmanapi.Migrations +{ + /// + public partial class changedordertojobpt2 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "order_id", + table: "job_items", + newName: "job_id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.RenameColumn( + name: "job_id", + table: "job_items", + newName: "order_id"); + } + } +} diff --git a/barkmanAPI/Migrations/20260725204039_FixJobsCustomerIdType.Designer.cs b/barkmanAPI/Migrations/20260725204039_FixJobsCustomerIdType.Designer.cs new file mode 100644 index 0000000..5bc7708 --- /dev/null +++ b/barkmanAPI/Migrations/20260725204039_FixJobsCustomerIdType.Designer.cs @@ -0,0 +1,294 @@ +// +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 + { + /// + 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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .HasColumnType("text") + .HasColumnName("address"); + + b.Property("BillingTerms") + .HasColumnType("text") + .HasColumnName("billing_terms"); + + b.Property("Company") + .HasColumnType("text") + .HasColumnName("company"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text") + .HasColumnName("email"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("Notes") + .HasColumnType("text") + .HasColumnName("notes"); + + b.Property("PhoneNumber") + .HasColumnType("text") + .HasColumnName("phone_number"); + + b.HasKey("Id") + .HasName("pk_customers"); + + b.ToTable("customers", (string)null); + }); + + modelBuilder.Entity("barkmanapi.InventoryItems", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Barcode") + .IsRequired() + .HasColumnType("text") + .HasColumnName("barcode"); + + b.Property("Brand") + .IsRequired() + .HasColumnType("text") + .HasColumnName("brand"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("Notes") + .HasColumnType("text") + .HasColumnName("notes"); + + b.Property("RentalPrice") + .HasColumnType("real") + .HasColumnName("rental_price"); + + b.Property("ReplacementCost") + .HasColumnType("real") + .HasColumnName("replacement_cost"); + + b.Property("SerialNumber") + .HasColumnType("text") + .HasColumnName("serial_number"); + + b.Property("StatusId") + .HasColumnType("text") + .HasColumnName("status_id"); + + b.Property("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("Id") + .HasColumnType("text") + .HasColumnName("id"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ItemId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("item_id"); + + b.Property("JobId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("job_id"); + + b.Property("JobsId") + .HasColumnType("integer") + .HasColumnName("jobs_id"); + + b.Property("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("Id") + .HasColumnType("text") + .HasColumnName("id"); + + b.Property("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("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Address") + .HasColumnType("text") + .HasColumnName("address"); + + b.Property("CustomerId") + .HasColumnType("integer") + .HasColumnName("customer_id"); + + b.Property("EndDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("end_date"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text") + .HasColumnName("name"); + + b.Property("Notes") + .HasColumnType("text") + .HasColumnName("notes"); + + b.Property("StartDate") + .HasColumnType("timestamp with time zone") + .HasColumnName("start_date"); + + b.Property("StatusId") + .HasColumnType("text") + .HasColumnName("status_id"); + + b.Property("TotalPrice") + .HasColumnType("numeric") + .HasColumnName("total_price"); + + b.Property("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 + } + } +} diff --git a/barkmanAPI/Migrations/20260725204039_FixJobsCustomerIdType.cs b/barkmanAPI/Migrations/20260725204039_FixJobsCustomerIdType.cs new file mode 100644 index 0000000..6db80e2 --- /dev/null +++ b/barkmanAPI/Migrations/20260725204039_FixJobsCustomerIdType.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace barkmanapi.Migrations +{ + /// + public partial class FixJobsCustomerIdType : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql( + "ALTER TABLE jobs ALTER COLUMN customer_id TYPE integer USING customer_id::integer;"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.Sql( + "ALTER TABLE jobs ALTER COLUMN customer_id TYPE text USING customer_id::text;"); + } + } +} diff --git a/barkmanAPI/Migrations/BarkContextModelSnapshot.cs b/barkmanAPI/Migrations/BarkContextModelSnapshot.cs index e02f50f..5fc1225 100644 --- a/barkmanAPI/Migrations/BarkContextModelSnapshot.cs +++ b/barkmanAPI/Migrations/BarkContextModelSnapshot.cs @@ -159,15 +159,15 @@ namespace barkmanapi.Migrations .HasColumnType("text") .HasColumnName("item_id"); + b.Property("JobId") + .IsRequired() + .HasColumnType("text") + .HasColumnName("job_id"); + b.Property("JobsId") .HasColumnType("integer") .HasColumnName("jobs_id"); - b.Property("OrderId") - .IsRequired() - .HasColumnType("text") - .HasColumnName("order_id"); - b.Property("Quantity") .HasColumnType("integer") .HasColumnName("quantity"); diff --git a/barkmanAPI/Program.cs b/barkmanAPI/Program.cs index 82e2ac6..72475d4 100644 --- a/barkmanAPI/Program.cs +++ b/barkmanAPI/Program.cs @@ -290,6 +290,7 @@ jobGroup.MapPost("", async (Jobs newJobInput, BarkContext db) => EndDate = newJobInput.EndDate, Venue = newJobInput.Venue, Address = newJobInput.Address, + Notes = newJobInput.Notes, }; db.Jobs.Add(newJob); @@ -370,7 +371,7 @@ jobItemGroup.MapPut("/{id}", async (int id, JobItems updatedJobItems, BarkContex return Results.NotFound(new { Message = "Job Items not found" }); } - existingJobItems.OrderId = updatedJobItems.OrderId; + existingJobItems.JobId = updatedJobItems.JobId; existingJobItems.ItemId = updatedJobItems.ItemId; existingJobItems.Quantity = updatedJobItems.Quantity; @@ -382,7 +383,7 @@ jobItemGroup.MapPost("", async (JobItems newJobItemsInput, BarkContext db) => { var newJobItem = new JobItems() { - OrderId = newJobItemsInput.OrderId, + JobId = newJobItemsInput.JobId, ItemId = newJobItemsInput.ItemId, Quantity = newJobItemsInput.Quantity, }; diff --git a/barkmanAPI/barkDbModel.cs b/barkmanAPI/barkDbModel.cs index 9ddfe9e..9a0300d 100644 --- a/barkmanAPI/barkDbModel.cs +++ b/barkmanAPI/barkDbModel.cs @@ -65,7 +65,7 @@ public class Jobs public class JobItems { public int Id { get; set; } - public required string OrderId { get; set; } + public required string JobId { get; set; } public required string ItemId { get; set; } public int Quantity { get; set; } } diff --git a/barkmanui/src/App.tsx b/barkmanui/src/App.tsx index 16fcc53..a46681d 100644 --- a/barkmanui/src/App.tsx +++ b/barkmanui/src/App.tsx @@ -14,6 +14,8 @@ 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"; // Create a client const queryClient = new QueryClient() @@ -54,6 +56,8 @@ function App() { }/> }/> }/> + }/> + }/> diff --git a/barkmanui/src/common/components/BarkHeader.tsx b/barkmanui/src/common/components/BarkHeader.tsx index 8ab8ea8..f52e88c 100644 --- a/barkmanui/src/common/components/BarkHeader.tsx +++ b/barkmanui/src/common/components/BarkHeader.tsx @@ -8,6 +8,7 @@ import BarkLogo from '@/assets/barklogo.png'; const links = [ { link: '/', label: 'Home' }, { link: '/customers', label: 'Customers' }, + { link: '/jobs', label: 'Jobs' }, { link: '/inventory', label: 'Inventory' }, ]; diff --git a/barkmanui/src/features/jobs/JobList.tsx b/barkmanui/src/features/jobs/JobList.tsx new file mode 100644 index 0000000..8d9fcf6 --- /dev/null +++ b/barkmanui/src/features/jobs/JobList.tsx @@ -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 ( + <> + +

+ ARFF ARFF BARK BARK +

+ Add Job +
+ + + + + Customer ID + Name + Venue + Status + Start Date + + + + {jobQuery.data?.map((data) => ( + + {data.customerId} + {data.name} + {data.venue} + {data.status.name} + {data.startDate.getDate()} + + Details + + + ))} + +
+ + ) +} +export default JobList; \ No newline at end of file