summaryrefslogtreecommitdiff
path: root/src/db/mod.rs
blob: 70505279578b76185fdd40c3b67caa8161c2ba6a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use sqlx::SqlitePool;

use crate::error::AppError;
use async_trait::async_trait;

pub mod game;
pub mod product;
pub mod producttag;
pub mod story;
pub mod tag;
pub mod tool;

#[async_trait]
pub trait ProductDatabaseHandler {
    async fn get_all(pool: &SqlitePool) -> Result<Vec<Self>, AppError>
    where
        Self: Sized;

    async fn post(
        &self,
        pool: &SqlitePool,
        name: String,
        description: String,
    ) -> Result<Self, AppError>
    where
        Self: Sized;
}