feat: create 100 fake entities
This commit is contained in:
parent
b4c68c5c73
commit
8a4e40c93a
1 changed files with 21 additions and 17 deletions
|
@ -15,24 +15,28 @@ pub async fn faker(db: &sea_orm::DatabaseConnection) -> Result<(), sea_orm::DbEr
|
|||
actor_type: sea_orm::Set(super::activitystream::object::actor::ActorType::Person),
|
||||
}).exec(db).await?;
|
||||
|
||||
for i in (0..100).rev() {
|
||||
let oid = uuid::Uuid::new_v4();
|
||||
let aid = uuid::Uuid::new_v4();
|
||||
object::Entity::insert(object::ActiveModel {
|
||||
id: sea_orm::Set("http://localhost:3000/objects/4e28d30b-33c1-4336-918b-6fbe592bdd44".into()),
|
||||
id: sea_orm::Set(format!("http://localhost:3000/objects/{oid}")),
|
||||
name: sea_orm::Set(None),
|
||||
object_type: sea_orm::Set(crate::activitystream::object::ObjectType::Note),
|
||||
attributed_to: sea_orm::Set(Some("http://localhost:3000/users/root".into())),
|
||||
summary: sea_orm::Set(None),
|
||||
content: sea_orm::Set(Some("Hello world!".into())),
|
||||
published: sea_orm::Set(chrono::Utc::now()),
|
||||
content: sea_orm::Set(Some(format!("Hello world! {i}"))),
|
||||
published: sea_orm::Set(chrono::Utc::now() - std::time::Duration::from_secs(60*i)),
|
||||
}).exec(db).await?;
|
||||
|
||||
activity::Entity::insert(activity::ActiveModel {
|
||||
id: sea_orm::Set("http://localhost:3000/activities/ebac57e1-9828-438c-be34-a44a52de7641".into()),
|
||||
id: sea_orm::Set(format!("http://localhost:3000/activities/{aid}")),
|
||||
activity_type: sea_orm::Set(crate::activitystream::object::activity::ActivityType::Create),
|
||||
actor: sea_orm::Set("http://localhost:3000/users/root".into()),
|
||||
object: sea_orm::Set(Some("http://localhost:3000/obkects/4e28d30b-33c1-4336-918b-6fbe592bdd44".into())),
|
||||
object: sea_orm::Set(Some(format!("http://localhost:3000/objects/{oid}"))),
|
||||
target: sea_orm::Set(None),
|
||||
published: sea_orm::Set(chrono::Utc::now()),
|
||||
published: sea_orm::Set(chrono::Utc::now() - std::time::Duration::from_secs(60*i)),
|
||||
}).exec(db).await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue