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

# History

## Description

L'entité History permet de stocker l'ensemble des évènements réalisés par un utilisateur (utilisateurs d'un OAV, services automatisés, ...) sur une entité.

## Relations

### Ascendantes

| Entité                                    | Propriété |
| ----------------------------------------- | --------- |
| ActivePolicy                              | history   |
| Address                                   | history   |
| Aml                                       | history   |
| BankAccount                               | history   |
| CSP                                       | history   |
| Check                                     | history   |
| ChosenRiskAndRange                        | history   |
| CollectionNeed                            | history   |
| Commission                                | history   |
| Company                                   | history   |
| Contact                                   | history   |
| Contribution                              | history   |
| Customer                                  | history   |
| Demography                                | history   |
| DigitalService                            | history   |
| Document                                  | history   |
| Email                                     | history   |
| Employee                                  | history   |
| Finance                                   | history   |
| FinanceCompany                            | history   |
| GDPR                                      | history   |
| Grantee                                   | history   |
| GroupPension                              | history   |
| HealthNeed                                | history   |
| Hypothesis                                | history   |
| HypothesisResult                          | history   |
| IndividualPension                         | history   |
| InvestmentBreakdown                       | history   |
| LegalProfile                              | history   |
| Mandate                                   | history   |
| Markup                                    | history   |
| OSCommonProps                             | history   |
| OSOfferProps                              | history   |
| Offer                                     | history   |
| OfferNode                                 | history   |
| OngoingClaim                              | history   |
| Pack                                      | history   |
| Parameter                                 | history   |
| Payment                                   | history   |
| PaymentMethod                             | history   |
| Pension                                   | history   |
| PensionNeed                               | history   |
| PersonalProfile                           | history   |
| Phone                                     | history   |
| Price                                     | history   |
| Pricing                                   | history   |
| Product                                   | history   |
| Project                                   | history   |
| ProtectionNeed                            | history   |
| Relation                                  | history   |
| SavingPensionWaiverDetails                | history   |
| Scenario                                  | history   |
| SeverancePay                              | history   |
| SeverancePayAverageDemography             | history   |
| SeverancePayFundingPlan                   | history   |
| SeverancePayHypothesis                    | history   |
| SeverancePayHypothesisCategory            | history   |
| SeverancePayHypothesisIndemnities         | history   |
| SeverancePayHypothesisResult              | history   |
| SeverancePayHypothesisSolution            | history   |
| SeverancePayHypothesisSolutionFundingPlan | history   |
| SeverancePaySocialLiabilityByAgeRange     | history   |
| SeverancePaySocialLiabilityByCategory     | history   |
| SeverancePaySocialLiabilitySchedule       | history   |
| SeverancePayTheorical                     | history   |
| Signature                                 | history   |
| SocialSecurity                            | history   |
| StockFunds                                | history   |
| Svc                                       | history   |
| Tns                                       | history   |
| Turnover                                  | history   |
| TurnoverDetail                            | history   |
| User                                      | history   |
| Waiver                                    | history   |
| WaiverDetail                              | history   |
| WaiverRequest                             | history   |

### Descendantes

| Entité | Propriété |
| ------ | --------- |

## Propriétés

| Nom          | Type     | Description                                                                                                | Validateur | Lecture seule ? | Dépréciée ? | Dernière version modifiée |
| ------------ | -------- | ---------------------------------------------------------------------------------------------------------- | ---------- | --------------- | ----------- | ------------------------- |
| OP           | `Json`   | Objet JSON pour stocker les informations et les données relatives à l'événement ou à l'opération à tracer. |            |                 |             | 2.7.0                     |
| at           | `Date`   | Indique l'heure de l'évènement.                                                                            |            |                 |             | 2.7.0                     |
| by           | `String` | Indique l'origine de l'évènement. Cela peut être un utilisateur, un service, un moteur ou autre.           |            |                 |             | 2.7.0                     |
| id           | `String` | Identifiant de l'entité `History`                                                                          |            | X               |             |                           |
| code         | `String` | Codification fonctionnelle de l'entité `History`                                                           |            |                 |             |                           |
| externalId   | `String` | Identifiant de l'entité `History` dans le système client                                                   |            |                 |             |                           |
| externalCode | `String` | Codification fonctionnelle de l'entité `History` dans le système client                                    |            |                 |             |                           |
| historyId    | `String` | Identifiant public de l'entité `History` dans l'OIP                                                        |            |                 |             |                           |
| label        | `String` | Information relative au nom de l'entité `History` dans son contexte d'utilisation                          |            |                 |             |                           |
| createdAt    | `Date`   | Date de création de l'entité `History`                                                                     |            | X               |             |                           |
| updatedAt    | `Date`   | Date de modification de l'entité `History`                                                                 |            | 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 { getActivePolicyId } from '@fasstech/oip-core/entities/ActivePolicy';
import { getCompanyId } from '@fasstech/oip-core/entities/Company';
import { getHistoryAt, getHistoryBy, getHistoryCode, getHistoryExternalCode, getHistoryExternalId, getHistoryHistoryId, getHistoryId, getHistoryLabel, getHistoryOP, setHistoryAt, setHistoryBy, setHistoryCode, setHistoryExternalCode, setHistoryExternalId, setHistoryHistoryId, setHistoryLabel, setHistoryOP } from '@fasstech/oip-core/entities/History';
import { getProjectId } from '@fasstech/oip-core/entities/Project';

(async () => {
  let project = await Entities('Project').create();
  let company = await Entities('Company').create();
  let activePolicy = await Entities('ActivePolicy').create();
  const history = await Entities('History').create();
  
  setHistoryOP({ OP: 'foo' }, history);
  setHistoryAt(new Date('2017-01-01'), history);
  setHistoryBy('by', history);
  setHistoryCode('code', history);
  setHistoryExternalId('externalId', history);
  setHistoryExternalCode('externalCode', history);
  setHistoryHistoryId('historyId', history);
  setHistoryLabel('label', history);
  
  activePolicy = await Entities('History').save(activePolicy, history);
  company = await Entities('ActivePolicy').save(company, activePolicy);
  project = await Entities('Company').save(project, company);
  await Entities('Project').save(project);
  
  const projectToTest = await Entities('Project').get({ id: getProjectId(project) });
  const companyToTest = await Entities('Company').get(projectToTest, { filter: ({ id }) => id === getCompanyId(company) });
  const activePolicyToTest = await Entities('ActivePolicy').get(companyToTest, { filter: ({ id }) => id === getActivePolicyId(activePolicy) });
  const historyToTest = await Entities('History').get(activePolicyToTest, { filter: ({ id }) => id === getHistoryId(history) });
  
  getHistoryOP(historyToTest); // { OP: 'foo' }
  getHistoryAt(historyToTest); // new Date('2017-01-01')
  getHistoryBy(historyToTest); // 'by'
  getHistoryCode(historyToTest); // 'code'
  getHistoryExternalId(historyToTest); // 'externalId'
  getHistoryExternalCode(historyToTest); // 'externalCode'
  getHistoryHistoryId(historyToTest); // 'historyId'
  getHistoryLabel(historyToTest); // 'label'
})();
```
