Skip to content

Commit

Permalink
Add challenge routes and ability to join and request challenges
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferrariic committed Mar 17, 2023
1 parent c988385 commit e674557
Show file tree
Hide file tree
Showing 4 changed files with 357 additions and 29 deletions.
10 changes: 10 additions & 0 deletions api/database/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ class ChallengeDetailsDay(Base):
is_start = Column(INTEGER)


class ChallengeMembers(Base):
__tablename__ = "challenge_members"

id = Column(INTEGER, primary_key=True)
challenge_id = Column(INTEGER)
recruiter = Column(INTEGER)
request_status = Column(INTEGER)
user_id = Column(INTEGER)


class Organization(Base):
__tablename__ = "organization"
ID = Column(INTEGER, primary_key=True, autoincrement=True)
Expand Down
8 changes: 8 additions & 0 deletions api/database/tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,12 @@ CREATE TABLE `organization_members` (
`recruiter` int DEFAULT NULL,
`request_status` int NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
CREATE TABLE `challenge_members` (
`id` int NOT NULL AUTO_INCREMENT,
`challenge_id` int NOT NULL,
`user_id` int NOT NULL,
`recruiter` int NOT NULL,
`request_status` int NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
2 changes: 1 addition & 1 deletion api/routers/models/challenge.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class challenge_details(BaseModel):
end_date: day
distance: int
reward: str
organization: organization
organization: int
leaderboard: leaderboard


Expand Down
Loading

0 comments on commit e674557

Please sign in to comment.