Skip to content

Commit

Permalink
Support metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
hugobessa committed Dec 20, 2024
1 parent fac4f2c commit 1c086a2
Show file tree
Hide file tree
Showing 4 changed files with 196 additions and 77 deletions.
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vintasend_sqlalchemy/alembic_initial_migration_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def create_notification_table(user_id_type: type):
sa.Column('preheader_template', sa.String(255), nullable=True, default=""),
sa.Column('context_name', sa.String(255), nullable=True, default=""),
sa.Column('context_kwargs', sa.JSON, default=dict),
sa.Column('metadata_json', sa.JSON, nullable=True),
sa.Column('send_after', sa.DateTime(), nullable=True),
sa.Column('user_id', user_id_type(), nullable=False),
sa.PrimaryKeyConstraint('id'),
Expand Down
3 changes: 2 additions & 1 deletion vintasend_sqlalchemy/model_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import uuid
from typing import Any, Generic, TypeVar

from sqlalchemy import JSON, BigInteger, DateTime, ForeignKey, Integer, String
from sqlalchemy import JSON, BigInteger, DateTime, ForeignKey, Integer, String, null
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
from sqlalchemy.orm.decl_api import DeclarativeAttributeIntercept

Expand Down Expand Up @@ -33,6 +33,7 @@ class NotificationMixin(Base):
preheader_template: Mapped[str] = mapped_column("preheader_template", String(255), nullable=True, default="")
context_name: Mapped[str] = mapped_column("context_name", String(255), nullable=True, default="")
context_kwargs: Mapped[dict] = mapped_column("context_kwargs", JSON, default=dict)
metadata_json: Mapped[dict | None] = mapped_column("metadata_json", JSON, nullable=True)

send_after = mapped_column("send_after", DateTime, nullable=True)

Expand Down
Loading

0 comments on commit 1c086a2

Please sign in to comment.