diff --git a/current_schema.json b/current_schema.json index c26faf7..b639a10 100644 --- a/current_schema.json +++ b/current_schema.json @@ -1,7 +1,22 @@ { "tables": { - "settings": { + "settings_v1": { "fields": [ + [ + "color", + "frozen", + false + ], + [ + "effect", + "frozen", + false + ], + [ + "is_developer", + "boolean", + false + ], [ "locale", "text", @@ -9,12 +24,12 @@ ], [ "occupation", - "text", + "frozen", false ], [ "pronouns", - "text", + "frozen", false ], [ @@ -39,21 +54,27 @@ ] ], "field_names": [ - "occupation", + "locale", "updated_at", + "color", + "is_developer", "user_id", "username", - "locale", + "effect", + "occupation", "timezone", "pronouns" ], "types_by_name": { - "locale": "text", + "pronouns": "frozen", "updated_at": "timestamp", - "pronouns": "text", - "occupation": "text", - "username": "text", + "is_developer": "boolean", "timezone": "text", + "effect": "frozen", + "color": "frozen", + "locale": "text", + "occupation": "frozen", + "username": "text", "user_id": "int" }, "type_name": "", @@ -62,18 +83,16 @@ "partition_keys": [ "user_id" ], - "clustering_keys": [ - "updated_at" - ], + "clustering_keys": [], "static_columns": [], "global_secondary_indexes": [], "local_secondary_indexes": [], "table_options": null }, - "user_metrics_by_channel_v1": { + "user_metrics_by_category_v1": { "fields": [ [ - "channel_id", + "category_id", "text", false ], @@ -94,22 +113,22 @@ ] ], "field_names": [ - "minutes_watched", - "channel_id", "messages_count", + "category_id", + "minutes_watched", "user_id" ], "types_by_name": { - "channel_id": "text", - "messages_count": "counter", + "category_id": "text", "minutes_watched": "counter", + "messages_count": "counter", "user_id": "int" }, "type_name": "", "table_name": "", "base_table": "", "partition_keys": [ - "channel_id", + "category_id", "user_id" ], "clustering_keys": [], @@ -118,13 +137,18 @@ "local_secondary_indexes": [], "table_options": null }, - "user_tokens_v1": { + "user_most_watched_category_leaderboard_v1": { "fields": [ [ - "access_token", + "category_id", "text", false ], + [ + "minutes_watched", + "int", + false + ], [ "user_id", "int", @@ -132,32 +156,32 @@ ] ], "field_names": [ - "access_token", - "user_id" + "user_id", + "category_id", + "minutes_watched" ], "types_by_name": { - "user_id": "int", - "access_token": "text" + "minutes_watched": "int", + "category_id": "text", + "user_id": "int" }, "type_name": "", "table_name": "", "base_table": "", "partition_keys": [ - "access_token" + "user_id" + ], + "clustering_keys": [ + "category_id", + "minutes_watched" ], - "clustering_keys": [], "static_columns": [], "global_secondary_indexes": [], "local_secondary_indexes": [], "table_options": null }, - "settings_v1": { + "settings": { "fields": [ - [ - "is_developer", - "boolean", - false - ], [ "locale", "text", @@ -165,12 +189,12 @@ ], [ "occupation", - "frozen", + "text", false ], [ "pronouns", - "frozen", + "text", false ], [ @@ -195,24 +219,22 @@ ] ], "field_names": [ - "user_id", "pronouns", - "updated_at", - "username", - "locale", + "occupation", "timezone", - "is_developer", - "occupation" + "user_id", + "username", + "updated_at", + "locale" ], "types_by_name": { - "occupation": "frozen", + "user_id": "int", + "locale": "text", "username": "text", - "is_developer": "boolean", - "updated_at": "timestamp", - "pronouns": "frozen", + "pronouns": "text", + "occupation": "text", "timezone": "text", - "locale": "text", - "user_id": "int" + "updated_at": "timestamp" }, "type_name": "", "table_name": "", @@ -220,22 +242,19 @@ "partition_keys": [ "user_id" ], - "clustering_keys": [], + "clustering_keys": [ + "updated_at" + ], "static_columns": [], "global_secondary_indexes": [], "local_secondary_indexes": [], "table_options": null }, - "user_metrics_v1": { + "user_tokens_v1": { "fields": [ [ - "messages_count", - "counter", - false - ], - [ - "minutes_watched", - "counter", + "access_token", + "text", false ], [ @@ -245,20 +264,18 @@ ] ], "field_names": [ - "minutes_watched", "user_id", - "messages_count" + "access_token" ], "types_by_name": { - "user_id": "int", - "messages_count": "counter", - "minutes_watched": "counter" + "access_token": "text", + "user_id": "int" }, "type_name": "", "table_name": "", "base_table": "", "partition_keys": [ - "user_id" + "access_token" ], "clustering_keys": [], "static_columns": [], @@ -266,13 +283,8 @@ "local_secondary_indexes": [], "table_options": null }, - "user_metrics_by_category_v1": { + "user_metrics_v1": { "fields": [ - [ - "category_id", - "text", - false - ], [ "messages_count", "counter", @@ -291,21 +303,18 @@ ], "field_names": [ "messages_count", - "category_id", - "user_id", - "minutes_watched" + "minutes_watched", + "user_id" ], "types_by_name": { - "messages_count": "counter", - "minutes_watched": "counter", "user_id": "int", - "category_id": "text" + "minutes_watched": "counter", + "messages_count": "counter" }, "type_name": "", "table_name": "", "base_table": "", "partition_keys": [ - "category_id", "user_id" ], "clustering_keys": [], @@ -314,10 +323,10 @@ "local_secondary_indexes": [], "table_options": null }, - "user_most_watched_category_leaderboard_v1": { + "user_most_watched_channels_leaderboard_v1": { "fields": [ [ - "category_id", + "channel_id", "text", false ], @@ -333,14 +342,14 @@ ] ], "field_names": [ + "minutes_watched", "user_id", - "category_id", - "minutes_watched" + "channel_id" ], "types_by_name": { + "minutes_watched": "int", "user_id": "int", - "category_id": "text", - "minutes_watched": "int" + "channel_id": "text" }, "type_name": "", "table_name": "", @@ -349,7 +358,7 @@ "user_id" ], "clustering_keys": [ - "category_id", + "channel_id", "minutes_watched" ], "static_columns": [], @@ -357,16 +366,21 @@ "local_secondary_indexes": [], "table_options": null }, - "user_most_watched_channels_leaderboard_v1": { + "throttle_v1": { "fields": [ [ - "channel_id", + "content", "text", false ], [ - "minutes_watched", - "int", + "updated_at", + "timestamp", + false + ], + [ + "uri", + "text", false ], [ @@ -376,45 +390,48 @@ ] ], "field_names": [ - "channel_id", - "user_id", - "minutes_watched" + "updated_at", + "uri", + "content", + "user_id" ], "types_by_name": { - "channel_id": "text", - "minutes_watched": "int", + "updated_at": "timestamp", + "content": "text", + "uri": "text", "user_id": "int" }, "type_name": "", "table_name": "", "base_table": "", "partition_keys": [ + "content", + "uri", "user_id" ], "clustering_keys": [ - "channel_id", - "minutes_watched" + "updated_at" ], "static_columns": [], "global_secondary_indexes": [], "local_secondary_indexes": [], "table_options": null }, - "throttle_v1": { + "user_metrics_by_channel_v1": { "fields": [ [ - "content", + "channel_id", "text", false ], [ - "updated_at", - "timestamp", + "messages_count", + "counter", false ], [ - "uri", - "text", + "minutes_watched", + "counter", false ], [ @@ -424,28 +441,25 @@ ] ], "field_names": [ - "content", - "uri", - "updated_at", - "user_id" + "channel_id", + "messages_count", + "user_id", + "minutes_watched" ], "types_by_name": { - "updated_at": "timestamp", + "channel_id": "text", "user_id": "int", - "content": "text", - "uri": "text" + "minutes_watched": "counter", + "messages_count": "counter" }, "type_name": "", "table_name": "", "base_table": "", "partition_keys": [ - "content", - "uri", + "channel_id", "user_id" ], - "clustering_keys": [ - "updated_at" - ], + "clustering_keys": [], "static_columns": [], "global_secondary_indexes": [], "local_secondary_indexes": [], @@ -453,7 +467,7 @@ } }, "udts": { - "settingoptions": { + "effectoption": { "fields": [ [ "name", @@ -469,17 +483,114 @@ "translation_key", "text", false + ], + [ + "class_name", + "text", + false + ], + [ + "hex", + "text", + false ] ], "field_names": [ - "name", "translation_key", + "class_name", + "hex", + "name", "slug" ], "types_by_name": { + "slug": "text", + "hex": "text", + "name": "text", "translation_key": "text", + "class_name": "text" + }, + "type_name": "", + "table_name": "", + "base_table": "", + "partition_keys": [], + "clustering_keys": [], + "static_columns": [], + "global_secondary_indexes": [], + "local_secondary_indexes": [], + "table_options": null + }, + "coloroption": { + "fields": [ + [ + "name", + "text", + false + ], + [ + "slug", + "text", + false + ], + [ + "translation_key", + "text", + false + ], + [ + "hex", + "text", + false + ] + ], + "field_names": [ + "translation_key", + "slug", + "name", + "hex" + ], + "types_by_name": { + "name": "text", "slug": "text", - "name": "text" + "translation_key": "text", + "hex": "text" + }, + "type_name": "", + "table_name": "", + "base_table": "", + "partition_keys": [], + "clustering_keys": [], + "static_columns": [], + "global_secondary_indexes": [], + "local_secondary_indexes": [], + "table_options": null + }, + "settingoptions": { + "fields": [ + [ + "name", + "text", + false + ], + [ + "slug", + "text", + false + ], + [ + "translation_key", + "text", + false + ] + ], + "field_names": [ + "slug", + "name", + "translation_key" + ], + "types_by_name": { + "slug": "text", + "name": "text", + "translation_key": "text" }, "type_name": "", "table_name": "", @@ -532,22 +643,22 @@ ] ], "field_names": [ - "timezone", - "updated_at", - "username", "occupation", + "timezone", "user_id", - "pronouns", - "locale" + "locale", + "username", + "updated_at", + "pronouns" ], "types_by_name": { - "locale": "text", - "occupation": "text", + "user_id": "int", "updated_at": "timestamp", - "timezone": "text", + "locale": "text", + "pronouns": "text", "username": "text", - "user_id": "int", - "pronouns": "text" + "occupation": "text", + "timezone": "text" }, "type_name": "", "table_name": "", @@ -566,6 +677,16 @@ }, "settings_by_username_v1": { "fields": [ + [ + "color", + "frozen", + false + ], + [ + "effect", + "frozen", + false + ], [ "locale", "text", @@ -603,22 +724,26 @@ ] ], "field_names": [ + "pronouns", + "username", "locale", "updated_at", + "user_id", + "effect", + "color", "timezone", - "username", - "occupation", - "pronouns", - "user_id" + "occupation" ], "types_by_name": { + "timezone": "text", "occupation": "frozen", "locale": "text", "updated_at": "timestamp", - "username": "text", + "pronouns": "frozen", + "color": "frozen", + "effect": "frozen", "user_id": "int", - "timezone": "text", - "pronouns": "frozen" + "username": "text" }, "type_name": "", "table_name": "", diff --git a/src/models/v1/settings.rs b/src/models/v1/settings.rs index 434c46b..9818d63 100644 --- a/src/models/v1/settings.rs +++ b/src/models/v1/settings.rs @@ -11,6 +11,25 @@ pub struct SettingOptions { pub translation_key: Text, } +#[charybdis_udt_model(type_name = coloroption)] +#[derive(Debug, Default, Clone, Deserialize, Serialize)] +pub struct ColorOption { + pub name: Text, + pub slug: Text, + pub translation_key: Text, + pub hex: Option, +} + +#[charybdis_udt_model(type_name = effectoption)] +#[derive(Debug, Default, Clone, Deserialize, Serialize)] +pub struct EffectOption { + pub name: Text, + pub slug: Text, + pub translation_key: Text, + pub class_name: Text, + pub hex: Option, +} + #[charybdis_model( table_name = settings_v1, partition_keys = [user_id], @@ -27,6 +46,8 @@ pub struct Settings { pub timezone: Option, pub occupation: Frozen, pub pronouns: Frozen, + pub color: Frozen, + pub effect: Frozen, pub is_developer: Option, #[serde(default = "default_updated_at")] pub updated_at: Timestamp, diff --git a/src/models/v1/settings_by_username.rs b/src/models/v1/settings_by_username.rs index afc855c..6808489 100644 --- a/src/models/v1/settings_by_username.rs +++ b/src/models/v1/settings_by_username.rs @@ -1,4 +1,4 @@ -use crate::models::v1::settings::SettingOptions; +use crate::models::v1::settings::{ColorOption, EffectOption, SettingOptions}; use charybdis::macros::charybdis_view_model; use charybdis::types::{Frozen, Int, Text, Timestamp}; use serde::{Deserialize, Serialize}; @@ -17,5 +17,7 @@ pub struct SettingsByUsername { pub timezone: Option, pub occupation: Frozen, pub pronouns: Frozen, + pub color: Frozen, + pub effect: Frozen, pub updated_at: Timestamp, }