diff --git a/barkmanAPI/Migrations/20260725205905_splitdatetimeIntoSeprateFeileds.Designer.cs b/barkmanAPI/Migrations/20260725205905_splitdatetimeIntoSeprateFeileds.Designer.cs
deleted file mode 100644
index 4142fc1..0000000
--- a/barkmanAPI/Migrations/20260725205905_splitdatetimeIntoSeprateFeileds.Designer.cs
+++ /dev/null
@@ -1,302 +0,0 @@
-//
-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("20260725205905_splitdatetimeIntoSeprateFeileds")]
- partial class splitdatetimeIntoSeprateFeileds
- {
- ///
- 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("date")
- .HasColumnName("end_date");
-
- b.Property("EndTime")
- .HasColumnType("time without time zone")
- .HasColumnName("end_time");
-
- b.Property("Name")
- .IsRequired()
- .HasColumnType("text")
- .HasColumnName("name");
-
- b.Property("Notes")
- .HasColumnType("text")
- .HasColumnName("notes");
-
- b.Property("StartDate")
- .HasColumnType("date")
- .HasColumnName("start_date");
-
- b.Property("StartTime")
- .HasColumnType("time without time zone")
- .HasColumnName("start_time");
-
- 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/20260725205905_splitdatetimeIntoSeprateFeileds.cs b/barkmanAPI/Migrations/20260725205905_splitdatetimeIntoSeprateFeileds.cs
deleted file mode 100644
index bf752e7..0000000
--- a/barkmanAPI/Migrations/20260725205905_splitdatetimeIntoSeprateFeileds.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using System;
-using Microsoft.EntityFrameworkCore.Migrations;
-
-#nullable disable
-
-namespace barkmanapi.Migrations
-{
- ///
- public partial class splitdatetimeIntoSeprateFeileds : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AlterColumn(
- name: "start_date",
- table: "jobs",
- type: "date",
- nullable: false,
- oldClrType: typeof(DateTime),
- oldType: "timestamp with time zone");
-
- migrationBuilder.AlterColumn(
- name: "end_date",
- table: "jobs",
- type: "date",
- nullable: false,
- oldClrType: typeof(DateTime),
- oldType: "timestamp with time zone");
-
- migrationBuilder.AddColumn(
- name: "end_time",
- table: "jobs",
- type: "time without time zone",
- nullable: false,
- defaultValue: new TimeOnly(0, 0, 0));
-
- migrationBuilder.AddColumn(
- name: "start_time",
- table: "jobs",
- type: "time without time zone",
- nullable: false,
- defaultValue: new TimeOnly(0, 0, 0));
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropColumn(
- name: "end_time",
- table: "jobs");
-
- migrationBuilder.DropColumn(
- name: "start_time",
- table: "jobs");
-
- migrationBuilder.AlterColumn(
- name: "start_date",
- table: "jobs",
- type: "timestamp with time zone",
- nullable: false,
- oldClrType: typeof(DateOnly),
- oldType: "date");
-
- migrationBuilder.AlterColumn(
- name: "end_date",
- table: "jobs",
- type: "timestamp with time zone",
- nullable: false,
- oldClrType: typeof(DateOnly),
- oldType: "date");
- }
- }
-}
diff --git a/barkmanAPI/Migrations/BarkContextModelSnapshot.cs b/barkmanAPI/Migrations/BarkContextModelSnapshot.cs
index 3ead0a3..57ae23d 100644
--- a/barkmanAPI/Migrations/BarkContextModelSnapshot.cs
+++ b/barkmanAPI/Migrations/BarkContextModelSnapshot.cs
@@ -215,14 +215,10 @@ namespace barkmanapi.Migrations
.HasColumnType("integer")
.HasColumnName("customer_id");
- b.Property("EndDate")
- .HasColumnType("date")
+ b.Property("EndDate")
+ .HasColumnType("timestamp with time zone")
.HasColumnName("end_date");
- b.Property("EndTime")
- .HasColumnType("time without time zone")
- .HasColumnName("end_time");
-
b.Property("Name")
.IsRequired()
.HasColumnType("text")
@@ -232,14 +228,10 @@ namespace barkmanapi.Migrations
.HasColumnType("text")
.HasColumnName("notes");
- b.Property("StartDate")
- .HasColumnType("date")
+ b.Property("StartDate")
+ .HasColumnType("timestamp with time zone")
.HasColumnName("start_date");
- b.Property("StartTime")
- .HasColumnType("time without time zone")
- .HasColumnName("start_time");
-
b.Property("StatusId")
.HasColumnType("text")
.HasColumnName("status_id");
diff --git a/barkmanAPI/Program.cs b/barkmanAPI/Program.cs
index 59d8afd..72475d4 100644
--- a/barkmanAPI/Program.cs
+++ b/barkmanAPI/Program.cs
@@ -271,8 +271,6 @@ jobGroup.MapPut("/{id}", async (int id, Jobs updatedJob, BarkContext db) =>
existingJob.Name = updatedJob.Name;
existingJob.StartDate = updatedJob.StartDate;
existingJob.EndDate = updatedJob.EndDate;
- existingJob.StartTime = updatedJob.StartTime;
- existingJob.EndTime = updatedJob.EndTime;
existingJob.TotalPrice = updatedJob.TotalPrice;
existingJob.Venue = updatedJob.Venue;
existingJob.Address = updatedJob.Address;
@@ -290,8 +288,6 @@ jobGroup.MapPost("", async (Jobs newJobInput, BarkContext db) =>
Name = newJobInput.Name,
StartDate = newJobInput.StartDate,
EndDate = newJobInput.EndDate,
- StartTime = newJobInput.StartTime,
- EndTime = newJobInput.EndTime,
Venue = newJobInput.Venue,
Address = newJobInput.Address,
Notes = newJobInput.Notes,
diff --git a/barkmanAPI/barkDbModel.cs b/barkmanAPI/barkDbModel.cs
index f41edc6..07db120 100644
--- a/barkmanAPI/barkDbModel.cs
+++ b/barkmanAPI/barkDbModel.cs
@@ -54,10 +54,8 @@ public class Jobs
public required string Name { get; set; }
public JobStatus Status { get; set; }
public string? StatusId { get; set; }
- public DateOnly StartDate { get; set; }
- public DateOnly EndDate { get; set; }
- public TimeOnly StartTime { get; set; }
- public TimeOnly EndTime { 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; }
diff --git a/barkmanui/src/features/jobs/AddJob.tsx b/barkmanui/src/features/jobs/AddJob.tsx
index 00a2146..734b6b3 100644
--- a/barkmanui/src/features/jobs/AddJob.tsx
+++ b/barkmanui/src/features/jobs/AddJob.tsx
@@ -20,8 +20,8 @@ function AddJob() {
initialValues: {
customerId: 0,
name: "",
- startDate: new Date(),
- endDate: new Date(),
+ startDate: "",
+ endDate: "",
address: "",
venue: "",
notes: "",
@@ -35,7 +35,11 @@ function AddJob() {
const result = await fetch(import.meta.env.VITE_API_URL + '/jobs', {
method: 'POST',
- body: JSON.stringify(values),
+ body: JSON.stringify({
+ ...values,
+ startDate: new Date(values.startDate).toISOString(),
+ endDate: new Date(values.endDate).toISOString(),
+ }),
headers: {
'Content-Type': 'application/json'
}
diff --git a/barkmanui/src/features/jobs/JobList.tsx b/barkmanui/src/features/jobs/JobList.tsx
index 8d9fcf6..a8b7f87 100644
--- a/barkmanui/src/features/jobs/JobList.tsx
+++ b/barkmanui/src/features/jobs/JobList.tsx
@@ -45,8 +45,8 @@ function JobList() {
{data.customerId}
{data.name}
{data.venue}
- {data.status.name}
- {data.startDate.getDate()}
+ {data.status?.name ?? '—'}
+ {new Date(data.startDate).toLocaleDateString()}
Details
diff --git a/barkmanui/src/features/jobs/types.ts b/barkmanui/src/features/jobs/types.ts
index e94ce17..b0745dd 100644
--- a/barkmanui/src/features/jobs/types.ts
+++ b/barkmanui/src/features/jobs/types.ts
@@ -2,10 +2,10 @@ export interface Job {
id: number,
customerId: number,
name: string,
- status: {id: string; name: string},
- statusId: string;
- startDate: Date;
- endDate: Date;
+ status: {id: string; name: string} | null,
+ statusId: string | null;
+ startDate: string;
+ endDate: string;
totalPrice: string,
venue: string,
address: string,
@@ -15,8 +15,8 @@ export interface Job {
export interface NewJob {
customerId: number,
name: string,
- startDate: Date;
- endDate: Date;
+ startDate: string;
+ endDate: string;
venue: string,
address: string,
notes: string,