diff --git a/__pycache__/app.cpython-313.pyc b/__pycache__/app.cpython-313.pyc index a39f09a..7cd674d 100644 Binary files a/__pycache__/app.cpython-313.pyc and b/__pycache__/app.cpython-313.pyc differ diff --git a/__pycache__/models.cpython-313.pyc b/__pycache__/models.cpython-313.pyc index f8a220e..f868725 100644 Binary files a/__pycache__/models.cpython-313.pyc and b/__pycache__/models.cpython-313.pyc differ diff --git a/app.py b/app.py index 34940a5..faaf2a2 100644 --- a/app.py +++ b/app.py @@ -29,9 +29,10 @@ import os # Modelle importieren from models import ( - db, User, Thought, Comment, MindMapNode, ThoughtRelation, ThoughtRating, - RelationType, Category, UserMindmap, UserMindmapNode, MindmapNote, - node_thought_association, user_thought_bookmark, node_relationship + db, User, Thought, Comment, MindMapNode, ThoughtRelation, ThoughtRating, + RelationType, Category, UserMindmap, UserMindmapNode, MindmapNote, + node_thought_association, user_thought_bookmark, node_relationship, + MindmapShare, PermissionType ) # Lade .env-Datei diff --git a/database/systades.db b/database/systades.db index efc21de..a528d12 100644 Binary files a/database/systades.db and b/database/systades.db differ diff --git a/logs/app.log b/logs/app.log index 49be42e..3d3804f 100644 --- a/logs/app.log +++ b/logs/app.log @@ -13,3 +13,9 @@ 2025-05-10 23:14:44,251 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:75] 2025-05-10 23:14:46,088 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:75] 2025-05-10 23:14:46,088 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:75] +2025-05-10 23:15:14,106 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:75] +2025-05-10 23:15:15,855 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:75] +2025-05-10 23:15:15,855 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:75] +2025-05-10 23:15:30,739 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-10 23:15:32,667 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] +2025-05-10 23:15:32,667 INFO: Anwendung gestartet [in C:\Users\TTOMCZA.EMEA\Dev\website\app.py:76] diff --git a/models.py b/models.py index e275d1b..ca8573a 100644 --- a/models.py +++ b/models.py @@ -359,4 +359,33 @@ class ForumPost(db.Model): replies = db.relationship('ForumPost', backref=db.backref('parent', remote_side=[id]), lazy=True) def __repr__(self): - return f'' \ No newline at end of file + return f'' + +# Berechtigungstypen für Mindmap-Freigaben +class PermissionType(Enum): + READ = "Nur-Lesen" + EDIT = "Bearbeiten" + ADMIN = "Administrator" + +# Freigabemodell für Mindmaps +class MindmapShare(db.Model): + """Speichert Informationen über freigegebene Mindmaps und Berechtigungen""" + id = db.Column(db.Integer, primary_key=True) + mindmap_id = db.Column(db.Integer, db.ForeignKey('user_mindmap.id'), nullable=False) + shared_by_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) + shared_with_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) + permission_type = db.Column(db.Enum(PermissionType), nullable=False, default=PermissionType.READ) + created_at = db.Column(db.DateTime, default=datetime.utcnow) + last_accessed = db.Column(db.DateTime, nullable=True) + + # Beziehungen + mindmap = db.relationship('UserMindmap', backref=db.backref('shares', lazy='dynamic')) + shared_by = db.relationship('User', foreign_keys=[shared_by_id], backref=db.backref('shared_mindmaps', lazy='dynamic')) + shared_with = db.relationship('User', foreign_keys=[shared_with_id], backref=db.backref('accessible_mindmaps', lazy='dynamic')) + + __table_args__ = ( + db.UniqueConstraint('mindmap_id', 'shared_with_id', name='unique_mindmap_share'), + ) + + def __repr__(self): + return f'' \ No newline at end of file