Files
boring-lang/goal-examples/webapp/models.bl

33 lines
794 B
Plaintext
Raw Normal View History

2025-10-09 17:40:54 -06:00
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;
}