add revisions to collections
This commit is contained in:
@@ -35,7 +35,7 @@ namespace zero.Web.Controllers
|
||||
}
|
||||
|
||||
|
||||
public virtual async Task<EditModel<TEntity>> GetById([FromQuery] string id) => Edit(await Collection.GetById(id));
|
||||
public virtual async Task<EditModel<TEntity>> GetById([FromQuery] string id, [FromQuery] string changeVector = null) => Edit(changeVector.IsNullOrEmpty() ? await Collection.GetById(id) : await Collection.GetRevision(changeVector));
|
||||
|
||||
|
||||
public virtual async Task<Dictionary<string, TEntity>> GetByIds([FromQuery] string[] ids) => await Collection.GetByIds(ids);
|
||||
@@ -57,6 +57,12 @@ namespace zero.Web.Controllers
|
||||
}
|
||||
|
||||
|
||||
public virtual async Task<ListResult<Revision>> GetRevisions([FromQuery] string id, [FromQuery] ListBackofficeQuery<TEntity> query)
|
||||
{
|
||||
return await Collection.GetRevisions(id, query.Page, query.PageSize);
|
||||
}
|
||||
|
||||
|
||||
public virtual async Task<IEnumerable<SelectModel>> GetForPicker() => await SelectList(Collection.Stream(), PickerTransform);
|
||||
|
||||
|
||||
|
||||
@@ -16,12 +16,10 @@ namespace zero.Web.Controllers
|
||||
{
|
||||
IPagesApi Api;
|
||||
IZeroStore Store;
|
||||
IRevisionsApi RevisionsApi;
|
||||
|
||||
public PagesController(IPagesApi api, IRevisionsApi revisionsApi, IZeroStore store)
|
||||
public PagesController(IPagesApi api, IZeroStore store)
|
||||
{
|
||||
Api = api;
|
||||
RevisionsApi = revisionsApi;
|
||||
Store = store;
|
||||
}
|
||||
|
||||
@@ -88,7 +86,8 @@ namespace zero.Web.Controllers
|
||||
}
|
||||
|
||||
|
||||
public async Task<ListResult<Revision>> GetRevisions([FromQuery] string id, [FromQuery] int page = 1) => await RevisionsApi.GetPaged<Page>(id, page);
|
||||
//public async Task<ListResult<Revision>> GetRevisions([FromQuery] string id, [FromQuery] int page = 1) => await RevisionsApi.GetPaged<Page>(id, page);
|
||||
// TODO this endpoint is available when pages controller moved to BackofficeCollectionController
|
||||
|
||||
|
||||
public async Task<EntityResult<Page>> Save([FromBody] Page model) => await Api.Save(model);
|
||||
|
||||
Reference in New Issue
Block a user