Skip to content
Open
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
3 changes: 2 additions & 1 deletion src/pwncore/models/ctf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class Problem(BaseProblem):
ma = fields.IntField(default=500)
visible = fields.BooleanField(default=True)
tags = fields.SmallIntField(default=1) # by default misc, 16 tag limit

difficulty_level = fields.SmallIntField(default=1)
problem_type = fields.TextField(default="jeopardy") #Can use enum too

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use SmallIntField

hints: fields.ReverseRelation[Hint]

class PydanticMeta:
Expand Down
19 changes: 19 additions & 0 deletions src/pwncore/models/round2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from tortoise import fields
from tortoise.models import Model
from tortoise.contrib.pydantic import pydantic_model_creator

from pwncore.models.ctf import Problem
from pwncore.models.user import Team


class AttackDefProblem(Model):
id = fields.IntField(pk=True)
team: fields.ForeignKeyRelation[Team] = fields.ForeignKeyField(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

attack_def_team: fields.ForeignKeyRelation[AttackDefTeam] = fields.ForeignKeyField(
  "models.AttackDefTeam", related_name="assigned_attack_def_problem"
)

"models.Team", related_name="attackdef_problems"
)
problem: fields.ForeignKeyRelation[Problem] = fields.ForeignKeyField(
"models.Problem", related_name="problems"
)


AttackDefProblem_Pydantic = pydantic_model_creator(AttackDefProblem)
2 changes: 1 addition & 1 deletion src/pwncore/types.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Only for type aliases and nothing else.
"""
"""