1
0
Fork 0
forked from alemi/upub

fix: faker also insert config and credentials

This commit is contained in:
əlemi 2024-03-23 06:10:33 +01:00
parent f48509e2d8
commit 05245c2776
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -1,4 +1,4 @@
use crate::{activitypub::PUBLIC_TARGET, activitystream::object::actor::Actor}; use crate::{activitypub::PUBLIC_TARGET, model::{config, credential}};
use super::{activity, object, user, Audience}; use super::{activity, object, user, Audience};
use sea_orm::IntoActiveModel; use sea_orm::IntoActiveModel;
@ -36,6 +36,21 @@ UQIDAQAB
user::Entity::insert(root.clone().into_active_model()).exec(db).await?; user::Entity::insert(root.clone().into_active_model()).exec(db).await?;
config::Entity::insert(config::ActiveModel {
id: Set(root.id.clone()),
accept_follow_requests: Set(true),
show_followers: Set(true),
show_following: Set(true),
show_following_count: Set(true),
show_followers_count: Set(true),
}).exec(db).await?;
credential::Entity::insert(credential::ActiveModel {
id: Set(root.id.clone()),
email: Set("mail@example.net".to_string()),
password: Set("very-strong-password".to_string()),
}).exec(db).await?;
let context = uuid::Uuid::new_v4().to_string(); let context = uuid::Uuid::new_v4().to_string();
for i in (0..100).rev() { for i in (0..100).rev() {
@ -55,7 +70,7 @@ UQIDAQAB
shares: Set(0), shares: Set(0),
to: Set(Audience(vec![PUBLIC_TARGET.to_string()])), to: Set(Audience(vec![PUBLIC_TARGET.to_string()])),
bto: Set(Audience::default()), bto: Set(Audience::default()),
cc: Set(Audience(vec![root.followers().id().unwrap_or("").to_string()])), cc: Set(Audience(vec![])),
bcc: Set(Audience::default()), bcc: Set(Audience::default()),
}).exec(db).await?; }).exec(db).await?;
@ -68,7 +83,7 @@ UQIDAQAB
published: Set(chrono::Utc::now() - std::time::Duration::from_secs(60*i)), published: Set(chrono::Utc::now() - std::time::Duration::from_secs(60*i)),
to: Set(Audience(vec![PUBLIC_TARGET.to_string()])), to: Set(Audience(vec![PUBLIC_TARGET.to_string()])),
bto: Set(Audience::default()), bto: Set(Audience::default()),
cc: Set(Audience(vec![root.followers().id().unwrap_or("").to_string()])), cc: Set(Audience(vec![])),
bcc: Set(Audience::default()), bcc: Set(Audience::default()),
}).exec(db).await?; }).exec(db).await?;
} }