diff --git a/sea-orm-pro/docs/01-index.md b/sea-orm-pro/docs/01-index.md index 8ce8fc9014..76639d912c 100644 --- a/sea-orm-pro/docs/01-index.md +++ b/sea-orm-pro/docs/01-index.md @@ -12,9 +12,9 @@ 2. Installation & Configuration - 2.1 [Choosing a Database & Async Runtime](02-install-and-config/01-database.md) + 2.1 [Database & Async Runtime](02-install-and-config/01-database.md) - 2.2 [Initializing Admin Dashboard Frontend](02-install-and-config/02-frontend.md) + 2.2 [Admin Dashboard Frontend](02-install-and-config/02-frontend.md) 3. Site Config @@ -22,22 +22,28 @@ 4. Raw Table Config - 4.1 [Table](04-raw-table-config/01-table.md) + 4.1 [The Basics](04-raw-table-config/01-basics.md) - 4.2 [View](04-raw-table-config/02-view.md) + 4.2 [Table](04-raw-table-config/02-table.md) - 4.3 [Create](04-raw-table-config/03-create.md) + 4.3 [View](04-raw-table-config/03-view.md) - 4.4 [Update](04-raw-table-config/04-update.md) + 4.4 [Create](04-raw-table-config/04-create.md) - 4.5 [Delete](04-raw-table-config/05-delete.md) + 4.5 [Update](04-raw-table-config/05-update.md) + + 4.6 [Delete](04-raw-table-config/06-delete.md) 5. Composite Table Config - 5.1 [Parent Table](05-composite-table-config/01-parent-table.md) + 5.1 [The Basics](05-composite-table-config/01-basics.md) + + 5.2 [Parent Table](05-composite-table-config/02-parent-table.md) - 5.2 [Child Table](05-composite-table-config/02-child-table.md) + 5.3 [Child Table](05-composite-table-config/03-child-table.md) 6. Deployment 6.1 [Nginx](06-deployment/01-nginx.md) + + 6.2 [User Authentication](06-deployment/02-user-auth.md) diff --git a/sea-orm-pro/docs/03-site-config/01-theme.md b/sea-orm-pro/docs/03-site-config/01-theme.md index 2b59a2246d..e76d4a0efb 100644 --- a/sea-orm-pro/docs/03-site-config/01-theme.md +++ b/sea-orm-pro/docs/03-site-config/01-theme.md @@ -1,5 +1,7 @@ # Theme +## Full Spec + ```toml [site.theme] diff --git a/sea-orm-pro/docs/04-raw-table-config/01-basics.md b/sea-orm-pro/docs/04-raw-table-config/01-basics.md new file mode 100644 index 0000000000..2e8f3364dd --- /dev/null +++ b/sea-orm-pro/docs/04-raw-table-config/01-basics.md @@ -0,0 +1,6 @@ +# The Basics + +* The `pro_admin/raw_tables` folder +* TOML file name convention +* The overall structure of the TOML file +* Each section will be explained separately in the following diff --git a/sea-orm-pro/docs/04-raw-table-config/01-table.md b/sea-orm-pro/docs/04-raw-table-config/02-table.md similarity index 69% rename from sea-orm-pro/docs/04-raw-table-config/01-table.md rename to sea-orm-pro/docs/04-raw-table-config/02-table.md index 36dec0f499..c94f999944 100644 --- a/sea-orm-pro/docs/04-raw-table-config/01-table.md +++ b/sea-orm-pro/docs/04-raw-table-config/02-table.md @@ -1,5 +1,26 @@ # Table +## Title + +* Use title case of the TOML file name as the title by default, can be override + +## Table Display + +* Display density +* Items per page + +## Table Columns + +* Show all columns by default, can be disabled +* Set column title +* Set column width +* Set column content ellipsis +* Set column input type for custom rendering +* Join one-to-one relation +* Column display sequence + +## Full Spec + ```toml [table] diff --git a/sea-orm-pro/docs/04-raw-table-config/02-view.md b/sea-orm-pro/docs/04-raw-table-config/03-view.md similarity index 71% rename from sea-orm-pro/docs/04-raw-table-config/02-view.md rename to sea-orm-pro/docs/04-raw-table-config/03-view.md index fe572a3958..20d6bca935 100644 --- a/sea-orm-pro/docs/04-raw-table-config/02-view.md +++ b/sea-orm-pro/docs/04-raw-table-config/03-view.md @@ -1,5 +1,15 @@ # View +## Hidden Columns + +* Columns that are hidden on the view table + +## Table Sorter + +* Sort by which column in ASC / DESC direction + +## Full Spec + ```toml [view] diff --git a/sea-orm-pro/docs/04-raw-table-config/03-create.md b/sea-orm-pro/docs/04-raw-table-config/04-create.md similarity index 57% rename from sea-orm-pro/docs/04-raw-table-config/03-create.md rename to sea-orm-pro/docs/04-raw-table-config/04-create.md index 3d01f7c6d7..ac32e51fef 100644 --- a/sea-orm-pro/docs/04-raw-table-config/03-create.md +++ b/sea-orm-pro/docs/04-raw-table-config/04-create.md @@ -1,5 +1,15 @@ # Create +## Enable Create + +* Is create enabled in the admin dashboard? + +## Hidden Columns + +* Columns that are hidden on the create form + +## Full Spec + ```toml [create] diff --git a/sea-orm-pro/docs/04-raw-table-config/04-update.md b/sea-orm-pro/docs/04-raw-table-config/05-update.md similarity index 57% rename from sea-orm-pro/docs/04-raw-table-config/04-update.md rename to sea-orm-pro/docs/04-raw-table-config/05-update.md index 73347c1470..7eeb9683e3 100644 --- a/sea-orm-pro/docs/04-raw-table-config/04-update.md +++ b/sea-orm-pro/docs/04-raw-table-config/05-update.md @@ -1,5 +1,19 @@ # Update +## Enable Update + +* Is update enabled in the admin dashboard? + +## Hidden Columns + +* Columns that are hidden on the update form + +## Readonly Columns + +* Columns that are readonly on the update form + +## Full Spec + ```toml [update] diff --git a/sea-orm-pro/docs/04-raw-table-config/05-delete.md b/sea-orm-pro/docs/04-raw-table-config/06-delete.md similarity index 51% rename from sea-orm-pro/docs/04-raw-table-config/05-delete.md rename to sea-orm-pro/docs/04-raw-table-config/06-delete.md index b386febef2..74800d1721 100644 --- a/sea-orm-pro/docs/04-raw-table-config/05-delete.md +++ b/sea-orm-pro/docs/04-raw-table-config/06-delete.md @@ -1,5 +1,11 @@ # Delete +## Enable Delete + +* Is delete enabled in the admin dashboard? + +## Full Spec + ```toml [delete] diff --git a/sea-orm-pro/docs/05-composite-table-config/01-basics.md b/sea-orm-pro/docs/05-composite-table-config/01-basics.md new file mode 100644 index 0000000000..d92e2c03d1 --- /dev/null +++ b/sea-orm-pro/docs/05-composite-table-config/01-basics.md @@ -0,0 +1,6 @@ +# The Basics + +* The `pro_admin/composite_tables` folder +* TOML file name convention +* The overall structure of the TOML file +* Each section will be explained separately in the following diff --git a/sea-orm-pro/docs/05-composite-table-config/01-parent-table.md b/sea-orm-pro/docs/05-composite-table-config/02-parent-table.md similarity index 90% rename from sea-orm-pro/docs/05-composite-table-config/01-parent-table.md rename to sea-orm-pro/docs/05-composite-table-config/02-parent-table.md index 37b2ac3572..e775cd71e3 100644 --- a/sea-orm-pro/docs/05-composite-table-config/01-parent-table.md +++ b/sea-orm-pro/docs/05-composite-table-config/02-parent-table.md @@ -1,5 +1,15 @@ # Parent Table +## Name of Parent Table + +* Specify name of the parent table + +## Parent Table is-a Raw Table + +* All raw table config can be applied to parent table + +## Full Spec + ```toml [parent] diff --git a/sea-orm-pro/docs/05-composite-table-config/02-child-table.md b/sea-orm-pro/docs/05-composite-table-config/03-child-table.md similarity index 88% rename from sea-orm-pro/docs/05-composite-table-config/02-child-table.md rename to sea-orm-pro/docs/05-composite-table-config/03-child-table.md index db51f241e8..fd93475372 100644 --- a/sea-orm-pro/docs/05-composite-table-config/02-child-table.md +++ b/sea-orm-pro/docs/05-composite-table-config/03-child-table.md @@ -1,9 +1,19 @@ # Child Table +## Name of Child Table + +* Specify name of the child table + +## Child Table is-a Raw Table + +* All raw table config can be applied to child table + +## Full Spec + ```toml [[children]] -# name of the SeaORM relation +# Name of the SeaORM relation relation = "customer" diff --git a/sea-orm-pro/docs/06-deployment/02-user-auth.md b/sea-orm-pro/docs/06-deployment/02-user-auth.md new file mode 100644 index 0000000000..08940c73c4 --- /dev/null +++ b/sea-orm-pro/docs/06-deployment/02-user-auth.md @@ -0,0 +1,34 @@ +# User Authentication + +You can override the login procedure in `src/controllers/auth.rs`. + +```rust +// Login with email and password +async fn password_login( + State(ctx): State, + Json(params): Json, +) -> Result { + // Database connection + let db = ctx.db; + + // Find user by email + let user = users::Model::find_by_email(db, ¶ms.email).await?; + + // Validate password + let algo = otpshka::Algorithm::SHA256; + let secret = "fxq9rHswDLfFVkdC69FeJPXStVMjwUjP".as_bytes(); + let totp = otpshka::TOTP::new(algo, secret); + let valid = totp.verify_now(¶ms.password); + if !valid { + return unauthorized("unauthorized!"); + } + + // Generate JWT + let jwt_secret = ctx.config.get_jwt_config()?; + let token = user + .generate_jwt(&jwt_secret.secret, &jwt_secret.expiration) + .or_else(|_| unauthorized("unauthorized!"))?; + + format::json(LoginResponse::new(&user, &token)) +} +``` diff --git a/sea-orm-pro/src/css/custom.css b/sea-orm-pro/src/css/custom.css index e262f1c601..6f1c716d6f 100644 --- a/sea-orm-pro/src/css/custom.css +++ b/sea-orm-pro/src/css/custom.css @@ -81,3 +81,8 @@ div[class^=announcementBar_] { .hover-btn:hover { color: #fff; } + +/* Tailwind and Prism both use the .table class. This resets the display:table property set by Tailwind. https://github.com/EmaApps/emanote/issues/320 */ +code span.token.table { + display:inline; +}