File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
byte_bot/server/domain/guilds Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 2222 GitHubConfigSchema ,
2323 GuildSchema ,
2424 SOTagsConfigSchema ,
25+ UpdateableGuildSettingEnum ,
2526)
2627from byte_bot .server .domain .guilds .services import (
2728 AllowedUsersConfigService , # noqa: TC001
@@ -118,7 +119,7 @@ async def update_guild(
118119 title = "Guild ID" ,
119120 description = "The guild ID." ,
120121 ),
121- setting : str = Parameter (
122+ setting : UpdateableGuildSettingEnum = Parameter ( # type: ignore[valid-type]
122123 title = "Setting" ,
123124 description = "The setting to update." ,
124125 ),
@@ -141,7 +142,7 @@ async def update_guild(
141142 result = await guilds_service .get (guild_id , id_attribute = "guild_id" )
142143 # todo: this is a placeholder, update to grab whichever setting is being update, and update the corresponding
143144 # tables value based on the setting parameter
144- await guilds_service .update ({setting : value }, item_id = guild_id )
145+ await guilds_service .update ({setting . value : value }, item_id = guild_id )
145146 return guilds_service .to_schema (schema_type = GuildSchema , data = result )
146147
147148 @get (
Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5+ from enum import Enum
56from uuid import UUID # noqa: TC003
67
78from pydantic import Field
1718 "GuildUpdate" ,
1819 "SOTagsConfigSchema" ,
1920 "UpdateableGuildSetting" ,
21+ "UpdateableGuildSettingEnum" ,
2022)
2123
2224
@@ -172,3 +174,10 @@ class UpdateableGuildSetting(CamelizedBaseModel):
172174 showcase_thread_auto_close_days : int = Field (
173175 title = "Showcase Thread Auto Close Days" , description = "The days to auto close showcase threads after inactivity."
174176 )
177+
178+
179+ # idk
180+ UpdateableGuildSettingEnum = Enum ( # type: ignore[misc]
181+ "UpdateableGuildSettingEnum" ,
182+ {field_name .upper (): field_name for field_name in UpdateableGuildSetting .model_fields },
183+ )
You can’t perform that action at this time.
0 commit comments