feat: Add PurchaseItem entity and job locking data layer
Add PurchaseItem entity with status tracking (Pending/Ordered/Received), supplier and job relationships. Add LockedAt timestamp to Job entity for controlling editability after materials are ordered. Includes PurchaseItemService (CRUD + bulk create), JobService Lock/Unlock methods, EF Core migrations, and DI registration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,26 @@ public class JobService
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
public async Task LockAsync(int id)
|
||||
{
|
||||
var job = await _context.Jobs.FindAsync(id);
|
||||
if (job != null)
|
||||
{
|
||||
job.LockedAt = DateTime.UtcNow;
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UnlockAsync(int id)
|
||||
{
|
||||
var job = await _context.Jobs.FindAsync(id);
|
||||
if (job != null)
|
||||
{
|
||||
job.LockedAt = null;
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(int id)
|
||||
{
|
||||
var job = await _context.Jobs.FindAsync(id);
|
||||
|
||||
Reference in New Issue
Block a user