Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone committed Jul 29, 2024
1 parent ae14d4c commit e67d040
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
4 changes: 1 addition & 3 deletions dsp-meta-cmd/src/main-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ async fn init_server() {
.unwrap_or(Url::parse("https://meta.dasch.swiss").unwrap());

let shared_state = Arc::new(AppState {
project_metadata_service: MetadataService::new(MetadataRepository::from_path(Path::new(
&data_dir,
))),
metadata_service: MetadataService::new(MetadataRepository::from_path(Path::new(&data_dir))),
public_dir,
version: VERSION,
base_url,
Expand Down
2 changes: 1 addition & 1 deletion dsp-meta/src/api/handler/sitemap_xml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub async fn sitemap_xml(
)
.as_str(),
);
for meta in state.project_metadata_service.find_all()? {
for meta in state.metadata_service.find_all()? {
let mut url = base_url.to_string() + "projects/";
url.push_str(&meta.project.shortcode.as_string());
let line = format!(
Expand Down
4 changes: 2 additions & 2 deletions dsp-meta/src/api/handler/v1/projects/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub async fn get_by_shortcode(
) -> Result<Response, DspMetaError> {
trace!("entered get_project_metadata_by_shortcode()");
state
.project_metadata_service
.metadata_service
.find_by_id(&shortcode)
.map(|option| match option {
Some(metadata) => (StatusCode::OK, ProjectMetadataDto(metadata)).into_response(),
Expand All @@ -46,7 +46,7 @@ pub async fn get_by_page_and_filter(
trace!("entered get_all_project_metadata()");
let Query(pagination) = pagination.unwrap_or_default();
let Query(filter) = filter.unwrap_or_default();
let page = state.project_metadata_service.find(&filter, &pagination)?;
let page = state.metadata_service.find(&filter, &pagination)?;
let mut response = Json(
page.data
.into_iter()
Expand Down
4 changes: 2 additions & 2 deletions dsp-meta/src/api/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ mod tests {
let data_dir = env::current_dir().unwrap().parent().unwrap().join("data");

let shared_state = Arc::new(AppState {
project_metadata_service: MetadataService::new(MetadataRepository::from_path(
metadata_service: MetadataService::new(MetadataRepository::from_path(
&data_dir.as_path(),
)),
public_dir: "".to_string(),
Expand Down Expand Up @@ -134,7 +134,7 @@ mod tests {
let data_dir = env::current_dir().unwrap().parent().unwrap().join("data");

let shared_state = Arc::new(AppState {
project_metadata_service: MetadataService::new(MetadataRepository::from_path(
metadata_service: MetadataService::new(MetadataRepository::from_path(
&data_dir.as_path(),
)),
public_dir: "".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion dsp-meta/src/app_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::domain::metadata_service::MetadataService;

#[derive(Debug, Clone)]
pub struct AppState {
pub project_metadata_service: MetadataService,
pub metadata_service: MetadataService,
pub public_dir: String,
pub version: &'static str,
pub base_url: Url,
Expand Down
2 changes: 1 addition & 1 deletion dsp-meta/tests/api_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ mod tests {
fn build_server(data: Vec<DraftMetadata>) -> TestServer {
let meta_repo = MetadataRepository::for_test(data);
let shared_state = Arc::new(AppState {
project_metadata_service: MetadataService::new(meta_repo),
metadata_service: MetadataService::new(meta_repo),
public_dir: "/public".to_string(),
version: "foo_version",
base_url: Url::parse("http://localhost:3000").expect("Valid url"),
Expand Down

0 comments on commit e67d040

Please sign in to comment.