mirror of
https://github.com/LD-Reborn/Berufsschule_HAM.git
synced 2025-12-20 23:11:54 +00:00
28 lines
751 B
C#
28 lines
751 B
C#
using System.Text.Json;
|
|
using Berufsschule_HAM.Exceptions;
|
|
|
|
namespace Berufsschule_HAM.Models;
|
|
|
|
public class MigrationModel
|
|
{
|
|
public int Version { get; set; }
|
|
public MigrationModel(Dictionary<string, string> ldapData)
|
|
{
|
|
string? description = ldapData.GetValueOrDefault("description");
|
|
if (description is null)
|
|
{
|
|
Version = 0;
|
|
}
|
|
else
|
|
{
|
|
MigrationDescriptionModel? descriptionModel = JsonSerializer.Deserialize<MigrationDescriptionModel>(description)
|
|
?? throw new InvalidMigrationDescriptionModel();
|
|
Version = descriptionModel.Version;
|
|
}
|
|
}
|
|
}
|
|
|
|
public class MigrationDescriptionModel
|
|
{
|
|
public required int Version { get; set; }
|
|
} |