aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/apps.rs2
-rw-r--r--src/bin/tosin-admin.rs7
-rw-r--r--src/contrib/admin/mod.rs2
-rw-r--r--src/contrib/admin/models.rs6
-rw-r--r--src/db/models/meta.rs3
-rw-r--r--src/db/models/mod.rs5
6 files changed, 23 insertions, 2 deletions
diff --git a/src/apps.rs b/src/apps.rs
index f72a883..8c16136 100644
--- a/src/apps.rs
+++ b/src/apps.rs
@@ -1,6 +1,8 @@
use crate::db::migration::Migration;
+use crate::db::models::ModelMeta;
pub struct AppConfig {
pub name: &'static str,
+ pub models: &'static [ModelMeta],
pub migrations: &'static [Migration],
}
diff --git a/src/bin/tosin-admin.rs b/src/bin/tosin-admin.rs
index 0a359d3..a0ea850 100644
--- a/src/bin/tosin-admin.rs
+++ b/src/bin/tosin-admin.rs
@@ -38,8 +38,10 @@ pub mod views;
pub use urls::urls;
+#[allow(dead_code)]
pub const APP: AppConfig = AppConfig {
name: module_path!(),
+ models: models::ALL,
migrations: migrations::migrations,
};
"#;
@@ -49,9 +51,12 @@ use tosin::db::migration::{Migration, gather};
gather!();
"#;
const APP_MODELS: &str = r#"
-use tosin::db::models::{Model, Id};
+#[allow(unused_imports)]
+use tosin::db::models::{Model, Id, gather};
// TODO define models
+
+gather!();
"#;
const APP_URLS: &str = r#"
use tosin::urls::{UrlMap, url_map};
diff --git a/src/contrib/admin/mod.rs b/src/contrib/admin/mod.rs
index f92e709..8572f8d 100644
--- a/src/contrib/admin/mod.rs
+++ b/src/contrib/admin/mod.rs
@@ -1,9 +1,11 @@
use crate::apps::AppConfig;
mod migrations;
+mod models;
pub mod site;
pub const APP: AppConfig = AppConfig {
name: module_path!(),
+ models: models::ALL,
migrations: migrations::migrations,
};
diff --git a/src/contrib/admin/models.rs b/src/contrib/admin/models.rs
new file mode 100644
index 0000000..7fde44a
--- /dev/null
+++ b/src/contrib/admin/models.rs
@@ -0,0 +1,6 @@
+#[allow(unused_imports)]
+use crate::db::models::{Model, Id, ModelMeta};
+
+pub const ALL: &[ModelMeta] = &[
+
+];
diff --git a/src/db/models/meta.rs b/src/db/models/meta.rs
new file mode 100644
index 0000000..50729a8
--- /dev/null
+++ b/src/db/models/meta.rs
@@ -0,0 +1,3 @@
+pub struct ModelMeta {
+ pub name: &'static str,
+}
diff --git a/src/db/models/mod.rs b/src/db/models/mod.rs
index 492df92..feadb43 100644
--- a/src/db/models/mod.rs
+++ b/src/db/models/mod.rs
@@ -1,4 +1,7 @@
-pub use tosin_macros::Model;
+pub use tosin_macros::{Model, gather_models as gather};
+
+mod meta;
+pub use meta::*;
pub type Id = usize;