Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions apps/labrinth/src/database/models/organization_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,31 @@
}
}

pub async fn get_projects<'a, E>(
organization_id: DBOrganizationId,
exec: E,
) -> Result<Vec<DBProjectId>, super::DatabaseError>
where
E: crate::database::Executor<'a, Database = sqlx::Postgres>,
{
use futures::TryStreamExt;

let db_projects = sqlx::query!(
"
SELECT m.id FROM organizations o
INNER JOIN mods m ON m.organization_id = o.id
WHERE o.id = $1
",

Check warning on line 223 in apps/labrinth/src/database/models/organization_item.rs

View workflow job for this annotation

GitHub Actions / Lint and Test

Diff in /home/runner/work/code/code/apps/labrinth/src/database/models/organization_item.rs
organization_id as DBOrganizationId,
)
.fetch(exec)
.map_ok(|m| DBProjectId(m.id))
.try_collect::<Vec<_>>()
.await?;

Ok(db_projects)
}

pub async fn remove(
id: DBOrganizationId,
transaction: &mut PgTransaction<'_>,
Expand Down
2 changes: 1 addition & 1 deletion apps/labrinth/src/models/v3/projects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,10 @@
/// Unlisted - Project is not displayed on search, but accessible by URL
/// Withheld - Same as unlisted, but set by a moderator. Cannot be switched to another type without moderator approval
/// Processing - Project is not displayed on search, and not accessible by URL (Temporary state, project under review)
/// Scheduled - Project is scheduled to be released in the future

Check warning on line 444 in apps/labrinth/src/models/v3/projects.rs

View workflow job for this annotation

GitHub Actions / Lint and Test

Diff in /home/runner/work/code/code/apps/labrinth/src/models/v3/projects.rs
/// Private - Project is approved, but is not viewable to the public
#[derive(
Serialize, Deserialize, Copy, Clone, Eq, PartialEq, Debug, utoipa::ToSchema,
Serialize, Deserialize, Copy, Clone, Eq, PartialEq, Hash, Debug, utoipa::ToSchema,
)]
#[serde(rename_all = "lowercase")]
pub enum ProjectStatus {
Expand Down
Loading
Loading