mirror of https://github.com/ErsatzTV/ErsatzTV.git
Browse Source
* add playout build status * show build status in playout list * update changelogpull/2477/head
27 changed files with 13866 additions and 79 deletions
@ -1,3 +0,0 @@ |
|||||||
namespace ErsatzTV.Application.Playouts; |
|
||||||
|
|
||||||
public record GetAllPlayouts : IRequest<List<PlayoutNameViewModel>>; |
|
||||||
@ -1,33 +0,0 @@ |
|||||||
using ErsatzTV.Infrastructure.Data; |
|
||||||
using Microsoft.EntityFrameworkCore; |
|
||||||
|
|
||||||
namespace ErsatzTV.Application.Playouts; |
|
||||||
|
|
||||||
public class GetAllPlayoutsHandler : IRequestHandler<GetAllPlayouts, List<PlayoutNameViewModel>> |
|
||||||
{ |
|
||||||
private readonly IDbContextFactory<TvContext> _dbContextFactory; |
|
||||||
|
|
||||||
public GetAllPlayoutsHandler(IDbContextFactory<TvContext> dbContextFactory) => |
|
||||||
_dbContextFactory = dbContextFactory; |
|
||||||
|
|
||||||
public async Task<List<PlayoutNameViewModel>> Handle( |
|
||||||
GetAllPlayouts request, |
|
||||||
CancellationToken cancellationToken) |
|
||||||
{ |
|
||||||
await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); |
|
||||||
return await dbContext.Playouts |
|
||||||
.AsNoTracking() |
|
||||||
.Include(p => p.ProgramSchedule) |
|
||||||
.Filter(p => p.Channel != null) |
|
||||||
.Map(p => new PlayoutNameViewModel( |
|
||||||
p.Id, |
|
||||||
p.ScheduleKind, |
|
||||||
p.Channel.Name, |
|
||||||
p.Channel.Number, |
|
||||||
p.Channel.PlayoutMode, |
|
||||||
p.ProgramScheduleId == null ? string.Empty : p.ProgramSchedule.Name, |
|
||||||
p.ScheduleFile, |
|
||||||
p.DailyRebuildTime)) |
|
||||||
.ToListAsync(cancellationToken); |
|
||||||
} |
|
||||||
} |
|
||||||
@ -0,0 +1,10 @@ |
|||||||
|
namespace ErsatzTV.Core.Domain; |
||||||
|
|
||||||
|
public class PlayoutBuildStatus |
||||||
|
{ |
||||||
|
public int PlayoutId { get; set; } |
||||||
|
public Playout Playout { get; set; } |
||||||
|
public DateTimeOffset LastBuild { get; set; } |
||||||
|
public bool Success { get; set; } |
||||||
|
public string Message { get; set; } |
||||||
|
} |
||||||
@ -0,0 +1,8 @@ |
|||||||
|
namespace ErsatzTV.Core.Scheduling; |
||||||
|
|
||||||
|
public class PlayoutBuildException : Exception |
||||||
|
{ |
||||||
|
public PlayoutBuildException() : base() { } |
||||||
|
public PlayoutBuildException(string message) : base(message) { } |
||||||
|
public PlayoutBuildException(string message, Exception innerException) : base(message, innerException) { } |
||||||
|
} |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,44 @@ |
|||||||
|
using System; |
||||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||||
|
|
||||||
|
#nullable disable |
||||||
|
|
||||||
|
namespace ErsatzTV.Infrastructure.MySql.Migrations |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Add_PlayoutBuildStatus : Migration |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
migrationBuilder.CreateTable( |
||||||
|
name: "PlayoutBuildStatus", |
||||||
|
columns: table => new |
||||||
|
{ |
||||||
|
PlayoutId = table.Column<int>(type: "int", nullable: false), |
||||||
|
LastBuild = table.Column<DateTimeOffset>(type: "datetime(6)", nullable: false), |
||||||
|
Success = table.Column<bool>(type: "tinyint(1)", nullable: false), |
||||||
|
Message = table.Column<string>(type: "longtext", nullable: true) |
||||||
|
.Annotation("MySql:CharSet", "utf8mb4") |
||||||
|
}, |
||||||
|
constraints: table => |
||||||
|
{ |
||||||
|
table.PrimaryKey("PK_PlayoutBuildStatus", x => x.PlayoutId); |
||||||
|
table.ForeignKey( |
||||||
|
name: "FK_PlayoutBuildStatus_Playout_PlayoutId", |
||||||
|
column: x => x.PlayoutId, |
||||||
|
principalTable: "Playout", |
||||||
|
principalColumn: "Id", |
||||||
|
onDelete: ReferentialAction.Cascade); |
||||||
|
}) |
||||||
|
.Annotation("MySql:CharSet", "utf8mb4"); |
||||||
|
} |
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
migrationBuilder.DropTable( |
||||||
|
name: "PlayoutBuildStatus"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,42 @@ |
|||||||
|
using System; |
||||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||||
|
|
||||||
|
#nullable disable |
||||||
|
|
||||||
|
namespace ErsatzTV.Infrastructure.Sqlite.Migrations |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Add_PlayoutBuildStatus : Migration |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
migrationBuilder.CreateTable( |
||||||
|
name: "PlayoutBuildStatus", |
||||||
|
columns: table => new |
||||||
|
{ |
||||||
|
PlayoutId = table.Column<int>(type: "INTEGER", nullable: false), |
||||||
|
LastBuild = table.Column<DateTimeOffset>(type: "TEXT", nullable: false), |
||||||
|
Success = table.Column<bool>(type: "INTEGER", nullable: false), |
||||||
|
Message = table.Column<string>(type: "TEXT", nullable: true) |
||||||
|
}, |
||||||
|
constraints: table => |
||||||
|
{ |
||||||
|
table.PrimaryKey("PK_PlayoutBuildStatus", x => x.PlayoutId); |
||||||
|
table.ForeignKey( |
||||||
|
name: "FK_PlayoutBuildStatus_Playout_PlayoutId", |
||||||
|
column: x => x.PlayoutId, |
||||||
|
principalTable: "Playout", |
||||||
|
principalColumn: "Id", |
||||||
|
onDelete: ReferentialAction.Cascade); |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
migrationBuilder.DropTable( |
||||||
|
name: "PlayoutBuildStatus"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
using ErsatzTV.Core.Domain; |
||||||
|
using Microsoft.EntityFrameworkCore; |
||||||
|
using Microsoft.EntityFrameworkCore.Metadata.Builders; |
||||||
|
|
||||||
|
namespace ErsatzTV.Infrastructure.Data.Configurations; |
||||||
|
|
||||||
|
public class PlayoutBuildStatusConfiguration : IEntityTypeConfiguration<PlayoutBuildStatus> |
||||||
|
{ |
||||||
|
public void Configure(EntityTypeBuilder<PlayoutBuildStatus> builder) |
||||||
|
{ |
||||||
|
builder.ToTable("PlayoutBuildStatus"); |
||||||
|
|
||||||
|
builder.HasKey(p => p.PlayoutId); |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue