mirror of
https://github.com/skoelle/focusapp.git
synced 2026-09-17 20:10:25 +00:00
some cleanup
This commit is contained in:
@@ -33,6 +33,12 @@ public class FocusTasksController : ControllerBase
|
||||
if (string.IsNullOrWhiteSpace(dto.Title))
|
||||
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 task = new FocusTask
|
||||
@@ -58,10 +64,18 @@ public class FocusTasksController : ControllerBase
|
||||
return NotFound();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(dto.Title))
|
||||
{
|
||||
if (dto.Title.Length > 255)
|
||||
return BadRequest("Title must not exceed 255 characters");
|
||||
task.Title = dto.Title;
|
||||
}
|
||||
|
||||
if (dto.Description != null)
|
||||
{
|
||||
if (dto.Description.Length > 2000)
|
||||
return BadRequest("Description must not exceed 2000 characters");
|
||||
task.Description = dto.Description;
|
||||
}
|
||||
|
||||
if (dto.Order.HasValue)
|
||||
task.Order = dto.Order.Value;
|
||||
@@ -88,7 +102,7 @@ public class FocusTasksController : ControllerBase
|
||||
var task = await _context.FocusTasks.FindAsync(order.Id);
|
||||
if (task != null)
|
||||
{
|
||||
// Invertiere die Order: höchste wird niedrigste und umgekehrt
|
||||
// Invertiere die Order: h�chste wird niedrigste und umgekehrt
|
||||
task.Order = maxOrder - order.Order;
|
||||
task.UpdatedAt = DateTime.UtcNow;
|
||||
_context.FocusTasks.Update(task);
|
||||
@@ -97,7 +111,7 @@ public class FocusTasksController : ControllerBase
|
||||
|
||||
await _context.SaveChangesAsync();
|
||||
|
||||
// Rückgabe: absteigend sortiert (neue oben)
|
||||
// R�ckgabe: absteigend sortiert (neue oben)
|
||||
return Ok(await _context.FocusTasks.OrderByDescending(t => t.Order).ToListAsync());
|
||||
}
|
||||
|
||||
|
||||
+1
-5
@@ -8,16 +8,12 @@ RUN npm run build
|
||||
|
||||
# Stage 2: .NET Publish
|
||||
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
|
||||
COPY *.csproj *.sln ./
|
||||
RUN dotnet restore
|
||||
COPY . .
|
||||
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
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime
|
||||
|
||||
+2
-2
@@ -22,8 +22,8 @@
|
||||
<Content Include="client\build\**" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Automatisches Frontend-Build bei Publish (nur Release) -->
|
||||
<Target Name="BuildFrontend" BeforeTargets="Publish" Condition="'$(Configuration)' == 'Release'">
|
||||
<!-- Automatisches Frontend-Build bei Publish (nur Release, skip mit -p:SkipFrontendBuild=true) -->
|
||||
<Target Name="BuildFrontend" BeforeTargets="Publish" Condition="'$(Configuration)' == 'Release' AND '$(SkipFrontendBuild)' != 'true'">
|
||||
<Message Text="🔨 Building React Frontend..." Importance="high" />
|
||||
|
||||
<!-- NPM Install falls node_modules nicht existiert -->
|
||||
|
||||
@@ -7,7 +7,6 @@ EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{12345678-1234-1234-1234-123456789012}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.gitignore = .gitignore
|
||||
deploy.ps1 = deploy.ps1
|
||||
Directory.Build.props = Directory.Build.props
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:62966;http://localhost:62967"
|
||||
"applicationUrl": "http://localhost:5000"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user