Skip to content

Commit

Permalink
[sea-orm-pro] edit
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Dec 20, 2024
1 parent f67d2e6 commit cd572b7
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 10 deletions.
24 changes: 15 additions & 9 deletions sea-orm-pro/docs/01-index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,38 @@

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

3.1 [Theme](03-site-config/01-theme.md)

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)
2 changes: 2 additions & 0 deletions sea-orm-pro/docs/03-site-config/01-theme.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Theme

## Full Spec

```toml
[site.theme]

Expand Down
6 changes: 6 additions & 0 deletions sea-orm-pro/docs/04-raw-table-config/01-basics.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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]

Expand Down
Original file line number Diff line number Diff line change
@@ -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]

Expand Down
Original file line number Diff line number Diff line change
@@ -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]

Expand Down
Original file line number Diff line number Diff line change
@@ -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]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Delete

## Enable Delete

* Is delete enabled in the admin dashboard?

## Full Spec

```toml
[delete]

Expand Down
6 changes: 6 additions & 0 deletions sea-orm-pro/docs/05-composite-table-config/01-basics.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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]

Expand Down
Original file line number Diff line number Diff line change
@@ -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"


Expand Down
34 changes: 34 additions & 0 deletions sea-orm-pro/docs/06-deployment/02-user-auth.md
Original file line number Diff line number Diff line change
@@ -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<AppContext>,
Json(params): Json<PasswordLoginParams>,
) -> Result<Response> {
// Database connection
let db = ctx.db;

// Find user by email
let user = users::Model::find_by_email(db, &params.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(&params.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))
}
```
5 changes: 5 additions & 0 deletions sea-orm-pro/src/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit cd572b7

Please sign in to comment.