Skip to content

Conversation

@taiphanvan2k3
Copy link
Member

@taiphanvan2k3 taiphanvan2k3 commented Sep 20, 2025

Summary by CodeRabbit

  • New Features

    • Added health endpoints (basic, detailed, ping, test).
    • Root URL redirects to API documentation.
  • DevOps

    • Added Docker support and docker-compose for local run with PostgreSQL.
    • Standardized local ports to 10000 (HTTP) and 10001 (HTTPS).
  • Infrastructure

    • Migrated database provider and health checks to PostgreSQL.
    • Added default PostgreSQL connection strings for development.
    • Removed default email and file storage settings from configuration.

@taiphanvan2k3 taiphanvan2k3 self-assigned this Sep 20, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 20, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Switches the project from SQL Server to PostgreSQL, adds containerization (docker-compose and Web.Api Dockerfile), introduces health and utility endpoints, makes HTTPS redirection conditional and adds a root redirect to Swagger, updates connection strings and launch URLs, and removes email and file-storage settings.

Changes

Cohort / File(s) Summary of changes
Containerization
docker-compose.yml, src/Web.Api/Dockerfile
Added compose stack legal-assistant with web-api and postgres; exposed ports 10000/10001 and 5432; mounted DB volume; new multi-stage .NET 8 Dockerfile publishing Web.Api and exposing 8080/8081.
Infrastructure: DB provider & health checks
src/Infrastructure/Extensions/ServiceCollectionExtensions.cs, src/Infrastructure/Infrastructure.csproj
Migrated EF Core provider from SQL Server to Npgsql (UseNpgsql); updated retry configuration and health checks to Npgsql; swapped package references to Npgsql.EntityFrameworkCore.PostgreSQL and AspNetCore.HealthChecks.Npgsql; removed default EmailSettings and FileStorageSettings configuration.
Web API: Health & utility endpoints
src/Web.Api/Controllers/V1/HealthController.cs
Added HealthController with /health, /health/details, /ping, and /test endpoints and new response record types and helpers (version, uptime).
Web API: Startup & routing
src/Web.Api/Program.cs
Made HTTPS redirection conditional (production or ASPNETCORE_HTTPS_PORT); added root redirect to /swagger; mapped health endpoints and adjusted middleware ordering.
Configuration & launch profiles
src/Web.Api/appsettings.json, src/Web.Api/appsettings.Development.json, src/Web.Api/Properties/launchSettings.json
Replaced DefaultConnection with PostgreSQL connection strings; removed EmailSettings and FileStorageSettings from appsettings; updated launch URLs to use ports 10000/10001 (profiles).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant WebApi as Web.Api
  participant DB as Postgres (Npgsql)
  Note over WebApi: Routing updated — /, /health, /health/details, /ping, /test

  Client->>WebApi: GET /
  WebApi-->>Client: 302 Redirect to /swagger

  Client->>WebApi: GET /health
  WebApi->>DB: Execute DB health check (Npgsql)
  DB-->>WebApi: DB health status
  WebApi-->>Client: 200 OK (aggregated health)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

I hop through configs, ports aligned just so,
From SQL’s meadow to Postgres fields I go.
Health pings and swagger paths now brightly sing,
Compose drums beat, containers take to spring.
Thump-thump, new builds—carrots queued for the show. 🥕🐇


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 055a32c and e39ce5d.

📒 Files selected for processing (1)
  • src/Web.Api/Program.cs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/Web.Api/Program.cs

Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR configures Docker support for the Legal Assistant API and adds basic testing endpoints to verify deployment functionality. The main changes include migrating from SQL Server to PostgreSQL, setting up containerized deployment, and creating health check endpoints for monitoring.

  • Migrates database from SQL Server to PostgreSQL for better Docker compatibility
  • Adds Docker containerization with docker-compose setup for local development
  • Creates comprehensive health check endpoints for testing and monitoring

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Web.Api/appsettings.json Updates connection string to PostgreSQL and removes unused configuration sections
src/Web.Api/appsettings.Development.json Adds PostgreSQL connection string for development environment
src/Web.Api/Properties/launchSettings.json Changes application ports to match Docker configuration
src/Web.Api/Program.cs Adds conditional HTTPS redirection and root path redirect to Swagger
src/Web.Api/Dockerfile Adds multi-stage Docker build configuration for the API
src/Web.Api/Controllers/V1/HealthController.cs Creates comprehensive health check controller with multiple endpoints
src/Infrastructure/Infrastructure.csproj Replaces SQL Server packages with PostgreSQL equivalents
src/Infrastructure/Extensions/ServiceCollectionExtensions.cs Updates database configuration to use PostgreSQL
docker-compose.yml Adds container orchestration with API and PostgreSQL services

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@taiphanvan2k3 taiphanvan2k3 merged commit 26c3d93 into main Sep 20, 2025
2 checks passed
@taiphanvan2k3 taiphanvan2k3 deleted the feat/implement-simple-endpoints branch September 20, 2025 15:32
taiphanvan2k3 added a commit that referenced this pull request Dec 22, 2025
* feat: Configure Docker and test with simple endpoints

* Update src/Web.Api/Program.cs

Co-authored-by: Copilot <[email protected]>

* Update src/Web.Api/Program.cs

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants