Skip to content
This repository was archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Code review improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
OmegaJak committed Oct 30, 2023
1 parent 780aae6 commit 48037b1
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 81 deletions.

This file was deleted.

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

This file was deleted.

15 changes: 0 additions & 15 deletions src/database/models/creator_follows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,6 @@ macro_rules! impl_follow {
Ok(())
}

pub async fn get_followers(
target_id: $target_id_type,
exec: impl sqlx::Executor<'_, Database = sqlx::Postgres>,
) -> Result<Vec<$target_struct>, DatabaseError> {
let res = sqlx::query_as!(
FollowQuery,
"SELECT follower_id, target_id FROM " + $table_name + " WHERE target_id=$1",
target_id.0
)
.fetch_all(exec)
.await?;

Ok(res.into_iter().map(|r| r.into()).collect_vec())
}

pub async fn get_follows_by_follower(
follower_user_id: UserId,
exec: impl sqlx::Executor<'_, Database = sqlx::Postgres>,
Expand Down
4 changes: 2 additions & 2 deletions src/database/models/event_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ impl Event {
created
FROM events e
WHERE
(target_id, target_id_type, event_type)
(target_id, target_id_type, event_type)
= ANY(SELECT * FROM UNNEST ($1::bigint[], $2::text[], $3::text[]))
OR
(triggerer_id, triggerer_id_type, event_type)
(triggerer_id, triggerer_id_type, event_type)
= ANY(SELECT * FROM UNNEST ($4::bigint[], $5::text[], $6::text[]))
ORDER BY created DESC
"#,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/models/ids.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use thiserror::Error;

pub use super::collections::CollectionId;
pub use super::feed_item::FeedItemId;
pub use super::feeds::FeedItemId;
pub use super::images::ImageId;
pub use super::notifications::NotificationId;
pub use super::oauth_clients::OAuthClientAuthorizationId;
Expand Down
2 changes: 1 addition & 1 deletion src/models/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod analytics;
pub mod collections;
pub mod error;
pub mod feed_item;
pub mod feeds;
pub mod ids;
pub mod images;
pub mod notifications;
Expand Down
2 changes: 1 addition & 1 deletion src/routes/v3/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
redis::RedisPool,
},
models::{
feed_item::{FeedItem, FeedItemBody},
feeds::{FeedItem, FeedItemBody},
ids::ProjectId,
pats::Scopes,
projects::Project,
Expand Down
2 changes: 1 addition & 1 deletion tests/common/api_v3/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use actix_web::{
dev::ServiceResponse,
test::{self, TestRequest},
};
use labrinth::models::feed_item::FeedItem;
use labrinth::models::feeds::FeedItem;

use crate::common::{actix::TestRequestExtensions, asserts::assert_status};

Expand Down
2 changes: 1 addition & 1 deletion tests/common/asserts.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(dead_code)]

use labrinth::models::feed_item::{FeedItem, FeedItemBody};
use labrinth::models::feeds::{FeedItem, FeedItemBody};

pub fn assert_status(response: &actix_web::dev::ServiceResponse, status: actix_http::StatusCode) {
assert_eq!(response.status(), status, "{:#?}", response.response());
Expand Down
2 changes: 1 addition & 1 deletion tests/feed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use common::{
database::{FRIEND_USER_PAT, USER_USER_ID, USER_USER_PAT},
environment::with_test_environment,
};
use labrinth::models::feed_item::FeedItemBody;
use labrinth::models::feeds::FeedItemBody;

mod common;

Expand Down

0 comments on commit 48037b1

Please sign in to comment.