Skip to content

Db desing and models creations#1

Merged
kavinda-100 merged 14 commits into
mainfrom
db_desing-and_models_creations
Mar 12, 2026
Merged

Db desing and models creations#1
kavinda-100 merged 14 commits into
mainfrom
db_desing-and_models_creations

Conversation

@kavinda-100

Copy link
Copy Markdown
Owner

No description provided.

…a with users, workspaces, projects, tasks, and relationships
…d registration forms, improved styling, and added endpoints table
… subscriber initialization, and implement TraceLayer for HTTP request logging
Copilot AI review requested due to automatic review settings March 12, 2026 07:49
@kavinda-100 kavinda-100 merged commit 5d6434e into main Mar 12, 2026
2 of 3 checks passed
@coderabbitai

coderabbitai Bot commented Mar 12, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 954e1fcf-5595-4262-aa19-cd31eadcba56

📥 Commits

Reviewing files that changed from the base of the PR and between 6b251a5 and 6258460.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (29)
  • .env
  • .github/copilot-instructions.md
  • .github/workflows/lint-and-format.yml
  • .vscode/settings.json
  • API.http
  • Cargo.toml
  • README.md
  • makefile
  • migrations/20260311153049_init_schema.sql
  • migrations/20260311154909_init_sprintly_schema.sql
  • public/index.html
  • public/login.html
  • public/register.html
  • public/styles.css
  • public/table.js
  • src/config/env.rs
  • src/config/mod.rs
  • src/controllers/auth_controller.rs
  • src/controllers/mod.rs
  • src/controllers/root_controller.rs
  • src/db/mod.rs
  • src/dtos/mod.rs
  • src/main.rs
  • src/middleware/mod.rs
  • src/models/mod.rs
  • src/routes/auth_routes.rs
  • src/routes/mod.rs
  • src/services/mod.rs
  • src/utils/mod.rs

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • New Features

    • Added public landing page with API documentation and endpoint reference
    • Introduced user authentication system with login and registration pages
    • Added authentication health check endpoint for system monitoring
  • Documentation

    • API endpoint reference guide now available
    • Entity relationship diagram added to documentation

Walkthrough

This PR establishes the Sprintly API project foundation, introducing environment-based configuration with tracing/logging, a comprehensive database schema with migrations, static frontend pages for authentication, new API endpoints, and development tooling including GitHub Actions workflows and Makefile targets.

Changes

Cohort / File(s) Summary
Configuration & Environment
.env, src/config/env.rs, src/config/mod.rs, .github/workflows/lint-and-format.yml
Reorganized environment variables (PORT moved to App section); added RUST_LOG=debug; created EnvConfig struct to read DATABASE_URL and PORT; expanded AppState with app_name and env_config fields; added GitHub Actions workflow for linting and formatting checks.
Documentation
.github/copilot-instructions.md, API.http, README.md
Added Copilot coding guidelines covering project structure, Rust/Axum patterns, and resource addition workflow; documented new auth/check endpoint in API.http; added entity relationship diagram showing users, workspaces, projects, tasks, and comments.
Database & Migrations
migrations/20260311153049_init_schema.sql, migrations/20260311154909_init_sprintly_schema.sql, src/db/mod.rs
Replaced simple schema with comprehensive new migration enabling uuid-ossp and creating users, workspaces, projects, task_status, task_priority, tasks, task_assignees, and comments tables with proper foreign keys and cascading deletes; updated establish_connection to accept database_url parameter and execute migrations.
Backend Routing & Controllers
src/controllers/auth_controller.rs, src/controllers/mod.rs, src/controllers/root_controller.rs, src/routes/auth_routes.rs, src/routes/mod.rs
Added auth_check endpoint returning health status with app metadata; modified health_check to consume AppState and include app_name and port in response; created auth_routes module; integrated static file serving fallback; removed root_handler.
Backend Core & Initialization
src/main.rs, src/models/mod.rs, src/services/mod.rs, src/utils/mod.rs, src/dtos/mod.rs, src/middleware/mod.rs
Initialized tracing subscriber with environment-based log filtering; integrated HTTP request/response logging via TraceLayer; loaded environment configuration during app startup; populated AppState with env_config and app_name; created stub modules for models, services, utilities, DTOs, and middleware.
Frontend UI
public/index.html, public/login.html, public/register.html, public/styles.css, public/table.js
Added landing page with endpoint discovery table; implemented login form with email/password and Google OAuth; created registration form with password confirmation and OAuth option; defined responsive stylesheet with typography, components, and mobile breakpoints; added client-side table rendering with endpoint data and method/status badges.
Build & Project Metadata
.vscode/settings.json, Cargo.toml, makefile
Added "ossp" to spelling dictionary; updated tracing-subscriber with "fmt" feature and tower-http with "fs" feature; created Makefile with help, run, build, test, and clean targets.

Poem

🐰 Our burrow now has doors and halls,
With schemas deep and routing calls,
From frontend forms to database rows,
Tracing logs that gently flows,
The Sprintly foundation grows!

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch db_desing-and_models_creations

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copilot AI left a comment

Copy link
Copy Markdown

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 introduces a new Postgres schema/migration for Sprintly, adds environment-based configuration to application state, and wires up basic routing including static file serving plus an auth “check” endpoint.

Changes:

  • Add initial database schema migration (users/workspaces/projects/tasks/comments + lookup/join tables).
  • Introduce EnvConfig and expand AppState, updating DB connection + health/auth handlers accordingly.
  • Add API v1 route composition and static asset serving from public/ (new landing/login/register pages).

Reviewed changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/utils/mod.rs Adds utils module placeholder.
src/services/mod.rs Adds services module placeholder.
src/routes/mod.rs Composes routes, nests /api/v1, adds static file fallback.
src/routes/auth_routes.rs Adds /api/v1/auth/check route group.
src/models/mod.rs Adds models module placeholder.
src/middleware/mod.rs Adds middleware module placeholder.
src/main.rs Adds tracing, loads EnvConfig, updates DB connection + state, installs TraceLayer.
src/dtos/mod.rs Adds dtos module placeholder.
src/db/mod.rs Makes DB connection accept a database_url parameter.
src/controllers/root_controller.rs Updates health check to use state and adds tracing log.
src/controllers/mod.rs Registers new auth controller module.
src/controllers/auth_controller.rs Adds auth check handler.
src/config/mod.rs Expands AppState to include app_name and env_config.
src/config/env.rs Adds environment configuration loader (DATABASE_URL, PORT).
public/table.js Adds dynamic endpoint table for landing page.
public/styles.css Adds styling for landing/login/register pages.
public/register.html Adds registration UI that calls auth endpoints.
public/login.html Adds login UI that calls auth endpoints.
public/index.html Adds landing page UI.
migrations/20260311154909_init_sprintly_schema.sql Adds full Sprintly schema + uuid extension.
migrations/20260311153049_init_schema.sql Removes earlier placeholder migration.
makefile Adds basic dev commands (run/build/test/clean).
README.md Adds an ASCII relationship diagram.
Cargo.toml Enables tower-http fs support and tracing-subscriber fmt.
Cargo.lock Updates lockfile for new deps (ServeDir-related crates).
API.http Adds auth check request.
.vscode/settings.json Adds ossp to cSpell dictionary.
.github/workflows/lint-and-format.yml Adds CI job for fmt + clippy.
.github/copilot-instructions.md Adds repository Copilot guidance doc.
.env Adds comments + RUST_LOG default.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread public/register.html
Comment on lines +105 to +110
const response = await fetch('/api/v1/auth/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email, password }),

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

This page submits to /api/v1/auth/register, but that route is not implemented in src/routes in this PR (only GET /api/v1/auth/check). This will always 404; either add the backend route or change the frontend action to match available endpoints.

Suggested change
const response = await fetch('/api/v1/auth/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email, password }),
const response = await fetch('/api/v1/auth/check', {
method: 'GET',

Copilot uses AI. Check for mistakes.
Comment thread public/login.html
Comment on lines +88 to +95
const response = await fetch('/api/v1/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email, password }),
});

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

This page submits to /api/v1/auth/login, but that route is not implemented in src/routes in this PR (only GET /api/v1/auth/check). This will always 404; either add the backend route or change the frontend action to match available endpoints.

Suggested change
const response = await fetch('/api/v1/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ email, password }),
});
const response = await fetch('/api/v1/auth/check', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
},
});

Copilot uses AI. Check for mistakes.
Comment thread src/config/mod.rs
use crate::config::env::EnvConfig;

#[derive(Clone)]
#[allow(dead_code)]

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

#[allow(dead_code)] on AppState suppresses warnings for unused fields; since app_name and env_config are already used by controllers in this PR, consider removing this to keep warnings meaningful.

Suggested change
#[allow(dead_code)]

Copilot uses AI. Check for mistakes.
Comment thread public/table.js
endpoint: '/api/v1/auth/login',
method: 'POST',
description: 'Login with email and password',
status: 'active',

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

/api/v1/auth/login is listed as an active endpoint, but no matching backend route exists in src/routes in this PR (only /api/v1/auth/check). Update this list or implement the route to avoid misleading documentation.

Suggested change
status: 'active',
status: 'inactive',

Copilot uses AI. Check for mistakes.
Comment thread src/routes/mod.rs
@@ -1,22 +1,33 @@
use axum::{Router, routing::get};
// use sqlx::PgPool;
use tower_http::services::fs::ServeDir;

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

ServeDir is imported from tower_http::services::fs::ServeDir, but in tower-http 0.6 the type is tower_http::services::ServeDir (no fs module). This will not compile; update the import path accordingly.

Suggested change
use tower_http::services::fs::ServeDir;
use tower_http::services::ServeDir;

Copilot uses AI. Check for mistakes.
Comment thread src/main.rs
Comment on lines +36 to +37
.make_span_with(DefaultMakeSpan::new().include_headers(true))
.on_response(DefaultOnResponse::new().include_headers(true));

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

TraceLayer is configured with .include_headers(true) for both spans and responses. This will log request/response headers (including Authorization, cookies, etc.) and can leak sensitive data; default to include_headers(false) or explicitly filter/redact sensitive headers.

Suggested change
.make_span_with(DefaultMakeSpan::new().include_headers(true))
.on_response(DefaultOnResponse::new().include_headers(true));
.make_span_with(DefaultMakeSpan::new().include_headers(false))
.on_response(DefaultOnResponse::new().include_headers(false));

Copilot uses AI. Check for mistakes.
Comment on lines +18 to +21
defaults:
run:
working-directory: ./src

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

GitHub Actions job sets working-directory: ./src, but Cargo.toml is at the repo root. Running cargo fmt / cargo clippy from ./src will fail; run from the repository root (or add a workspace/Cargo.toml under src).

Copilot uses AI. Check for mistakes.
Comment thread public/table.js
Comment on lines +10 to +12
endpoint: '/api/v1/auth/register',
method: 'POST',
description: 'Register a new user account',

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

/api/v1/auth/register is listed as an active endpoint, but no matching backend route exists in src/routes in this PR (only /api/v1/auth/check). Update this list or implement the route to avoid misleading documentation.

Suggested change
endpoint: '/api/v1/auth/register',
method: 'POST',
description: 'Register a new user account',
endpoint: '/api/v1/auth/check',
method: 'POST',
description: 'Check authentication status',

Copilot uses AI. Check for mistakes.
Comment thread src/config/env.rs
use std::env;

#[derive(Debug, Clone)]
#[allow(dead_code)]

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

#[allow(dead_code)] on EnvConfig hides warnings for unused fields. Since this struct is used to configure DB and server port, consider removing the attribute to avoid masking future unused/typo fields.

Suggested change
#[allow(dead_code)]

Copilot uses AI. Check for mistakes.
Comment thread public/table.js
endpoint: '/api/v1/auth/google',
method: 'GET',
description: 'Login with Google OAuth',
status: 'active',

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

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

/api/v1/auth/google is listed as an active endpoint, but no matching backend route exists in src/routes in this PR. Update this list or implement the route to avoid misleading documentation.

Suggested change
status: 'active',
status: 'inactive',

Copilot uses AI. Check for mistakes.
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