TeamA.DevFollow.API is a .NET 9 web API designed to manage habits and tags. It provides endpoints for creating, updating, retrieving, and deleting habits and tags, with support for HATEOAS links and data shaping.
- CRUD operations for habits and tags
- HATEOAS support for navigation links
- Data shaping for optimized responses
- FluentValidation for request validation
- OpenTelemetry for observability
- Docker support for containerized deployment
- .NET 9
- ASP.NET Core
- Entity Framework Core
- FluentValidation
- OpenTelemetry
- PostgreSQL
- Docker
-
Clone the repository:
- git clone https://github.com/your-repo/TeamA.DevFollow.API.git
- cd TeamA.DevFollow.API
-
Set up the database:
- Update the connection string in
appsettings.jsonto point to your PostgreSQL instance.
- Update the connection string in
-
Apply database migrations:
- dotnet ef database update
-
Run the application:
- dotnet run
-
Alternatively, you can use Docker:
- docker-compose up
- GET /tags: Retrieve all tags
- GET /tags/{id}: Retrieve a specific tag by ID
- POST /tags: Create a new tag
- PUT /tags/{id}: Update an existing tag
- DELETE /tags/{id}: Delete a tag
- GET /habits: Retrieve all habits
- GET /habits/{id}: Retrieve a specific habit by ID
- POST /habits: Create a new habit
- PUT /habits/{id}: Update an existing habit
- PATCH /habits/{id}: Partially update a habit
- DELETE /habits/{id}: Delete a habit
The project uses FluentValidation to validate incoming requests. Validators are defined for DTOs such as CreateTagDto and CreateHabitDto.
Example validation rules for CreateTagDto:
public sealed class CreateTagDtoValidator : AbstractValidator<CreateTagDto>
{
public CreateTagDtoValidator()
{
RuleFor(x => x.Name).NotEmpty().MinimumLength(3);
RuleFor(x => x.Description).MaximumLength(50);
}
}
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature/your-feature). - Create a new Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.