Skip to content

Commit

Permalink
feat: added first logentry draft
Browse files Browse the repository at this point in the history
  • Loading branch information
creyD committed Oct 10, 2024
1 parent 6abaef7 commit d8798e5
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions app/models/entry.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from creyPY.fastapi.models.base import Base
from sqlalchemy import Column, String, ForeignKey, Enum, JSON
from sqlalchemy.dialects.postgresql import UUID

from enum import Enum as pyenum


class TransactionType(pyenum):
CREATE = "create"
UPDATE = "update"
DELETE = "delete"
UNDEFINED = "undefined"


class LogType(pyenum):
INFO = "info"
WARNING = "warning"
ERROR = "error"
CRITICAL = "critical"


class LogEntry(Base):
application = Column(
UUID(as_uuid=True), ForeignKey("application.id", ondelete="CASCADE"), nullable=False
)

t_type = Column(Enum(TransactionType), nullable=False, default=TransactionType.UNDEFINED)
l_type = Column(Enum(LogType), nullable=False, default=LogType.INFO)

message = Column(String(512), nullable=True)
author = Column(String(512), nullable=False, default="system")

previous_object = Column(JSON, nullable=True)

0 comments on commit d8798e5

Please sign in to comment.