more status

This commit is contained in:
2025-01-23 18:52:25 -06:00
parent b13acf36ed
commit 64ec597a1c
5 changed files with 202 additions and 5 deletions
+9 -2
View File
@@ -12,6 +12,7 @@ builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1",
new OpenApiInfo { Title = "BarkMan API", Description = "BARK BARK WOOF WOOF", Version = "v1" });
});
builder.Services.AddCors(options =>
@@ -30,12 +31,14 @@ var app = builder.Build();
if (!app.Environment.IsProduction())
{
app.UseSwagger();
app.MapOpenApi();
app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "Bark Productions API V1"); });
}
app.MapGet("/", () => "Hello World!");
app.MapGet("/inventory", async (BarkContext db) =>
await db.Inventory.OrderBy(item => item.Id).ToListAsync());
@@ -61,7 +64,7 @@ app.MapPut("/inventory/{id}", async (int id, InventoryItems updatedItem, BarkCon
existingItem.Name = updatedItem.Name;
existingItem.Brand = updatedItem.Brand;
existingItem.SerialNumber = updatedItem.SerialNumber;
existingItem.Status = updatedItem.Status;
existingItem.StatusId = updatedItem.StatusId;
existingItem.RentalPrice = updatedItem.RentalPrice;
existingItem.ReplacementCost = updatedItem.ReplacementCost;
existingItem.Notes = updatedItem.Notes;
@@ -140,6 +143,10 @@ app.MapDelete("/itemstatus/{id}", async (string id, BarkContext db) =>
return Results.Ok(new { Message = "Item status deleted successfully" });
});
var inventoryGroup = app.MapGroup(prefix: "/inventory")
.WithTags("Inventory")
.WithDescription("Endpoints for managing inventory items");
using (var serviceScope = app.Services.CreateScope())
{
var dbContext = serviceScope.ServiceProvider.GetRequiredService<BarkContext>();