Files
LehrerApp/LehrerApp.Sync/Models/PlainSyncModels.cs

31 lines
1.1 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
namespace LehrerApp.Sync.Models;
/// <summary>
/// Event das die WebApp oder Companion-App erzeugt.
/// Payload ist NICHT verschlüsselt JWT schützt den Transport.
/// Der Desktop-Client erkennt PlainEvents am DeviceType
/// und wendet sie ohne Entschlüsselung an.
/// </summary>
public class PlainSyncEvent
{
public Guid EventId { get; init; } = Guid.NewGuid();
public string DeviceId { get; init; } = "";
public DeviceType DeviceType { get; init; } = DeviceType.Companion;
public DateTime Timestamp { get; init; } = DateTime.UtcNow;
public string EntityType { get; init; } = ""; // "Grade", "Exam", ...
public string EntityId { get; init; } = "";
public string Operation { get; init; } = ""; // "Upsert", "Delete"
public string Payload { get; init; } = ""; // JSON, Klartext
}
/// <summary>
/// Antwort auf einen Plain-Push.
/// </summary>
public record class PlainPushResponse
{
public bool Success { get; init; }
public long ServerSequenceNr { get; init; }
public List<Guid> RejectedEventIds { get; init; } = [];
public string? ErrorMessage { get; init; }
}