mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 17:58:55 +00:00
new token types: comments, audit logs
This commit is contained in:
1 parent
f810256b9c
commit
12ffb2ded1
4 files changed
+30
No files matched your search
@@ -13,6 +13,8 @@ use strum::EnumIter;
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
#[cfg_attr(test, derive(EnumIter, EnumCount))]
|
||||
pub(crate) enum EntityType {
|
||||
AuditLog,
|
||||
Comment,
|
||||
DownloadJob,
|
||||
InferenceJob,
|
||||
MediaUpload,
|
||||
@@ -29,6 +31,8 @@ impl EntityType {
|
||||
|
||||
pub fn prefix(self) -> &'static str {
|
||||
match self {
|
||||
Self::AuditLog => "audit_",
|
||||
Self::Comment => "comment_",
|
||||
Self::DownloadJob => "jdown_", // NB: Was "JGUP:"
|
||||
Self::InferenceJob => "jinf_",
|
||||
Self::MediaUpload => "mu_",
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
use crate::prefixes::EntityType;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use std::fmt::Debug;
|
||||
|
||||
/// The primary key for Audit Logs.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
pub struct AuditLogToken(pub String);
|
||||
|
||||
impl_string_token!(AuditLogToken);
|
||||
impl_crockford_generator!(AuditLogToken, 32usize, EntityType::AuditLog, CrockfordLower);
|
||||
@@ -0,0 +1,12 @@
|
||||
use crate::prefixes::EntityType;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use std::fmt::Debug;
|
||||
|
||||
/// The primary key for Audit Logs.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, sqlx::Type, Debug, Serialize, Deserialize)]
|
||||
#[sqlx(transparent)]
|
||||
pub struct CommentToken(pub String);
|
||||
|
||||
impl_string_token!(CommentToken);
|
||||
impl_crockford_generator!(CommentToken, 32usize, EntityType::Comment, CrockfordLower);
|
||||
@@ -1,4 +1,6 @@
|
||||
// ===== For MySQL =====
|
||||
pub mod audit_logs;
|
||||
pub mod comments;
|
||||
pub mod model_categories;
|
||||
pub mod tts_models;
|
||||
pub mod w2l_templates;
|
||||
|
||||
Reference in new issue
Block a user