This repository contains the backend for Task Management. You can access the frontend UI repository here: Task Management UI Repository
This solution consists of three projects, each designed with specific responsibilities to ensure a clean architecture.
- Clean Architecture
- SOLID Principles
- Dependency Injection
- Entity Framework
- Model Validation
- Authentication using JWT
- Role-Based Authorization using JWT
- Refresh Tokens
- Filters
- Global Exception Middleware
- Logging using Serilog
- LINQ
- DbContext
- Swagger UI for both Development and Production (as it is a web API project)
- Seed Roles, Users and Tasks
Handles incoming HTTP requests and includes:
- Controllers: Process requests for both Admin and User roles.
- Filters: Custom filters for consistent request preprocessing and postprocessing.
- Log Folder: Stores application logs for debugging and monitoring.
- Exception Middleware: Global Middleware for all requests made.
Manages database interactions and includes:
- DbContexts: Contains the database context for Entity Framework.
- Migrations: Handles schema changes over time.
- Repositories: Implements CRUD operations for database entities.
Contains core application logic and includes:
- Models: Domain models representing application data structures.
- IdentityModels: Authentication and authorization models.
- RepositoryContracts: Interfaces for repository operations.
- ServiceContracts: Interfaces for business logic services.
- Services: Implements business logic and orchestrates data access.
To register as an administrator:
POST api/Authentication/Register/0
{
"username": "admin_username",
"password": "YourStrongPassword1!"
}
Can access APIs in AdminController and AuthenticationController.
To register as a User:
POST api/Authentication/Register/1
{
"username": "user_username",
"password": "YourStrongPassword1!"
}
Can access APIs in UserController and AuthenticationController.
To login for Admin or User role:
POST api/Authentication/Login/
{
"username": "admin/user_username",
"password": "YourStrongPassword1!"
}
- If the credentials is correct the token will be generated. Paste this token in the Authorize section in Swagger UI as
Bearer your_token
. - If you are Admin then you will have access to Admin APIs and if you are User then you will have access to User APIs.
To add a task:
{
"title": "string",
"description": "string",
"userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"dueDate": "2024-11-30T11:53:26.525Z",
"status": 0
}
- Download the project and extract it
- Go to Package Manager Console
- Select
finalSubmission.Infrastructure
as project - Write command "
Add-Migration Initial
" - Write command "
Update-Database
" - After successful message, run the project
- To Login as User:
Then Paste the generated token in Authorize section of SwaggerUI.
{ "userName": "user", "password": "User301@" }
- To Login as Admin:
Then Paste the generated token in Authorize section of SwaggerUI.
{ "userName": "admin", "password": "Admin301@" }