Skip to content

Commit

Permalink
Shield SeaORM: Fix migrations and entities
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielleHuisman committed Dec 25, 2024
1 parent f5ed668 commit 1c01111
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/providers/shield-oidc/src/subprovider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use crate::provider::OIDC_PROVIDER_ID;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum OidcProviderVisibility {
Private,
Public,
Unlisted,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ pub enum OauthProviderType {
enum_name = "oauth_provider_visibility"
)]
pub enum OauthProviderVisibility {
#[sea_orm(string_value = "private")]
Private,
#[sea_orm(string_value = "public")]
Public,
#[sea_orm(string_value = "unlisted")]
Unlisted,
}

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
Expand Down
6 changes: 4 additions & 2 deletions packages/storage/shield-sea-orm/src/entities/oidc_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ pub enum OidcProviderType {
enum_name = "oidc_provider_visibility"
)]
pub enum OidcProviderVisibility {
#[sea_orm(string_value = "private")]
Private,
#[sea_orm(string_value = "public")]
Public,
#[sea_orm(string_value = "unlisted")]
Unlisted,
}

#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
Expand All @@ -58,6 +58,8 @@ pub struct Model {
#[sea_orm(column_type = "Text", nullable)]
pub redirect_url: Option<String>,
#[sea_orm(column_type = "Text", nullable)]
pub discovery_url: Option<String>,
#[sea_orm(column_type = "Text", nullable)]
pub issuer_url: Option<String>,
#[sea_orm(column_type = "Text", nullable)]
pub authorization_url: Option<String>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,12 @@ enum OauthProviderVisibility {
Table,

Public,
Private,
Unlisted,
}

impl OauthProviderVisibility {
fn variants() -> Vec<Self> {
vec![Self::Public, Self::Private]
vec![Self::Public, Self::Unlisted]
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(OidcProvider::ClientSecret).text())
.col(ColumnDef::new(OidcProvider::Scopes).text())
.col(ColumnDef::new(OidcProvider::RedirectUrl).text())
.col(ColumnDef::new(OidcProvider::DiscoveryUrl).text())
.col(ColumnDef::new(OidcProvider::IssuerUrl).text())
.col(ColumnDef::new(OidcProvider::AuthorizationUrl).text())
.col(ColumnDef::new(OidcProvider::AuthorizationUrlParams).text())
Expand Down Expand Up @@ -243,12 +244,12 @@ enum OidcProviderVisibility {
Table,

Public,
Private,
Unlisted,
}

impl OidcProviderVisibility {
fn variants() -> Vec<Self> {
vec![Self::Public, Self::Private]
vec![Self::Public, Self::Unlisted]
}
}

Expand Down Expand Up @@ -279,6 +280,7 @@ enum OidcProvider {
ClientSecret,
Scopes,
RedirectUrl,
DiscoveryUrl,
IssuerUrl,
AuthorizationUrl,
AuthorizationUrlParams,
Expand Down

0 comments on commit 1c01111

Please sign in to comment.