| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
use super::SeedError; |
| 10 |
use super::projects::SeededProject; |
| 11 |
use crate::db::{self, FollowTargetType}; |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
pub async fn seed_social(pool: &sqlx::PgPool, projects: &[SeededProject]) -> Result<(), SeedError> { |
| 17 |
for a in projects { |
| 18 |
for b in projects { |
| 19 |
if a.user_id == b.user_id { |
| 20 |
continue; |
| 21 |
} |
| 22 |
db::follows::follow( |
| 23 |
pool, |
| 24 |
a.user_id, |
| 25 |
FollowTargetType::User, |
| 26 |
*b.user_id.as_uuid(), |
| 27 |
) |
| 28 |
.await?; |
| 29 |
db::follows::follow( |
| 30 |
pool, |
| 31 |
a.user_id, |
| 32 |
FollowTargetType::Project, |
| 33 |
*b.project.id.as_uuid(), |
| 34 |
) |
| 35 |
.await?; |
| 36 |
} |
| 37 |
} |
| 38 |
tracing::info!("example seed: seeded follows between example accounts"); |
| 39 |
Ok(()) |
| 40 |
} |
| 41 |
|