mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Storage - Added LiteDB to SQLite migration UI - Try to die a bit more gracefully Core - Delay start watching plugins for hot reload after initializing UI - Simplify category management logic UI - Avoid crash during profile icon load Storage - Fix entry metadata retrieval
28 lines
937 B
C#
28 lines
937 B
C#
using System;
|
|
using System.Linq;
|
|
using Artemis.Storage.Entities.General;
|
|
using Artemis.Storage.Repositories.Interfaces;
|
|
|
|
namespace Artemis.Storage.Repositories;
|
|
|
|
public class ReleaseRepository(Func<ArtemisDbContext> getContext) : IReleaseRepository
|
|
{
|
|
public bool SaveVersionInstallDate(string version)
|
|
{
|
|
using ArtemisDbContext dbContext = getContext();
|
|
|
|
ReleaseEntity? release = dbContext.Releases.FirstOrDefault(r => r.Version == version);
|
|
if (release != null)
|
|
return false;
|
|
|
|
dbContext.Releases.Add(new ReleaseEntity {Version = version, InstalledAt = DateTimeOffset.UtcNow});
|
|
dbContext.SaveChanges();
|
|
return true;
|
|
}
|
|
|
|
public ReleaseEntity? GetPreviousInstalledVersion()
|
|
{
|
|
using ArtemisDbContext dbContext = getContext();
|
|
return dbContext.Releases.AsEnumerable().OrderByDescending(r => r.InstalledAt).Skip(1).FirstOrDefault();
|
|
}
|
|
} |