// Generated code from WYRE Script use serde::{Deserialize, Serialize}; use chrono::{DateTime, Utc}; use uuid::Uuid; use sqlx::sqlite::SqlitePool; use async_trait::async_trait; use thiserror::Error; #[derive(Error, Debug)] pub enum WyreError { #[error("Database error: {0}")] DatabaseError(#[from] sqlx::Error), #[error("Validation error: {0}")] ValidationError(String), #[error("Authorization error: {0}")] AuthorizationError(String), #[error("Not found: {0}")] NotFoundError(String), } #[async_trait] pub trait DbModel: Sized { async fn create(self, db: &SqlitePool) -> Result; async fn read(id: Uuid, db: &SqlitePool) -> Result; async fn update(self, db: &SqlitePool) -> Result; async fn delete(id: Uuid, db: &SqlitePool) -> Result<(), WyreError>; } {% include "models.rs.tera" %} {% include "messages.rs.tera" %} {% include "services.rs.tera" %} {% include "hooks.rs.tera" %}