Adds DecoTemplateController mirroring TemplateController: CRUD for deco template groups, deco templates (flat list + by-id), item listing, and a full-replace PUT for a deco template's item list. Hardening (deviation from a literal port of the existing handlers, matching the #144 S2 fix for ReplaceTemplateItemsHandler): - CreateDecoTemplateHandler now validates DecoTemplateGroupId exists before insert (previously a bad id hit the FK constraint at SaveChanges and surfaced as a 500; now a 422). - ReplaceDecoTemplateItemsHandler now rejects invalid items (unknown DecoId, StartTime >= EndTime unless EndTime is the end-of-day sentinel 00:00:00, or overlapping ranges) with a 422 instead of silently dropping/persisting them - the same silent-drop/silent-overlap bug class already fixed for templates. Response DTOs serialize the raw item TimeSpans (via .TimeOfDay), so an end-of-day item still round-trips as StartTime=22:00:00/EndTime=00:00:00 regardless of the ViewModel's day-wrapping DateTime representation.
This commit is contained in:
@@ -0,0 +1,221 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ErsatzTV.Application.Scheduling;
|
||||
using ErsatzTV.Controllers.Api.Requests;
|
||||
using ErsatzTV.Core;
|
||||
using ErsatzTV.Core.Api.Scheduling;
|
||||
using ErsatzTV.Extensions;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ErsatzTV.Controllers.Api;
|
||||
|
||||
[ApiController]
|
||||
public class DecoTemplateController(IMediator mediator) : ControllerBase
|
||||
{
|
||||
[HttpGet("/api/deco-templates/groups", Name = "GetDecoTemplateGroups")]
|
||||
[Tags("DecoTemplates")]
|
||||
[EndpointSummary("Get all deco template groups")]
|
||||
[EndpointGroupName("general")]
|
||||
[ProducesResponseType(typeof(List<DecoTemplateGroupResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<List<DecoTemplateGroupResponseModel>> GetGroups(CancellationToken cancellationToken)
|
||||
{
|
||||
List<DecoTemplateGroupViewModel> groups =
|
||||
await mediator.Send(new GetAllDecoTemplateGroups(), cancellationToken);
|
||||
return groups.Map(ProjectToResponseModel).ToList();
|
||||
}
|
||||
|
||||
[HttpPost("/api/deco-templates/groups")]
|
||||
[Tags("DecoTemplates")]
|
||||
[EndpointSummary("Create a deco template group")]
|
||||
[EndpointGroupName("general")]
|
||||
[ProducesResponseType(typeof(DecoTemplateGroupResponseModel), StatusCodes.Status201Created)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status422UnprocessableEntity)]
|
||||
public async Task<IActionResult> CreateGroup(
|
||||
[Required] [FromBody] CreateDecoTemplateGroupRequest request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
Either<BaseError, DecoTemplateGroupViewModel> result =
|
||||
await mediator.Send(request.ToCommand(), cancellationToken);
|
||||
return result.ToCreatedResult(
|
||||
vm => $"/api/deco-templates/groups/{vm.Id}",
|
||||
vm => ProjectToResponseModel(vm));
|
||||
}
|
||||
|
||||
[HttpDelete("/api/deco-templates/groups/{id:int}")]
|
||||
[Tags("DecoTemplates")]
|
||||
[EndpointSummary("Delete a deco template group")]
|
||||
[EndpointDescription(
|
||||
"Deletes the deco template group. The database cascade removes every deco template (and its items) in " +
|
||||
"the group; any playout template that used a removed deco template has that reference cleared.")]
|
||||
[EndpointGroupName("general")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> DeleteGroup(int id, CancellationToken cancellationToken)
|
||||
{
|
||||
List<DecoTemplateGroupViewModel> groups =
|
||||
await mediator.Send(new GetAllDecoTemplateGroups(), cancellationToken);
|
||||
if (groups.All(g => g.Id != id))
|
||||
{
|
||||
return ApiResults.NotFoundProblem();
|
||||
}
|
||||
|
||||
Option<BaseError> result = await mediator.Send(new DeleteDecoTemplateGroup(id), cancellationToken);
|
||||
return result.Match<IActionResult>(
|
||||
Some: error => error.ToErrorResult(),
|
||||
None: () => new NoContentResult());
|
||||
}
|
||||
|
||||
[HttpGet("/api/deco-templates")]
|
||||
[Tags("DecoTemplates")]
|
||||
[EndpointSummary("Get all deco templates")]
|
||||
[EndpointDescription(
|
||||
"Returns every deco template as a flat list, ordered by group name then deco template name.")]
|
||||
[EndpointGroupName("general")]
|
||||
[ProducesResponseType(typeof(List<DecoTemplateResponseModel>), StatusCodes.Status200OK)]
|
||||
public async Task<List<DecoTemplateResponseModel>> GetAll(CancellationToken cancellationToken)
|
||||
{
|
||||
List<DecoTemplateGroupViewModel> groups =
|
||||
await mediator.Send(new GetAllDecoTemplateGroups(), cancellationToken);
|
||||
var result = new List<DecoTemplateResponseModel>();
|
||||
foreach (DecoTemplateGroupViewModel group in groups)
|
||||
{
|
||||
List<DecoTemplateViewModel> decoTemplates =
|
||||
await mediator.Send(new GetDecoTemplatesByDecoTemplateGroupId(group.Id), cancellationToken);
|
||||
result.AddRange(decoTemplates.Map(ProjectToResponseModel));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpGet("/api/deco-templates/{id:int}", Name = "GetDecoTemplateById")]
|
||||
[Tags("DecoTemplates")]
|
||||
[EndpointSummary("Get a deco template by id")]
|
||||
[EndpointGroupName("general")]
|
||||
[ProducesResponseType(typeof(DecoTemplateResponseModel), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> GetById(int id, CancellationToken cancellationToken)
|
||||
{
|
||||
Option<DecoTemplateViewModel> result = await mediator.Send(new GetDecoTemplateById(id), cancellationToken);
|
||||
return result.Map(ProjectToResponseModel).ToGetResult();
|
||||
}
|
||||
|
||||
[HttpPost("/api/deco-templates")]
|
||||
[Tags("DecoTemplates")]
|
||||
[EndpointSummary("Create a deco template")]
|
||||
[EndpointDescription("Creates an empty deco template in the given deco template group.")]
|
||||
[EndpointGroupName("general")]
|
||||
[ProducesResponseType(typeof(DecoTemplateResponseModel), StatusCodes.Status201Created)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status422UnprocessableEntity)]
|
||||
public async Task<IActionResult> Create(
|
||||
[Required] [FromBody] CreateDecoTemplateRequest request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
Either<BaseError, DecoTemplateViewModel> result =
|
||||
await mediator.Send(request.ToCommand(), cancellationToken);
|
||||
return result.ToCreatedResult(
|
||||
vm => $"/api/deco-templates/{vm.Id}",
|
||||
vm => ProjectToResponseModel(vm));
|
||||
}
|
||||
|
||||
[HttpDelete("/api/deco-templates/{id:int}")]
|
||||
[Tags("DecoTemplates")]
|
||||
[EndpointSummary("Delete a deco template")]
|
||||
[EndpointGroupName("general")]
|
||||
[ProducesResponseType(StatusCodes.Status204NoContent)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> Delete(int id, CancellationToken cancellationToken)
|
||||
{
|
||||
Option<DecoTemplateViewModel> existing = await mediator.Send(new GetDecoTemplateById(id), cancellationToken);
|
||||
if (existing.IsNone)
|
||||
{
|
||||
return ApiResults.NotFoundProblem();
|
||||
}
|
||||
|
||||
Option<BaseError> result = await mediator.Send(new DeleteDecoTemplate(id), cancellationToken);
|
||||
return result.Match<IActionResult>(
|
||||
Some: error => error.ToErrorResult(),
|
||||
None: () => new NoContentResult());
|
||||
}
|
||||
|
||||
[HttpGet("/api/deco-templates/{id:int}/items")]
|
||||
[Tags("DecoTemplates")]
|
||||
[EndpointSummary("Get deco template items")]
|
||||
[EndpointGroupName("general")]
|
||||
[ProducesResponseType(typeof(List<DecoTemplateItemResponseModel>), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
public async Task<IActionResult> GetItems(int id, CancellationToken cancellationToken)
|
||||
{
|
||||
Option<DecoTemplateViewModel> decoTemplate = await mediator.Send(new GetDecoTemplateById(id), cancellationToken);
|
||||
if (decoTemplate.IsNone)
|
||||
{
|
||||
return ApiResults.NotFoundProblem();
|
||||
}
|
||||
|
||||
List<DecoTemplateItemViewModel> items = await mediator.Send(new GetDecoTemplateItems(id), cancellationToken);
|
||||
return new OkObjectResult(
|
||||
items.OrderBy(i => i.StartTime.TimeOfDay).Map(ProjectToResponseModel).ToList());
|
||||
}
|
||||
|
||||
[HttpPut("/api/deco-templates/{id:int}")]
|
||||
[Tags("DecoTemplates")]
|
||||
[EndpointSummary("Replace a deco template and its items")]
|
||||
[EndpointDescription(
|
||||
"Replaces the deco template's name and its full item list. Each item assigns a deco to a start/end time " +
|
||||
"of day; an end time of 00:00:00 means the item runs to the end of the day. Items must not overlap.")]
|
||||
[EndpointGroupName("general")]
|
||||
[ProducesResponseType(typeof(DecoTemplateWithItemsResponseModel), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status404NotFound)]
|
||||
[ProducesResponseType(typeof(ProblemDetails), StatusCodes.Status422UnprocessableEntity)]
|
||||
public async Task<IActionResult> Replace(
|
||||
int id,
|
||||
[Required] [FromBody] ReplaceDecoTemplateRequest request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
Option<DecoTemplateViewModel> maybeDecoTemplate =
|
||||
await mediator.Send(new GetDecoTemplateById(id), cancellationToken);
|
||||
if (maybeDecoTemplate.IsNone)
|
||||
{
|
||||
return ApiResults.NotFoundProblem();
|
||||
}
|
||||
|
||||
int decoTemplateGroupId = maybeDecoTemplate.Map(t => t.DecoTemplateGroupId).IfNone(0);
|
||||
|
||||
Either<BaseError, List<DecoTemplateItemViewModel>> result =
|
||||
await mediator.Send(request.ToCommand(decoTemplateGroupId, id), cancellationToken);
|
||||
|
||||
return await result.Match(
|
||||
Left: error => Task.FromResult(error.ToErrorResult()),
|
||||
Right: async _ =>
|
||||
{
|
||||
Option<DecoTemplateViewModel> refreshed =
|
||||
await mediator.Send(new GetDecoTemplateById(id), cancellationToken);
|
||||
List<DecoTemplateItemViewModel> items =
|
||||
await mediator.Send(new GetDecoTemplateItems(id), cancellationToken);
|
||||
return refreshed.Match(
|
||||
Some: vm => (IActionResult)new OkObjectResult(ProjectToWithItemsResponseModel(vm, items)),
|
||||
None: () => ApiResults.NotFoundProblem());
|
||||
});
|
||||
}
|
||||
|
||||
private static DecoTemplateGroupResponseModel ProjectToResponseModel(DecoTemplateGroupViewModel vm) =>
|
||||
new(vm.Id, vm.Name, vm.DecoTemplateCount);
|
||||
|
||||
private static DecoTemplateResponseModel ProjectToResponseModel(DecoTemplateViewModel vm) =>
|
||||
new(vm.Id, vm.DecoTemplateGroupId, vm.GroupName, vm.Name);
|
||||
|
||||
private static DecoTemplateWithItemsResponseModel ProjectToWithItemsResponseModel(
|
||||
DecoTemplateViewModel vm,
|
||||
List<DecoTemplateItemViewModel> items) =>
|
||||
new(
|
||||
vm.Id,
|
||||
vm.DecoTemplateGroupId,
|
||||
vm.GroupName,
|
||||
vm.Name,
|
||||
items.OrderBy(i => i.StartTime.TimeOfDay).Map(ProjectToResponseModel).ToList());
|
||||
|
||||
private static DecoTemplateItemResponseModel ProjectToResponseModel(DecoTemplateItemViewModel vm) =>
|
||||
new(vm.DecoId, vm.DecoName, vm.StartTime.TimeOfDay, vm.EndTime.TimeOfDay);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using ErsatzTV.Application.Scheduling;
|
||||
|
||||
namespace ErsatzTV.Controllers.Api.Requests;
|
||||
|
||||
public record CreateDecoTemplateGroupRequest(string Name)
|
||||
{
|
||||
public CreateDecoTemplateGroup ToCommand() => new(Name);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using ErsatzTV.Application.Scheduling;
|
||||
|
||||
namespace ErsatzTV.Controllers.Api.Requests;
|
||||
|
||||
public record CreateDecoTemplateRequest(int DecoTemplateGroupId, string Name)
|
||||
{
|
||||
public CreateDecoTemplate ToCommand() => new(DecoTemplateGroupId, Name);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using ErsatzTV.Application.Scheduling;
|
||||
|
||||
namespace ErsatzTV.Controllers.Api.Requests;
|
||||
|
||||
public record DecoTemplateItemRequest(int DecoId, TimeSpan StartTime, TimeSpan EndTime)
|
||||
{
|
||||
public ReplaceDecoTemplateItem ToReplaceItem() => new(DecoId, StartTime, EndTime);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using ErsatzTV.Application.Scheduling;
|
||||
|
||||
namespace ErsatzTV.Controllers.Api.Requests;
|
||||
|
||||
public record ReplaceDecoTemplateRequest(string Name, List<DecoTemplateItemRequest> Items)
|
||||
{
|
||||
public ReplaceDecoTemplateItems ToCommand(int decoTemplateGroupId, int decoTemplateId) =>
|
||||
new(
|
||||
decoTemplateId,
|
||||
decoTemplateGroupId,
|
||||
Name,
|
||||
(Items ?? []).Select(item => item.ToReplaceItem()).ToList());
|
||||
}
|
||||
@@ -3247,6 +3247,597 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/deco-templates/groups": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"DecoTemplates"
|
||||
],
|
||||
"summary": "Get all deco template groups",
|
||||
"operationId": "GetDecoTemplateGroups",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DecoTemplateGroupResponseModel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DecoTemplateGroupResponseModel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DecoTemplateGroupResponseModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"tags": [
|
||||
"DecoTemplates"
|
||||
],
|
||||
"summary": "Create a deco template group",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json-patch+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreateDecoTemplateGroupRequest"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreateDecoTemplateGroupRequest"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreateDecoTemplateGroupRequest"
|
||||
}
|
||||
},
|
||||
"application/*+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreateDecoTemplateGroupRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateGroupResponseModel"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateGroupResponseModel"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateGroupResponseModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Unprocessable Entity",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/deco-templates/groups/{id}": {
|
||||
"delete": {
|
||||
"tags": [
|
||||
"DecoTemplates"
|
||||
],
|
||||
"summary": "Delete a deco template group",
|
||||
"description": "Deletes the deco template group. The database cascade removes every deco template (and its items) in the group; any playout template that used a removed deco template has that reference cleared.",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "No Content"
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/deco-templates": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"DecoTemplates"
|
||||
],
|
||||
"summary": "Get all deco templates",
|
||||
"description": "Returns every deco template as a flat list, ordered by group name then deco template name.",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DecoTemplateResponseModel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DecoTemplateResponseModel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DecoTemplateResponseModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"tags": [
|
||||
"DecoTemplates"
|
||||
],
|
||||
"summary": "Create a deco template",
|
||||
"description": "Creates an empty deco template in the given deco template group.",
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json-patch+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreateDecoTemplateRequest"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreateDecoTemplateRequest"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreateDecoTemplateRequest"
|
||||
}
|
||||
},
|
||||
"application/*+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/CreateDecoTemplateRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"201": {
|
||||
"description": "Created",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateResponseModel"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateResponseModel"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateResponseModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Unprocessable Entity",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/deco-templates/{id}": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"DecoTemplates"
|
||||
],
|
||||
"summary": "Get a deco template by id",
|
||||
"operationId": "GetDecoTemplateById",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateResponseModel"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateResponseModel"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateResponseModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"delete": {
|
||||
"tags": [
|
||||
"DecoTemplates"
|
||||
],
|
||||
"summary": "Delete a deco template",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"204": {
|
||||
"description": "No Content"
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"put": {
|
||||
"tags": [
|
||||
"DecoTemplates"
|
||||
],
|
||||
"summary": "Replace a deco template and its items",
|
||||
"description": "Replaces the deco template's name and its full item list. Each item assigns a deco to a start/end time of day; an end time of 00:00:00 means the item runs to the end of the day. Items must not overlap.",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json-patch+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ReplaceDecoTemplateRequest"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ReplaceDecoTemplateRequest"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ReplaceDecoTemplateRequest"
|
||||
}
|
||||
},
|
||||
"application/*+json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ReplaceDecoTemplateRequest"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": true
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateWithItemsResponseModel"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateWithItemsResponseModel"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/DecoTemplateWithItemsResponseModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"422": {
|
||||
"description": "Unprocessable Entity",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/deco-templates/{id}/items": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"DecoTemplates"
|
||||
],
|
||||
"summary": "Get deco template items",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DecoTemplateItemResponseModel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DecoTemplateItemResponseModel"
|
||||
}
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DecoTemplateItemResponseModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found",
|
||||
"content": {
|
||||
"text/plain": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
},
|
||||
"text/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ProblemDetails"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/ffmpeg/profiles": {
|
||||
"get": {
|
||||
"tags": [
|
||||
@@ -11876,6 +12467,39 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"CreateDecoTemplateGroupRequest": {
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": [
|
||||
"null",
|
||||
"string"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"CreateDecoTemplateRequest": {
|
||||
"required": [
|
||||
"decoTemplateGroupId",
|
||||
"name"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"decoTemplateGroupId": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"name": {
|
||||
"type": [
|
||||
"null",
|
||||
"string"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"CreateFFmpegProfileRequest": {
|
||||
"required": [
|
||||
"name",
|
||||
@@ -12724,6 +13348,132 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"DecoTemplateGroupResponseModel": {
|
||||
"required": [
|
||||
"id",
|
||||
"name",
|
||||
"decoTemplateCount"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"decoTemplateCount": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DecoTemplateItemRequest": {
|
||||
"required": [
|
||||
"decoId",
|
||||
"startTime",
|
||||
"endTime"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"decoId": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"startTime": {
|
||||
"pattern": "^-?(\\d+\\.)?\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,7})?$",
|
||||
"type": "string"
|
||||
},
|
||||
"endTime": {
|
||||
"pattern": "^-?(\\d+\\.)?\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,7})?$",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DecoTemplateItemResponseModel": {
|
||||
"required": [
|
||||
"decoId",
|
||||
"decoName",
|
||||
"startTime",
|
||||
"endTime"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"decoId": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"decoName": {
|
||||
"type": "string"
|
||||
},
|
||||
"startTime": {
|
||||
"pattern": "^-?(\\d+\\.)?\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,7})?$",
|
||||
"type": "string"
|
||||
},
|
||||
"endTime": {
|
||||
"pattern": "^-?(\\d+\\.)?\\d{2}:\\d{2}:\\d{2}(\\.\\d{1,7})?$",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DecoTemplateResponseModel": {
|
||||
"required": [
|
||||
"id",
|
||||
"decoTemplateGroupId",
|
||||
"groupName",
|
||||
"name"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"decoTemplateGroupId": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"groupName": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DecoTemplateWithItemsResponseModel": {
|
||||
"required": [
|
||||
"id",
|
||||
"decoTemplateGroupId",
|
||||
"groupName",
|
||||
"name",
|
||||
"items"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"decoTemplateGroupId": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"groupName": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DecoTemplateItemResponseModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"DeleteMediaItemsRequest": {
|
||||
"required": [
|
||||
"ids"
|
||||
@@ -14815,6 +15565,30 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"ReplaceDecoTemplateRequest": {
|
||||
"required": [
|
||||
"name",
|
||||
"items"
|
||||
],
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": [
|
||||
"null",
|
||||
"string"
|
||||
]
|
||||
},
|
||||
"items": {
|
||||
"type": [
|
||||
"null",
|
||||
"array"
|
||||
],
|
||||
"items": {
|
||||
"$ref": "#/components/schemas/DecoTemplateItemRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"ReplaceScheduleItemsRequest": {
|
||||
"required": [
|
||||
"items"
|
||||
@@ -16927,6 +17701,9 @@
|
||||
{
|
||||
"name": "Decos"
|
||||
},
|
||||
{
|
||||
"name": "DecoTemplates"
|
||||
},
|
||||
{
|
||||
"name": "FFmpeg Profiles"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user