Send help, im stuck in life time hell

This commit is contained in:
2025-09-13 20:04:24 +03:00
parent 7d88ac6db8
commit 66704b4e2e
19 changed files with 252 additions and 66 deletions

View File

@@ -1,8 +1,9 @@
use anyhow::Result;
use sqlx::prelude::FromRow;
use crate::db::CurrPool;
use crate::db::{CurrPool, tables::TableMeta};
#[derive(Debug, Default, Clone)]
#[derive(Debug, Default, Clone, FromRow)]
pub struct Training {
pub id: i64,
pub name: String,
@@ -11,6 +12,11 @@ pub struct Training {
pub modified_at: i64,
}
impl TableMeta<'_> for Training {
type PrimaryKey = i64;
const TABLE: &'static str = "trainings";
}
impl Training {
pub async fn insert_new(&self, pool: &CurrPool) -> Result<Self> {
let session = sqlx::query_as!(