CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/aspnet-security-basics

Security defaults that belong in every ASP.NET Core application from day one.

87

1.91x
Quality

83%

Does it follow best practices?

Impact

94%

1.91x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-3/

Build an Inventory Management API with ASP.NET Core

Problem/Feature Description

A warehouse operations team needs an inventory management API built with ASP.NET Core and C#. An Angular dashboard on https://warehouse.example.com will consume this API. The system tracks products, stock levels, and stock adjustments (receiving shipments, recording sales, making corrections).

The API needs the following endpoints:

  • GET /api/inventory -- list all products with current stock levels (supports ?search=widget&lowStock=true&page=1)
  • GET /api/inventory/{sku} -- get a single product's details and stock history
  • POST /api/inventory -- add a new product to inventory (accepts sku, name, description, category, unitPrice, reorderPoint)
  • PUT /api/inventory/{sku} -- update product details
  • POST /api/inventory/{sku}/adjustments -- record a stock adjustment (accepts type enum: Received, Sold, Correction, Return; quantity, reason)
  • GET /api/inventory/{sku}/adjustments -- get stock adjustment history for a product
  • GET /api/reports/low-stock -- list products below their reorder point (manager only)
  • POST /api/inventory/bulk-import -- import products from a JSON array (admin only, accepts up to 100 items)

Use an in-memory data store. Products have Sku, Name, Description, Category, UnitPrice, CurrentStock, ReorderPoint, CreatedAt, UpdatedAt. Adjustments have Id, Sku, Type, Quantity, PreviousStock, NewStock, Reason, UserId, CreatedAt.

Output Specification

Produce:

  • Program.cs -- Application setup with services and middleware
  • Controllers/InventoryController.cs -- Product and stock endpoints
  • Controllers/ReportsController.cs -- Reporting endpoints
  • Models/ -- Request/response DTOs and entity classes
  • Services/InventoryService.cs -- Stock management business logic
  • appsettings.json -- Configuration
  • InventoryApi.csproj -- Project file with NuGet packages

evals

tile.json