juanluelguerre / Taskin2.0

Task[in] 2.0 is a productivity application backend built using ASP.NET Core Web API, following Clean Architecture principles. It provides RESTful APIs for managing projects, tasks, and Pomodoros, utilizing the Pomodoro Technique to enhance productivity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Task[in] 2.0 (Backend)

Task[in] 2.0 is a productivity application backend built using ASP.NET Core Web API, following Clean Architecture principles. It provides RESTful APIs for managing projects, tasks, and Pomodoros, utilizing the Pomodoro Technique to enhance productivity.

Table of Contents

Features

  • Project Management: Create, read, update, and delete projects.
  • Task Management: CRUD operations for tasks within projects.
  • Pomodoro Management: Manage Pomodoros associated with tasks.
  • CQRS and MediatR: Implements Command and Query patterns for separation of concerns.
  • Entity Framework Core: Uses EF Core for data access with SQL Server.
  • Clean Architecture: Ensures a maintainable and testable codebase.

Architecture

The backend follows the Clean Architecture pattern, dividing the solution into four projects:

  1. ElGuerre.Taskin.Api: The presentation layer containing controllers.
  2. ElGuerre.Taskin.Application: Contains application logic, commands, queries, and handlers.
  3. ElGuerre.Taskin.Domain: Defines domain entities and interfaces.
  4. ElGuerre.Taskin.Infrastructure: Implements data access and persistence using Entity Framework Core.

Technologies Used

  • .NET 6 SDK
  • ASP.NET Core Web API
  • Entity Framework Core
  • MediatR
  • SQL Server
  • Swagger (for API documentation)

Project Structure

ElGuerre.Taskin.sln
├── ElGuerre.Taskin.Api
│   ├── Controllers
│   ├── Program.cs
│   └── appsettings.json
├── ElGuerre.Taskin.Application
│   ├── Projects
│   ├── Tasks
│   └── Pomodoros
├── ElGuerre.Taskin.Domain
│   └── Entities
└── ElGuerre.Taskin.Infrastructure
    ├── EntityFramework
    │   ├── TaskinDbContext.cs
    │   └── Configurations
    └── Migrations

Getting Started

Prerequisites

  • .NET 6 SDK: Download and install from Microsoft .NET.
  • SQL Server: Install SQL Server or use SQL Server Express.
  • Visual Studio 2022 or Visual Studio Code

Setup Instructions

  1. Clone the Repository

    git clone https://github.com/your-username/taskin-backend.git
    cd taskin-backend
  2. Restore NuGet Packages

    Open the solution in Visual Studio or use the command line:

    dotnet restore
  3. Configure Database Connection

    Update the appsettings.json file in ElGuerre.Taskin.Api with your SQL Server connection string:

    {
      "ConnectionStrings": {
        "DefaultConnection": "Server=your_server;Database=TaskinDB;Trusted_Connection=True;MultipleActiveResultSets=true"
      }
    }
  4. Apply Database Migrations

    Navigate to the ElGuerre.Taskin.Api directory and run:

    # Navigate to the Infrastructure project directory
    cd ElGuerre.Taskin.Infrastructure
    
    # Add a migration
    dotnet ef migrations add InitialCreate --startup-project ../ElGuerre.Taskin.Api
    
    # Update the database
    dotnet ef database update --startup-project ../ElGuerre.Taskin.Api

    Ensure that the ElGuerre.Taskin.Api project is set as the startup project.

Running the Application

  1. Start the API

    In the ElGuerre.Taskin.Api project directory, run:

    dotnet run

    The API will start and listen on https://localhost:5001 by default.

  2. Test the API

    Open a browser and navigate to https://localhost:5001/swagger to view the Swagger UI and test the endpoints.

API Endpoints

Projects

  • GET /api/Projects - Get a list of projects.
  • GET /api/Projects/{id} - Get a project by ID.
  • POST /api/Projects - Create a new project.
  • PUT /api/Projects/{id} - Update an existing project.
  • DELETE /api/Projects/{id} - Delete a project.

Tasks

  • GET /api/Tasks?projectId={projectId} - Get tasks by project ID.
  • GET /api/Tasks/{id} - Get a task by ID.
  • POST /api/Tasks - Create a new task.
  • PUT /api/Tasks/{id} - Update an existing task.
  • DELETE /api/Tasks/{id} - Delete a task.

Pomodoros

  • GET /api/Pomodoros?taskId={taskId} - Get pomodoros by task ID.
  • GET /api/Pomodoros/{id} - Get a pomodoro by ID.
  • POST /api/Pomodoros - Create a new pomodoro.
  • PUT /api/Pomodoros/{id} - Update an existing pomodoro.
  • DELETE /api/Pomodoros/{id} - Delete a pomodoro.

Database Migrations

To manage database schema changes, use Entity Framework Core migrations.

Adding a Migration

dotnet ef migrations add #MIGRATION_NAME# --startup-project .\ElGuerre.Taskin.Api --project .\ElGuerre.Taskin.Infrastructure -o .\EntityFramework\Migrations

Updating the Database

dotnet ef database update --startup-project .\ElGuerre.Taskin.Api\ElGuerre.Taskin.Api.csproj --project .\ElGuerre.Taskin.Infrastructure\

Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the Repository

    Click the "Fork" button at the top right of the repository page.

  2. Create a Feature Branch

    git checkout -b feature/YourFeature
  3. Commit Your Changes

    git commit -m "Add your message here"
  4. Push to Your Fork

    git push origin feature/YourFeature
  5. Create a Pull Request

    Open a pull request to the main branch of the original repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or support, please open an issue on the GitHub repository.

Acknowledgments

Thank you for using Task[in] 2.0 Backend! We hope this tool helps you build efficient and scalable applications.

About

Task[in] 2.0 is a productivity application backend built using ASP.NET Core Web API, following Clean Architecture principles. It provides RESTful APIs for managing projects, tasks, and Pomodoros, utilizing the Pomodoro Technique to enhance productivity.

License:MIT License


Languages

Language:C# 100.0%