Skip to content

Commit c521aef

Browse files
committed
feat: add auth, sql migrations, and modular structure
1 parent 443dc10 commit c521aef

37 files changed

Lines changed: 1247 additions & 120 deletions

AGENTS.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Repository Guidelines
2+
3+
## Project Structure & Module Organization
4+
- `Propel.Api/` hosts the .NET 10 Minimal API backend (entry point in `Program.cs`, data in `Data/`, entities in `Models/`).
5+
- `propel-ui/` hosts the Angular 21 SSR frontend (app code in `src/app/`, global styles in `src/styles.scss`).
6+
- Solution file: `propel-rental-core.sln` at the repo root.
7+
8+
## Build, Test, and Development Commands
9+
Backend (from `Propel.Api/`):
10+
- `dotnet run` — run the API.
11+
- `dotnet watch` — run with hot reload.
12+
- `dotnet build` — compile the API.
13+
- `dotnet test` — run backend tests (if/when added).
14+
15+
Frontend (from `propel-ui/`):
16+
- `npm start` — Angular dev server at `http://localhost:4200`.
17+
- `npm run build` — production build with SSR output in `dist/`.
18+
- `npm run serve:ssr:propel-ui` — serve the SSR build.
19+
- `npm test` — run Vitest via Angular CLI.
20+
21+
## Coding Style & Naming Conventions
22+
- C#: prefer Minimal APIs (no controllers), records for DTOs, and primary constructors. Use `app.MapGet/MapPost/...` patterns.
23+
- Angular: standalone components only, `inject()` for DI, and `httpResource` + signals for data/state.
24+
- Indentation: 4 spaces for C#, 2 spaces for TypeScript/HTML/SCSS.
25+
- Formatting: Prettier config lives in `propel-ui/package.json` (single quotes, 100-char width).
26+
27+
## Testing Guidelines
28+
- Frontend: `ng test` runs Vitest; keep specs alongside features (e.g., `src/app/app.spec.ts`).
29+
- Backend: no test project yet; when adding tests, wire them to `dotnet test` and keep them under a `Propel.Api.Tests/` or similar directory.
30+
31+
## Commit & Pull Request Guidelines
32+
- Current history uses Conventional Commit-style prefixes like `feat:` and `initial:`; follow the same pattern (e.g., `feat:`, `fix:`, `chore:`).
33+
- PRs should include a concise description, key decisions, and any UI screenshots when visual changes are involved.
34+
35+
## Security & Configuration Tips
36+
- App settings live in `Propel.Api/appsettings*.json`; avoid committing secrets.
37+
- Update API base URLs in the frontend service layer (`src/app/services/`) when environments differ.
38+
39+
## Agent-Specific Instructions
40+
- See `CLAUDE.md` for architecture notes and do/don’t guidelines (Minimal APIs, zoneless Angular, no NgModules).

Propel.Api/Data/RentalDbContext.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

Propel.Api/Data/RentalDbSeeder.cs

Lines changed: 0 additions & 24 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Diagnostics;
2+
3+
namespace Propel.Api.Middleware;
4+
5+
public sealed class CorrelationIdMiddleware(RequestDelegate next)
6+
{
7+
public const string HeaderName = "X-Correlation-Id";
8+
9+
public async Task InvokeAsync(HttpContext context, ILogger<CorrelationIdMiddleware> logger)
10+
{
11+
var correlationId = context.Request.Headers[HeaderName].FirstOrDefault();
12+
if (string.IsNullOrWhiteSpace(correlationId))
13+
{
14+
correlationId = Activity.Current?.TraceId.ToString() ?? Guid.NewGuid().ToString();
15+
}
16+
17+
context.Response.Headers[HeaderName] = correlationId;
18+
19+
using (logger.BeginScope(new Dictionary<string, object> { ["CorrelationId"] = correlationId }))
20+
{
21+
await next(context);
22+
}
23+
}
24+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
#nullable disable
4+
5+
namespace Propel.Api.Migrations;
6+
7+
public partial class InitialCreate : Migration
8+
{
9+
protected override void Up(MigrationBuilder migrationBuilder)
10+
{
11+
migrationBuilder.CreateTable(
12+
name: "RentalItems",
13+
columns: table => new
14+
{
15+
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
16+
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
17+
Category = table.Column<string>(type: "nvarchar(max)", nullable: false),
18+
DailyRate = table.Column<decimal>(type: "decimal(10,2)", nullable: false),
19+
Status = table.Column<string>(type: "nvarchar(max)", nullable: false)
20+
},
21+
constraints: table =>
22+
{
23+
table.PrimaryKey("PK_RentalItems", x => x.Id);
24+
});
25+
}
26+
27+
protected override void Down(MigrationBuilder migrationBuilder)
28+
{
29+
migrationBuilder.DropTable(
30+
name: "RentalItems");
31+
}
32+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using Microsoft.EntityFrameworkCore;
2+
using Microsoft.EntityFrameworkCore.Infrastructure;
3+
using Propel.Api.Modules.Inventory.Data;
4+
5+
#nullable disable
6+
7+
namespace Propel.Api.Migrations;
8+
9+
[DbContext(typeof(RentalDbContext))]
10+
public partial class RentalDbContextModelSnapshot : ModelSnapshot
11+
{
12+
protected override void BuildModel(ModelBuilder modelBuilder)
13+
{
14+
modelBuilder.HasAnnotation("ProductVersion", "10.0.0");
15+
16+
modelBuilder.Entity("Propel.Api.Modules.Inventory.Domain.RentalItem", b =>
17+
{
18+
b.Property<Guid>("Id")
19+
.ValueGeneratedNever()
20+
.HasColumnType("uniqueidentifier");
21+
22+
b.Property<string>("Category")
23+
.IsRequired()
24+
.HasColumnType("nvarchar(max)");
25+
26+
b.Property<decimal>("DailyRate")
27+
.HasColumnType("decimal(10,2)");
28+
29+
b.Property<string>("Name")
30+
.IsRequired()
31+
.HasMaxLength(200)
32+
.HasColumnType("nvarchar(200)");
33+
34+
b.Property<string>("Status")
35+
.IsRequired()
36+
.HasColumnType("nvarchar(max)");
37+
38+
b.HasKey("Id");
39+
40+
b.ToTable("RentalItems");
41+
});
42+
}
43+
}

Propel.Api/Models/Category.cs

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Propel.Api.Modules.AI;
2+
3+
public static class ModuleInfo
4+
{
5+
public const string Name = "AI";
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Propel.Api.Modules.Audit;
2+
3+
public static class ModuleInfo
4+
{
5+
public const string Name = "Audit";
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace Propel.Api.Modules.Contracts;
2+
3+
public static class ModuleInfo
4+
{
5+
public const string Name = "Contracts";
6+
}

0 commit comments

Comments
 (0)