mirror of
https://github.com/Rarebuffalo/securelens-backend.git
synced 2026-06-19 07:00:30 +00:00
updated the architecture
This commit is contained in:
27
app/models/scan.py
Normal file
27
app/models/scan.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from sqlalchemy import DateTime, ForeignKey, Integer, JSON, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class ScanResult(Base):
|
||||
__tablename__ = "scan_results"
|
||||
|
||||
id: Mapped[str] = mapped_column(
|
||||
String(36), primary_key=True, default=lambda: str(uuid.uuid4())
|
||||
)
|
||||
user_id: Mapped[str] = mapped_column(
|
||||
String(36), ForeignKey("users.id"), index=True
|
||||
)
|
||||
url: Mapped[str] = mapped_column(String(2048))
|
||||
security_score: Mapped[int] = mapped_column(Integer)
|
||||
layers: Mapped[dict] = mapped_column(JSON)
|
||||
issues: Mapped[list] = mapped_column(JSON)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)
|
||||
)
|
||||
|
||||
user = relationship("User", back_populates="scans")
|
||||
Reference in New Issue
Block a user