33 lines
794 B
Plaintext
33 lines
794 B
Plaintext
import uuid as uuid;
|
|
import orm as orm;
|
|
|
|
|
|
#[derive(DeepCopy, Debug, PartialEq, DeriveEntityModel)]
|
|
#[orm::model(table_name = "user")]
|
|
pub type User struct {
|
|
#[orm::model(primary_key)]
|
|
pub id: uuid::UUID;
|
|
#[orm::model(unique, column_type = "VARCHAR(256)")]
|
|
pub email: String;
|
|
#[orm::model(nullable)]
|
|
pub password_hash: Option[String];
|
|
}
|
|
|
|
#[derive(DeepCopy, Debug, PartialEq, DeriveEntityModel)]
|
|
#[orm::model(table_name = "todo")]
|
|
pub type Todo struct {
|
|
#[orm::model(primary_key)]
|
|
pub id: uuid::UUID;
|
|
|
|
#[orm::model(foreign_key = "user", on_delete="CASCADE")]
|
|
pub user_id: uuid::UUID;
|
|
|
|
#[orm::model(column_type = "VARCHAR(256)")]
|
|
pub title: String;
|
|
|
|
#[orm::model(column_type = "TEXT")]
|
|
pub description: String;
|
|
|
|
pub created_at: DateTime;
|
|
pub updated_at: DateTime;
|
|
} |