blob: 5ed52c5b4004c91ebc7eea8a6b9d73d8efa4e629 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
use tosin::db::models::{Model, Id};
#[derive(Model)]
pub struct Question {
id: Option<Id>,
#[model(max_length=200)]
question_text: String,
/// date published
pub_date: time::PrimitiveDateTime,
}
#[derive(Model)]
pub struct Choice {
id: Option<Id>,
#[model(Question, on_delete=Cascade)]
question: Id,
#[model(max_length=200)]
choice_text: String,
#[model(default = 0)]
votes: usize,
}
|