Python backend for a Slack's kudos plugin.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: typing for alembic

+19 -17
+17 -15
kefi/models/database.py
··· 1 + from typing import Optional 2 + 1 3 from sqlalchemy import Column, String 2 4 from sqlmodel import Field, Relationship, SQLModel, create_engine 3 5 ··· 9 11 class User(SQLModel, table=True): # type: ignore 10 12 """A slack user.""" 11 13 12 - id: int | None = Field(default=None, primary_key=True) 13 - first_name: str | None = "" 14 - last_name: str | None = "" 14 + id: Optional[int] = Field(default=None, primary_key=True) 15 + first_name: Optional[str] = "" 16 + last_name: Optional[str] = "" 15 17 slack_user_id: str = Field(sa_column=Column(String(100), unique=True, index=True)) 16 - slack_username: str | None = "" 18 + slack_username: Optional[str] = "" 17 19 transactions: list["Transaction"] = Relationship( 18 20 back_populates="user", 19 21 sa_relationship_kwargs=dict(foreign_keys="[Transaction.user_id]"), ··· 36 38 class Action(SQLModel, table=True): # type: ignore 37 39 """Each action a user can perform to give kefis to another user.""" 38 40 39 - id: int | None = Field(default=None, primary_key=True) 41 + id: Optional[int] = Field(default=None, primary_key=True) 40 42 keyword: str = Field(sa_column=Column(String(100), unique=True, index=True)) 41 43 amount: int 42 44 transactions: list["Transaction"] = Relationship(back_populates="action") ··· 44 46 header_template: str = "" 45 47 message_template: str = "" 46 48 context_template: str = "" 47 - image: str | None 48 - text: str | None 49 + image: Optional[str] 50 + text: Optional[str] 49 51 50 52 51 53 class Transaction(SQLModel, table=True): # type: ignore ··· 53 55 another. 54 56 """ 55 57 56 - id: int | None = Field(default=None, primary_key=True) 58 + id: Optional[int] = Field(default=None, primary_key=True) 57 59 amount: int 58 60 user_id: int = Field(foreign_key="user.id") 59 61 user: User = Relationship( 60 62 back_populates="transactions", 61 63 sa_relationship_kwargs=dict(foreign_keys="[Transaction.user_id]"), 62 64 ) 63 - message: str | None = Field(default=None) 65 + message: Optional[str] = Field(default=None) 64 66 65 67 # Action, the reference of the action used to send the transaction 66 - action_id: int | None = Field(default=None, foreign_key="action.id") 67 - action: "Action" | None = Relationship(back_populates="transactions") 68 + action_id: Optional[int] = Field(default=None, foreign_key="action.id") 69 + action: Optional["Action"] = Relationship(back_populates="transactions") 68 70 69 71 # Sender user, if not defined, is a system transaction 70 - sender_id: int | None = Field(default=None, foreign_key="user.id") 71 - sender: "User" | None = Relationship( 72 + sender_id: Optional[int] = Field(default=None, foreign_key="user.id") 73 + sender: Optional["User"] = Relationship( 72 74 back_populates="transactions_sent", 73 75 sa_relationship_kwargs=dict(foreign_keys="[Transaction.sender_id]"), 74 76 ) 75 77 76 78 # Receiver user 77 - receiver_id: int | None = Field(default=None, foreign_key="user.id") 78 - receiver: "User" | None = Relationship( 79 + receiver_id: Optional[int] = Field(default=None, foreign_key="user.id") 80 + receiver: Optional["User"] = Relationship( 79 81 back_populates="transactions_received", 80 82 sa_relationship_kwargs=dict(foreign_keys="[Transaction.receiver_id]"), 81 83 )
+1 -1
poetry.lock
··· 1260 1260 [metadata] 1261 1261 lock-version = "1.1" 1262 1262 python-versions = "^3.10" 1263 - content-hash = "3de1ef8fa7f1fa256f2923864a5ce3adc1f26678d8c3a4d1de284df38749e8aa" 1263 + content-hash = "4b3065ab74cdd53056aeb1c2743923dc78a8013ea7b7cfa11383dfcbd63bcb11" 1264 1264 1265 1265 [metadata.files] 1266 1266 aiodns = [
+1 -1
pyproject.toml
··· 17 17 ipython = "^7.29.0" 18 18 requests = "^2.26.0" 19 19 arq = "^0.22" 20 - alembic = "^1.7.4" 20 + alembic = "^1.8.1" 21 21 psycopg2-binary = "^2.9.1" 22 22 aiohttp = {version = "^3.8.0", extras = ["speedups"]} 23 23 single-source = "^0.3.0"