back end changes

This commit is contained in:
2025-01-29 19:56:56 -06:00
parent aa4ff86d3e
commit 4c844a8051
2 changed files with 14 additions and 3 deletions
+10 -2
View File
@@ -85,11 +85,19 @@ inventoryGroup.MapPut("/{id}", async (int id, InventoryItems updatedItem, BarkCo
}); });
inventoryGroup.MapPost("", async (InventoryItems newItem, BarkContext db) => inventoryGroup.MapPost("", async (InventoryItems newItemInput, BarkContext db) =>
{ {
var newItem = new InventoryItems();
newItemInput.Name = newItem.Name;
newItem.Brand = newItemInput.Brand;
newItem.SerialNumber = newItemInput.SerialNumber;
newItem.RentalPrice = newItemInput.RentalPrice;
newItem.ReplacementCost = newItemInput.ReplacementCost;
newItem.StatusId = "ready";
db.Inventory.Add(newItem); db.Inventory.Add(newItem);
await db.SaveChangesAsync(); await db.SaveChangesAsync();
return Results.Created($"/inventory/{newItem.Id}", newItem); return Results.Created($"/inventory/{newItemInput.Id}", newItemInput);
}); });
inventoryGroup.MapDelete("/{id}", async (int id, BarkContext db) => inventoryGroup.MapDelete("/{id}", async (int id, BarkContext db) =>
+3
View File
@@ -1 +1,4 @@
#Staging API
VITE_API_URL=https://barkdev.ts.drewr.io VITE_API_URL=https://barkdev.ts.drewr.io
#Local Dev API
#VITE_API_URL=http://localhost:5145