La méthode get
2 min
La méthode get permet de récupérer une entité éxistante.
Une entité project peut être récupérée par id, par externalId ou par signatureId.
import { Entities } from '@fasstech/oip-core';
// par id
const project = await Entities('Project').get({ id: 'my-project-id' });
// par externalId
const project = await Entities('Project').get({ externalId: 'my-external-id' });
// par signatureId
const project = await Entities('Project').get({ signatureId: 'my-signature-id' });Pour récupérer une entité qui n'est pas de type tableau, l'entité parent doit être passé en paramètre de la méthode get.
import { Entities } from '@fasstech/oip-core';
// récupération de l'entité customer
const customer = await Entities('Customer').get(project);Pour récupérer une entité d'un tableau, l'entité parent doit être passé en premier paramètre ainsi que l'id de l'entité souhaitée en second paramètre.
import { Entities } from '@fasstech/oip-core';
// récupération d'une entité company par son id
const company = await Entities('Company').get(project, 'my-company-id');