tag token

This commit is contained in:
Brandon Thomas committed 2024-05-15 17:41:58 -07:00
1 parent ba76e70242
commit f584cd103f
3 files changed
+19

No files matched your search

+2
View File
@@ -36,6 +36,7 @@ pub(crate) enum TokenPrefix {
NewsStory, // NB: aichatbot / sqlite
PasswordReset,
Prompt,
Tag,
TtsRenderTask, // NB: aichatbot / sqlite
User,
UserBookmark,
@@ -105,6 +106,7 @@ impl PrefixGenerator for TokenPrefix {
Self::NewsStory => "news_story_",
Self::PasswordReset => "pw_reset_",
Self::Prompt => "prompt_",
Self::Tag => "tag_",
Self::TtsRenderTask => "tts_task_",
Self::User => "user_", // NB: Previously "U:"
Self::UserBookmark => "ub_",
+1
View File
@@ -38,3 +38,4 @@ pub mod w2l_templates;
pub mod zs_voice_dataset_samples;
pub mod zs_voice_datasets;
pub mod zs_voices;
mod tags;
+16
View File
@@ -0,0 +1,16 @@
use std::fmt::Debug;
use serde::Deserialize;
use serde::Serialize;
use utoipa::ToSchema;
use crate::prefixes::TokenPrefix;
/// The primary key for Prompts
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize, ToSchema)]
#[sqlx(transparent)]
pub struct TagToken(pub String);
impl_crockford_generator!(TagToken, 32usize, TokenPrefix::Tag, CrockfordLower);
impl_mysql_token_from_row!(TagToken);
impl_string_token!(TagToken);