Skip to content

Commit bb604d4

Browse files
committed
Initial commit
0 parents  commit bb604d4

File tree

280 files changed

+22002
-0
lines changed

Some content is hidden

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

280 files changed

+22002
-0
lines changed

.dockerignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
**/.classpath
2+
**/.dockerignore
3+
**/.env
4+
**/.git
5+
**/.gitignore
6+
**/.project
7+
**/.settings
8+
**/.toolstarget
9+
**/.vs
10+
**/.vscode
11+
**/*.*proj.user
12+
**/*.dbmdl
13+
**/*.jfm
14+
**/azds.yaml
15+
**/bin
16+
**/charts
17+
**/docker-compose*
18+
**/Dockerfile*
19+
**/node_modules
20+
**/npm-debug.log
21+
**/obj
22+
**/secrets.dev.yaml
23+
**/values.dev.yaml
24+
LICENSE
25+
README.md

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
194 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

.vs/Forums.API/FileContentIndex/read.lock

Whitespace-only changes.

.vs/Forums.API/v17/.futdcache.v2

603 Bytes
Binary file not shown.

.vs/Forums.API/v17/.suo

107 KB
Binary file not shown.
204 KB
Binary file not shown.
527 KB
Binary file not shown.

.vs/VSWorkspaceState.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"ExpandedNodes": [],
3+
"SelectedNode": "\\Forums.API.sln",
4+
"PreviewInSolutionExplorer": false
5+
}

.vs/slnx.sqlite

508 KB
Binary file not shown.

Forums.API.sln

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.3.32804.467
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E55534E5-3740-433D-9286-C73BB94B80A7}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Forums", "Forums\Forums.csproj", "{B32A812D-6725-4E30-A6A3-75C746BAE10E}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForumsService.Application", "ForumsService.API\ForumsService.Application.csproj", "{3277C567-8A09-4BBB-9588-96DFBF1A5D93}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForumsService.Domain", "ForumsService.Domain\ForumsService.Domain.csproj", "{890E3992-0D7E-4090-B7ED-658A2EA9207D}"
13+
EndProject
14+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForumsService.Infrastructure", "ForumsService.Infrastructure\ForumsService.Infrastructure.csproj", "{24838E55-59E1-4B37-A8CA-740AE56265BA}"
15+
EndProject
16+
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{4FEA7726-C49A-4E6D-8A14-FD2BF2E35187}"
17+
EndProject
18+
Global
19+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
20+
Debug|Any CPU = Debug|Any CPU
21+
Release|Any CPU = Release|Any CPU
22+
EndGlobalSection
23+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
24+
{B32A812D-6725-4E30-A6A3-75C746BAE10E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{B32A812D-6725-4E30-A6A3-75C746BAE10E}.Debug|Any CPU.Build.0 = Debug|Any CPU
26+
{B32A812D-6725-4E30-A6A3-75C746BAE10E}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{B32A812D-6725-4E30-A6A3-75C746BAE10E}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{3277C567-8A09-4BBB-9588-96DFBF1A5D93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29+
{3277C567-8A09-4BBB-9588-96DFBF1A5D93}.Debug|Any CPU.Build.0 = Debug|Any CPU
30+
{3277C567-8A09-4BBB-9588-96DFBF1A5D93}.Release|Any CPU.ActiveCfg = Release|Any CPU
31+
{3277C567-8A09-4BBB-9588-96DFBF1A5D93}.Release|Any CPU.Build.0 = Release|Any CPU
32+
{890E3992-0D7E-4090-B7ED-658A2EA9207D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33+
{890E3992-0D7E-4090-B7ED-658A2EA9207D}.Debug|Any CPU.Build.0 = Debug|Any CPU
34+
{890E3992-0D7E-4090-B7ED-658A2EA9207D}.Release|Any CPU.ActiveCfg = Release|Any CPU
35+
{890E3992-0D7E-4090-B7ED-658A2EA9207D}.Release|Any CPU.Build.0 = Release|Any CPU
36+
{24838E55-59E1-4B37-A8CA-740AE56265BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
37+
{24838E55-59E1-4B37-A8CA-740AE56265BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
38+
{24838E55-59E1-4B37-A8CA-740AE56265BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
39+
{24838E55-59E1-4B37-A8CA-740AE56265BA}.Release|Any CPU.Build.0 = Release|Any CPU
40+
{4FEA7726-C49A-4E6D-8A14-FD2BF2E35187}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
41+
{4FEA7726-C49A-4E6D-8A14-FD2BF2E35187}.Debug|Any CPU.Build.0 = Debug|Any CPU
42+
{4FEA7726-C49A-4E6D-8A14-FD2BF2E35187}.Release|Any CPU.ActiveCfg = Release|Any CPU
43+
{4FEA7726-C49A-4E6D-8A14-FD2BF2E35187}.Release|Any CPU.Build.0 = Release|Any CPU
44+
EndGlobalSection
45+
GlobalSection(SolutionProperties) = preSolution
46+
HideSolutionNode = FALSE
47+
EndGlobalSection
48+
GlobalSection(NestedProjects) = preSolution
49+
{B32A812D-6725-4E30-A6A3-75C746BAE10E} = {E55534E5-3740-433D-9286-C73BB94B80A7}
50+
{3277C567-8A09-4BBB-9588-96DFBF1A5D93} = {E55534E5-3740-433D-9286-C73BB94B80A7}
51+
{890E3992-0D7E-4090-B7ED-658A2EA9207D} = {E55534E5-3740-433D-9286-C73BB94B80A7}
52+
{24838E55-59E1-4B37-A8CA-740AE56265BA} = {E55534E5-3740-433D-9286-C73BB94B80A7}
53+
EndGlobalSection
54+
GlobalSection(ExtensibilityGlobals) = postSolution
55+
SolutionGuid = {D57F2274-3A35-4EA2-AF42-2AFAC90C35B7}
56+
EndGlobalSection
57+
EndGlobal

Forums/Controllers/ForumController.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Forums.Models;
2+
using ForumsService.Application.Query.GetAllForums;
3+
using MediatR;
4+
using Microsoft.AspNetCore.Mvc;
5+
6+
namespace Forums.Controllers
7+
{
8+
[Route("api/[controller]")]
9+
[ApiController]
10+
public class ForumController : Controller
11+
{
12+
private readonly IMediator _mediator;
13+
14+
public ForumController(IMediator mediator)
15+
{
16+
_mediator = mediator;
17+
}
18+
19+
[HttpGet]
20+
public async Task<ActionResult<IEnumerable<ForumsViewModel>>> GetAll()
21+
{
22+
var query = new GetAllForumsQuery();
23+
var result = await _mediator.Send(query);
24+
List<ForumsViewModel> forums = new();
25+
26+
foreach (var forum in result)
27+
{
28+
forums.Add(new ForumsViewModel(forum.Id,forum.Title,forum.Description,forum.Ownership,forum.DateOfAdded,forum.Reported,forum.Amountoflikes,forum.MovieId));
29+
}
30+
31+
return Ok(forums);
32+
}
33+
}
34+
}

Forums/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
2+
3+
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
4+
WORKDIR /app
5+
EXPOSE 80
6+
7+
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
8+
WORKDIR /src
9+
COPY ["Forums/Forums.csproj", "Forums/"]
10+
RUN dotnet restore "Forums/Forums.csproj"
11+
COPY . .
12+
WORKDIR "/src/Forums"
13+
RUN dotnet build "Forums.csproj" -c Release -o /app/build
14+
15+
FROM build AS publish
16+
RUN dotnet publish "Forums.csproj" -c Release -o /app/publish /p:UseAppHost=false
17+
18+
FROM base AS final
19+
WORKDIR /app
20+
COPY --from=publish /app/publish .
21+
ENTRYPOINT ["dotnet", "Forums.dll"]

Forums/Forums.csproj

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<UserSecretsId>ae536c8f-b6ee-4327-a32c-55c551b0a005</UserSecretsId>
8+
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
9+
<DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
14+
<PackageReference Include="MediatR.Extensions.Microsoft.DependencyInjectionFixed" Version="5.1.2" />
15+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.0" />
16+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.0">
17+
<PrivateAssets>all</PrivateAssets>
18+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
19+
</PackageReference>
20+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
21+
</ItemGroup>
22+
23+
<ItemGroup>
24+
<ProjectReference Include="..\ForumsService.API\ForumsService.Application.csproj" />
25+
<ProjectReference Include="..\ForumsService.Infrastructure\ForumsService.Infrastructure.csproj" />
26+
</ItemGroup>
27+
28+
</Project>

Forums/Forums.csproj.user

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
5+
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
6+
</PropertyGroup>
7+
</Project>

Forums/Migrations/20221116102051_InitialCreate.Designer.cs

Lines changed: 88 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
using System;
2+
using Microsoft.EntityFrameworkCore.Migrations;
3+
4+
#nullable disable
5+
6+
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
7+
8+
namespace Forums.Migrations
9+
{
10+
/// <inheritdoc />
11+
public partial class InitialCreate : Migration
12+
{
13+
/// <inheritdoc />
14+
protected override void Up(MigrationBuilder migrationBuilder)
15+
{
16+
migrationBuilder.CreateTable(
17+
name: "Forums",
18+
columns: table => new
19+
{
20+
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
21+
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
22+
Description = table.Column<string>(type: "nvarchar(max)", nullable: false),
23+
Ownership = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
24+
DateOfAdded = table.Column<DateTime>(type: "datetime2", nullable: false),
25+
Reported = table.Column<bool>(type: "bit", nullable: false),
26+
Amountoflikes = table.Column<int>(type: "int", nullable: false),
27+
MovieId = table.Column<int>(type: "int", nullable: false)
28+
},
29+
constraints: table =>
30+
{
31+
table.PrimaryKey("PK_Forums", x => x.Id);
32+
});
33+
34+
migrationBuilder.InsertData(
35+
table: "Forums",
36+
columns: new[] { "Id", "Amountoflikes", "DateOfAdded", "Description", "MovieId", "Ownership", "Reported", "Title" },
37+
values: new object[,]
38+
{
39+
{ new Guid("1c565daf-3eaa-4b60-bc11-d0a96fce249e"), 4, new DateTime(2022, 11, 16, 11, 20, 51, 634, DateTimeKind.Local).AddTicks(2679), "I don't think this is a good movie at all! It contains a lot of bad filming.", 42543, new Guid("1c565daf-3eaa-4b60-bc11-d0a96fce249e"), false, "Is the Star-Wars - Rise of Empire movie good?" },
40+
{ new Guid("208e2274-db97-4ac4-b17c-27d10abca7a8"), 245, new DateTime(2022, 11, 16, 11, 20, 51, 634, DateTimeKind.Local).AddTicks(2716), "Just Hagrid in the movie?!.", 5345, new Guid("48aff7a7-702c-40d7-bbb0-417c0d775c08"), false, "Harry Potter & The Deathly Hallows Part 1 - Hagrid?!" }
41+
});
42+
}
43+
44+
/// <inheritdoc />
45+
protected override void Down(MigrationBuilder migrationBuilder)
46+
{
47+
migrationBuilder.DropTable(
48+
name: "Forums");
49+
}
50+
}
51+
}

0 commit comments

Comments
 (0)