---
title: History
slug: oip-next/ha3jl2sbys4gsouki6toa
createdAt: 2024-02-21T13:33:45.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é |
| ----------------------------------------- | --------- |
| Project                                   | history   |
| Markup                                    | history   |
| Mandate                                   | history   |
| Finance                                   | history   |
| PensionNeed                               | history   |
| Product                                   | history   |
| PaymentMethod                             | history   |
| Hypothesis                                | history   |
| Pack                                      | history   |
| FinanceCompany                            | history   |
| Pension                                   | history   |
| Commission                                | history   |
| Company                                   | history   |
| Scenario                                  | history   |
| StockFunds                                | history   |
| Tns                                       | history   |
| OngoingClaim                              | history   |
| Payment                                   | history   |
| TurnoverDetail                            | history   |
| Address                                   | history   |
| Relation                                  | history   |
| Employee                                  | history   |
| GDPR                                      | history   |
| PersonalProfile                           | history   |
| SeverancePayHypothesisCategory            | history   |
| HypothesisResult                          | history   |
| HealthNeed                                | history   |
| DigitalService                            | history   |
| SeverancePaySocialLiabilitySchedule       | history   |
| Phone                                     | history   |
| Svc                                       | history   |
| ActivePolicy                              | history   |
| Price                                     | history   |
| SeverancePayHypothesis                    | history   |
| User                                      | history   |
| LegalProfile                              | history   |
| SeverancePayHypothesisSolutionFundingPlan | history   |
| Check                                     | history   |
| Aml                                       | history   |
| Email                                     | history   |
| CSP                                       | history   |
| ChosenRiskAndRange                        | history   |
| WaiverRequest                             | history   |
| WaiverDetail                              | history   |
| SeverancePaySocialLiabilityByCategory     | history   |
| SeverancePayHypothesisIndemnities         | history   |
| SeverancePayHypothesisResult              | history   |
| Signature                                 | history   |
| InvestmentBreakdown                       | history   |
| SeverancePayFundingPlan                   | history   |
| GroupPension                              | history   |
| SeverancePayTheorical                     | history   |
| SeverancePaySocialLiabilityByAgeRange     | history   |
| Pricing                                   | history   |
| Demography                                | history   |
| ProtectionNeed                            | history   |
| SavingPensionWaiverDetails                | history   |
| SeverancePay                              | history   |
| Document                                  | history   |
| Turnover                                  | history   |
| Contact                                   | history   |
| IndividualPension                         | history   |
| Customer                                  | history   |
| SocialSecurity                            | history   |
| Offer                                     | history   |
| Grantee                                   | history   |
| SeverancePayAverageDemography             | history   |
| CollectionNeed                            | history   |
| BankAccount                               | history   |
| Waiver                                    | history   |
| SeverancePayHypothesisSolution            | history   |

### Descendantes

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

## Liste des propriétés

| Nom       | Type     | Dernière version modifiée | Description                                                                                                | Getter              | Setter        | Deprecated |
| --------- | -------- | ------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------------- | ------------- | ---------- |
| OP        | `Json`   | 2.7.0                     | Objet JSON pour stocker les informations et les données relatives à l'événement ou à l'opération à tracer. | getHistoryOP        | setHistoryOP  | -          |
| at        | `Date`   | 2.7.0                     | Indique l'heure de l'évènement.                                                                            | getHistoryAt        | setHistoryAt  | -          |
| by        | `String` | 2.7.0                     | Indique l'origine de l'évènement. Cela peut être un utilisateur, un service, un moteur ou autre.           | getHistoryBy        | setHistoryBy  | -          |
| createdAt | `Date`   |                           | Date de création de l'entité `History`                                                                     | getHistoryCreatedAt | Lecture seule | -          |
| createdBy | `String` |                           | Utilisateur à l'origine de la création de l'entité `History`                                               | getHistoryCreatedBy | Lecture seule | -          |
| id        | `String` |                           | Identifiant unique de l'entité `History`                                                                   | getHistoryId        | Lecture seule | -          |
| updatedAt | `Date`   |                           | Date de modification de l'entité `History`                                                                 | getHistoryUpdatedAt | Lecture seule | -          |
| updatedBy | `String` |                           | Utilisateur à l'origine de la modification de l'entité `History`                                           | getHistoryUpdatedBy | Lecture seule | -          |

## Enums

Aucune enumération disponible pour cette entité.

## Exemple

```javascript
import { Entities } from '@fasstech/oip-core';
import { getHistoryAt, getHistoryBy, getHistoryOP, gethistoryId, setHistoryAt, setHistoryBy, setHistoryOP } from '@fasstech/oip-core/entities/history';
import { getHypothesisId } from '@fasstech/oip-core/entities/hypothesis';
import { getOfferId } from '@fasstech/oip-core/entities/offer';
import { getProjectId } from '@fasstech/oip-core/entities/project';
import { getSeverancePayHypothesisSolutionId } from '@fasstech/oip-core/entities/severancePayHypothesisSolution';

(async () => {
  let ProjectEntity = await Entities('Project').get({ id: projectId });
  let OfferEntity = await Entities('Offer').create();
  let HypothesisEntity = await Entities('Hypothesis').create();
  let SeverancePayHypothesisEntity = await Entities('SeverancePayHypothesis').get(HypothesisEntity);
  let SeverancePayHypothesisSolutionEntity = await Entities('SeverancePayHypothesisSolution').create();
  const HistoryEntity = await Entities('History').create();
  
  setHistoryOP({ OP: 'foo' }, HistoryEntity);
  setHistoryAt(new Date('2017-01-01'), HistoryEntity);
  setHistoryBy('by', HistoryEntity);
  
  SeverancePayHypothesisSolutionEntity = await Entities('History').save(SeverancePayHypothesisSolutionEntity, HistoryEntity);
  SeverancePayHypothesisEntity = await Entities('SeverancePayHypothesisSolution').save(SeverancePayHypothesisEntity, SeverancePayHypothesisSolutionEntity);
  HypothesisEntity = await Entities('SeverancePayHypothesis').save(HypothesisEntity, SeverancePayHypothesisEntity);
  OfferEntity = await Entities('Hypothesis').save(OfferEntity, HypothesisEntity);
  ProjectEntity = await Entities('Offer').save(ProjectEntity, OfferEntity);
  await Entities('Project').save(ProjectEntity);
  
  const ProjectEntityToTest = await Entities('Project').get({ id: getProjectId(ProjectEntity) });
  const OfferEntityToTest = await Entities('Offer').get(ProjectEntityToTest, getOfferId(OfferEntity));
  const HypothesisEntityToTest = await Entities('Hypothesis').get(OfferEntityToTest, getHypothesisId(HypothesisEntity));
  const SeverancePayHypothesisEntityToTest = await Entities('SeverancePayHypothesis').get(HypothesisEntityToTest);
  const SeverancePayHypothesisSolutionEntityToTest = await Entities('SeverancePayHypothesisSolution').get(SeverancePayHypothesisEntityToTest, getSeverancePayHypothesisSolutionId(SeverancePayHypothesisSolutionEntity));
  const HistoryEntityToTest = await Entities('History').get(SeverancePayHypothesisSolutionEntityToTest, getHistoryId(HistoryEntity));
  
  getHistoryOP(HistoryEntityToTest); // { OP: 'foo' }
  getHistoryAt(HistoryEntityToTest); // new Date('2017-01-01')
  getHistoryBy(HistoryEntityToTest); // 'by'
})();
```
