Update Datastore interface

Add new locked field syntax
This commit is contained in:
Finn Stutzenstein 2020-12-10 13:12:40 +01:00 committed by Joshua Sangmeister
parent 253126723f
commit 08691f3a1f

View File

@ -72,7 +72,7 @@ Interface WriteRequest {
locked_fields: { locked_fields: {
<fqid>: Position; <fqid>: Position;
<fqfield>: Position; <fqfield>: Position;
<CollectionField>: Position; <CollectionField>: Position | CollectionFieldLock;
} }
} }
@ -104,6 +104,11 @@ Interface DeleteEvent {
fqid: Fqid; fqid: Fqid;
} }
Interface CollectionFieldLock {
position: Position;
filter: Filter;
}
// Note: The modified fqfields include: // Note: The modified fqfields include:
// - all updated fqfields // - all updated fqfields
// - all deleted fqfields // - all deleted fqfields
@ -213,16 +218,22 @@ get_all(collection: Collection, mapped_fields?: Field[], get_deleted_models?: De
*/ */
get_everything(get_deleted_models?: DeletedModelsBehaviour): Map<Collection, Model[]>; get_everything(get_deleted_models?: DeletedModelsBehaviour): Map<Collection, Model[]>;
interface FilterResponse {
max_position: Position;
data: Map<Id, Partial<Model>>;
}
/** /**
* Returns all models of one collection that satisfy the filter condition. * Returns all models of one collection that satisfy the filter condition.
* Url: POST to /internal/datastore/reader/filter * Url: POST to /internal/datastore/reader/filter
* *
* The global max position of the datastore is returned next the the filtered data.
* This method does not take a position and can not be used when browsing the history. * This method does not take a position and can not be used when browsing the history.
* *
* @returns see get_many * @returns see get_many
* @throws InvalidFormat * @throws InvalidFormat
*/ */
filter(collection: Collection, filter: Filter, mapped_fields?: Field[]): Map<Id, Partial<Model>> filter(collection: Collection, filter: Filter, mapped_fields?: Field[]): FilterResponse
/** /**
* Url: POST to /internal/datastore/reader/exists * Url: POST to /internal/datastore/reader/exists