Skip to content

Commit 0fe7459

Browse files
authored
feat: add role and user mapping profiles (#4)
* Add base setup of dotnet project * Add document for base setup * Remove the Api.http file * Add editorconfig file * Upgrade project to .NET 9 and update dependencies * Enhance exception handling and logging * Add using directive for StatusCodes * Revert to .net 8 * Add models and DTOs * Add migrations for inital database setup * Add user repo and service layers * Add role repo and service layers * Update the IRoleService * Update the migration scripts * Update the model classes * Updated RoleDTOs to use inheritance * Updated the class name * Validate the connection string * Make the RoleBaseDto class abstract * Configure Health Checks * Use the 8.x version for HealthCheck package * Remove the database health check * Add custom database health check * Update the migrations * Fix lint errors * Configure Health Checks * Add User DTOs * Add role controller * Update the service and repo layers in respect to DTOs * Add User controller * Add Bcrypt package * Remove the default values * Add data validations to UserDTOs * Add MaxLength constraint to PasswordHash for security * Add validation for duplicate role names * Add validation for unique email * Avoid redundant JSON serializer options * Allow updating user with the same email * Reverse the null-check logic for role creation * Reverse the logic to allow valid name updates * Remove the debugger files * Add user and role mapping profiles * Modify the servcie layer to use mapper * Register automapper in Program.cs * Add the AutoMapper package * Update the user controller * Use the explicitly set role method * Add ModelState validation for UpdateUser method * Use the ToLower comparison function in LINQ query
1 parent 177ba93 commit 0fe7459

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2277
-0
lines changed

base_setup.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Base Setup for .NET Foundation Repository
2+
3+
This document provides step-by-step instructions to set up the base structure for your .NET projects, including an API project and a Core library.
4+
5+
## Prerequisites
6+
Ensure you have the following installed:
7+
- [.NET SDK 8.0.11](https://dotnet.microsoft.com/en-us/download)
8+
- Git
9+
- A terminal (Command Prompt, PowerShell, or Linux/macOS shell)
10+
11+
## 1. Initialize the Root Directory
12+
```sh
13+
mkdir DotNetFoundationV2 && cd DotNetFoundationV2
14+
```
15+
16+
## 2. Create the `src` Directory
17+
```sh
18+
mkdir src && cd src
19+
```
20+
21+
## 3. Create the API Project
22+
```sh
23+
dotnet new webapi -o Api
24+
```
25+
This will create an ASP.NET Core Web API inside `src/Api`.
26+
27+
## 4. Create the Core Library
28+
```sh
29+
dotnet new classlib -o Core
30+
```
31+
This will create a .NET Class Library inside `src/Core`.
32+
33+
## 5. Add `Core` as a Reference to `Api`
34+
```sh
35+
cd Api
36+
dotnet add reference ../Core/Core.csproj
37+
cd ..
38+
```
39+
40+
## 6. Create a Solution File and Add Projects
41+
```sh
42+
dotnet new sln -n DotNetFoundation
43+
```
44+
Add projects to the solution:
45+
```sh
46+
dotnet sln DotNetFoundation.sln add Api/Api.csproj
47+
```
48+
```sh
49+
dotnet sln DotNetFoundation.sln add Core/Core.csproj
50+
```
51+
52+
## 7. Verify the Directory Structure
53+
Run the following command:
54+
```sh
55+
tree
56+
```
57+
Expected output:
58+
```
59+
src/
60+
├── Api/
61+
│ ├── Api.csproj
62+
│ ├── Program.cs
63+
│ └── ...
64+
└── Core/
65+
├── Core.csproj
66+
└── ...
67+
```
68+
69+
70+
This setup provides a structured foundation for your .NET projects. 🚀
71+

0 commit comments

Comments
 (0)