17 lines
724 B
Python
17 lines
724 B
Python
from datetime import datetime, timezone # noqa: F401
|
|
|
|
from sqlalchemy import Boolean, DateTime, ForeignKey, String
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship # noqa: F401
|
|
|
|
from app.models.user import Base
|
|
|
|
|
|
class SSHKey(Base):
|
|
__tablename__ = "ssh_keys"
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
user_id: Mapped[int] = mapped_column(ForeignKey("users.id", ondelete="CASCADE"))
|
|
name: Mapped[str] = mapped_column(String(80))
|
|
public_key: Mapped[str] = mapped_column(String(4096))
|
|
algo: Mapped[str] = mapped_column(String(32))
|
|
expires_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
|
is_active: Mapped[bool] = mapped_column(Boolean, default=True) |