Schülerdokumentation: Einträge, Fehlzeitenbilanz, Datenschutz (Kapitel 5)
Dokumentationseinträge mit Typwahl (Gespräch, Vorkommnis, Förderplan, Fehlzeit, Elternanruf, Elternbrief), vertrauliche Einträge nur nach Bestätigung sichtbar, weiche Löschung mit Nachvollziehbarkeit. Fehlzeiten als Auswertung des bestehenden Anwesenheits-Trackings statt zweiter Erfassung, mit Schwellenwert-Warnung im Schülerdetail und Dashboard. Förderplan-Wiedervorlage als Dashboard-Karte. Datenschutz: Löschfristen mit manueller Bereinigung und DSGVO-Art.-15-Datenauskunft als Export. Auf Nutzer-Feedback hin ergänzt: Elternanruf mit begleitendem Gesprächsprotokoll-Dialog (Punkte abhaken, Eindrücke festhalten), Elternbrief mit Versand-/Rückmeldungs-Tracking, Datei-Anhänge über LiteDBs Dateispeicher, frei vergebbare Labels zur Nachverfolgung mit Dringlichkeits-Farbcodierung, sowie eine sichtbare Farblegende für das bestehende Notenentwicklungs-Diagramm. Dabei einen Absturz behoben: leere Textfelder lieferten über das Binding null statt "", was beim Speichern eine NullReferenceException auslöste. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
using LehrerApp.Core.Interfaces;
|
||||
|
||||
namespace LehrerApp.Data;
|
||||
|
||||
public class LiteAttachmentStorage(LiteDbContext db) : IAttachmentStorage
|
||||
{
|
||||
public string Upload(string fileName, Stream content)
|
||||
{
|
||||
if (content.Length > IAttachmentStorage.MaxSizeBytes)
|
||||
throw new InvalidOperationException(
|
||||
$"Datei ist größer als {IAttachmentStorage.MaxSizeBytes / 1024 / 1024} MB.");
|
||||
|
||||
var id = Guid.NewGuid().ToString("N");
|
||||
db.Attachments.Upload(id, fileName, content);
|
||||
return id;
|
||||
}
|
||||
|
||||
public Stream? OpenRead(string storageId) =>
|
||||
db.Attachments.Exists(storageId) ? db.Attachments.OpenRead(storageId) : null;
|
||||
|
||||
public void Delete(string storageId) => db.Attachments.Delete(storageId);
|
||||
}
|
||||
@@ -46,6 +46,7 @@ public class LiteDbContext : IDisposable
|
||||
public ILiteCollection<Unit> Units => _db.GetCollection<Unit>("units");
|
||||
public ILiteCollection<Lesson> Lessons => _db.GetCollection<Lesson>("lessons");
|
||||
public ILiteCollection<Documentation> Documentation => _db.GetCollection<Documentation>("documentation");
|
||||
public ILiteStorage<string> Attachments => _db.GetStorage<string>("attachments", "attachments_chunks");
|
||||
public ILiteCollection<WorkTask> Tasks => _db.GetCollection<WorkTask>("tasks");
|
||||
public ILiteCollection<TimeEntry> TimeEntries => _db.GetCollection<TimeEntry>("time_entries");
|
||||
public ILiteCollection<ParticipationSession> ParticipationSessions => _db.GetCollection<ParticipationSession>("participation_sessions");
|
||||
|
||||
@@ -190,12 +190,28 @@ public class LessonRepository(LiteDbContext db) : ILessonRepository
|
||||
public class DocumentationRepository(LiteDbContext db) : IDocumentationRepository
|
||||
{
|
||||
public List<Documentation> GetByStudent(Guid id) =>
|
||||
db.Documentation.Find(d => d.StudentId == id).OrderByDescending(d => d.Date).ToList();
|
||||
db.Documentation.Find(d => d.StudentId == id && !d.IsDeleted).OrderByDescending(d => d.Date).ToList();
|
||||
public List<Documentation> GetByStudentAndType(Guid sid, DocumentationType type) =>
|
||||
db.Documentation.Find(d => d.StudentId == sid && d.Type == type)
|
||||
db.Documentation.Find(d => d.StudentId == sid && d.Type == type && !d.IsDeleted)
|
||||
.OrderByDescending(d => d.Date).ToList();
|
||||
public List<Documentation> GetAll() =>
|
||||
db.Documentation.Find(d => !d.IsDeleted).OrderByDescending(d => d.Date).ToList();
|
||||
public void Save(Documentation d) { d.UpdatedAt = DateTime.UtcNow; db.Documentation.Upsert(d); }
|
||||
public void Delete(Guid id) => db.Documentation.Delete(id);
|
||||
public void Delete(Guid id)
|
||||
{
|
||||
var doc = db.Documentation.FindById(id);
|
||||
if (doc is null) return;
|
||||
doc.IsDeleted = true;
|
||||
doc.DeletedAt = DateTime.UtcNow;
|
||||
db.Documentation.Update(doc);
|
||||
}
|
||||
public void HardDelete(Guid id)
|
||||
{
|
||||
var doc = db.Documentation.FindById(id);
|
||||
if (doc is not null)
|
||||
foreach (var attachment in doc.Attachments) db.Attachments.Delete(attachment.StorageId);
|
||||
db.Documentation.Delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
public class WorkTaskRepository(LiteDbContext db) : IWorkTaskRepository
|
||||
|
||||
Reference in New Issue
Block a user