Skip to content

Commit

Permalink
made sure that we use pub instead of the equivalent pub(crate)
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed May 8, 2024
1 parent e2c0fc4 commit e85a8d8
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 25 deletions.
2 changes: 1 addition & 1 deletion server/main-api/src/calendar/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub(super) struct Event {
}

impl Event {
pub(crate) async fn store(
pub async fn store(
&self,
tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,
) -> Result<sqlx::postgres::PgQueryResult, sqlx::Error> {
Expand Down
4 changes: 2 additions & 2 deletions server/main-api/src/feedback/proposed_edits/discription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ pub struct Description {
}

impl Description {
pub(crate) fn add_context(&mut self, additional_context: &str) {
pub fn add_context(&mut self, additional_context: &str) {
if !additional_context.is_empty() {
self.body += &format!("Additional context: {additional_context}\n");
}
}
pub(crate) fn appply_set<T: AppliableEdit>(
pub fn appply_set<T: AppliableEdit>(
&mut self,
category_name: &'static str,
set: HashMap<String, T>,
Expand Down
4 changes: 2 additions & 2 deletions server/main-api/src/maps/fetch_tile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Display for TileLocation {
}

#[derive(Debug)]
pub(crate) struct FetchTileTask {
pub struct FetchTileTask {
location: TileLocation,
index: (u32, u32),
}
Expand Down Expand Up @@ -72,7 +72,7 @@ impl FetchTileTask {
}
}

pub(crate) fn offset_by(self, x_offset: i32, y_offset: i32) -> Self {
pub fn offset_by(self, x_offset: i32, y_offset: i32) -> Self {
Self {
location: TileLocation {
x: zoom_aware_offset(self.location.z, self.location.x, x_offset),
Expand Down
16 changes: 9 additions & 7 deletions server/main-api/src/maps/overlay_map.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use crate::maps::fetch_tile::FetchTileTask;
use crate::models::Location;
use futures::{stream::FuturesUnordered, StreamExt};
use log::warn;

pub(crate) struct OverlayMapTask {
pub(crate) x: f64,
pub(crate) y: f64,
pub(crate) z: u32,
use crate::maps::fetch_tile::FetchTileTask;
use crate::models::Location;

pub struct OverlayMapTask {
pub x: f64,
pub y: f64,
pub z: u32,
}

impl OverlayMapTask {
Expand Down Expand Up @@ -103,9 +104,10 @@ fn is_in_range(x_pixels: u32, y_pixels: u32, x_index: u32, y_index: u32) -> bool

#[cfg(test)]
mod overlay_tests {
use super::*;
use pretty_assertions::assert_eq;

use super::*;

#[test]
fn test_lat_lon_z_to_xyz() {
let (x, y, _) = lat_lon_z_to_xyz(52.520_008, 13.404_954, 17);
Expand Down
2 changes: 1 addition & 1 deletion server/main-api/src/maps/overlay_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ lazy_static! {
}
const SCALE: PxScale = PxScale { x: 35.0, y: 35.0 };

pub(crate) struct OverlayText {
pub struct OverlayText {
x: i32,
y: i32,
text: String,
Expand Down
6 changes: 3 additions & 3 deletions server/main-api/src/search/search_executor/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct Filter {
usages: HashSet<String>,
}
impl Filter {
pub(crate) fn as_meilisearch_filters(&self) -> String {
pub fn as_meilisearch_filters(&self) -> String {
let mut filters = vec![];
if !self.parents.is_empty() {
let parents: Vec<&str> = self.parents.iter().map(String::as_str).collect();
Expand All @@ -38,7 +38,7 @@ pub struct Sorting {
}

impl Sorting {
pub(crate) fn as_meilisearch_sorting(&self) -> Vec<String> {
pub fn as_meilisearch_sorting(&self) -> Vec<String> {
self.location
.iter()
.map(|s| format!("_geoPoint({s}):asc"))
Expand All @@ -60,7 +60,7 @@ pub struct ParsedQuery {
}

impl ParsedQuery {
pub(crate) fn relevant_enough_for_room_highligting(&self) -> bool {
pub fn relevant_enough_for_room_highligting(&self) -> bool {
if self.tokens.len() == 1 {
return true;
}
Expand Down
5 changes: 3 additions & 2 deletions server/main-api/src/setup/database/alias.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::time::Instant;

use log::info;
use serde::Deserialize;
use std::time::Instant;

#[derive(Debug)]
struct Alias {
Expand Down Expand Up @@ -102,7 +103,7 @@ impl Alias {
}
}

pub(crate) async fn load_all_to_db(
pub async fn load_all_to_db(
tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,
) -> Result<(), crate::BoxedError> {
let cdn_url = std::env::var("CDN_URL").unwrap_or_else(|_| "https://nav.tum.de/cdn".to_string());
Expand Down
2 changes: 1 addition & 1 deletion server/main-api/src/setup/database/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl DelocalisedValues {
}
}

pub(crate) async fn load_all_to_db(
pub async fn load_all_to_db(
tx: &mut sqlx::Transaction<'_, sqlx::Postgres>,
) -> Result<(), crate::BoxedError> {
let start = Instant::now();
Expand Down
6 changes: 3 additions & 3 deletions server/main-api/src/setup/database/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use log::info;

mod alias;
mod data;

use log::info;

pub(crate) async fn setup_database(pool: &sqlx::PgPool) -> Result<(), crate::BoxedError> {
pub async fn setup_database(pool: &sqlx::PgPool) -> Result<(), crate::BoxedError> {
info!("setting up the database");
sqlx::migrate!("./migrations").run(pool).await?;
info!("migrations complete");
Expand Down
2 changes: 1 addition & 1 deletion server/main-api/src/setup/meilisearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ async fn wait_for_healthy(client: &Client) {
}
}

pub(crate) async fn setup_meilisearch() -> Result<(), crate::BoxedError> {
pub async fn setup_meilisearch() -> Result<(), crate::BoxedError> {
info!("setting up meilisearch");
let start = std::time::Instant::now();
let ms_url = std::env::var("MIELI_URL").unwrap_or_else(|_| "http://localhost:7700".to_string());
Expand Down
4 changes: 2 additions & 2 deletions server/main-api/src/setup/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(not(feature = "skip_db_setup"))]
pub(crate) mod database;
pub mod database;

#[cfg(not(feature = "skip_ms_setup"))]
pub(crate) mod meilisearch;
pub mod meilisearch;

0 comments on commit e85a8d8

Please sign in to comment.