Change Over to new derive
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use anyhow::Result;
|
||||
use persmgr_derive::TableMeta;
|
||||
use sqlx::prelude::FromRow;
|
||||
|
||||
use crate::db::{
|
||||
@@ -6,7 +7,8 @@ use crate::db::{
|
||||
tables::{ForeignKey, TableMeta, assignables::missions::Mission, user::User},
|
||||
};
|
||||
|
||||
#[derive(Debug, Default, Clone, FromRow)]
|
||||
#[derive(Debug, Default, Clone, FromRow, TableMeta)]
|
||||
#[meta(table = "records_missions")]
|
||||
pub struct MissionRecord {
|
||||
pub id: i64,
|
||||
pub user_id: ForeignKey<User>,
|
||||
@@ -15,11 +17,6 @@ pub struct MissionRecord {
|
||||
pub created_at: i64,
|
||||
}
|
||||
|
||||
impl TableMeta for MissionRecord {
|
||||
type PrimaryKey = i64;
|
||||
const TABLE: &'static str = "records_missions";
|
||||
}
|
||||
|
||||
impl MissionRecord {
|
||||
pub async fn insert_new(&self, pool: &CurrPool) -> Result<Self> {
|
||||
let session = sqlx::query_as!(
|
||||
|
||||
Reference in New Issue
Block a user