Skip to content

Commit 0e2a560

Browse files
committed
Add link rendering
1 parent 134dd14 commit 0e2a560

9 files changed

Lines changed: 64 additions & 13 deletions

File tree

examples/app/src/models/article.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use sea_orm::entity::prelude::*;
22
use serde::{Deserialize, Serialize};
33

4-
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize, vespera::Schema)]
4+
#[derive(
5+
Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize, vespera::Schema,
6+
)]
57
#[serde(rename_all = "camelCase")]
68
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "article_status")]
79
pub enum Status {

examples/app/src/models/article_user.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
use sea_orm::entity::prelude::*;
22
use serde::{Deserialize, Serialize};
33

4-
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize, vespera::Schema)]
4+
#[derive(
5+
Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize, vespera::Schema,
6+
)]
57
#[serde(rename_all = "camelCase")]
68
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "article_user_role")]
79
pub enum Role {

examples/app/src/models/dual.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ pub struct Model {
88
pub username: String,
99
#[sea_orm(has_many, relation_enum = "DualRel", via_rel = "Username")]
1010
pub username_dual_rels: HasMany<super::dual_rel::Entity>,
11-
#[sea_orm(has_many, relation_enum = "CheckerUsername", via_rel = "CheckerUsername")]
11+
#[sea_orm(
12+
has_many,
13+
relation_enum = "CheckerUsername",
14+
via_rel = "CheckerUsername"
15+
)]
1216
pub checker_username_dual_rels: HasMany<super::dual_rel::Entity>,
1317
}
1418

examples/app/src/models/dual_rel.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,19 @@ pub struct Model {
88
pub username: String,
99
#[sea_orm(primary_key)]
1010
pub checker_username: String,
11-
#[sea_orm(belongs_to, relation_enum = "Username", from = "username", to = "username")]
11+
#[sea_orm(
12+
belongs_to,
13+
relation_enum = "Username",
14+
from = "username",
15+
to = "username"
16+
)]
1217
pub dual: HasOne<super::dual::Entity>,
13-
#[sea_orm(belongs_to, relation_enum = "CheckerUsername", from = "checker_username", to = "username")]
18+
#[sea_orm(
19+
belongs_to,
20+
relation_enum = "CheckerUsername",
21+
from = "checker_username",
22+
to = "username"
23+
)]
1424
pub checker: HasOne<super::dual::Entity>,
1525
}
1626

examples/app/src/models/media.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ pub struct Model {
2121
pub articles: HasMany<super::article::Entity>,
2222
#[sea_orm(has_many)]
2323
pub user_media_roles: HasMany<super::user_media_role::Entity>,
24-
#[sea_orm(has_many, relation_enum = "UserViaUserMediaRole", via = "user_media_role")]
24+
#[sea_orm(
25+
has_many,
26+
relation_enum = "UserViaUserMediaRole",
27+
via = "user_media_role"
28+
)]
2529
pub users_via_user_media_role: HasMany<super::user::Entity>,
2630
}
2731

examples/app/src/models/triple.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ pub struct Model {
88
pub username: String,
99
#[sea_orm(has_many, relation_enum = "TripleRel", via_rel = "Username")]
1010
pub username_triple_rels: HasMany<super::triple_rel::Entity>,
11-
#[sea_orm(has_many, relation_enum = "CheckerUsername", via_rel = "CheckerUsername")]
11+
#[sea_orm(
12+
has_many,
13+
relation_enum = "CheckerUsername",
14+
via_rel = "CheckerUsername"
15+
)]
1216
pub checker_username_triple_rels: HasMany<super::triple_rel::Entity>,
1317
#[sea_orm(has_many, relation_enum = "OtherUsername", via_rel = "OtherUsername")]
1418
pub other_username_triple_rels: HasMany<super::triple_rel::Entity>,

examples/app/src/models/triple_rel.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,26 @@ pub struct Model {
1010
pub checker_username: String,
1111
#[sea_orm(primary_key)]
1212
pub other_username: String,
13-
#[sea_orm(belongs_to, relation_enum = "Username", from = "username", to = "username")]
13+
#[sea_orm(
14+
belongs_to,
15+
relation_enum = "Username",
16+
from = "username",
17+
to = "username"
18+
)]
1419
pub triple: HasOne<super::triple::Entity>,
15-
#[sea_orm(belongs_to, relation_enum = "CheckerUsername", from = "checker_username", to = "username")]
20+
#[sea_orm(
21+
belongs_to,
22+
relation_enum = "CheckerUsername",
23+
from = "checker_username",
24+
to = "username"
25+
)]
1626
pub checker: HasOne<super::triple::Entity>,
17-
#[sea_orm(belongs_to, relation_enum = "OtherUsername", from = "other_username", to = "username")]
27+
#[sea_orm(
28+
belongs_to,
29+
relation_enum = "OtherUsername",
30+
from = "other_username",
31+
to = "username"
32+
)]
1833
pub other: HasOne<super::triple::Entity>,
1934
}
2035

examples/app/src/models/user.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ pub struct Model {
2222
pub medias: HasMany<super::media::Entity>,
2323
#[sea_orm(has_many)]
2424
pub user_media_roles: HasMany<super::user_media_role::Entity>,
25-
#[sea_orm(has_many, relation_enum = "MediaViaUserMediaRole", via = "user_media_role")]
25+
#[sea_orm(
26+
has_many,
27+
relation_enum = "MediaViaUserMediaRole",
28+
via = "user_media_role"
29+
)]
2630
pub medias_via_user_media_role: HasMany<super::media::Entity>,
2731
}
2832

examples/app/src/models/user_media_role.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
use sea_orm::entity::prelude::*;
22
use serde::{Deserialize, Serialize};
33

4-
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize, vespera::Schema)]
4+
#[derive(
5+
Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Serialize, Deserialize, vespera::Schema,
6+
)]
57
#[serde(rename_all = "camelCase")]
6-
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "user_media_role_role")]
8+
#[sea_orm(
9+
rs_type = "String",
10+
db_type = "Enum",
11+
enum_name = "user_media_role_role"
12+
)]
713
pub enum Role {
814
#[sea_orm(string_value = "owner")]
915
Owner,

0 commit comments

Comments
 (0)