feat: control how many statuses to insert
This commit is contained in:
parent
b84a682ed4
commit
3a0ca6af86
2 changed files with 6 additions and 3 deletions
|
@ -47,7 +47,10 @@ enum CliCommand {
|
||||||
Migrate,
|
Migrate,
|
||||||
|
|
||||||
/// generate fake user, note and activity
|
/// generate fake user, note and activity
|
||||||
Faker,
|
Faker{
|
||||||
|
/// how many fake statuses to insert for root user
|
||||||
|
count: usize,
|
||||||
|
},
|
||||||
|
|
||||||
/// fetch a single AP object
|
/// fetch a single AP object
|
||||||
Fetch {
|
Fetch {
|
||||||
|
|
|
@ -2,7 +2,7 @@ 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;
|
||||||
|
|
||||||
pub async fn faker(db: &sea_orm::DatabaseConnection, domain: String) -> Result<(), sea_orm::DbErr> {
|
pub async fn faker(db: &sea_orm::DatabaseConnection, domain: String, count: usize) -> Result<(), sea_orm::DbErr> {
|
||||||
use sea_orm::{EntityTrait, Set};
|
use sea_orm::{EntityTrait, Set};
|
||||||
|
|
||||||
let root = super::user::Model {
|
let root = super::user::Model {
|
||||||
|
@ -55,7 +55,7 @@ UQIDAQAB
|
||||||
|
|
||||||
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..count).rev() {
|
||||||
let oid = uuid::Uuid::new_v4();
|
let oid = uuid::Uuid::new_v4();
|
||||||
let aid = uuid::Uuid::new_v4();
|
let aid = uuid::Uuid::new_v4();
|
||||||
object::Entity::insert(object::ActiveModel {
|
object::Entity::insert(object::ActiveModel {
|
||||||
|
|
Loading…
Reference in a new issue