-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove some endpoints, update some model names, remove some models, c…
…ombine some model files
- Loading branch information
1 parent
5bfa254
commit 2bc277b
Showing
21 changed files
with
267 additions
and
331 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,43 @@ | ||
from pydantic import Field | ||
|
||
from otf_api.models.base import OtfItemBase | ||
from otf_api.models.enums import EquipmentType | ||
|
||
|
||
class Year(OtfItemBase): | ||
year: str = Field(..., alias="Year") | ||
is_participated: bool = Field(..., alias="IsParticipated") | ||
in_progress: bool = Field(..., alias="InProgress") | ||
year: int | None = Field(None, alias="Year") | ||
is_participated: bool | None = Field(None, alias="IsParticipated") | ||
in_progress: bool | None = Field(None, alias="InProgress") | ||
|
||
|
||
class Program(OtfItemBase): | ||
challenge_category_id: int = Field(..., alias="ChallengeCategoryId") | ||
challenge_sub_category_id: int = Field(..., alias="ChallengeSubCategoryId") | ||
challenge_name: str = Field(..., alias="ChallengeName") | ||
years: list[Year] = Field(..., alias="Years") | ||
logo_url: str = Field(..., alias="LogoUrl") | ||
# NOTE: These ones do seem to match the ProgramType enums in the OTF app. | ||
# Leaving them as int for now though in case older data or other user's | ||
# data doesn't match up. | ||
challenge_category_id: int | None = Field(None, alias="ChallengeCategoryId") | ||
challenge_sub_category_id: int | None = Field(None, alias="ChallengeSubCategoryId") | ||
challenge_name: str | None = Field(None, alias="ChallengeName") | ||
years: list[Year] = Field(default_factory=list, alias="Years") | ||
|
||
|
||
class Challenge(OtfItemBase): | ||
challenge_category_id: int = Field(..., alias="ChallengeCategoryId") | ||
challenge_sub_category_id: int = Field(..., alias="ChallengeSubCategoryId") | ||
challenge_name: str = Field(..., alias="ChallengeName") | ||
years: list[Year] = Field(..., alias="Years") | ||
logo_url: str = Field(..., alias="LogoUrl") | ||
# NOTE: The challenge category/subcategory ids here do not seem to be at | ||
# all related to the ChallengeType enums or the few SubCategory enums I've | ||
# been able to puzzle out. I haven't been able to link them to any code | ||
# in the OTF app. Due to that, they are being excluded from the model for now. | ||
challenge_category_id: int | None = Field(None, alias="ChallengeCategoryId", exclude=True, repr=False) | ||
challenge_sub_category_id: int | None = Field(None, alias="ChallengeSubCategoryId", exclude=True, repr=False) | ||
challenge_name: str | None = Field(None, alias="ChallengeName") | ||
years: list[Year] = Field(default_factory=list, alias="Years") | ||
|
||
|
||
class Benchmark(OtfItemBase): | ||
equipment_id: int = Field(..., alias="EquipmentId") | ||
equipment_name: str = Field(..., alias="EquipmentName") | ||
years: list[Year] = Field(..., alias="Years") | ||
logo_url: str = Field(..., alias="LogoUrl") | ||
equipment_id: EquipmentType | None = Field(None, alias="EquipmentId") | ||
equipment_name: str | None = Field(None, alias="EquipmentName") | ||
years: list[Year] = Field(default_factory=list, alias="Years") | ||
|
||
|
||
class ChallengeTrackerContent(OtfItemBase): | ||
programs: list[Program] = Field(..., alias="Programs") | ||
challenges: list[Challenge] = Field(..., alias="Challenges") | ||
benchmarks: list[Benchmark] = Field(..., alias="Benchmarks") | ||
class ChallengeTracker(OtfItemBase): | ||
programs: list[Program] = Field(default_factory=list, alias="Programs") | ||
challenges: list[Challenge] = Field(default_factory=list, alias="Challenges") | ||
benchmarks: list[Benchmark] = Field(default_factory=list, alias="Benchmarks") |
Oops, something went wrong.