-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
106 changed files
with
378 additions
and
343 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
...ky.ToDoAppTemplate.Core/Infrastructure/Communication/Email/Settings/EmailConfiguration.cs
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
DZarsky.ToDoAppTemplate.Core/Infrastructure/Communication/Email/Settings/SenderType.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
# ToDo app template API | ||
|
||
A template repository for a ToDo app API with .NET8 and PostgreSQL. REPR (FastEndpoints), CQRS (MediatR) and partially Clean Architecture patterns are used. | ||
The API is easily extensible and can be used as a starting point for a new project. | ||
|
||
Functionality: | ||
|
||
- Create, read, update and delete ToDos | ||
- User registration, login, option to reset user's password. Accounts are stored in the database, authentication is done using JWT. | ||
- Email templates and sending emails via Smtp or SendGrid is supported. | ||
|
||
## Prerequisites | ||
|
||
- [.NET 8](https://dotnet.microsoft.com/download/dotnet/8.0) | ||
- [PostgreSQL](https://www.postgresql.org/download/) | ||
- [Dotnet ef](https://docs.microsoft.com/en-us/ef/core/cli/dotnet) | ||
- Optional: [Docker](https://docs.docker.com/get-docker/) and [Docker Compose](https://docs.docker.com/compose/install/) | ||
|
||
## Applying the database migrations | ||
|
||
The database migrations are located in the `ToDoAppTemplate.Data` project. The following commands can be run from the solution root directory: | ||
|
||
```powershell | ||
# Create a new migration | ||
dotnet ef migrations add MigrationName --project ./ToDoAppTemplate.Data --startup-project ./ToDoAppTemplate/Api | ||
# Apply a migration | ||
dotnet ef database update --project ./ToDoAppTemplate.Data --startup-project ./ToDoAppTemplate.Api | ||
``` | ||
|
||
## Running the API | ||
|
||
Either run the API by running `docker-compose up` from the root of the solution. This will start the API and a PostgreSQL database in Docker containers. | ||
|
||
Or run the API from Visual Studio or the command line. The connection string to the database can be configured in the `appsettings.json` file. |
8 changes: 4 additions & 4 deletions
8
.../Auth/Endpoints/ChangePasswordEndpoint.cs → .../Auth/Endpoints/ChangePasswordEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
...plate.Api/Auth/Endpoints/LoginEndpoint.cs → ...plate.Api/Auth/Endpoints/LoginEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...te.Api/Auth/Endpoints/RegisterEndpoint.cs → ...te.Api/Auth/Endpoints/RegisterEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...Endpoints/RequestPasswordResetEndpoint.cs → ...Endpoints/RequestPasswordResetEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...i/Auth/Endpoints/ResetPasswordEndpoint.cs → ...i/Auth/Endpoints/ResetPasswordEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...pTemplate.Api/Auth/Models/LoginRequest.cs → ...pTemplate.Api/Auth/Models/LoginRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...Template.Api/Auth/Models/LoginResponse.cs → ...Template.Api/Auth/Models/LoginResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
....Api/Auth/Models/PasswordChangeRequest.cs → ....Api/Auth/Models/PasswordChangeRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e.Api/Auth/Models/PasswordResetRequest.cs → ...e.Api/Auth/Models/PasswordResetRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...mplate.Api/Auth/Models/RegisterRequest.cs → ...mplate.Api/Auth/Models/RegisterRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...uth/Models/RequestPasswordResetRequest.cs → ...uth/Models/RequestPasswordResetRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...idators/PasswordChangeRequestValidator.cs → ...idators/PasswordChangeRequestValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...lidators/PasswordResetRequestValidator.cs → ...lidators/PasswordResetRequestValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...th/Validators/RegisterRequestValidator.cs → ...th/Validators/RegisterRequestValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...s/RequestPasswordResetRequestValidator.cs → ...s/RequestPasswordResetRequestValidator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...emplate.Api/Common/Constants/Endpoints.cs → ...emplate.Api/Common/Constants/Endpoints.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...i/Common/Models/GetResourceByIdRequest.cs → ...i/Common/Models/GetResourceByIdRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base | ||
USER $APP_UID | ||
WORKDIR /app | ||
EXPOSE 8080 | ||
EXPOSE 8081 | ||
|
||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||
ARG BUILD_CONFIGURATION=Release | ||
WORKDIR /src | ||
COPY ["ToDoAppTemplate.Api/ToDoAppTemplate.Api.csproj", "ToDoAppTemplate.Api/"] | ||
COPY ["ToDoAppTemplate.Domain/ToDoAppTemplate.Domain.csproj", "ToDoAppTemplate.Domain/"] | ||
COPY ["ToDoAppTemplate.Application/ToDoAppTemplate.Application.csproj", "ToDoAppTemplate.Application/"] | ||
COPY ["ToDoAppTemplate.Data/ToDoAppTemplate.Data.csproj", "ToDoAppTemplate.Data/"] | ||
COPY ["ToDoAppTemplate.Core/ToDoAppTemplate.Core.csproj", "ToDoAppTemplate.Core/"] | ||
RUN dotnet restore "ToDoAppTemplate.Api/ToDoAppTemplate.Api.csproj" | ||
COPY . . | ||
WORKDIR "/src/ToDoAppTemplate.Api" | ||
RUN dotnet build "ToDoAppTemplate.Api.csproj" -c $BUILD_CONFIGURATION -o /app/build | ||
|
||
FROM build AS publish | ||
ARG BUILD_CONFIGURATION=Release | ||
RUN dotnet publish "ToDoAppTemplate.Api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false | ||
|
||
FROM base AS final | ||
WORKDIR /app | ||
COPY --from=publish /app/publish . | ||
ENTRYPOINT ["dotnet", "ToDoAppTemplate.Api.dll"] |
6 changes: 3 additions & 3 deletions
6
...nfiguration/ApiConfigurationExtensions.cs → ...nfiguration/ApiConfigurationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...tructure/Extensions/EndpointExtensions.cs → ...tructure/Extensions/EndpointExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...structure/Resolvers/StatusCodeResolver.cs → ...structure/Resolvers/StatusCodeResolver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rastructure/Security/AuthConfiguration.cs → ...rastructure/Security/AuthConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...Infrastructure/Security/TokenGenerator.cs → ...Infrastructure/Security/TokenGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
DZarsky.ToDoAppTemplate.Api/Program.cs → ToDoAppTemplate.Api/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...te.Api/Todos/Endpoints/AddToDoEndpoint.cs → ...te.Api/Todos/Endpoints/AddToDoEndpoint.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.