Skip to content

Commit

Permalink
Fixes to CIDR ban model
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Myers <[email protected]>
  • Loading branch information
Elizafox committed Mar 13, 2024
1 parent 458c55c commit dade023
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions entity/src/cidr_ban.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ pub struct Model {
pub range_begin: Vec<u8>,
#[sea_orm(column_type = "Binary(16)", unique)]
pub range_end: Vec<u8>,
#[sea_orm(unique)]
pub reason: String,
pub reason: Option<String>,
pub created_at: DateTime,
pub user_created_id: Option<i64>,
}

Expand Down
2 changes: 1 addition & 1 deletion migration/src/m20240312_184421_create_ip_filter_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl MigrationTrait for Migration {
)
.col(binary_len(CidrBan::RangeBegin, 16).unique_key().not_null())
.col(binary_len(CidrBan::RangeEnd, 16).unique_key().not_null())
.col(string(CidrBan::Reason).unique_key().not_null())
.col(string(CidrBan::Reason))
.col(
ColumnDef::new(CidrBan::CreatedAt)
.date_time()
Expand Down
2 changes: 1 addition & 1 deletion service/src/mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Mutation {
pub async fn create_cidr_ban(
db: &DbConn,
network: IpNetwork,
reason: String,
reason: Option<String>,
user: &user::Model,
) -> Result<cidr_ban::ActiveModel, DbErr> {
let (start, end) = match network {
Expand Down

0 comments on commit dade023

Please sign in to comment.