mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-06-13 06:11:55 +00:00
more status
This commit is contained in:
@@ -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>();
|
||||
|
||||
Reference in New Issue
Block a user