Skip to content

Commit 55a3aca

Browse files
committed
Fix issues?
1 parent 61c686f commit 55a3aca

File tree

6 files changed

+3
-101
lines changed

6 files changed

+3
-101
lines changed

cli/src/main.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use atomic_lib::atomic_url::Routes;
21
use atomic_lib::{agents::generate_public_key, mapping::Mapping};
32
use atomic_lib::{agents::Agent, config::Config};
43
use atomic_lib::{errors::AtomicResult, Storelike};

lib/src/populate.rs

+1-21
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,8 @@ pub fn populate_collections(store: &impl Storelike) -> AtomicResult<()> {
253253
pub fn populate_endpoints(store: &crate::Db) -> AtomicResult<()> {
254254
use crate::atomic_url::Routes;
255255

256-
let endpoints = crate::plugins::default_endpoints();
257256
let endpoints_collection = store.get_server_url().set_route(Routes::Endpoints);
258-
for endpoint in endpoints {
257+
for endpoint in crate::endpoints::build_default_endpoints() {
259258
let mut resource = endpoint.to_resource(store)?;
260259
resource.set_propval(
261260
urls::PARENT.into(),
@@ -267,25 +266,6 @@ pub fn populate_endpoints(store: &crate::Db) -> AtomicResult<()> {
267266
Ok(())
268267
}
269268

270-
#[cfg(feature = "db")]
271-
/// Adds default Endpoints (versioning) to the Db.
272-
/// Makes sure they are fetchable
273-
pub fn populate_importer(store: &crate::Db) -> AtomicResult<()> {
274-
let base = store
275-
.get_self_url()
276-
.ok_or("No self URL in this Store - required for populating importer")?;
277-
let mut importer = crate::Resource::new(urls::construct_path_import(&base));
278-
importer.set_class(urls::IMPORTER);
279-
importer.set_propval(
280-
urls::PARENT.into(),
281-
Value::AtomicUrl(base.to_string()),
282-
store,
283-
)?;
284-
importer.set_propval(urls::NAME.into(), Value::String("Import".into()), store)?;
285-
importer.save_locally(store)?;
286-
Ok(())
287-
}
288-
289269
#[cfg(feature = "db")]
290270
/// Adds items to the SideBar as subresources.
291271
/// Useful for helping a new user get started.

lib/src/resources.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
//! Has methods for saving resources and getting properties inside them.
33
44
use crate::commit::{CommitOpts, CommitResponse};
5-
use crate::storelike::Query;
65
use crate::urls;
76
use crate::utils::random_string;
87
use crate::values::{SubResource, Value};
8+
use crate::Query;
99
use crate::{commit::CommitBuilder, errors::AtomicResult};
1010
use crate::{
1111
mapping::is_url,

lib/src/store.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl Storelike for Store {
184184
fn get_server_url(&self) -> &AtomicUrl {
185185
// TODO Should be implemented later when companion functionality is here
186186
// https://github.com./atomicdata-dev/atomic-server/issues/6
187-
"local:store"
187+
&LOCAL_STORE_URL
188188
}
189189

190190
fn get_self_url(&self) -> Option<&AtomicUrl> {

lib/src/storelike.rs

-74
Original file line numberDiff line numberDiff line change
@@ -393,77 +393,3 @@ pub trait Storelike: Sized {
393393
crate::validate::validate_store(self, false)
394394
}
395395
}
396-
397-
/// Use this to construct a list of Resources
398-
#[derive(Debug)]
399-
pub struct Query {
400-
/// Filter by Property
401-
pub property: Option<String>,
402-
/// Filter by Value
403-
pub value: Option<Value>,
404-
/// Maximum of items to return, if none returns all items.
405-
pub limit: Option<usize>,
406-
/// Value at which to begin lexicographically sorting things.
407-
pub start_val: Option<Value>,
408-
/// Value at which to stop lexicographically sorting things.
409-
pub end_val: Option<Value>,
410-
/// How many items to skip from the first one
411-
pub offset: usize,
412-
/// The Property URL that is used to sort the results
413-
pub sort_by: Option<String>,
414-
/// Sort descending instead of ascending.
415-
pub sort_desc: bool,
416-
/// Whether to include non-server resources
417-
pub include_external: bool,
418-
/// Whether to include full Resources in the result, if not, will add empty vector here.
419-
pub include_nested: bool,
420-
/// For which Agent the query is executed. Pass `None` if you want to skip permission checks.
421-
pub for_agent: ForAgent,
422-
}
423-
424-
impl Query {
425-
pub fn new() -> Self {
426-
Query {
427-
property: None,
428-
value: None,
429-
limit: None,
430-
start_val: None,
431-
end_val: None,
432-
offset: 0,
433-
sort_by: None,
434-
sort_desc: false,
435-
include_external: false,
436-
include_nested: true,
437-
for_agent: ForAgent::Sudo,
438-
}
439-
}
440-
441-
/// Search for a property-value combination
442-
pub fn new_prop_val(prop: &str, val: &str) -> Self {
443-
let mut q = Self::new();
444-
q.property = Some(prop.to_string());
445-
q.value = Some(Value::String(val.to_string()));
446-
q
447-
}
448-
449-
/// Search for instances of some Class
450-
pub fn new_class(class: &str) -> Self {
451-
let mut q = Self::new();
452-
q.property = Some(urls::IS_A.into());
453-
q.value = Some(Value::AtomicUrl(class.to_string()));
454-
q
455-
}
456-
}
457-
458-
impl Default for Query {
459-
fn default() -> Self {
460-
Self::new()
461-
}
462-
}
463-
464-
pub struct QueryResult {
465-
pub subjects: Vec<String>,
466-
pub resources: Vec<Resource>,
467-
/// The amount of hits that were found, including the ones that were out of bounds or not authorized.
468-
pub count: usize,
469-
}

lib/src/urls.rs

-3
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,4 @@ pub const PATH_REGISTER: &str = "/register";
153153
pub const PATH_CONFIRM_EMAIL: &str = "/confirm-email";
154154
pub const PATH_ADD_PUBKEY: &str = "/add-public-key";
155155
pub const PATH_CONFIRM_PUBKEY: &str = "/confirm-add-public-key";
156-
157-
pub const PATH_IMPORT: &str = "/import";
158-
pub const PATH_FETCH_BOOKMARK: &str = "/fetch-bookmark";
159156
pub const PATH_QUERY: &str = "/query";

0 commit comments

Comments
 (0)