Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ jobs:
key: ${{ secrets.VM_SSH_KEY }}
script: |
cd ~/website/
FLASK_APP=codesoc.py flask db current 2>/dev/null | grep -q '[0-9a-f]' || \
FLASK_APP=codesoc.py flask db stamp head
FLASK_APP=codesoc.py flask db upgrade

- name: Reset database
Expand Down
49 changes: 49 additions & 0 deletions data/elections.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"categories": [
{
"name": "Management",
"slug": "management",
"positions": [
{ "title": "President", "candidates": [] },
{ "title": "Vice-President", "candidates": [] },
{ "title": "Head of Infrastructure", "candidates": [] }
]
},
{
"name": "Finance Team",
"slug": "finance",
"positions": [
{ "title": "Treasurer", "candidates": [] },
{ "title": "Merchandise Manager", "candidates": [] }
]
},
{
"name": "Academic Team",
"slug": "academic",
"positions": [
{ "title": "Head of Mentoring", "candidates": [] },
{ "title": "Python Course Lead", "candidates": [] },
{ "title": "C++ Course Lead", "candidates": [] },
{ "title": "HPC Team Lead", "candidates": [] }
]
},
{
"name": "Creative Team",
"slug": "creative",
"positions": [
{ "title": "Social Media Lead", "candidates": [] },
{ "title": "Graphics Lead", "candidates": [] },
{ "title": "Video Production", "candidates": [] }
]
},
{
"name": "Community Team",
"slug": "community",
"positions": [
{ "title": "Social Secretary", "candidates": [] },
{ "title": "Sports Coordinator", "candidates": [] },
{ "title": "Diversity Director", "candidates": [] }
]
}
]
}
56 changes: 56 additions & 0 deletions migrations/versions/b300460f8ead_add_election_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"""Add election models

Revision ID: b300460f8ead
Revises: 91e2ccd08922
Create Date: 2026-03-04 09:47:35.646898

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'b300460f8ead'
down_revision = '91e2ccd08922'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('electionCandidates',
sa.Column('candidateID', sa.Integer(), nullable=False),
sa.Column('categorySlug', sa.String(length=64), nullable=True),
sa.Column('categoryName', sa.String(length=128), nullable=True),
sa.Column('positionTitle', sa.String(length=128), nullable=True),
sa.Column('name', sa.String(length=128), nullable=True),
sa.Column('manifestoLink', sa.String(length=512), nullable=True),
sa.PrimaryKeyConstraint('candidateID')
)
op.create_table('electionSettings',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('isOpen', sa.Boolean(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('electionVotes',
sa.Column('voteID', sa.Integer(), nullable=False),
sa.Column('voterStudentID', sa.Integer(), nullable=False),
sa.Column('candidateID', sa.Integer(), nullable=False),
sa.Column('positionTitle', sa.String(length=128), nullable=True),
sa.Column('categorySlug', sa.String(length=64), nullable=True),
sa.Column('rank', sa.Integer(), nullable=True),
sa.Column('points', sa.Integer(), nullable=True),
sa.Column('submittedAt', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('voteID'),
sa.UniqueConstraint('voterStudentID', 'candidateID', name='uq_voter_candidate'),
sa.UniqueConstraint('voterStudentID', 'positionTitle', 'rank', name='uq_voter_position_rank')
)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('electionVotes')
op.drop_table('electionSettings')
op.drop_table('electionCandidates')
# ### end Alembic commands ###