---
title: CSP
slug: oip-next/ntmajusv0-foc-c5gtjw
createdAt: 2024-03-08T11:05:41.000Z
---

# CSP

## Description

L'entité CSP pour les informations de Catégorie Socio-Professionnelle.

## Relations

### Ascendantes

| Entité   | Propriété |
| -------- | --------- |
| Customer | CSPs      |
| Grantee  | CSPs      |

### Descendantes

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

## Liste des propriétés

| Nom                   | Type     | Dernière version modifiée | Description                                                  | Getter                      | Setter                      | Deprecated |
| --------------------- | -------- | ------------------------- | ------------------------------------------------------------ | --------------------------- | --------------------------- | ---------- |
| CSPExternalId         | `String` | 2.8.0                     | ID externe                                                   | getCSPCSPExternalId         | setCSPCSPExternalId         | -          |
| CSPId                 | `String` | 2.8.0                     | ID publique                                                  | getCSPCSPId                 | setCSPCSPId                 | -          |
| categoryCSPExternalId | `String` | 2.8.0                     | id de la categorie externe                                   | getCSPCategoryCSPExternalId | setCSPCategoryCSPExternalId | -          |
| categoryCSPId         | `String` | 2.8.0                     | id publique de la catégorie                                  | getCSPCategoryCSPId         | setCSPCategoryCSPId         | -          |
| categoryLabel         | `String` | 2.8.0                     | dénomination de la catégorie socio professionnelle           | getCSPCategoryLabel         | setCSPCategoryLabel         | -          |
| categoryLvl1CSPId     | `String` | 2.12.0                    | id publique de la catégorie niveau 1                         | getCSPCategoryLvl1CSPId     | setCSPCategoryLvl1CSPId     | -          |
| categoryLvl1Label     | `String` | 2.12.0                    | dénomination de la catégorie socioprofessionnelle niveau 1   | getCSPCategoryLvl1Label     | setCSPCategoryLvl1Label     | -          |
| categoryLvl2CSPId     | `String` | 2.12.0                    | id publique de la catégorie niveau 2                         | getCSPCategoryLvl2CSPId     | setCSPCategoryLvl2CSPId     | -          |
| categoryLvl2Label     | `String` | 2.12.0                    | dénomination de la catégorie socioprofessionnelle niveau 2   | getCSPCategoryLvl2Label     | setCSPCategoryLvl2Label     | -          |
| createdAt             | `Date`   |                           | Date de création de l'entité `CSP`                           | getCSPCreatedAt             | Lecture seule               | -          |
| createdBy             | `String` |                           | Utilisateur à l'origine de la création de l'entité `CSP`     | getCSPCreatedBy             | Lecture seule               | -          |
| id                    | `String` |                           | Identifiant unique de l'entité `CSP`                         | getCSPId                    | Lecture seule               | -          |
| label                 | `String` | 2.8.0                     | Dénomination du métier                                       | getCSPLabel                 | setCSPLabel                 | -          |
| updatedAt             | `Date`   |                           | Date de modification de l'entité `CSP`                       | getCSPUpdatedAt             | Lecture seule               | -          |
| updatedBy             | `String` |                           | Utilisateur à l'origine de la modification de l'entité `CSP` | getCSPUpdatedBy             | Lecture seule               | -          |

## Enums

Aucune enumération disponible pour cette entité.

## Exemple

```javascript
import { Entities } from '@fasstech/oip-core';
import { getCSPCSPExternalId, getCSPCSPId, getCSPCategoryCSPExternalId, getCSPCategoryCSPId, getCSPCategoryLabel, getCSPCategoryLvl1CSPId, getCSPCategoryLvl1Label, getCSPCategoryLvl2CSPId, getCSPCategoryLvl2Label, getCSPId, getCSPLabel, setCSPCSPExternalId, setCSPCSPId, setCSPCategoryCSPExternalId, setCSPCategoryCSPId, setCSPCategoryLabel, setCSPCategoryLvl1CSPId, setCSPCategoryLvl1Label, setCSPCategoryLvl2CSPId, setCSPCategoryLvl2Label, setCSPLabel } from '@fasstech/oip-core/entities/CSP';
import { getProjectId } from '@fasstech/oip-core/entities/project';

(async () => {
  let ProjectEntity = await Entities('Project').get({ id: projectId });
  let CustomerEntity = await Entities('Customer').get(ProjectEntity);
  const CSPEntity = await Entities('CSP').create();
  
  setCSPCSPExternalId('CSPExternalId', CSPEntity);
  setCSPCSPId('CSPId', CSPEntity);
  setCSPCategoryCSPExternalId('categoryCSPExternalId', CSPEntity);
  setCSPCategoryCSPId('categoryCSPId', CSPEntity);
  setCSPCategoryLabel('categoryLabel', CSPEntity);
  setCSPCategoryLvl1CSPId('categoryLvl1CSPId', CSPEntity);
  setCSPCategoryLvl1Label('categoryLvl1Label', CSPEntity);
  setCSPCategoryLvl2CSPId('categoryLvl2CSPId', CSPEntity);
  setCSPCategoryLvl2Label('categoryLvl2Label', CSPEntity);
  setCSPLabel('label', CSPEntity);
  
  CustomerEntity = await Entities('CSP').save(CustomerEntity, CSPEntity);
  ProjectEntity = await Entities('Customer').save(ProjectEntity, CustomerEntity);
  await Entities('Project').save(ProjectEntity);
  
  const ProjectEntityToTest = await Entities('Project').get({ id: getProjectId(ProjectEntity) });
  const CustomerEntityToTest = await Entities('Customer').get(ProjectEntityToTest);
  const CSPEntityToTest = await Entities('CSP').get(CustomerEntityToTest, getCSPId(CSPEntity));
  
  getCSPCSPExternalId(CSPEntityToTest); // 'CSPExternalId'
  getCSPCSPId(CSPEntityToTest); // 'CSPId'
  getCSPCategoryCSPExternalId(CSPEntityToTest); // 'categoryCSPExternalId'
  getCSPCategoryCSPId(CSPEntityToTest); // 'categoryCSPId'
  getCSPCategoryLabel(CSPEntityToTest); // 'categoryLabel'
  getCSPCategoryLvl1CSPId(CSPEntityToTest); // 'categoryLvl1CSPId'
  getCSPCategoryLvl1Label(CSPEntityToTest); // 'categoryLvl1Label'
  getCSPCategoryLvl2CSPId(CSPEntityToTest); // 'categoryLvl2CSPId'
  getCSPCategoryLvl2Label(CSPEntityToTest); // 'categoryLvl2Label'
  getCSPLabel(CSPEntityToTest); // 'label'
})();
```
