diff --git a/surfsense_backend/alembic/versions/91_add_discord_join_incentive_task.py b/surfsense_backend/alembic/versions/91_add_discord_join_incentive_task.py new file mode 100644 index 000000000..58af5968f --- /dev/null +++ b/surfsense_backend/alembic/versions/91_add_discord_join_incentive_task.py @@ -0,0 +1,33 @@ +"""Add DISCORD_JOIN to incentive task type enum + +Revision ID: 91 +Revises: 90 + +Changes: +1. Add DISCORD_JOIN value to incentivetasktype enum +""" + +from collections.abc import Sequence + +from alembic import op + +# revision identifiers, used by Alembic. +revision: str = "91" +down_revision: str | None = "90" +branch_labels: str | Sequence[str] | None = None +depends_on: str | Sequence[str] | None = None + + +def upgrade() -> None: + """Add DISCORD_JOIN to incentivetasktype enum.""" + op.execute("ALTER TYPE incentivetasktype ADD VALUE IF NOT EXISTS 'DISCORD_JOIN'") + + +def downgrade() -> None: + """Remove DISCORD_JOIN from incentivetasktype enum. + + Note: PostgreSQL doesn't support removing values from enums directly. + This would require recreating the enum type, which is complex and risky. + For safety, we leave the enum value in place during downgrade. + """ + pass diff --git a/surfsense_backend/app/db.py b/surfsense_backend/app/db.py index 28b37fe4b..5cdb712db 100644 --- a/surfsense_backend/app/db.py +++ b/surfsense_backend/app/db.py @@ -164,6 +164,7 @@ class IncentiveTaskType(str, Enum): GITHUB_STAR = "GITHUB_STAR" REDDIT_FOLLOW = "REDDIT_FOLLOW" + DISCORD_JOIN = "DISCORD_JOIN" # Future tasks can be added here: # GITHUB_ISSUE = "GITHUB_ISSUE" # SOCIAL_SHARE = "SOCIAL_SHARE" @@ -185,6 +186,12 @@ INCENTIVE_TASKS_CONFIG = { "pages_reward": 100, "action_url": "https://www.reddit.com/r/SurfSense/", }, + IncentiveTaskType.DISCORD_JOIN: { + "title": "Join our Discord", + "description": "Join the SurfSense community on Discord", + "pages_reward": 100, + "action_url": "https://discord.gg/ejRNvftDp9", + }, # Future tasks can be configured here: # IncentiveTaskType.GITHUB_ISSUE: { # "title": "Create an issue",