mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-08-11 11:42:03 +00:00
5517924259
Two divergent copies of this branch each independently regenerated an EF migration named changedOrderToJob, and merging both left two files with the same C# class name (compile error) plus an orphaned fixedOrderCustomerID migration referencing the already-renamed orders table. Removed the dead/unapplied migrations, committed the two migrations already live on the shared dev DB, and added FixJobsCustomerIdType to bring jobs.customer_id in line with the model (text -> integer) using an explicit USING cast. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
78 lines
2.2 KiB
C#
78 lines
2.2 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace barkmanapi;
|
|
|
|
public class BarkContext(DbContextOptions<BarkContext> options) : DbContext(options)
|
|
{
|
|
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)]
|
|
public class InventoryItems
|
|
{
|
|
public int Id {get; set;}
|
|
public string Barcode {get; set;}
|
|
public string Name { get; set; }
|
|
public string Brand { get; set; }
|
|
public string? SerialNumber { get; set; }
|
|
public ItemStatus Status { get; set; }
|
|
public string? StatusId { get; set; }
|
|
public float? Weight { get; set; }
|
|
public float? RentalPrice { get; set; }
|
|
public float? ReplacementCost { get; set; }
|
|
public string? Notes { get; set; }
|
|
}
|
|
|
|
public class ItemStatus
|
|
{
|
|
public string Id { get; set; }
|
|
public string Name { get; set; }
|
|
}
|
|
|
|
public class Customers
|
|
{
|
|
public int Id { get; set; }
|
|
public required string Name { get; set; }
|
|
public string? Company { get; set; }
|
|
public required string Email { get; set; }
|
|
public string? PhoneNumber { get; set; }
|
|
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 DateTimeOffset StartDate { get; set; }
|
|
public DateTimeOffset EndDate { get; set; }
|
|
public decimal TotalPrice { get; set; }
|
|
public string? Venue { get; set; }
|
|
public string? Address { get; set; }
|
|
public 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; }
|
|
}
|