updated datastore interface

This commit is contained in:
Joshua Sangmeister 2020-04-28 11:59:28 +02:00
parent bc19de9570
commit f66346405b

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;