---
title: Product
slug: oip-next/qdo9ugymxrglv6gxgiflh
icon: {"lucideIcon":"📘"}
createdAt: 2024-04-08T10:17:29.000Z
---

# Product

## Description

L'entité Product regroupe les offres, comparaisons ou CCN accessibles à l'utilisateur courtier. Elle représente un groupement de type de garanties.

## Relations

### Ascendantes

| Entité  | Propriété |
| ------- | --------- |
| Project | products  |

### Descendantes

| Entité  | Propriété |
| ------- | --------- |
| History | history   |

## Propriétés

| Nom          | Type      | Description                                                                       | Validateur | Lecture seule ? | Dépréciée ? | Dernière version modifiée |
| ------------ | --------- | --------------------------------------------------------------------------------- | ---------- | --------------- | ----------- | ------------------------- |
| isSelected   | `Boolean` | Indique si l'offre a été sélectionné par l'utilisateur                            |            |                 |             | 2.6.0                     |
| metadata     | `Json`    | Données non prédictives à stocker                                                 |            |                 |             | 2.6.0                     |
| uri          | `String`  | Alternative à l'externalId                                                        |            |                 |             | 2.6.0                     |
| id           | `String`  | Identifiant de l'entité `Product`                                                 |            | X               |             |                           |
| code         | `String`  | Codification fonctionnelle de l'entité `Product`                                  |            |                 |             |                           |
| externalId   | `String`  | Identifiant de l'entité `Product` dans le système client                          |            |                 |             |                           |
| externalCode | `String`  | Codification fonctionnelle de l'entité `Product` dans le système client           |            |                 |             |                           |
| productId    | `String`  | Identifiant public de l'entité `Product` dans l'OIP                               |            |                 |             |                           |
| label        | `String`  | Information relative au nom de l'entité `Product` dans son contexte d'utilisation |            |                 |             |                           |
| createdAt    | `Date`    | Date de création de l'entité `Product`                                            |            | X               |             |                           |
| updatedAt    | `Date`    | Date de modification de l'entité `Product`                                        |            | X               |             |                           |

## Enumérations

Aucune enumération.

## Enumérations génériques

Aucune enumération générique.

## Exemple

```javascript
import { Entities } from '@fasstech/oip-core';
import { getProductCode, getProductExternalCode, getProductExternalId, getProductId, getProductIsSelected, getProductLabel, getProductMetadata, getProductProductId, getProductUri, setProductCode, setProductExternalCode, setProductExternalId, setProductIsSelected, setProductLabel, setProductMetadata, setProductProductId, setProductUri } from '@fasstech/oip-core/entities/Product';
import { getProjectId } from '@fasstech/oip-core/entities/Project';

(async () => {
  let project = await Entities('Project').create();
  const product = await Entities('Product').create();
  
  setProductIsSelected(false, product);
  setProductMetadata({ metadata: 'foo' }, product);
  setProductUri('uri', product);
  setProductCode('code', product);
  setProductExternalId('externalId', product);
  setProductExternalCode('externalCode', product);
  setProductProductId('productId', product);
  setProductLabel('label', product);
  
  project = await Entities('Product').save(project, product);
  await Entities('Project').save(project);
  
  const projectToTest = await Entities('Project').get({ id: getProjectId(project) });
  const productToTest = await Entities('Product').get(projectToTest, { filter: ({ id }) => id === getProductId(product) });
  
  getProductIsSelected(productToTest); // false
  getProductMetadata(productToTest); // { metadata: 'foo' }
  getProductUri(productToTest); // 'uri'
  getProductCode(productToTest); // 'code'
  getProductExternalId(productToTest); // 'externalId'
  getProductExternalCode(productToTest); // 'externalCode'
  getProductProductId(productToTest); // 'productId'
  getProductLabel(productToTest); // 'label'
})();
```
