Mo Expense Tracker is a multi-user web api for tracking user's expenditure. It was implemented to learn dotnet.
Core has functionality or object that is shared across the api such as exception handling, endpoint filters (for validation), response objects...
Data has the database context
It says break your api into features and so it was done. There are four featuresc as of this time. There are the Account, Auth, Category and Expense. Each feature may have a controller, dao, dto, endpoint and validation. (There was a time I wanted to remove the dao).
Migrations has the table migrations created to the tables (models).
Models represent the table for users, categories and expenses.
- Program.cs - the entry point into the app
- MoExpenseTracker.http - used as the api client to make api requests
How to CRUD
- ASP.NET Core Full Course For Beginners by Julio Casal
- Build CRUD with .NET 6 Web API & Entity Framework Core by Mohamad Lawand
How to use ef core and relationship (I didn't really much of these but you'd understand)
- Getting Started with Entity Framework Core in .NET by Nick Chapsas
- DbContext, Code First Migrations and Database Creation with EFCore by ISeeSharp
- 1 to 1, 1 to Many and Many to Many Relationships with EFCore in 2023 by ISeeSharp
How to connect to a database
- Getting Started with Entity Framework Core in .NET by Nick Chapsas
How to do authentication and authorization in dotnet
- How to implement JWT authentication in ASP.NET Core by Joydip Kanjilal
- JWT Authentication in ASP.NET Core Minimal API by dotnettutorials
How to hash password - hash and verify
- Best Practices for Hashing and Salting Passwords in .NET by Code Maze
- Best Practices for Secure Password Hashing in .NET (Stop Storing Passwords in Plain Text!) by Milan Jovanović
- How to hash a password by arad
How to handle exceptions (global)
- Global Exception Handling in Asp.Net Core Web API using IExceptionHandler by Nitish Kaushik
- The New Global Error Handling in ASP.NET Core 8 by Milan Jovanović
How to route endpoints (group routes)
- NET Core 7 : Routing - UseRouting vs UseEndpoints // Map vs MapGet vs MapPost by hikitoc -How To Organize Minimal API Endpoints Inside Of Clean Architecture by Milan Jovanović
How to create extension methods
- What are Extension Methods in C#? When to use extension methods in real applications? by Interview Happy
How to validate request
- New AddEndpointFilter in .Net 7.0, filters in Minimal API by Tech In Talk (endpoint filters)
- Coding Shorts: Minimal API Endpoint Filters for Model Validation by Shawn Wildermuth (+endpoint filters & fluent validation)
- Creating your first validator by Fluentvalidation docs
MISC (extra information, won't hurt to watch, read or run through)
- Mastering Minimal API's Dotnet 7 by Tech In Talk (dotnet)
- Back-end Web Development with .NET by dotnet (dotnet)
- IResult/Results/TypedResult or IActionResult/ActionResult/controllerBase methods? (difference between IResults, ITypeResults, ...)
- .NET dependency injection (difference between scoped, singleton, transcient)
Most contains the first implementations
These are the responses I had from reddit and discord (dotnet/csharp) group about this app and I am looking forward to integrate them in this version of the app.
- api versioning ✅
- rename controllers into handlers (not to miscommunicate that they are class "controllers") ✅
- refactor to use endpoint filter for all validation ✅
- refactor the content of the program.cs into another file ✅
- use dateonly for the expense data ✅
- lowercase user data on insert and update, especially email, description, etc ✅
- for searching, implement filters and sorting and pagination ✅
- issue: could not search for an expense by text in the description ❌
- refactor the user id check in the request handlers and pass it as a dependency or endpoint filter ✅
- use a middleware or some sort to validate the authentication and don't inject the http context ✅
- return every created/updated record, this way an extra db call will be saved ✅
- reduce the logic in the request handlers
- when checking if the email is used on profile update, compare the user id rather when the result is not null ✅