---
title: CSP
slug: oip-next/gt0mvcqdebes4wzpp382p
icon: {"lucideIcon":"📘"}
createdAt: 2024-04-08T10:17:29.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   |

## Propriétés

| Nom                   | Type     | Description                                                                   | Validateur | Lecture seule ? | Dépréciée ? | Dernière version modifiée |
| --------------------- | -------- | ----------------------------------------------------------------------------- | ---------- | --------------- | ----------- | ------------------------- |
| categoryCSPExternalId | `String` | id de la categorie externe                                                    |            |                 |             | 2.8.0                     |
| categoryCSPId         | `String` | id publique de la catégorie                                                   |            |                 |             | 2.8.0                     |
| categoryLabel         | `String` | dénomination de la catégorie socio professionnelle                            |            |                 |             | 2.8.0                     |
| categoryLvl1CSPId     | `String` | id publique de la catégorie niveau 1                                          |            |                 |             | 2.12.0                    |
| categoryLvl1Label     | `String` | dénomination de la catégorie socioprofessionnelle niveau 1                    |            |                 |             | 2.12.0                    |
| categoryLvl2CSPId     | `String` | id publique de la catégorie niveau 2                                          |            |                 |             | 2.12.0                    |
| categoryLvl2Label     | `String` | dénomination de la catégorie socioprofessionnelle niveau 2                    |            |                 |             | 2.12.0                    |
| id                    | `String` | Identifiant de l'entité `CSP`                                                 |            | X               |             |                           |
| code                  | `String` | Codification fonctionnelle de l'entité `CSP`                                  |            |                 |             |                           |
| externalId            | `String` | Identifiant de l'entité `CSP` dans le système client                          |            |                 |             |                           |
| externalCode          | `String` | Codification fonctionnelle de l'entité `CSP` dans le système client           |            |                 |             |                           |
| cSPId                 | `String` | Identifiant public de l'entité `CSP` dans l'OIP                               |            |                 |             |                           |
| label                 | `String` | Information relative au nom de l'entité `CSP` dans son contexte d'utilisation |            |                 |             |                           |
| createdAt             | `Date`   | Date de création de l'entité `CSP`                                            |            | X               |             |                           |
| updatedAt             | `Date`   | Date de modification de l'entité `CSP`                                        |            | 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 { getCSPCSPId, getCSPCategoryCSPExternalId, getCSPCategoryCSPId, getCSPCategoryLabel, getCSPCategoryLvl1CSPId, getCSPCategoryLvl1Label, getCSPCategoryLvl2CSPId, getCSPCategoryLvl2Label, getCSPCode, getCSPExternalCode, getCSPExternalId, getCSPId, getCSPLabel, setCSPCSPId, setCSPCategoryCSPExternalId, setCSPCategoryCSPId, setCSPCategoryLabel, setCSPCategoryLvl1CSPId, setCSPCategoryLvl1Label, setCSPCategoryLvl2CSPId, setCSPCategoryLvl2Label, setCSPCode, setCSPExternalCode, setCSPExternalId, setCSPLabel } from '@fasstech/oip-core/entities/CSP';
import { getCustomerId } from '@fasstech/oip-core/entities/Customer';
import { getProjectId } from '@fasstech/oip-core/entities/Project';

(async () => {
  let project = await Entities('Project').create();
  let customer = await Entities('Customer').create();
  const cSP = await Entities('CSP').create();
  
  setCSPCategoryCSPExternalId('categoryCSPExternalId', cSP);
  setCSPCategoryCSPId('categoryCSPId', cSP);
  setCSPCategoryLabel('categoryLabel', cSP);
  setCSPCategoryLvl1CSPId('categoryLvl1CSPId', cSP);
  setCSPCategoryLvl1Label('categoryLvl1Label', cSP);
  setCSPCategoryLvl2CSPId('categoryLvl2CSPId', cSP);
  setCSPCategoryLvl2Label('categoryLvl2Label', cSP);
  setCSPCode('code', cSP);
  setCSPExternalId('externalId', cSP);
  setCSPExternalCode('externalCode', cSP);
  setCSPCSPId('cSPId', cSP);
  setCSPLabel('label', cSP);
  
  customer = await Entities('CSP').save(customer, cSP);
  project = await Entities('Customer').save(project, customer);
  await Entities('Project').save(project);
  
  const projectToTest = await Entities('Project').get({ id: getProjectId(project) });
  const customerToTest = await Entities('Customer').get(projectToTest, { filter: ({ id }) => id === getCustomerId(customer) });
  const cSPToTest = await Entities('CSP').get(customerToTest, { filter: ({ id }) => id === getCSPId(cSP) });
  
  getCSPCategoryCSPExternalId(cSPToTest); // 'categoryCSPExternalId'
  getCSPCategoryCSPId(cSPToTest); // 'categoryCSPId'
  getCSPCategoryLabel(cSPToTest); // 'categoryLabel'
  getCSPCategoryLvl1CSPId(cSPToTest); // 'categoryLvl1CSPId'
  getCSPCategoryLvl1Label(cSPToTest); // 'categoryLvl1Label'
  getCSPCategoryLvl2CSPId(cSPToTest); // 'categoryLvl2CSPId'
  getCSPCategoryLvl2Label(cSPToTest); // 'categoryLvl2Label'
  getCSPCode(cSPToTest); // 'code'
  getCSPExternalId(cSPToTest); // 'externalId'
  getCSPExternalCode(cSPToTest); // 'externalCode'
  getCSPCSPId(cSPToTest); // 'cSPId'
  getCSPLabel(cSPToTest); // 'label'
})();
```
