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