some cleanup

This commit is contained in:
2026-08-09 13:51:00 +02:00
parent 99535fe9d9
commit 7e0c60253e
5 changed files with 20 additions and 11 deletions
+16 -2
View File
@@ -33,6 +33,12 @@ public class FocusTasksController : ControllerBase
if (string.IsNullOrWhiteSpace(dto.Title)) if (string.IsNullOrWhiteSpace(dto.Title))
return BadRequest("Title is required"); return BadRequest("Title is required");
if (dto.Title.Length > 255)
return BadRequest("Title must not exceed 255 characters");
if (dto.Description != null && dto.Description.Length > 2000)
return BadRequest("Description must not exceed 2000 characters");
var maxOrder = await _context.FocusTasks.MaxAsync(t => (int?)t.Order) ?? 0; var maxOrder = await _context.FocusTasks.MaxAsync(t => (int?)t.Order) ?? 0;
var task = new FocusTask var task = new FocusTask
@@ -58,10 +64,18 @@ public class FocusTasksController : ControllerBase
return NotFound(); return NotFound();
if (!string.IsNullOrWhiteSpace(dto.Title)) if (!string.IsNullOrWhiteSpace(dto.Title))
{
if (dto.Title.Length > 255)
return BadRequest("Title must not exceed 255 characters");
task.Title = dto.Title; task.Title = dto.Title;
}
if (dto.Description != null) if (dto.Description != null)
{
if (dto.Description.Length > 2000)
return BadRequest("Description must not exceed 2000 characters");
task.Description = dto.Description; task.Description = dto.Description;
}
if (dto.Order.HasValue) if (dto.Order.HasValue)
task.Order = dto.Order.Value; task.Order = dto.Order.Value;
@@ -88,7 +102,7 @@ public class FocusTasksController : ControllerBase
var task = await _context.FocusTasks.FindAsync(order.Id); var task = await _context.FocusTasks.FindAsync(order.Id);
if (task != null) if (task != null)
{ {
// Invertiere die Order: höchste wird niedrigste und umgekehrt // Invertiere die Order: hchste wird niedrigste und umgekehrt
task.Order = maxOrder - order.Order; task.Order = maxOrder - order.Order;
task.UpdatedAt = DateTime.UtcNow; task.UpdatedAt = DateTime.UtcNow;
_context.FocusTasks.Update(task); _context.FocusTasks.Update(task);
@@ -97,7 +111,7 @@ public class FocusTasksController : ControllerBase
await _context.SaveChangesAsync(); await _context.SaveChangesAsync();
// Rückgabe: absteigend sortiert (neue oben) // Rckgabe: absteigend sortiert (neue oben)
return Ok(await _context.FocusTasks.OrderByDescending(t => t.Order).ToListAsync()); return Ok(await _context.FocusTasks.OrderByDescending(t => t.Order).ToListAsync());
} }
+1 -5
View File
@@ -8,16 +8,12 @@ RUN npm run build
# Stage 2: .NET Publish # Stage 2: .NET Publish
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
RUN apt-get update && apt-get install -y curl && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*
WORKDIR /src WORKDIR /src
COPY *.csproj *.sln ./ COPY *.csproj *.sln ./
RUN dotnet restore RUN dotnet restore
COPY . . COPY . .
COPY --from=frontend /app/client/build ./client/build COPY --from=frontend /app/client/build ./client/build
RUN dotnet publish FocusApp.csproj -c Release -o /app/publish --no-restore RUN dotnet publish FocusApp.csproj -c Release -o /app/publish --no-restore -p:SkipFrontendBuild=true
# Stage 3: Runtime # Stage 3: Runtime
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
+2 -2
View File
@@ -22,8 +22,8 @@
<Content Include="client\build\**" CopyToOutputDirectory="PreserveNewest" /> <Content Include="client\build\**" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup> </ItemGroup>
<!-- Automatisches Frontend-Build bei Publish (nur Release) --> <!-- Automatisches Frontend-Build bei Publish (nur Release, skip mit -p:SkipFrontendBuild=true) -->
<Target Name="BuildFrontend" BeforeTargets="Publish" Condition="'$(Configuration)' == 'Release'"> <Target Name="BuildFrontend" BeforeTargets="Publish" Condition="'$(Configuration)' == 'Release' AND '$(SkipFrontendBuild)' != 'true'">
<Message Text="🔨 Building React Frontend..." Importance="high" /> <Message Text="🔨 Building React Frontend..." Importance="high" />
<!-- NPM Install falls node_modules nicht existiert --> <!-- NPM Install falls node_modules nicht existiert -->
-1
View File
@@ -7,7 +7,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{12345678-1234-1234-1234-123456789012}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{12345678-1234-1234-1234-123456789012}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore .gitignore = .gitignore
deploy.ps1 = deploy.ps1
Directory.Build.props = Directory.Build.props Directory.Build.props = Directory.Build.props
README.md = README.md README.md = README.md
EndProjectSection EndProjectSection
+1 -1
View File
@@ -6,7 +6,7 @@
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },
"applicationUrl": "https://localhost:62966;http://localhost:62967" "applicationUrl": "http://localhost:5000"
} }
} }
} }