From 0bd5893e7d2c66bbed16a6b35352587ab35ef257 Mon Sep 17 00:00:00 2001 From: Namekuji Date: Wed, 31 May 2023 12:24:02 -0400 Subject: [PATCH] fix varchar array --- .../native-utils/crates/model/src/entity/antenna.rs | 8 ++++---- .../native-utils/crates/model/src/entity/newtype/mod.rs | 8 ++++---- .../native-utils/crates/model/src/schema/antenna.rs | 8 ++++---- .../backend/native-utils/crates/model/tests/common.rs | 2 +- .../native-utils/crates/model/tests/repository/antenna.rs | 2 +- packages/backend/native-utils/package.json | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/backend/native-utils/crates/model/src/entity/antenna.rs b/packages/backend/native-utils/crates/model/src/entity/antenna.rs index 5e514576be..ccff0aab4f 100644 --- a/packages/backend/native-utils/crates/model/src/entity/antenna.rs +++ b/packages/backend/native-utils/crates/model/src/entity/antenna.rs @@ -17,7 +17,7 @@ pub struct Model { #[sea_orm(column_name = "userListId")] pub user_list_id: Option, #[sea_orm(column_type = "JsonBinary")] - pub keywords: newtype::Keyword, + pub keywords: newtype::JsonKeyword, #[sea_orm(column_name = "withFile")] pub with_file: bool, pub expression: Option, @@ -28,11 +28,11 @@ pub struct Model { pub with_replies: bool, #[sea_orm(column_name = "userGroupJoiningId")] pub user_group_joining_id: Option, - pub users: newtype::StringVec, + pub users: Vec, #[sea_orm(column_name = "excludeKeywords", column_type = "JsonBinary")] - pub exclude_keywords: newtype::Keyword, + pub exclude_keywords: newtype::JsonKeyword, #[sea_orm(column_type = "JsonBinary")] - pub instances: newtype::StringVec, + pub instances: newtype::JsonStringVec, } #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] diff --git a/packages/backend/native-utils/crates/model/src/entity/newtype/mod.rs b/packages/backend/native-utils/crates/model/src/entity/newtype/mod.rs index 714f3dafb7..f7e3c3d436 100644 --- a/packages/backend/native-utils/crates/model/src/entity/newtype/mod.rs +++ b/packages/backend/native-utils/crates/model/src/entity/newtype/mod.rs @@ -8,10 +8,10 @@ use serde::{Deserialize, Serialize}; use crate::impl_json_newtype; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, From)] -pub struct Keyword(pub Vec>); -impl_json_newtype!(Keyword); +pub struct JsonKeyword(pub Vec>); +impl_json_newtype!(JsonKeyword); #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, From)] -pub struct StringVec(pub Vec); -impl_json_newtype!(StringVec); +pub struct JsonStringVec(pub Vec); +impl_json_newtype!(JsonStringVec); diff --git a/packages/backend/native-utils/crates/model/src/schema/antenna.rs b/packages/backend/native-utils/crates/model/src/schema/antenna.rs index 035dca344c..4a71982f7f 100644 --- a/packages/backend/native-utils/crates/model/src/schema/antenna.rs +++ b/packages/backend/native-utils/crates/model/src/schema/antenna.rs @@ -13,14 +13,14 @@ pub struct Antenna { pub id: String, pub created_at: chrono::DateTime, pub name: String, - pub keywords: newtype::Keyword, - pub exclude_keywords: newtype::Keyword, + pub keywords: newtype::JsonKeyword, + pub exclude_keywords: newtype::JsonKeyword, #[schema(inline)] pub src: AntennaSrc, pub user_list_id: Option, pub user_group_id: Option, - pub users: newtype::StringVec, - pub instances: newtype::StringVec, + pub users: Vec, + pub instances: newtype::JsonStringVec, #[serde(default)] pub case_sensitive: bool, #[serde(default)] diff --git a/packages/backend/native-utils/crates/model/tests/common.rs b/packages/backend/native-utils/crates/model/tests/common.rs index 6a54ca414b..d459056f3f 100644 --- a/packages/backend/native-utils/crates/model/tests/common.rs +++ b/packages/backend/native-utils/crates/model/tests/common.rs @@ -88,7 +88,7 @@ async fn setup_model(db: &DatabaseConnection) { .expect("Unable to setup predefined models"); } -mod it_test { +mod int_test { use super::{cleanup, prepare}; #[tokio::test] diff --git a/packages/backend/native-utils/crates/model/tests/repository/antenna.rs b/packages/backend/native-utils/crates/model/tests/repository/antenna.rs index 73ddc65054..e07a16c072 100644 --- a/packages/backend/native-utils/crates/model/tests/repository/antenna.rs +++ b/packages/backend/native-utils/crates/model/tests/repository/antenna.rs @@ -1,4 +1,4 @@ -mod it_test { +mod int_test { use model::{ entity::{antenna, user}, repository::Repository, diff --git a/packages/backend/native-utils/package.json b/packages/backend/native-utils/package.json index 60f14260dd..aa194bad3a 100644 --- a/packages/backend/native-utils/package.json +++ b/packages/backend/native-utils/package.json @@ -41,6 +41,6 @@ "universal": "napi universal", "version": "napi version", "cargo:unit": "cargo test --workspace unit_test", - "cargo:integration": "cargo test --workspace it_test -- --test-threads=1" + "cargo:integration": "cargo test --workspace int_test -- --test-threads=1" } }