Merge pull request #5342 from jsangmeister/update-interface

Updated datastore interface
This commit is contained in:
jsangmeister 2020-05-05 10:05:52 +02:00 committed by GitHub
commit ae6c214cd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -155,17 +155,31 @@ get(fqid: Fqid, mapped_fields?: Field[], position?: Position, get_deleted_models
/** /**
* Returns multiple models. * Returns multiple models.
* Can either be called with a list of fqids (if all fields are needed/wanted or if the * Can either be called with a list of Fqfields or with a list of specific request
* same fields of all objects are needed) or with a list of specific request objects * objects that map a collection to the needed ids and fields. If both the lower and
* that map a collection to the needed ids and fields. If both the lower and the higher * the higher level mapped_fields are given, the higher level one is merged into all
* level mapped_fields are given, the higher level one is merged into all lower level * lower level ones. If Fqfields are given, the mapped_fields are ignored.
* ones.
* If an id is not found, it is not included in the response instead of throwing a * If an id is not found, it is not included in the response instead of throwing a
* ModelDoesNotExist. * ModelDoesNotExist.
* *
* @returns A mapping of collection to ids to models. Example:
* {
* "collection1": {
* "id1": {
* "field1": "foo",
* "field2": "bar",
* },
* },
* "collection2": {
* "id2": {
* "field3": 42,
* },
* },
* }
*
* @throws InvalidFormat * @throws InvalidFormat
*/ */
getMany(requests: GetManyRequest[], mapped_fields?: Field[], position?: Position, get_deleted_models?: DeletedModelsBehaviour): Map<Fqid, Partial<Model>>; getMany(requests: GetManyRequest[] | Fqfield[], mapped_fields?: Field[], position?: Position, get_deleted_models?: DeletedModelsBehaviour): Map<Collection, Map<Id, Partial<Model>>>;
Interface GetManyRequest { Interface GetManyRequest {
collection: Collection; collection: Collection;