Compare commits
1 Commits
ceb4271182
...
feature/FA
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df7978fb43 |
99
FictionArchive.API/build_gateway.bat
Normal file
99
FictionArchive.API/build_gateway.bat
Normal file
@@ -0,0 +1,99 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
set ROOT=%~dp0
|
||||
|
||||
for %%A in ("%ROOT%..") do set SERVICES_DIR=%%~fA\
|
||||
|
||||
REM ----------------------------------------
|
||||
REM List of project names to skip
|
||||
REM (space-separated, match folder names exactly)
|
||||
REM ----------------------------------------
|
||||
set SKIP_PROJECTS=FictionArchive.Service.Shared FictionArchive.Service.AuthenticationService
|
||||
|
||||
echo ----------------------------------------
|
||||
echo Finding GraphQL services...
|
||||
echo ----------------------------------------
|
||||
|
||||
set SERVICE_LIST=
|
||||
|
||||
for /d %%F in ("%SERVICES_DIR%FictionArchive.Service.*") do (
|
||||
set "PROJECT_NAME=%%~nxF"
|
||||
set "SKIP=0"
|
||||
|
||||
REM Check if this project name is in the skip list
|
||||
for %%X in (%SKIP_PROJECTS%) do (
|
||||
if /I "!PROJECT_NAME!"=="%%X" (
|
||||
set "SKIP=1"
|
||||
)
|
||||
)
|
||||
|
||||
if !SKIP!==0 (
|
||||
echo Found service: !PROJECT_NAME!
|
||||
set SERVICE_LIST=!SERVICE_LIST! %%F
|
||||
) else (
|
||||
echo Skipping service: !PROJECT_NAME!
|
||||
)
|
||||
)
|
||||
|
||||
echo:
|
||||
echo ----------------------------------------
|
||||
echo Exporting schemas and packing subgraphs...
|
||||
echo ----------------------------------------
|
||||
|
||||
for %%S in (%SERVICE_LIST%) do (
|
||||
echo Processing service folder: %%S
|
||||
pushd "%%S"
|
||||
|
||||
echo Running schema export...
|
||||
dotnet run -- schema export --output schema.graphql
|
||||
if errorlevel 1 (
|
||||
echo ERROR during schema export in %%S
|
||||
popd
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo Running fusion subgraph pack...
|
||||
fusion subgraph pack
|
||||
if errorlevel 1 (
|
||||
echo ERROR during subgraph pack in %%S
|
||||
popd
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
popd
|
||||
echo Completed: %%S
|
||||
echo.
|
||||
)
|
||||
|
||||
echo ----------------------------------------
|
||||
echo Running fusion compose...
|
||||
echo ----------------------------------------
|
||||
|
||||
pushd "%ROOT%"
|
||||
|
||||
if exist gateway.fgp del gateway.fgp
|
||||
|
||||
for %%S in (%SERVICE_LIST%) do (
|
||||
REM Extract the full folder name WITH dots preserved
|
||||
set "SERVICE_NAME=%%~nxS"
|
||||
|
||||
echo Composing subgraph: !SERVICE_NAME!
|
||||
|
||||
fusion compose -p gateway.fgp -s "..\!SERVICE_NAME!"
|
||||
if errorlevel 1 (
|
||||
echo ERROR during fusion compose
|
||||
popd
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
|
||||
popd
|
||||
|
||||
|
||||
echo ----------------------------------------
|
||||
echo Fusion build complete!
|
||||
echo ----------------------------------------
|
||||
|
||||
endlocal
|
||||
exit /b 0
|
||||
104
FictionArchive.API/build_gateway.sh
Normal file
104
FictionArchive.API/build_gateway.sh
Normal file
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
###############################################
|
||||
# Resolve important directories
|
||||
###############################################
|
||||
|
||||
# Directory where this script lives
|
||||
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Services live one directory above the script's directory
|
||||
SERVICES_DIR="$(cd "$ROOT/.." && pwd)"
|
||||
|
||||
###############################################
|
||||
# Skip list (folder names, match exactly)
|
||||
###############################################
|
||||
SKIP_PROJECTS=(
|
||||
"FictionArchive.Service.Shared"
|
||||
"FictionArchive.Service.Legacy"
|
||||
)
|
||||
|
||||
echo "----------------------------------------"
|
||||
echo " Finding GraphQL services..."
|
||||
echo "----------------------------------------"
|
||||
|
||||
SERVICE_LIST=()
|
||||
|
||||
# Convert skip projects into a single searchable string
|
||||
SKIP_STRING=" ${SKIP_PROJECTS[*]} "
|
||||
|
||||
# Find service directories
|
||||
shopt -s nullglob
|
||||
for FOLDER in "$SERVICES_DIR"/FictionArchive.Service.*; do
|
||||
[ -d "$FOLDER" ] || continue
|
||||
|
||||
PROJECT_NAME="$(basename "$FOLDER")"
|
||||
|
||||
# Skip entries that match the skip list
|
||||
if [[ "$SKIP_STRING" == *" $PROJECT_NAME "* ]]; then
|
||||
echo "Skipping service: $PROJECT_NAME"
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "Found service: $PROJECT_NAME"
|
||||
SERVICE_LIST+=("$FOLDER")
|
||||
done
|
||||
shopt -u nullglob
|
||||
|
||||
echo
|
||||
echo "----------------------------------------"
|
||||
echo " Exporting schemas and packing subgraphs..."
|
||||
echo "----------------------------------------"
|
||||
|
||||
for SERVICE in "${SERVICE_LIST[@]}"; do
|
||||
PROJECT_NAME="$(basename "$SERVICE")"
|
||||
|
||||
echo "Processing service: $PROJECT_NAME"
|
||||
pushd "$SERVICE" >/dev/null
|
||||
|
||||
echo "Building service..."
|
||||
dotnet build -c Release >/dev/null
|
||||
|
||||
# Automatically detect built DLL in bin/Release/<TFM>/
|
||||
DLL_PATH="$(find "bin/Release" -maxdepth 3 -name '*.dll' | head -n 1)"
|
||||
if [[ -z "$DLL_PATH" ]]; then
|
||||
echo "ERROR: Could not locate DLL for $PROJECT_NAME"
|
||||
popd >/dev/null
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Running schema export..."
|
||||
dotnet exec "$DLL_PATH" schema export --output schema.graphql
|
||||
|
||||
echo "Running subgraph pack..."
|
||||
fusion subgraph pack
|
||||
|
||||
popd >/dev/null
|
||||
echo "Completed: $PROJECT_NAME"
|
||||
echo
|
||||
done
|
||||
|
||||
echo "----------------------------------------"
|
||||
echo " Running fusion compose..."
|
||||
echo "----------------------------------------"
|
||||
|
||||
pushd "$ROOT" >/dev/null
|
||||
|
||||
# Remove old composition file
|
||||
rm -f gateway.fgp
|
||||
|
||||
for SERVICE in "${SERVICE_LIST[@]}"; do
|
||||
SERVICE_NAME="$(basename "$SERVICE")"
|
||||
|
||||
echo "Composing subgraph: $SERVICE_NAME"
|
||||
|
||||
# Note: Fusion compose must reference parent dir (services live above ROOT)
|
||||
fusion compose -p gateway.fgp -s "../$SERVICE_NAME"
|
||||
done
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
echo "----------------------------------------"
|
||||
echo " Fusion build complete!"
|
||||
echo "----------------------------------------"
|
||||
Binary file not shown.
@@ -78,7 +78,5 @@ public class Program
|
||||
app.MapGraphQL();
|
||||
|
||||
app.RunWithGraphQLCommands(args);
|
||||
|
||||
app.Run();
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,6 @@ public class Program
|
||||
|
||||
app.MapGraphQL();
|
||||
|
||||
app.Run();
|
||||
app.RunWithGraphQLCommands(args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"subgraph": "Scheduler",
|
||||
"http": {
|
||||
"baseAddress": "http://localhost:5213/graphql"
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="GraphQL.Server.Ui.GraphiQL" Version="8.3.3" />
|
||||
<PackageReference Include="HotChocolate.AspNetCore" Version="15.1.11" />
|
||||
<PackageReference Include="HotChocolate.AspNetCore.CommandLine" Version="15.1.11" />
|
||||
<PackageReference Include="HotChocolate.Data.EntityFramework" Version="15.1.11" />
|
||||
<PackageReference Include="HotChocolate.Types.Scalars" Version="15.1.11" />
|
||||
<PackageReference Include="HotChocolate.Types.NodaTime" Version="15.1.11" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FictionArchive.Service.TranslationService.Services.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
@@ -12,7 +13,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
namespace FictionArchive.Service.TranslationService.Migrations
|
||||
{
|
||||
[DbContext(typeof(TranslationServiceDbContext))]
|
||||
[Migration("20251118052322_Initial")]
|
||||
[Migration("20251122225458_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
@@ -27,11 +28,9 @@ namespace FictionArchive.Service.TranslationService.Migrations
|
||||
|
||||
modelBuilder.Entity("FictionArchive.Service.TranslationService.Models.Database.TranslationRequest", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("BilledCharacterCount")
|
||||
.HasColumnType("bigint");
|
||||
@@ -1,6 +1,6 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using NodaTime;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
@@ -16,8 +16,7 @@ namespace FictionArchive.Service.TranslationService.Migrations
|
||||
name: "TranslationRequests",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
OriginalText = table.Column<string>(type: "text", nullable: false),
|
||||
TranslatedText = table.Column<string>(type: "text", nullable: true),
|
||||
From = table.Column<int>(type: "integer", nullable: false),
|
||||
@@ -1,4 +1,5 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FictionArchive.Service.TranslationService.Services.Database;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
@@ -24,11 +25,9 @@ namespace FictionArchive.Service.TranslationService.Migrations
|
||||
|
||||
modelBuilder.Entity("FictionArchive.Service.TranslationService.Models.Database.TranslationRequest", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<long>("BilledCharacterCount")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
@@ -73,6 +73,6 @@ public class Program
|
||||
|
||||
app.MapGraphQL();
|
||||
|
||||
app.Run();
|
||||
app.RunWithGraphQLCommands(args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"subgraph": "Translation",
|
||||
"http": {
|
||||
"baseAddress": "http://localhost:5234/graphql"
|
||||
}
|
||||
}
|
||||
@@ -47,6 +47,6 @@ public class Program
|
||||
|
||||
app.MapHealthChecks("/healthz");
|
||||
|
||||
app.Run();
|
||||
app.RunWithGraphQLCommands(args);
|
||||
}
|
||||
}
|
||||
6
FictionArchive.Service.UserService/subgraph-config.json
Normal file
6
FictionArchive.Service.UserService/subgraph-config.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"subgraph": "User",
|
||||
"http": {
|
||||
"baseAddress": "http://localhost:5145/graphql"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user