Skip to content
Draft
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
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion apps/labrinth/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
- no trailing punctuation
- wrap code items e.g. type names in backticks
- Prefer `wrap_internal_err`, `wrap_request_err` when attaching context to an existing error (like Anyhow `context` or Eyre `wrap_err`)
- Prefer importing `eyre::Result` and using `Result<T>` instead of `eyre::Result<T>`
- Prefer `eyre::Ok(value)` instead of `Ok::<_, eyre::Report>(value)` when an explicit Eyre result type is needed
- All operations should ideally have some context attached
- Database operations can have a message like `.wrap_internal_err("failed to fetch XYZ")`
- Database operations can have a message like `.wrap_internal_err("fetching XYZ")`
- You can perform real-time queries against the databases in the Docker Compose
- `docker exec labrinth-postgres psql -c "select 1"`
- `docker exec labrinth-redis redis-cli flushall`
Expand Down
6 changes: 0 additions & 6 deletions apps/labrinth/src/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,6 @@ pub enum AuthenticationError {
Url,
}

impl From<xredis::Error> for AuthenticationError {
fn from(error: xredis::Error) -> Self {
Self::Database(error.into())
}
}

impl actix_web::ResponseError for AuthenticationError {
fn status_code(&self) -> StatusCode {
match self {
Expand Down
2 changes: 1 addition & 1 deletion apps/labrinth/src/database/models/analytics_event_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
};
use serde::{Deserialize, Serialize};

const ANALYTICS_EVENTS_NAMESPACE: &str = "analytics_events:v3";
const ANALYTICS_EVENTS_NAMESPACE: &str = "analytics_events:v4";
const ANALYTICS_EVENTS_ALL_KEY: &str = "all";

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion apps/labrinth/src/database/models/categories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::ids::*;
use futures::TryStreamExt;
use serde::{Deserialize, Serialize};

const TAGS_NAMESPACE: &str = "tags:v3";
const TAGS_NAMESPACE: &str = "tags:v4";

pub struct ProjectType {
pub id: ProjectTypeId,
Expand Down
2 changes: 1 addition & 1 deletion apps/labrinth/src/database/models/collection_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use futures::TryStreamExt;
use serde::{Deserialize, Serialize};
use xredis::RedisPool;

const COLLECTIONS_NAMESPACE: &str = "collections:v3";
const COLLECTIONS_NAMESPACE: &str = "collections:v4";

#[derive(Clone)]
pub struct CollectionBuilder {
Expand Down
2 changes: 1 addition & 1 deletion apps/labrinth/src/database/models/flow_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use url::Url;
use webauthn_rs::prelude::{DiscoverableAuthentication, PasskeyRegistration};
use xredis::RedisPool;

const FLOWS_NAMESPACE: &str = "flows:v3";
const FLOWS_NAMESPACE: &str = "flows:v4";

#[derive(Deserialize, Serialize)]
pub enum DBFlow {
Expand Down
2 changes: 1 addition & 1 deletion apps/labrinth/src/database/models/image_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use dashmap::DashMap;
use serde::{Deserialize, Serialize};
use xredis::RedisPool;

const IMAGES_NAMESPACE: &str = "images:v3";
const IMAGES_NAMESPACE: &str = "images:v4";

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct DBImage {
Expand Down
13 changes: 2 additions & 11 deletions apps/labrinth/src/database/models/legacy_loader_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,8 @@ impl MinecraftGameVersion {
id: loader_field_enum_value.id,
version: loader_field_enum_value.value,
created: loader_field_enum_value.created,
type_: loader_field_enum_value
.metadata
.get("type")
.and_then(|x| x.as_str())
.map(|x| x.to_string())
.unwrap_or_default(),
major: loader_field_enum_value
.metadata
.get("major")
.and_then(|x| x.as_bool())
.unwrap_or_default(),
type_: loader_field_enum_value.ty.unwrap_or_default(),
major: loader_field_enum_value.major.unwrap_or_default(),
}
}
}
Expand Down
Loading
Loading