refactor: update
This commit is contained in:
parent
b3278bff62
commit
967579009d
@ -367,6 +367,12 @@ pub mod repository {
|
|||||||
id: LookupKey,
|
id: LookupKey,
|
||||||
data: Value,
|
data: Value,
|
||||||
) -> Option<RepositoryItem>;
|
) -> Option<RepositoryItem>;
|
||||||
|
async fn replace(
|
||||||
|
&mut self,
|
||||||
|
context: &RepositoryContext,
|
||||||
|
id: LookupKey,
|
||||||
|
data: Value,
|
||||||
|
) -> Option<RepositoryItem>;
|
||||||
async fn delete(&mut self, context: &RepositoryContext, id: LookupKey) -> Option<Value>;
|
async fn delete(&mut self, context: &RepositoryContext, id: LookupKey) -> Option<Value>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,12 @@ impl AdminRepository for Repository {
|
|||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get(&self, model: &RepositoryContext, id: LookupKey) -> Option<RepositoryItem> {
|
// GET on item collection.
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
async fn list(&self, model: &RepositoryContext) -> RepositoryList {
|
async fn list(&self, model: &RepositoryContext) -> RepositoryList {
|
||||||
RepositoryList::Empty
|
RepositoryList::Empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// POST on item collection.
|
||||||
async fn create(
|
async fn create(
|
||||||
&mut self,
|
&mut self,
|
||||||
model: &RepositoryContext,
|
model: &RepositoryContext,
|
||||||
@ -34,6 +32,12 @@ impl AdminRepository for Repository {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GET single item.
|
||||||
|
async fn get(&self, model: &RepositoryContext, id: LookupKey) -> Option<RepositoryItem> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
// PATCH single item.
|
||||||
async fn update(
|
async fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
model: &RepositoryContext,
|
model: &RepositoryContext,
|
||||||
@ -43,6 +47,17 @@ impl AdminRepository for Repository {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PUT single item.
|
||||||
|
async fn replace(
|
||||||
|
&mut self,
|
||||||
|
model: &RepositoryContext,
|
||||||
|
id: LookupKey,
|
||||||
|
data: Value,
|
||||||
|
) -> Option<RepositoryItem> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
// DELETE single item.
|
||||||
async fn delete(&mut self, _: &RepositoryContext, id: LookupKey) -> Option<Value> {
|
async fn delete(&mut self, _: &RepositoryContext, id: LookupKey) -> Option<Value> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
@ -124,6 +124,15 @@ impl AdminRepository for MyStaticRepository {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn replace(
|
||||||
|
&mut self,
|
||||||
|
model: &RepositoryContext,
|
||||||
|
id: LookupKey,
|
||||||
|
data: Value,
|
||||||
|
) -> Option<RepositoryItem> {
|
||||||
|
self.update(model, id, data).await
|
||||||
|
}
|
||||||
|
|
||||||
async fn delete(&mut self, _: &RepositoryContext, id: LookupKey) -> Option<Value> {
|
async fn delete(&mut self, _: &RepositoryContext, id: LookupKey) -> Option<Value> {
|
||||||
debug!("Would delete: {}", id);
|
debug!("Would delete: {}", id);
|
||||||
|
|
||||||
|
@ -46,6 +46,15 @@ impl AdminRepository for UserRepository {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn replace(
|
||||||
|
&mut self,
|
||||||
|
model: &RepositoryContext,
|
||||||
|
id: LookupKey,
|
||||||
|
data: Value,
|
||||||
|
) -> Option<RepositoryItem> {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
async fn delete(&mut self, _: &RepositoryContext, id: LookupKey) -> Option<Value> {
|
async fn delete(&mut self, _: &RepositoryContext, id: LookupKey) -> Option<Value> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user