48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
|
#!/usr/bin/env python3
|
||
|
import enum
|
||
|
from typing import Any
|
||
|
from typing import Optional
|
||
|
from typing import Union
|
||
|
|
||
|
|
||
|
from app.database import Base
|
||
|
from app.database import metadata_obj
|
||
|
|
||
|
from sqlalchemy import Column
|
||
|
from sqlalchemy import Boolean
|
||
|
from sqlalchemy import DateTime
|
||
|
from sqlalchemy import Integer
|
||
|
from sqlalchemy import String
|
||
|
from sqlalchemy import JSON
|
||
|
from sqlalchemy.orm import Mapped
|
||
|
from sqlalchemy.orm import relationship
|
||
|
|
||
|
from datetime import datetime as dtime
|
||
|
from datetime import timezone
|
||
|
|
||
|
def now() -> dtime:
|
||
|
return dtime.now(timezone.utc)
|
||
|
|
||
|
class Actor(Base):
|
||
|
__tablename__ = "actor"
|
||
|
|
||
|
id = Column(Integer, primary_key=True, index=True)
|
||
|
created_at = Column(DateTime(timezone=True), nullable=False, default=now)
|
||
|
updated_at = Column(DateTime(timezone=True), nullable=False, default=now)
|
||
|
|
||
|
ap_id: Mapped[str] = Column(String, unique=True, nullable=False, index=True) # type: ignore
|
||
|
ap_actor = Column(JSON, nullable=False)
|
||
|
ap_actor = Column(String, nullable=False)
|
||
|
|
||
|
is_blocked = Column(Boolean, nullable=False, default=False, server_default="0")
|
||
|
is_deleted = Column(Boolean, nullable=False, default=False, server_default="0")
|
||
|
|
||
|
class IncomingActivity(Base):
|
||
|
__tablename__ = "ingress"
|
||
|
|
||
|
id = Column(Integer, primary_key=True, index=True)
|
||
|
created_at = Column(DateTime(timezone=True), nullable=False, default=now)
|
||
|
|
||
|
ap_id = Column(String, nullable=True, index=True)
|
||
|
ap_object = Column(JSON, nullable=True)
|