Skip to content

Commit

Permalink
[profiles] make graduation year an int
Browse files Browse the repository at this point in the history
  • Loading branch information
voltini committed Dec 15, 2024
1 parent 9107782 commit 6c6de70
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 50 deletions.
9 changes: 9 additions & 0 deletions dbschema/migrations/00029-m1cpmoz.edgeql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CREATE MIGRATION m1cpmoz6ue576uzldgepkp5bolfgg2n7l32dfx4ga5gudxbo7ypxxa
ONTO m1vnk3u6ttr6yrd4dkxficgsidqy5264drzusoppur7gowyhmkzmwa
{
ALTER TYPE user::Profile {
ALTER PROPERTY graduation_year {
SET TYPE std::int16 USING (<std::int16>.graduation_year);
};
};
};
2 changes: 1 addition & 1 deletion dbschema/user.esdl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module user {
type Profile {
property birthday -> datetime;
property full_name -> str;
property graduation_year -> str;
property graduation_year -> int16;
property photo -> str;
property pronouns -> str;
property n7_major -> str;
Expand Down
24 changes: 12 additions & 12 deletions nanapi/database/calendar/guild_event_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,9 @@ class ProjectionStatus(StrEnum):


class GuildEventDeleteResultClient(BaseModel):
id: UUID
password_hash: str
username: str


class GuildEventDeleteResultProjection(BaseModel):
id: UUID
channel_id: int
channel_id_str: str
message_id: int | None
message_id_str: str | None
name: str
status: ProjectionStatus
password_hash: str


class GuildEventDeleteResultParticipants(BaseModel):
Expand All @@ -51,6 +41,16 @@ class GuildEventDeleteResultOrganizer(BaseModel):
discord_username: str


class GuildEventDeleteResultProjection(BaseModel):
id: UUID
channel_id: int
message_id: int | None
name: str
status: ProjectionStatus
channel_id_str: str
message_id_str: str | None


class GuildEventDeleteResult(BaseModel):
url: str | None
start_time: datetime
Expand All @@ -62,9 +62,9 @@ class GuildEventDeleteResult(BaseModel):
description: str | None
discord_id: int
id: UUID
projection: GuildEventDeleteResultProjection | None
organizer: GuildEventDeleteResultOrganizer
participants: list[GuildEventDeleteResultParticipants]
projection: GuildEventDeleteResultProjection | None
client: GuildEventDeleteResultClient


Expand Down
24 changes: 12 additions & 12 deletions nanapi/database/calendar/guild_event_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,16 @@ class ProjectionStatus(StrEnum):
COMPLETED = 'COMPLETED'


class GuildEventMergeResultProjection(BaseModel):
id: UUID
channel_id: int
message_id: int | None
name: str
status: ProjectionStatus
channel_id_str: str
message_id_str: str | None


class GuildEventMergeResultOrganizer(BaseModel):
id: UUID
discord_id: int
Expand All @@ -79,20 +89,10 @@ class GuildEventMergeResultParticipants(BaseModel):
discord_username: str


class GuildEventMergeResultProjection(BaseModel):
id: UUID
channel_id: int
channel_id_str: str
message_id: int | None
message_id_str: str | None
name: str
status: ProjectionStatus


class GuildEventMergeResultClient(BaseModel):
username: str
id: UUID
password_hash: str
username: str


class GuildEventMergeResult(BaseModel):
Expand All @@ -107,9 +107,9 @@ class GuildEventMergeResult(BaseModel):
start_time: datetime
url: str | None
client: GuildEventMergeResultClient
projection: GuildEventMergeResultProjection | None
participants: list[GuildEventMergeResultParticipants]
organizer: GuildEventMergeResultOrganizer
projection: GuildEventMergeResultProjection | None


adapter = TypeAdapter(GuildEventMergeResult)
Expand Down
24 changes: 12 additions & 12 deletions nanapi/database/calendar/guild_event_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ class ProjectionStatus(StrEnum):
COMPLETED = 'COMPLETED'


class GuildEventSelectResultProjection(BaseModel):
id: UUID
channel_id: int
message_id: int | None
name: str
status: ProjectionStatus
channel_id_str: str
message_id_str: str | None


class GuildEventSelectResultOrganizer(BaseModel):
id: UUID
discord_id: int
Expand All @@ -35,20 +45,10 @@ class GuildEventSelectResultParticipants(BaseModel):
discord_username: str


class GuildEventSelectResultProjection(BaseModel):
id: UUID
channel_id: int
channel_id_str: str
message_id: int | None
message_id_str: str | None
name: str
status: ProjectionStatus


class GuildEventSelectResultClient(BaseModel):
username: str
id: UUID
password_hash: str
username: str


class GuildEventSelectResult(BaseModel):
Expand All @@ -63,9 +63,9 @@ class GuildEventSelectResult(BaseModel):
start_time: datetime
url: str | None
client: GuildEventSelectResultClient
projection: GuildEventSelectResultProjection | None
participants: list[GuildEventSelectResultParticipants]
organizer: GuildEventSelectResultOrganizer
projection: GuildEventSelectResultProjection | None


adapter = TypeAdapter(list[GuildEventSelectResult])
Expand Down
4 changes: 2 additions & 2 deletions nanapi/database/projection/projo_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ class ProjoSelectResult(BaseModel):
external_medias: list[ProjoSelectResultExternalMedias]
participants: list[ProjoSelectResultParticipants]
guild_events: list[ProjoSelectResultGuildEvents]
message_id_str: str | None
channel_id_str: str
status: ProjectionStatus
name: str
message_id_str: str | None
message_id: int | None
channel_id_str: str
channel_id: int
id: UUID

Expand Down
2 changes: 1 addition & 1 deletion nanapi/database/user/profile_get_by_discord_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ProfileGetByDiscordIdResultUser(BaseModel):
class ProfileGetByDiscordIdResult(BaseModel):
birthday: datetime | None
full_name: str | None
graduation_year: str | None
graduation_year: int | None
photo: str | None
pronouns: str | None
n7_major: str | None
Expand Down
2 changes: 1 addition & 1 deletion nanapi/database/user/profile_merge_select.edgeql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ with
discord_username := <str>$discord_username,
birthday := <optional datetime>$birthday,
full_name := <optional str>$full_name,
graduation_year := <optional str>$graduation_year,
graduation_year := <optional int16>$graduation_year,
photo := <optional str>$photo,
pronouns := <optional str>$pronouns,
n7_major := <optional str>$n7_major,
Expand Down
6 changes: 3 additions & 3 deletions nanapi/database/user/profile_merge_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
discord_username := <str>$discord_username,
birthday := <optional datetime>$birthday,
full_name := <optional str>$full_name,
graduation_year := <optional str>$graduation_year,
graduation_year := <optional int16>$graduation_year,
photo := <optional str>$photo,
pronouns := <optional str>$pronouns,
n7_major := <optional str>$n7_major,
Expand Down Expand Up @@ -73,7 +73,7 @@ class ProfileMergeSelectResultUser(BaseModel):

class ProfileMergeSelectResult(BaseModel):
birthday: datetime | None
graduation_year: str | None
graduation_year: int | None
full_name: str | None
photo: str | None
pronouns: str | None
Expand All @@ -92,7 +92,7 @@ async def profile_merge_select(
discord_username: str,
birthday: datetime | None = None,
full_name: str | None = None,
graduation_year: str | None = None,
graduation_year: int | None = None,
photo: str | None = None,
pronouns: str | None = None,
n7_major: str | None = None,
Expand Down
2 changes: 1 addition & 1 deletion nanapi/database/user/profile_select_filter_discord_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ProfileSelectFilterDiscordIdResultUser(BaseModel):
class ProfileSelectFilterDiscordIdResult(BaseModel):
birthday: datetime | None
full_name: str | None
graduation_year: str | None
graduation_year: int | None
photo: str | None
pronouns: str | None
n7_major: str | None
Expand Down
2 changes: 1 addition & 1 deletion nanapi/database/user/profile_select_ilike.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ProfileSelectIlikeResultUser(BaseModel):
class ProfileSelectIlikeResult(BaseModel):
birthday: datetime | None
full_name: str | None
graduation_year: str | None
graduation_year: int | None
photo: str | None
pronouns: str | None
n7_major: str | None
Expand Down
2 changes: 1 addition & 1 deletion nanapi/database/waicolle/trade_get_by_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ class TradeGetByIdResult(BaseModel):
received: list[TradeGetByIdResultReceived]
offeree: TradeGetByIdResultOfferee
offered: list[TradeGetByIdResultOffered]
id: UUID
blood_shards: int
completed_at: datetime | None
created_at: datetime
id: UUID


adapter = TypeAdapter(TradeGetByIdResult | None)
Expand Down
2 changes: 1 addition & 1 deletion nanapi/database/waicolle/trade_insert.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ class TradeInsertResult(BaseModel):
received: list[TradeInsertResultReceived]
offeree: TradeInsertResultOfferee
offered: list[TradeInsertResultOffered]
id: UUID
created_at: datetime
completed_at: datetime | None
blood_shards: int
id: UUID


adapter = TypeAdapter(TradeInsertResult)
Expand Down
2 changes: 1 addition & 1 deletion nanapi/database/waicolle/trade_select.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ class TradeSelectResult(BaseModel):
received: list[TradeSelectResultReceived]
offeree: TradeSelectResultOfferee
offered: list[TradeSelectResultOffered]
id: UUID
blood_shards: int
completed_at: datetime | None
created_at: datetime
id: UUID


adapter = TypeAdapter(list[TradeSelectResult])
Expand Down
2 changes: 1 addition & 1 deletion nanapi/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class UpsertProfileBody(BaseModel):
birthday: datetime | None = None
discord_username: str
full_name: str | None = None
graduation_year: str | None = None
graduation_year: int | None = None
n7_major: str | None = None
photo: str | None = None
pronouns: str | None = None
Expand Down

0 comments on commit 6c6de70

Please sign in to comment.