= HashMap::new();
+ for path_buf in path_bufs {
+ let path = path_buf.as_path();
+ let file = File::open(path).expect("Should have been able to open the file");
+ let metadata: DraftMetadata =
+ serde_json::from_reader(file).expect("Should have been able to deserialize the file");
+ let shortcode = metadata.project.shortcode;
+ if shortcodes.contains_key(&shortcode) {
+ let last_path = shortcodes.get(&shortcode).unwrap();
+ panic!(
+ "Shortcode {:?} is not unique!\nFound in files '{}' and '{}'. Please fix this.",
+ shortcode,
+ path.file_name()
+ .and_then(|os| os.to_str())
+ .unwrap_or_default(),
+ last_path
+ .file_name()
+ .and_then(|os| os.to_str())
+ .unwrap_or_default()
+ );
+ }
+ shortcodes.insert(shortcode, path_buf);
}
- let failure_count = results.values().filter(|v| !v.is_valid()).count();
- assert_eq!(failure_count, 0);
}
diff --git a/example_http/get_all_projects.http b/example_http/get_all_projects.http
index 6e0694b8..865a41dc 100644
--- a/example_http/get_all_projects.http
+++ b/example_http/get_all_projects.http
@@ -1 +1,4 @@
-GET http://0.0.0.0:3000/projects
+GET http://localhost:3000/api/v1/projects
+
+### With project status `q`, search filter `filter`, and with pagination `_page` and `_limit` query parameters
+GET http://localhost:3000/api/v1/projects?q=f&filter=database&_page=2&_limit=1
\ No newline at end of file
diff --git a/example_http/get_projects_count.http b/example_http/get_projects_count.http
deleted file mode 100644
index 1d06ff50..00000000
--- a/example_http/get_projects_count.http
+++ /dev/null
@@ -1 +0,0 @@
-GET http://0.0.0.0:3000/projects/count
diff --git a/example_http/get_single_project.http b/example_http/get_single_project.http
index b193e0b6..5058975d 100644
--- a/example_http/get_single_project.http
+++ b/example_http/get_single_project.http
@@ -1 +1 @@
-GET http://0.0.0.0:3000/projects/0803
+GET http://localhost:3000/api/v1/projects/0803
diff --git a/example_http/get_single_project_as_rdf.http b/example_http/get_single_project_as_rdf.http
deleted file mode 100644
index a4270f7f..00000000
--- a/example_http/get_single_project_as_rdf.http
+++ /dev/null
@@ -1 +0,0 @@
-GET http://0.0.0.0:3000/projects/0803/rdf
diff --git a/example_http/store_project_metadata.http b/example_http/store_project_metadata.http
deleted file mode 100644
index a4cb6373..00000000
--- a/example_http/store_project_metadata.http
+++ /dev/null
@@ -1,6 +0,0 @@
-POST http://0.0.0.0:3000/projects
-Content-Type: application/hcl
-
-< ../data/incunabula.hcl
-
-###
diff --git a/flake.nix b/flake.nix
index 9ddf4dc9..b7ea4daa 100644
--- a/flake.nix
+++ b/flake.nix
@@ -26,6 +26,7 @@
cargo-fuzz
cargo-nextest
rustup
+ graphviz
];
shellHook = ''
diff --git a/justfile b/justfile
index 1996e1b5..f4655acf 100644
--- a/justfile
+++ b/justfile
@@ -34,10 +34,22 @@ build-frontend:
test:
cargo test --tests
+# Clean all build artifacts
+clean:
+ cargo clean
+
# Run dsp-meta-server
-serve:
+serve: build-frontend clean
export DSP_META_DATA_DIR=${PWD}/data && export DSP_META_PUBLIC_DIR=${PWD}/web-frontend/public && export DSP_META_LOG_FILTER=trace,hyper=info && cargo run --bin dsp-meta-server
+# Run dsp-meta-server and watch for changes in the Rust code
+serve-dev:
+ export DSP_META_DATA_DIR=${PWD}/data && export DSP_META_PUBLIC_DIR=${PWD}/web-frontend/public && export DSP_META_LOG_FILTER=trace,hyper=info && cargo watch -x 'run --bin dsp-meta-server'
+
+# Run the frontend dev server
+serve-frontend:
+ cd web-frontend && yarn run dev
+
# Run dsp-meta-validator validating all hcl documents under ./data
validate:
export DSP_META_DATA_DIR=${PWD}/data && cargo run --bin dsp-meta-validator
diff --git a/result-bin b/result-bin
deleted file mode 120000
index 7afa6152..00000000
--- a/result-bin
+++ /dev/null
@@ -1 +0,0 @@
-/nix/store/wq3q06m18agdvj8q9lzf917mnkgsjd3z-crate-dsp-meta-cmd-0.1.3-bin
\ No newline at end of file
diff --git a/web-frontend/public/index.html b/web-frontend/public/index.html
index c63ccb65..dc7afe10 100644
--- a/web-frontend/public/index.html
+++ b/web-frontend/public/index.html
@@ -4,8 +4,8 @@
-
-
+
+
diff --git a/web-frontend/src/Footer.svelte b/web-frontend/src/Footer.svelte
index 9d340d71..014d6084 100644
--- a/web-frontend/src/Footer.svelte
+++ b/web-frontend/src/Footer.svelte
@@ -1,10 +1,11 @@
{#if $projectMetadata}
-
+ {#if ($projectMetadata?.project.url || $projectMetadata?.project.secondaryURL) && !$isTestEnvironment}
+
+ {:else if $isTestEnvironment}
+
+ {/if}
+
@@ -56,7 +86,7 @@
{#if $projectMetadata?.project.shortcode}
DSP Internal Shortcode
{$projectMetadata?.project.shortcode}
- {:else if isTestEnvironment}
+ {:else if $isTestEnvironment}
DSP Internal Shortcode
Shortcode missing
{/if}
@@ -72,13 +102,16 @@
How To Cite
{#if $projectMetadata?.project.howToCite}
{/if}
{$projectMetadata?.project.howToCite}
- {:else if isTestEnvironment}
+ {:else if $isTestEnvironment}
How To Cite
How-to-cite missing
{/if}
@@ -92,13 +125,14 @@
{truncateString(d.text)}
{:else}
{#if getText(d).match(/^\d+ /)}
- {truncateString(getText(d))}
+ {truncateString(getText(d))}
{:else}
{getText(d)}
{/if}
{/if}
{/each}
- {:else if isTestEnvironment}
+ {:else if $isTestEnvironment}
Disciplines
Disciplines missing
{/if}
@@ -113,7 +147,7 @@
{getText(t)}
{/if}
{/each}
- {:else if isTestEnvironment}
+ {:else if $isTestEnvironment}
Temporal Coverage
Temporal coverage missing
{/if}
@@ -125,7 +159,7 @@
{#each $projectMetadata?.project.spatialCoverage as s}
{truncateString(s.text)}
{/each}
- {:else if isTestEnvironment}
+ {:else if $isTestEnvironment}
Spatial Coverage
Spatial coverage missing
{/if}
@@ -134,11 +168,11 @@
{#if $projectMetadata?.project.startDate}
Start date
{$projectMetadata?.project.startDate}
- {:else if isTestEnvironment}
+ {:else if $isTestEnvironment}
Start date
Start date missing
{/if}
-
+
{#if $projectMetadata?.project.endDate}
End date
@@ -146,25 +180,31 @@
{/if}
- {#if $projectMetadata?.project.funders && $projectMetadata?.project.funders.map((o) => {return findObjectByID(o)}).filter(e => e).length>0 }
+ {#if $projectMetadata?.project.funders && $projectMetadata?.project.funders.map((o) => {
+ return findObjectByID(o)
+ }).filter(e => e).length > 0 }
Funder
- {#each $projectMetadata?.project.funders.map((o) => {return findObjectByID(o)}) as f}
- {#if f.__type === "Person"}
-
-
- {:else if f.__type === "Organization"}
- {f.name}
- {/if}
+ {#each $projectMetadata?.project.funders.map((o) => {
+ return findObjectByID(o)
+ }) as f}
+ {#if f.__type === "Person"}
+
+
+ {:else if f.__type === "Organization"}
+ {f.name}
+ {/if}
{/each}
- {:else if isTestEnvironment}
+ {:else if $isTestEnvironment}
Funder
funders missing
{/if}
-
+
{#if $projectMetadata?.project.grants}
Grant
- {#each $projectMetadata?.project.grants.map(id => {return findGrantByID(id)}) as g}
+ {#each $projectMetadata?.project.grants.map(id => {
+ return findGrantByID(id)
+ }) as g}
{#if g?.number && g?.url && g?.name}
{truncateString(`${g?.name}: ${g?.number}`)}
{:else if g?.number && g?.url}
@@ -172,7 +212,9 @@
{:else if g?.number}
{g?.number}
{:else}
- {#each [g?.funders[0]].map(o => {return findOrganizationByID(o)}) as f}
+ {#each [g?.funders[0]].map(o => {
+ return findOrganizationByID(o)
+ }) as f}
{f.name}
{/each}
{/if}
@@ -209,64 +251,73 @@
{#if $projectMetadata?.project.keywords}
Keywords
- {$projectMetadata?.project.keywords.map(t => {return getText(t)}).join(", ")}
- {:else if isTestEnvironment}
+ {$projectMetadata?.project.keywords.map(t => {
+ return getText(t)
+ }).join(", ")}
+ {:else if $isTestEnvironment}
Keywords
keywords missing
{/if}
- {:else if isTestEnvironment}
- Project not available
+{:else if $isTestEnvironment}
+ Project not available
{/if}
diff --git a/web-frontend/src/projects-repository/ProjectsRepository.svelte b/web-frontend/src/projects-repository/ProjectsRepository.svelte
index f65dccca..f528ba63 100644
--- a/web-frontend/src/projects-repository/ProjectsRepository.svelte
+++ b/web-frontend/src/projects-repository/ProjectsRepository.svelte
@@ -12,7 +12,7 @@
$: document.title = 'DaSCH Metadata Browser';
setTimeout(() => {
- const noData = 'No data retrived. Please check the connection and retry.';
+ const noData = 'No data retrieved. Please check the connection and retry.';
const noProject = 'No projects found.'
message = $pagedResults && $pagedResults.length ? noData : noProject;
}, 3000);
@@ -32,7 +32,7 @@
// first page on main page arrival
await getProjectsMetadata(1);
} else {
- // preserved on rehresh or manually entered query
+ // preserved on refresh or manually entered query
await getProjectsMetadata(page, query);
}
});
diff --git a/web-frontend/src/projects-repository/Tile.svelte b/web-frontend/src/projects-repository/Tile.svelte
index 0140278c..a57c2588 100644
--- a/web-frontend/src/projects-repository/Tile.svelte
+++ b/web-frontend/src/projects-repository/Tile.svelte
@@ -8,7 +8,7 @@
-
+