Merge pull request #5768 from FinnStutzenstein/updateDSInterface

Update Datastore interface
This commit is contained in:
Finn Stutzenstein 2021-01-12 16:25:58 +01:00 committed by GitHub
commit b825fb2a35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,7 +72,7 @@ Interface WriteRequest {
locked_fields: {
<fqid>: Position;
<fqfield>: Position;
<CollectionField>: Position;
<CollectionField>: Position | CollectionFieldLock;
}
}
@ -104,6 +104,15 @@ Interface DeleteEvent {
fqid: Fqid;
}
// Collection fields can not only be locked to a specific position, but also filtered
// first, e.g. when selecting all models from a specific meeting. WARNING: the filter
// should always contain an equals check with the meeting_id, since this will be
// indexed. Other filters can lead to long query times.
Interface CollectionFieldLock {
position: Position;
filter: Filter;
}
// Note: The modified fqfields include:
// - all updated fqfields
// - all deleted fqfields
@ -213,16 +222,22 @@ get_all(collection: Collection, mapped_fields?: Field[], get_deleted_models?: De
*/
get_everything(get_deleted_models?: DeletedModelsBehaviour): Map<Collection, Model[]>;
interface FilterResponse {
position: Position;
data: Map<Id, Partial<Model>>;
}
/**
* Returns all models of one collection that satisfy the filter condition.
* 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.
*
* @returns see get_many
* @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