Skip to content

IrwinBeyond/2026-crms-backend

Repository files navigation

CRMS Backend

Classroom / Room Management System (CRMS) — Backend API Built with ASP.NET Core + Entity Framework Core + MySQL


Overview

CRMS Backend provides the RESTful API layer for managing classroom borrowing operations.

The system enforces domain-level business rules including:

  • Borrowing lifecycle management
  • Status transition constraints
  • Conflict detection
  • Soft delete behavior
  • Advanced query filtering
  • Dashboard aggregation

This backend is designed to align strictly with the CRMS Frontend contract.


Tech Stack

  • ASP.NET Core
  • Entity Framework Core
  • MySQL
  • Swagger (OpenAPI)
  • Dependency Injection
  • RESTful API Architecture

Requirements

  • .NET SDK 8.0 (or compatible)
  • MySQL Server
  • Node.js (if running frontend together)

Installation

1️⃣ Clone Repository

git clone <repository-url>
cd crms-backend

2️⃣ Configure Database

Update appsettings.Development.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "server=localhost;port=3306;database=crms;user=root;password=yourpassword;"
  }
}

Ensure:

  • Database exists
  • Credentials are correct

3️⃣ Configure CORS

In appsettings.Development.json:

{
  "Cors": {
    "AllowedOrigins": [
      "http://localhost:5173"
    ]
  }
}

If frontend runs on different port, update accordingly.


4️⃣ Run Application

dotnet run

Default API endpoint:

http://localhost:5233

Swagger UI available at:

http://localhost:5233/swagger

Core Features

Borrowing Management

  • Create borrowing request
  • Update borrowing
  • Soft delete borrowing
  • Get single borrowing
  • Paginated borrowing list

Status Transition Enforcement

Allowed transitions:

From Allowed To
Requested Approved, Rejected, Cancelled
Approved Completed, Cancelled
Rejected
Completed
Cancelled

Invalid transitions return:

400 Bad Request

Conflict Detection

When status becomes Approved:

  • Validates room availability
  • Checks overlapping time range
  • Returns conflict response if violation occurs

Advanced Query Capability

Supports:

  • Multi-status filtering:

    ?status=Requested&status=Approved
    
  • Multi-field search

  • Date range overlap filtering

  • Sorting

  • Pagination

  • Pagination metadata


Dashboard Endpoint

Returns aggregated metrics:

totalRooms
totalBorrowings
totalApproved
totalRequested
latestBorrowings[]

Optimized for frontend summary display.


API Endpoints Overview

Borrowing

GET    /api/borrowing
GET    /api/borrowing/{id}
POST   /api/borrowing
PUT    /api/borrowing/{id}
DELETE /api/borrowing/{id}

Dashboard

GET /api/dashboard

JSON Behavior

Enums are serialized as strings using:

JsonStringEnumConverter

Example:

"status": "Approved"

Versioning

Current Stable Version:

v1.0.0

Semantic Versioning:

  • PATCH → Bug fix
  • MINOR → Feature addition
  • MAJOR → Breaking change

Development Workflow

Branching Strategy:

main        → Stable release
develop     → Active development
feature/*   → New features
fix/*       → Bug fixes

Tagging is performed on main.


Notes

  • Soft delete is globally filtered via EF Core.
  • Availability validation handled in service layer.
  • Status history tracking is preserved on transition.
  • Designed to align with CRMS Frontend v1.0.0.

License

MIT License

About

CRMS Backend

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages