Skip to content

Commit a143b74

Browse files
authored
merge(#36): migrate to MongoDB, add comment tree flattening, and refine API documentation
2 parents de80b9a + 98d6177 commit a143b74

File tree

70 files changed

+1255
-1141
lines changed

Some content is hidden

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

70 files changed

+1255
-1141
lines changed

.github/workflows/openapi.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ jobs:
2323
- name: ⚙️ Setup .NET
2424
uses: actions/setup-dotnet@v1
2525
with:
26-
dotnet-version: |
27-
7.0.x
28-
8.0.x
26+
dotnet-version: 9.0.x
2927
- name: ⚒ Build solution
3028
run: dotnet build
3129
- name: ⚙️ Restore .NET tools
3230
run: dotnet tool restore
3331
- name: 📝 Produce OpenAPI specification
34-
run: dotnet swagger tofile --output openapi.yaml --yaml ./src/CrowdParlay.Social.Api/bin/Debug/net8.0/CrowdParlay.Social.Api.dll v1
32+
run: dotnet swagger tofile --output openapi.yaml --yaml ./src/CrowdParlay.Social.Api/bin/Debug/net9.0/CrowdParlay.Social.Api.dll v1
3533
- name: 🔗 Upload OpenAPI specification as release asset
3634
uses: actions/upload-release-asset@v1
3735
env:

.github/workflows/test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ jobs:
2020
- name: ⚙️ Setup .NET
2121
uses: actions/setup-dotnet@v3
2222
with:
23-
dotnet-version: |
24-
7.0.x
25-
8.0.x
23+
dotnet-version: 9.0.x
2624
- name: 📥 Restore dependencies
2725
run: dotnet restore
2826
- name: ⚒ Build solution
@@ -35,4 +33,4 @@ jobs:
3533
with:
3634
name: .NET test results
3735
path: "**/TestResults/*.trx"
38-
reporter: dotnet-trx
36+
reporter: dotnet-trx

.gitmodules

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
[submodule "src/CrowdParlay.Social.Infrastructure.gRPC/Users"]
2-
path = src/CrowdParlay.Social.Infrastructure.gRPC/Users
3-
url = https://github.com/crowdparlay/users-proto
4-
[submodule "src/CrowdParlay.Social.Application/gRPC/Users"]
5-
path = src/CrowdParlay.Social.Application/gRPC/Users
6-
url = https://github.com/crowdparlay/users-proto
71
[submodule "src/CrowdParlay.Social.Infrastructure.Communication/gRPC/Users"]
82
path = src/CrowdParlay.Social.Infrastructure.Communication/gRPC/Users
93
url = https://github.com/crowdparlay/users-proto.git

Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
1-
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
1+
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
22
WORKDIR /app
33

44
COPY /src .
55
RUN dotnet restore "CrowdParlay.Social.Api/CrowdParlay.Social.Api.csproj"
66
RUN dotnet publish "CrowdParlay.Social.Api/CrowdParlay.Social.Api.csproj" -c Release -o out
77

8-
FROM mcr.microsoft.com/dotnet/aspnet:8.0
8+
FROM mcr.microsoft.com/dotnet/aspnet:9.0
99
WORKDIR /app
1010
COPY --from=build /app/out .
11-
COPY /neo4j/migrations ./neo4j/migrations
1211

13-
RUN apt-get update && apt-get install -y curl unzip
14-
RUN curl -LO https://github.com/michael-simons/neo4j-migrations/releases/download/2.9.3/neo4j-migrations-2.9.3-linux-x86_64.zip
15-
RUN unzip -j neo4j-migrations-2.9.3-linux-x86_64.zip neo4j-migrations-2.9.3-linux-x86_64/bin/neo4j-migrations
16-
RUN rm neo4j-migrations-2.9.3-linux-x86_64.zip
17-
18-
ENTRYPOINT ["sh", "-c", "./neo4j-migrations -a $NEO4J_URI -u $NEO4J_USERNAME -p $NEO4J_PASSWORD migrate && dotnet CrowdParlay.Social.Api.dll"]
12+
ENTRYPOINT ["sh", "-c", "dotnet CrowdParlay.Social.Api.dll"]

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# Crowd Parlay's *social* microservice [![Test](https://github.com/crowdparlay/social/actions/workflows/test.yml/badge.svg)](https://github.com/crowdparlay/social/actions/workflows/test.yml)
2-
- **languages:** <kbd>C#</kbd> <kbd>Cypher</kbd>
3-
- **technologies:** <kbd>.NET 8</kbd> <kbd>ASP.NET Core</kbd> <kbd>RabbitMQ</kbd> <kbd>Neo4j</kbd> <kbd>SSE</kbd> <kbd>OpenAPI</kbd>
4-
- **dependencies:** <kbd>MassTransit</kbd> <kbd>SignalR</kbd> <kbd>MediatR</kbd> <kbd>FluentValidation</kbd> <kbd>Mapster</kbd> <kbd>Swashbuckle</kbd> <kbd>Testcontainers</kbd>
2+
3+
A high-performance, cloud-native microservice enabling discussions, threaded comments, emoji/text reactions, and real-time event publishing via message broker. Designed with a clean onion architecture and test-driven development, it integrates seamlessly with other services through resilient, cache-optimized API calls. Built on a NoSQL store with embedded documents and strategic indexing for fast reads. Basic telemetry and observability are integrated, with support for future expansion. Fully automated CI/CD pipelines enable one-click production deployments.
4+
5+
- **Stack:** <kbd>C# 13</kbd> <kbd>.NET 9</kbd> <kbd>ASP.NET Core</kbd> <kbd>MongoDb.Driver</kbd> <kbd>MassTransit</kbd> <kbd>OpenTelemetry</kbd> <kbd>SignalR</kbd> <kbd>FluentValidation</kbd> <kbd>Mapster</kbd> <kbd>Swashbuckle/OpenAPI</kbd> <kbd>Testcontainers</kbd>
6+
- **Environment:** <kbd>MongoDB</kbd> <kbd>Redis</kbd> <kbd>RabbitMQ</kbd> <kbd>Elastic APM</kbd> [<kbd>crowdparlay/users</kbd>](https://github.com/crowdparlay/users)
7+
- **Adopted but retired:** <kbd>Neo4j</kbd> <kbd>MediatR</kbd>
8+
9+
> [!NOTE]
10+
> This Git repository contains Submodules. Don’t forget to clone with `--recurse-submodules`

neo4j/migrations/V010__Add_indexes.cypher

Lines changed: 0 additions & 3 deletions
This file was deleted.

neo4j/migrations/V020__Remove_excessive_author_properties.cypher

Lines changed: 0 additions & 2 deletions
This file was deleted.

src/CrowdParlay.Social.Api/Consumers/UserEventConsumer.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/CrowdParlay.Social.Api/CrowdParlay.Social.Api.csproj

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
@@ -10,19 +10,19 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Elastic.Apm.NetCoreAll" Version="1.26.0" />
14-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.2" />
15-
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.7" />
13+
<PackageReference Include="Elastic.Apm.NetCoreAll" Version="1.32.2" />
14+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.5" />
15+
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="9.0.5" />
1616
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0"/>
17-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.2" />
18-
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="8.0.2" />
19-
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.8.1" />
20-
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.8.1" />
21-
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.8.1" />
17+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.5" />
18+
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.5" />
19+
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
20+
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0" />
21+
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
2222
<PackageReference Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.9.0-beta.1" />
2323
<PackageReference Include="Serilog.Enrichers.OpenTelemetry" Version="1.0.1" />
24-
<PackageReference Include="SignalRSwaggerGen" Version="4.5.0" />
25-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
24+
<PackageReference Include="SignalRSwaggerGen" Version="4.8.0" />
25+
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.2" />
2626
</ItemGroup>
2727

2828
<ItemGroup>

src/CrowdParlay.Social.Api/Extensions/ConfigureServices.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using CrowdParlay.Communication;
2-
using CrowdParlay.Social.Api.Consumers;
32
using CrowdParlay.Social.Api.Services;
43
using MassTransit;
54

@@ -21,7 +20,6 @@ public static IServiceCollection AddApi(this IServiceCollection services, IConfi
2120

2221
return services.AddMassTransit(bus =>
2322
{
24-
bus.AddConsumersFromNamespaceContaining<UserEventConsumer>();
2523
bus.UsingRabbitMq((context, configurator) =>
2624
{
2725
var amqpServerUrl =

0 commit comments

Comments
 (0)