Skip to content

Commit

Permalink
Rename projects and namespaces to Geopilot
Browse files Browse the repository at this point in the history
  • Loading branch information
domi-b committed Mar 11, 2024
1 parent c8fb9b4 commit d2b6ae9
Show file tree
Hide file tree
Showing 140 changed files with 304 additions and 305 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@ jobs:
dotnet-version: '7.0'

- name: Install dependencies
run: dotnet restore GeoCop.sln
run: dotnet restore Geopilot.sln

- name: Build dotnet
run: dotnet build GeoCop.sln -c Release --no-restore /warnaserror
run: dotnet build Geopilot.sln -c Release --no-restore /warnaserror

- name: Test
run: dotnet test GeoCop.sln -c Release --no-build --verbosity normal
run: dotnet test Geopilot.sln -c Release --no-build --verbosity normal

- name: Run frontend ci
working-directory: ./src/GeoCop.Frontend
working-directory: ./src/Geopilot.Frontend
run: npm ci

- name: Build frontend
working-directory: ./src/GeoCop.Frontend
working-directory: ./src/Geopilot.Frontend
run: npm run build --if-present

- name: Lint frontend
working-directory: ./src/GeoCop.Frontend
working-directory: ./src/Geopilot.Frontend
run: npm run lint
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ RUN apt-get update && \
rm -rf /var/lib/apt/lists/*

# Restore dependencies and tools
COPY src/GeoCop.Api/GeoCop.Api.csproj GeoCop.Api/
COPY src/GeoCop.Frontend/nuget.config GeoCop.Frontend/
COPY src/GeoCop.Frontend/package* GeoCop.Frontend/
COPY src/GeoCop.Frontend/GeoCop.Frontend.esproj GeoCop.Frontend/
COPY src/Geopilot.Api/Geopilot.Api.csproj Geopilot.Api/
COPY src/Geopilot.Frontend/nuget.config Geopilot.Frontend/
COPY src/Geopilot.Frontend/package* Geopilot.Frontend/
COPY src/Geopilot.Frontend/Geopilot.Frontend.esproj Geopilot.Frontend/

RUN dotnet restore "GeoCop.Api/GeoCop.Api.csproj"
RUN npm install -C GeoCop.Frontend
RUN dotnet restore "Geopilot.Api/Geopilot.Api.csproj"
RUN npm install -C Geopilot.Frontend

# Set environment variables
ENV PUBLISH_DIR=/app/publish
ENV GENERATE_SOURCEMAP=false

# Create optimized production build
COPY src/ .
RUN dotnet publish "GeoCop.Api/GeoCop.Api.csproj" \
RUN dotnet publish "Geopilot.Api/Geopilot.Api.csproj" \
-c Release \
-p:VersionPrefix=${VERSION} \
-p:SourceRevisionId=${REVISION} \
Expand Down
6 changes: 3 additions & 3 deletions GeoCop.sln → Geopilot.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.7.34202.233
MinimumVisualStudioVersion = 10.0.40219.1
Project("{54A90642-561A-4BB1-A94E-469ADEE60C69}") = "GeoCop.Frontend", "src\GeoCop.Frontend\GeoCop.Frontend.esproj", "{3970CA03-F5E1-47CE-A054-D4B358F8CDB0}"
Project("{54A90642-561A-4BB1-A94E-469ADEE60C69}") = "Geopilot.Frontend", "src\Geopilot.Frontend\Geopilot.Frontend.esproj", "{3970CA03-F5E1-47CE-A054-D4B358F8CDB0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeoCop.Api", "src\GeoCop.Api\GeoCop.Api.csproj", "{29505995-981F-45FE-9410-684E086DC556}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Geopilot.Api", "src\Geopilot.Api\Geopilot.Api.csproj", "{29505995-981F-45FE-9410-684E086DC556}"
ProjectSection(ProjectDependencies) = postProject
{41D679A6-C4B1-4B18-B9AB-BEC6C647A180} = {41D679A6-C4B1-4B18-B9AB-BEC6C647A180}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeoCop.Api.Test", "tests\GeoCop.Api.Test\GeoCop.Api.Test.csproj", "{CD485179-7CB7-4131-8B17-43634CA6857C}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Geopilot.Api.Test", "tests\Geopilot.Api.Test\Geopilot.Api.Test.csproj", "{CD485179-7CB7-4131-8B17-43634CA6857C}"
EndProject
Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{41D679A6-C4B1-4B18-B9AB-BEC6C647A180}"
EndProject
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ Für die Formattierung wird ESLint verwendet. Dazu im Visual Studio unter `Optio
| Project | Action |
|-----------------|-------------------------|
| docker-compose | Start without debugging |
| GeoCop.Api | Start |
| GeoCop.Api.Test | None |
| GeoCop.Frontend | Start |
| Geopilot.Api | Start |
| Geopilot.Api.Test | None |
| Geopilot.Frontend | Start |

### URLs Entwicklungsumgebung 🔗

| URL | Project | Reverse Proxy |
| --- | --- | --- |
| https://localhost:5173 | GeoCop.Frontend | `/api` und `/browser` zu https://localhost:7188 |
| https://localhost:7188 | GeoCop.Api | `/browser` zu http://localhost:8080 (der `/browser`-Prefix wird entfernt) |
| https://localhost:5173 | Geopilot.Frontend | `/api` und `/browser` zu https://localhost:7188 |
| https://localhost:7188 | Geopilot.Api | `/browser` zu http://localhost:8080 (der `/browser`-Prefix wird entfernt) |
| http://localhost:8080 | stac-browser (in docker-compose) | - |
| http://localhost:3001 | PgAdmin (in docker-compose) | - |
| http://localhost:3080 | interlis-check-service (in docker-compose) | - |
Expand All @@ -39,7 +39,7 @@ Der STAC Browser ist auch über https://localhost:5173/browser erreichbar und da

### Debugging 🪲

Das Debugging sollte nun sowol für das GeoCop.Frontend in JavaScript als auch für GeoCop.Api in C# funtkionieren.
Das Debugging sollte nun sowohl für das Geopilot.Frontend in JavaScript als auch für Geopilot.Api in C# funtkionieren.

PgAdmin kann für eine Analyse der Datenbank verwendet werden und ist unter [localhost:3001](http://localhost:3001/) verfügbar.

Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ services:
Auth__ClientId: ac09549e-6cf8-40fe-91a9-25515ec71954
Validation__InterlisCheckServiceUrl: http://interlis-check-service/
volumes:
- ./src/GeoCop.Api/Uploads:/uploads
- ./src/GeoCop.Api/Persistent:/assets
- ./src/Geopilot.Api/Uploads:/uploads
- ./src/Geopilot.Api/Persistent:/assets
- ./README.md:/public/info-hilfe.md
- ./LICENSE:/public/nutzungsbestimmungen.md
2 changes: 1 addition & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ timezone: $TZ
"

echo -e "geopilot app is up and running!\n" && \
sudo -H --preserve-env --user abc dotnet GeoCop.Api.dll
sudo -H --preserve-env --user abc dotnet Geopilot.Api.dll
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using System.Security.Claims;

namespace GeoCop.Api.Authorization;
namespace Geopilot.Api.Authorization;

/// <summary>
/// Middleware that automatically authorizes as the first user in development.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
namespace GeoCop.Api.Authorization;
namespace Geopilot.Api.Authorization;

/// <summary>
/// Defines constants for the authorization policies.
/// </summary>
public static class GeocopPolicies
public static class GeopilotPolicies
{
/// <summary>
/// Require admin permissions.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
using Microsoft.AspNetCore.Authorization;

namespace GeoCop.Api.Authorization;
namespace Geopilot.Api.Authorization;

/// <summary>
/// Authorization handler for <see cref="GeocopUserRequirement"/>.
/// Authorization handler for <see cref="GeopilotUserRequirement"/>.
/// </summary>
public class GeocopUserHandler : AuthorizationHandler<GeocopUserRequirement>
public class GeopilotUserHandler : AuthorizationHandler<GeopilotUserRequirement>
{
private readonly Context dbContext;
private readonly ILogger<GeocopUserHandler> logger;
private readonly ILogger<GeopilotUserHandler> logger;

/// <summary>
/// Initializes a new instance of the <see cref="GeocopUserHandler"/> class.
/// Initializes a new instance of the <see cref="GeopilotUserHandler"/> class.
/// </summary>
/// <param name="dbContext">The database context.</param>
/// <param name="logger">The logger used for authorization related logging.</param>
public GeocopUserHandler(ILogger<GeocopUserHandler> logger, Context dbContext)
public GeopilotUserHandler(ILogger<GeopilotUserHandler> logger, Context dbContext)
{
this.dbContext = dbContext;
this.logger = logger;
}

/// <inheritdoc/>
protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, GeocopUserRequirement requirement)
protected override async Task HandleRequirementAsync(AuthorizationHandlerContext context, GeopilotUserRequirement requirement)
{
if (context.User.Identity?.IsAuthenticated != true)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
using Microsoft.AspNetCore.Authorization;

namespace GeoCop.Api.Authorization;
namespace Geopilot.Api.Authorization;

/// <summary>
/// Authorization requirement for geocop users.
/// Authorization requirement for geopilot users.
/// </summary>
public class GeocopUserRequirement : IAuthorizationRequirement
public class GeopilotUserRequirement : IAuthorizationRequirement
{
/// <summary>
/// Only allow administrators.
Expand Down
4 changes: 2 additions & 2 deletions src/GeoCop.Api/Context.cs → src/Geopilot.Api/Context.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using GeoCop.Api.Models;
using Geopilot.Api.Models;
using Microsoft.EntityFrameworkCore;

namespace GeoCop.Api;
namespace Geopilot.Api;

/// <summary>
/// Database context to manage the delivery database.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using Bogus;
using Bogus.DataSets;
using GeoCop.Api.Models;
using Geopilot.Api.Models;
using Microsoft.EntityFrameworkCore;
using NetTopologySuite.Geometries;
using System.Globalization;
using System.Security.Claims;
using System.Security.Cryptography;

namespace GeoCop.Api;
namespace Geopilot.Api;

internal static class ContextExtensions
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace GeoCop.Api.Contracts;
namespace Geopilot.Api.Contracts;

/// <summary>
/// Represents the configured auth options of type BrowserAuthOptions from @azure/msal-browser.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;

namespace GeoCop.Api.Contracts;
namespace Geopilot.Api.Contracts;

/// <summary>
/// Request for transforming a validation to a delivery.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace GeoCop.Api.Contracts;
namespace Geopilot.Api.Contracts;

/// <summary>
/// The validation settings response schema.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using System.Globalization;
using GeoCop.Api.Authorization;
using GeoCop.Api.Contracts;
using GeoCop.Api.FileAccess;
using GeoCop.Api.Models;
using GeoCop.Api.Validation;
using Geopilot.Api.Authorization;
using Geopilot.Api.Contracts;
using Geopilot.Api.FileAccess;
using Geopilot.Api.Models;
using Geopilot.Api.Validation;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Swashbuckle.AspNetCore.Annotations;

namespace GeoCop.Api.Controllers;
namespace Geopilot.Api.Controllers;

/// <summary>
/// Controller for declaring deliveries.
Expand Down Expand Up @@ -40,7 +40,7 @@ public DeliveryController(ILogger<DeliveryController> logger, Context context, I
/// <param name="declaration"><see cref="DeliveryRequest"/> containing all information for the declaration process.</param>
/// <returns>Created <see cref="Delivery"/>.</returns>
[HttpPost]
[Authorize(Policy = GeocopPolicies.User)]
[Authorize(Policy = GeopilotPolicies.User)]
[SwaggerResponse(StatusCodes.Status201Created, "The delivery was created successfully.")]
[SwaggerResponse(StatusCodes.Status400BadRequest, "The server cannot process the request due to invalid or malformed request.", typeof(ValidationProblemDetails), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status404NotFound, "The validation job or mandate could not be found.")]
Expand Down Expand Up @@ -130,7 +130,7 @@ public async Task<IActionResult> Create(DeliveryRequest declaration)
/// <param name="mandateId">Optional. Filter deliveries for given mandate.</param>
/// <returns>A list of <see cref="Delivery"/>.</returns>
[HttpGet]
[Authorize(Policy = GeocopPolicies.User)]
[Authorize(Policy = GeopilotPolicies.User)]
[SwaggerResponse(StatusCodes.Status200OK, "A list matching filter criteria.", typeof(List<Delivery>), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status404NotFound, "Failed to find mandate.")]
public async Task<IActionResult> Get([FromQuery] int? mandateId = null)
Expand Down Expand Up @@ -167,7 +167,7 @@ public async Task<IActionResult> Get([FromQuery] int? mandateId = null)
/// </summary>
/// <returns>An updated list of <see cref="Delivery"/>.</returns>
[HttpDelete("{deliveryId}")]
[Authorize(Policy = GeocopPolicies.Admin)]
[Authorize(Policy = GeopilotPolicies.Admin)]
[SwaggerResponse(StatusCodes.Status200OK, "The delivery was successfully deleted.")]
[SwaggerResponse(StatusCodes.Status400BadRequest, "The server cannot process the request due to invalid or malformed request.", typeof(ValidationProblemDetails), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status404NotFound, "The delivery could be found.")]
Expand Down Expand Up @@ -205,7 +205,7 @@ public IActionResult Delete([FromRoute] int deliveryId)
/// </summary>
/// <returns>The asset file.</returns>
[HttpGet("assets/{assetId}")]
[Authorize(Policy = GeocopPolicies.Admin)]
[Authorize(Policy = GeopilotPolicies.Admin)]
[SwaggerResponse(StatusCodes.Status200OK, "A file has been downloaded.", typeof(File), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status400BadRequest, "The server cannot process the request due to invalid or malformed request.", typeof(ValidationProblemDetails), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status404NotFound, "The asset could be found.")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using GeoCop.Api.Authorization;
using GeoCop.Api.Models;
using GeoCop.Api.Validation;
using Geopilot.Api.Authorization;
using Geopilot.Api.Models;
using Geopilot.Api.Validation;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Swashbuckle.AspNetCore.Annotations;

namespace GeoCop.Api.Controllers;
namespace Geopilot.Api.Controllers;

/// <summary>
/// Controller for listing mandates.
Expand Down Expand Up @@ -38,7 +38,7 @@ public MandateController(ILogger<MandateController> logger, Context context, IVa
/// <param name="jobId">Optional. Get matching mandates by validation job id.</param>
/// <returns>List of mandates matching optional filter criteria.</returns>
[HttpGet]
[Authorize(Policy = GeocopPolicies.User)]
[Authorize(Policy = GeopilotPolicies.User)]
[SwaggerResponse(StatusCodes.Status200OK, "Returns list of mandates associated to the current user matching the optional filter criteria.", typeof(IEnumerable<DeliveryMandate>), new[] { "application/json" })]
public async Task<IActionResult> Get(
[FromQuery, SwaggerParameter("Filter mandates matching validation job file extension.")]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using GeoCop.Api.Authorization;
using GeoCop.Api.Contracts;
using GeoCop.Api.Models;
using Geopilot.Api.Authorization;
using Geopilot.Api.Contracts;
using Geopilot.Api.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.Annotations;

namespace GeoCop.Api.Controllers;
namespace Geopilot.Api.Controllers;

/// <summary>
/// Controller for user information.
Expand Down Expand Up @@ -37,7 +37,7 @@ public UserController(ILogger<UserController> logger, Context context, IOptions<
/// </summary>
/// <returns>The <see cref="User"/> that is currently logged in.</returns>
[HttpGet]
[Authorize(Policy = GeocopPolicies.User)]
[Authorize(Policy = GeopilotPolicies.User)]
[SwaggerResponse(StatusCodes.Status200OK, "Returns the currently logged in user.", typeof(User), new[] { "application/json" })]
public async Task<User?> GetAsync()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using Asp.Versioning;
using GeoCop.Api.Contracts;
using GeoCop.Api.FileAccess;
using GeoCop.Api.Validation;
using Geopilot.Api.Contracts;
using Geopilot.Api.FileAccess;
using Geopilot.Api.Validation;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
using Swashbuckle.AspNetCore.Annotations;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;

namespace GeoCop.Api.Controllers;
namespace Geopilot.Api.Controllers;

/// <summary>
/// Controller for file validation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Swashbuckle.AspNetCore.Annotations;
using System.Reflection;

namespace GeoCop.Api.Controllers;
namespace Geopilot.Api.Controllers;

/// <summary>
/// Constroller for Version information.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Options;

namespace GeoCop.Api.Conventions;
namespace Geopilot.Api.Conventions;

/// <summary>
/// Customizes the convention for GeoCop actions to use System.Text.Json.
/// Customizes the convention for Geopilot actions to use System.Text.Json.
/// </summary>
public class GeocopJsonConvention : IActionFilter, IActionModelConvention
public class GeopilotJsonConvention : IActionFilter, IActionModelConvention
{
private const string BaseNamespace = nameof(GeoCop);
private const string BaseNamespace = nameof(Geopilot);
private FormatterCollection<IOutputFormatter>? outputFormatters;

/// <inheritdoc/>
Expand Down
Loading

0 comments on commit d2b6ae9

Please sign in to comment.