[DB] Update migrations for datetime update
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="Library\" />
|
||||||
<Folder Include="Logs\Debug\" />
|
<Folder Include="Logs\Debug\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@@ -8,21 +8,26 @@ namespace Manager.App.Services.System;
|
|||||||
public class ClientManager : BackgroundService
|
public class ClientManager : BackgroundService
|
||||||
{
|
{
|
||||||
private readonly List<YouTubeClient> _clients = [];
|
private readonly List<YouTubeClient> _clients = [];
|
||||||
private bool _cancelled;
|
private CancellationToken _cancellationToken;
|
||||||
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
{
|
{
|
||||||
|
_cancellationToken = stoppingToken;
|
||||||
stoppingToken.Register(CancellationRequested);
|
stoppingToken.Register(CancellationRequested);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CancellationRequested()
|
private void CancellationRequested()
|
||||||
{
|
{
|
||||||
_cancelled = true;
|
|
||||||
// Clear up
|
// Clear up
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Result<YouTubeClient>> LoadClient(ClientAccountEntity accountEntity)
|
public async Task<Result<YouTubeClient>> LoadClient(ClientAccountEntity accountEntity)
|
||||||
{
|
{
|
||||||
|
if (_cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
return ResultError.Fail("Service is shutting down.");
|
||||||
|
}
|
||||||
|
|
||||||
var container = new CookieContainer();
|
var container = new CookieContainer();
|
||||||
|
|
||||||
if (accountEntity.HttpCookies.Count != 0)
|
if (accountEntity.HttpCookies.Count != 0)
|
||||||
|
12
Manager.App/Services/System/SystemService.cs
Normal file
12
Manager.App/Services/System/SystemService.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace Manager.App.Services.System;
|
||||||
|
|
||||||
|
public class SystemService : BackgroundService
|
||||||
|
{
|
||||||
|
private CancellationToken _cancellationToken { get; set; }
|
||||||
|
|
||||||
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
||||||
|
{
|
||||||
|
_cancellationToken = stoppingToken;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -11,6 +11,7 @@ public sealed class LibraryDbContext : DbContext
|
|||||||
{
|
{
|
||||||
ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;
|
||||||
ChangeTracker.LazyLoadingEnabled = false;
|
ChangeTracker.LazyLoadingEnabled = false;
|
||||||
|
Database.EnsureCreated();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DbSet<CaptionEntity> Captions { get; set; }
|
public DbSet<CaptionEntity> Captions { get; set; }
|
||||||
|
@@ -11,7 +11,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||||||
namespace Manager.Data.Migrations
|
namespace Manager.Data.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(LibraryDbContext))]
|
[DbContext(typeof(LibraryDbContext))]
|
||||||
[Migration("20250902133345_InitialLibrary")]
|
[Migration("20250902141251_InitialLibrary")]
|
||||||
partial class InitialLibrary
|
partial class InitialLibrary
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -30,6 +30,12 @@ namespace Manager.Data.Migrations
|
|||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAtUtc")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModifiedUtc")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
@@ -157,10 +163,10 @@ namespace Manager.Data.Migrations
|
|||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("DateAddedUtc")
|
b.Property<DateTime>("CreatedAtUtc")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("DateModifiedUtc")
|
b.Property<DateTime>("LastModifiedUtc")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.HasKey("PlaylistId", "MediaId");
|
b.HasKey("PlaylistId", "MediaId");
|
||||||
@@ -242,6 +248,9 @@ namespace Manager.Data.Migrations
|
|||||||
b.Property<long>("ContentLengthBytes")
|
b.Property<long>("ContentLengthBytes")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAtUtc")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<double?>("Framerate")
|
b.Property<double?>("Framerate")
|
||||||
.HasColumnType("REAL");
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
@@ -254,6 +263,9 @@ namespace Manager.Data.Migrations
|
|||||||
b.Property<long>("LastModifiedUnixEpoch")
|
b.Property<long>("LastModifiedUnixEpoch")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModifiedUtc")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<double?>("LoudnessDb")
|
b.Property<double?>("LoudnessDb")
|
||||||
.HasColumnType("REAL");
|
.HasColumnType("REAL");
|
||||||
|
|
@@ -131,7 +131,9 @@ namespace Manager.Data.Migrations
|
|||||||
{
|
{
|
||||||
MediaId = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
MediaId = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
||||||
LanguageCode = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
LanguageCode = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
||||||
Name = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false)
|
Name = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
||||||
|
CreatedAtUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
LastModifiedUtc = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@@ -164,7 +166,9 @@ namespace Manager.Data.Migrations
|
|||||||
QualityLabel = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
QualityLabel = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
||||||
AudioChannels = table.Column<int>(type: "INTEGER", nullable: true),
|
AudioChannels = table.Column<int>(type: "INTEGER", nullable: true),
|
||||||
AudioSampleRate = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
AudioSampleRate = table.Column<string>(type: "TEXT", maxLength: 100, nullable: true),
|
||||||
LoudnessDb = table.Column<double>(type: "REAL", nullable: true)
|
LoudnessDb = table.Column<double>(type: "REAL", nullable: true),
|
||||||
|
CreatedAtUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
|
LastModifiedUtc = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@@ -183,8 +187,8 @@ namespace Manager.Data.Migrations
|
|||||||
{
|
{
|
||||||
PlaylistId = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
PlaylistId = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
||||||
MediaId = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
MediaId = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false),
|
||||||
DateAddedUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
|
CreatedAtUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
|
||||||
DateModifiedUtc = table.Column<DateTime>(type: "TEXT", nullable: false)
|
LastModifiedUtc = table.Column<DateTime>(type: "TEXT", nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
@@ -27,6 +27,12 @@ namespace Manager.Data.Migrations
|
|||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAtUtc")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModifiedUtc")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
@@ -154,10 +160,10 @@ namespace Manager.Data.Migrations
|
|||||||
.HasMaxLength(100)
|
.HasMaxLength(100)
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("DateAddedUtc")
|
b.Property<DateTime>("CreatedAtUtc")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<DateTime>("DateModifiedUtc")
|
b.Property<DateTime>("LastModifiedUtc")
|
||||||
.HasColumnType("TEXT");
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.HasKey("PlaylistId", "MediaId");
|
b.HasKey("PlaylistId", "MediaId");
|
||||||
@@ -239,6 +245,9 @@ namespace Manager.Data.Migrations
|
|||||||
b.Property<long>("ContentLengthBytes")
|
b.Property<long>("ContentLengthBytes")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("CreatedAtUtc")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<double?>("Framerate")
|
b.Property<double?>("Framerate")
|
||||||
.HasColumnType("REAL");
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
@@ -251,6 +260,9 @@ namespace Manager.Data.Migrations
|
|||||||
b.Property<long>("LastModifiedUnixEpoch")
|
b.Property<long>("LastModifiedUnixEpoch")
|
||||||
.HasColumnType("INTEGER");
|
.HasColumnType("INTEGER");
|
||||||
|
|
||||||
|
b.Property<DateTime>("LastModifiedUtc")
|
||||||
|
.HasColumnType("TEXT");
|
||||||
|
|
||||||
b.Property<double?>("LoudnessDb")
|
b.Property<double?>("LoudnessDb")
|
||||||
.HasColumnType("REAL");
|
.HasColumnType("REAL");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user