mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-08-11 03:42:01 +00:00
fixed a lot of stuff
This commit is contained in:
-302
@@ -1,302 +0,0 @@
|
||||
// <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("20260725205905_splitdatetimeIntoSeprateFeileds")]
|
||||
partial class splitdatetimeIntoSeprateFeileds
|
||||
{
|
||||
/// <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<DateOnly>("EndDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("end_date");
|
||||
|
||||
b.Property<TimeOnly>("EndTime")
|
||||
.HasColumnType("time without time zone")
|
||||
.HasColumnName("end_time");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("name");
|
||||
|
||||
b.Property<string>("Notes")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<DateOnly>("StartDate")
|
||||
.HasColumnType("date")
|
||||
.HasColumnName("start_date");
|
||||
|
||||
b.Property<TimeOnly>("StartTime")
|
||||
.HasColumnType("time without time zone")
|
||||
.HasColumnName("start_time");
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace barkmanapi.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class splitdatetimeIntoSeprateFeileds : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<DateOnly>(
|
||||
name: "start_date",
|
||||
table: "jobs",
|
||||
type: "date",
|
||||
nullable: false,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
|
||||
migrationBuilder.AlterColumn<DateOnly>(
|
||||
name: "end_date",
|
||||
table: "jobs",
|
||||
type: "date",
|
||||
nullable: false,
|
||||
oldClrType: typeof(DateTime),
|
||||
oldType: "timestamp with time zone");
|
||||
|
||||
migrationBuilder.AddColumn<TimeOnly>(
|
||||
name: "end_time",
|
||||
table: "jobs",
|
||||
type: "time without time zone",
|
||||
nullable: false,
|
||||
defaultValue: new TimeOnly(0, 0, 0));
|
||||
|
||||
migrationBuilder.AddColumn<TimeOnly>(
|
||||
name: "start_time",
|
||||
table: "jobs",
|
||||
type: "time without time zone",
|
||||
nullable: false,
|
||||
defaultValue: new TimeOnly(0, 0, 0));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "end_time",
|
||||
table: "jobs");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "start_time",
|
||||
table: "jobs");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "start_date",
|
||||
table: "jobs",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
oldClrType: typeof(DateOnly),
|
||||
oldType: "date");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTime>(
|
||||
name: "end_date",
|
||||
table: "jobs",
|
||||
type: "timestamp with time zone",
|
||||
nullable: false,
|
||||
oldClrType: typeof(DateOnly),
|
||||
oldType: "date");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,14 +215,10 @@ namespace barkmanapi.Migrations
|
||||
.HasColumnType("integer")
|
||||
.HasColumnName("customer_id");
|
||||
|
||||
b.Property<DateOnly>("EndDate")
|
||||
.HasColumnType("date")
|
||||
b.Property<DateTime>("EndDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("end_date");
|
||||
|
||||
b.Property<TimeOnly>("EndTime")
|
||||
.HasColumnType("time without time zone")
|
||||
.HasColumnName("end_time");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text")
|
||||
@@ -232,14 +228,10 @@ namespace barkmanapi.Migrations
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("notes");
|
||||
|
||||
b.Property<DateOnly>("StartDate")
|
||||
.HasColumnType("date")
|
||||
b.Property<DateTime>("StartDate")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("start_date");
|
||||
|
||||
b.Property<TimeOnly>("StartTime")
|
||||
.HasColumnType("time without time zone")
|
||||
.HasColumnName("start_time");
|
||||
|
||||
b.Property<string>("StatusId")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("status_id");
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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; }
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ function JobList() {
|
||||
<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>{data.startDate.getDate()}</Table.Td>
|
||||
<Table.Td>{data.status?.name ?? '—'}</Table.Td>
|
||||
<Table.Td>{new Date(data.startDate).toLocaleDateString()}</Table.Td>
|
||||
<Table.Td>
|
||||
<Link to={`/inventory/itemDetail/${data.id}`}>Details</Link>
|
||||
</Table.Td>
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user