- Updated user and thought models to utilize UUIDs for primary keys. - Modified persistence functions to accommodate UUIDs for user and thought IDs. - Implemented tag functionality with new Tag and ThoughtTag models. - Added migration scripts to create new tables for tags and thought-tag relationships. - Enhanced thought creation to parse hashtags and link them to thoughts. - Updated tests to reflect changes in user and thought ID types.
19 lines
558 B
Rust
19 lines
558 B
Rust
use sea_orm::{DatabaseConnection, TryIntoModel};
|
|
|
|
use app::persistence::user::create_user;
|
|
use models::params::user::CreateUserParams;
|
|
|
|
pub(super) async fn test_user(db: &DatabaseConnection) {
|
|
let params = CreateUserParams {
|
|
username: "test".to_string(),
|
|
password: "password".to_string(),
|
|
};
|
|
let user_model = create_user(db, params)
|
|
.await
|
|
.expect("Create user failed!")
|
|
.try_into_model() // Convert ActiveModel to Model for easier checks
|
|
.unwrap();
|
|
|
|
assert_eq!(user_model.username, "test");
|
|
}
|