1
0
mirror of https://github.com/bitwarden/server synced 2025-12-16 00:03:54 +00:00

Split scene service and query service

rename instances of `recipe` to `scene`
This commit is contained in:
Matt Gibson
2025-10-30 09:08:36 -07:00
parent 2d50d05587
commit 3f22adcbf2
13 changed files with 217 additions and 86 deletions

View File

@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Bit.SeederApi.Controllers;
[Route("query")]
public class QueryController(ILogger<QueryController> logger, ISeedService recipeService)
public class QueryController(ILogger<QueryController> logger, IQueryService queryService)
: Controller
{
[HttpPost]
@@ -15,15 +15,15 @@ public class QueryController(ILogger<QueryController> logger, ISeedService recip
try
{
var result = recipeService.ExecuteQuery(request.Template, request.Arguments);
var result = queryService.ExecuteQuery(request.Template, request.Arguments);
return Json(new { Result = result });
return Json(result);
}
catch (RecipeNotFoundException ex)
catch (SceneNotFoundException ex)
{
return NotFound(new { Error = ex.Message });
}
catch (RecipeExecutionException ex)
catch (SceneExecutionException ex)
{
logger.LogError(ex, "Error executing query: {Query}", request.Template);
return BadRequest(new

View File

@@ -6,7 +6,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Bit.SeederApi.Controllers;
[Route("seed")]
public class SeedController(ILogger<SeedController> logger, ISeedService recipeService)
public class SeedController(ILogger<SeedController> logger, ISceneService sceneService)
: Controller
{
[HttpPost]
@@ -16,15 +16,15 @@ public class SeedController(ILogger<SeedController> logger, ISeedService recipeS
try
{
SceneResponseModel response = recipeService.ExecuteScene(request.Template, request.Arguments);
SceneResponseModel response = sceneService.ExecuteScene(request.Template, request.Arguments);
return Json(response);
}
catch (RecipeNotFoundException ex)
catch (SceneNotFoundException ex)
{
return NotFound(new { Error = ex.Message });
}
catch (RecipeExecutionException ex)
catch (SceneExecutionException ex)
{
logger.LogError(ex, "Error executing scene: {Template}", request.Template);
return BadRequest(new
@@ -48,7 +48,7 @@ public class SeedController(ILogger<SeedController> logger, ISeedService recipeS
{
try
{
await recipeService.DestroyRecipe(seedId);
await sceneService.DestroyScene(seedId);
}
catch (Exception ex)
{
@@ -79,11 +79,11 @@ public class SeedController(ILogger<SeedController> logger, ISeedService recipeS
try
{
var result = await recipeService.DestroyRecipe(seedId);
var result = await sceneService.DestroyScene(seedId);
return Json(result);
}
catch (RecipeExecutionException ex)
catch (SceneExecutionException ex)
{
logger.LogError(ex, "Error deleting seeded data: {SeedId}", seedId);
return BadRequest(new
@@ -101,7 +101,7 @@ public class SeedController(ILogger<SeedController> logger, ISeedService recipeS
logger.LogInformation("Deleting all seeded data");
// Pull all Seeded Data ids
var seededData = recipeService.GetAllSeededData();
var seededData = sceneService.GetAllSeededData();
var aggregateException = new AggregateException();
@@ -111,7 +111,7 @@ public class SeedController(ILogger<SeedController> logger, ISeedService recipeS
{
try
{
await recipeService.DestroyRecipe(sd.Id);
await sceneService.DestroyScene(sd.Id);
}
catch (Exception ex)
{