Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Add additional sync commands
Browse files Browse the repository at this point in the history
  • Loading branch information
DebugOk committed Dec 24, 2023
1 parent dd4d3c0 commit 12bde2f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions SS14.MapServer/Controllers/MapController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,35 @@ public async Task<IActionResult> SyncMaps(List<string>? mapFileNames, bool syncA
return Ok();
}

[HttpPost("syncall")]
[Consumes("application/json")]
public async Task<IActionResult> SyncAllMaps()
{
var data = new JobDataMap
{
{Jobs.SyncMaps.MapListKey, new List<string>() },
{Jobs.SyncMaps.SyncAllKey, true}
};

await _schedulingService.RunJob<Jobs.SyncMaps>(nameof(Jobs.SyncMaps), "Sync", data);
return Ok();
}

[HttpPost("sync/{gitRef}")]
[Consumes("application/json")]
public async Task<IActionResult> SyncMaps(string gitRef, bool syncAll)
{
var data = new JobDataMap
{
{Jobs.SyncMaps.MapListKey, new List<string>() },
{Jobs.SyncMaps.SyncAllKey, syncAll},
{Jobs.SyncMaps.GitRefKey, gitRef}
};

await _schedulingService.RunJob<Jobs.SyncMaps>(nameof(Jobs.SyncMaps), "Sync", data);
return Ok();
}

private bool ValidateMapRequest(Map map, ICollection<IFormFile> images, [NotNullWhen(true)] out BadRequestObjectResult? error)
{
//Ensure map id is lowercase
Expand Down
2 changes: 1 addition & 1 deletion SS14.MapServer/SS14.MapServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<Version>1.1.6</Version>
<Version>1.1.7</Version>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 12bde2f

Please sign in to comment.