Life ConnectLife Connect
Table of contents
Architecture
Services
Swagger Docs
GitHub
Table of contents
Architecture
Services
Swagger Docs
GitHub

I can have part equipments

API endpoints and models

Important: As per the agreement in the corresponding Slack channel discussion, no validation for required attributes has been implemented on the back-end.

Equipment

HTTP GET parts/{id}/equipment
HTTP PATCH parts/{id}/equipment

openapi: 3.0.0
info:
  title: Equipment API
  version: 1.0.0
paths:
  /parts/{id}/equipment:
    parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
        description: The id of the part
    get:
      summary: >
        Retrieves the equipment details
        associated with a specific part identified by its id
      responses:
        '200':
          description: A set of equipment
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EquipmentSet" # see below
    patch:
      summary: Update equipment
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/EquipmentSet"
        required: true
      responses:
        '200':
          description: Updated set of equipment
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EquipmentSet"
        '404':
          description: Not Found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - APIError
                  catalog:
                    type: string
                    enum:
                      - ERROR_MESSAGE.NOT_FOUND
                  requestId:
                    type: string
                    description: "An alpha-numeric string like 6b45fb5c-8857"
                  errorMessage:
                    type: string
                    example: >
                      Part not found by following criterias:
                      [
                        {id: 679789417db7cf60b6cf669a1},
                        {organisationId: 636a620bb76aeb7288603210}
                      ]
                  code:
                    type: number
                    enum:
                      - 404

components:
  schemas:
    EquipmentSet:
      type: array
      items:
        oneOf:
          - $ref: "#/components/schemas/Heating"
          - $ref: "#/components/schemas/WaterHeating"
          - $ref: "#/components/schemas/Elevator"
          - $ref: "#/components/schemas/AirConditioning"
      uniqueItems: true
      description: >
        Each object in the array must be unique,
        identified by its id attribute
    Equipment:
      type: object
      discriminator:
        propertyName: type
      properties:
        costSharing:
          type: string
          enum:
            - COST_SHARING.COLLECTIVE
            - COST_SHARING.INDIVIDUAL
            - COST_SHARING.MIXTE
    Heating:
      allOf:
        - $ref: "#/components/schemas/Equipment"
        - type: object
          properties:
            equipmentType:
              type: string
              enum:
                - EQUIPMENT_TYPE.HEATING
            energyTypes:
              type: array
              items:
                type: string
                enum:
                  - HEATING_ENERGY_TYPE.COAL
                  - HEATING_ENERGY_TYPE.ELECTRICITY
                  - HEATING_ENERGY_TYPE.FIREPLACE
                  - HEATING_ENERGY_TYPE.FLOOR
                  - HEATING_ENERGY_TYPE.FUEL
                  - HEATING_ENERGY_TYPE.GAS
                  - HEATING_ENERGY_TYPE.HEATPUMP
                  - HEATING_ENERGY_TYPE.MIX
                  - HEATING_ENERGY_TYPE.OTHER
                  - HEATING_ENERGY_TYPE.REVERSEAIRCONDITIONNING
                  - HEATING_ENERGY_TYPE.SOLAR
                  - HEATING_ENERGY_TYPE.WOOD
          required:
            - equipmentType
          oneOf:
            - required: [ costSharing ]
            - required: [ energyTypes ]
    WaterHeating:
      allOf:
        - $ref: "#/components/schemas/Equipment"
        - type: object
          properties:
            equipmentType:
              type: string
              enum:
                - EQUIPMENT_TYPE.WATER_HEATING
            energyTypes:
              type: array
              items:
                type: string
                enum:
                  - WATER_ENERGY_TYPE.ELECTRICITY
                  - WATER_ENERGY_TYPE.FUEL
                  - WATER_ENERGY_TYPE.GAS
                  - WATER_ENERGY_TYPE.OTHER
                  - WATER_ENERGY_TYPE.SOLAR
          required:
            - equipmentType
          oneOf:
            - required: [ costSharing ]
            - required: [ energyTypes ]
    Elevator:
      allOf:
        - $ref: "#/components/schemas/Equipment"
        - type: object
          properties:
            equipmentType:
              type: string
              enum:
                - EQUIPMENT_TYPE.ELEVATOR
            numberOfFloors:
              type: integer
            numberOfElevators:
              type: integer
          # according to LCS-5580 BE developer - Equipment Acceptance test
          required:
            - equipmentType
            - costSharing
            - numberOfFloors
            - numberOfElevators
    AirConditioning:
      allOf:
        - $ref: "#/components/schemas/Equipment"
        - type: object
          properties:
            equipmentType:
              type: string
              enum:
                - EQUIPMENT_TYPE.AIR_CONDITIONING
            numberOfUnits:
              type: integer
          # according to LCS-5580 BE developer - Equipment Acceptance test
          required:
            - equipmentType
            - costSharing
            - numberOfUnits

Patch part equipment back-end implementation

sequence_diagram

Building and Unit

HTTP GET parts/{id}

Note: The Building and Unit schema specifies the location of the equipment attribute within the object. It does not enumerate all attributes, nor does it indicate their mandatory status.

openapi: 3.0.0
info:
  title: Building and Unit API
  version: 1.0.0
paths:
  /parts/{id}:
    get:
      summary: Get part by id
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The id of the part to retrieve
      responses:
        '200':
          description: A part with its equipment
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: "#/components/schemas/Building" # see below
                  - $ref: "#/components/schemas/Unit"
        '404':
          content:
            application/json:
              schema:
                type: object
                properties:
                  catalog:
                    type: string
                    enum:
                      - ERROR_MESSAGE.NOT_FOUND
                  requestId:
                    type: string
                    description: "An alpha-numeric string like 1f4ecca6-4512"
                  errorMessage:
                    type: string
                  code:
                    type: number
                    enum:
                      - 404

components:
  schemas:
    Unit:
      type: object
      properties:
        type:
          type: string
          enum:
            - Unit
        id:
          type: string
        organisationId:
          type: string
        partNature:
          type: object
        unitCategory:
          type: object
        name:
          type: string
        easyId:
          type: string
        mortgageNumber:
          type: string
        localAddress:
          type: object
        equipment:
          $ref: "#/components/schemas/EquipmentSet"
        inMaintenance:
          type: boolean
        partPostalAddresses:
          type: array
        parent:
          type: object
        acquisitionDate:
          type: string
          format: date
          description: A date in YYYY-MM-DD format
          example: "2024-03-15"
        isCondo:
          type: boolean
      required:
        - type
        - id
        - organisationId
        - partNature
        - unitCategory
        - mortgageNumber
        - localAddress
    Building:
      type: object
      properties:
        type:
          type: string
          enum:
            - Building
        id:
          type: string
        name:
          type: string
        easyId:
          type: string
        mortgageNumber:
          type: string
        equipment:
          $ref: "#/components/schemas/EquipmentSet"
        inMaintenance:
          type: boolean
        partPostalAddresses:
          type: array
        partNature:
          type: object
        parent:
          type: object
        acquisitionDate:
          type: string
          format: date
          description: A date in YYYY-MM-DD format
          example: "2024-03-15"
        isCondo:
          type: boolean
        unitCommercialStrategy:
          type: object

Building and Unit aggregate

HTTP GET aggregates/parts/{id}

Note: The BuildingAggregate and UnitAggregate schema specifies the location of the equipment attribute within the object. It does not enumerate all attributes, nor does it indicate their mandatory status.

openapi: 3.0.0
info:
  title: Aggregates API
  description: API for retrieving aggregate details for parts.
  version: 1.0.0
paths:
  /aggregates/parts/{id}:
    get:
      summary: Retrieve aggregate details for a specific part
      description: >
        Retrieves the aggregate details associated with a specific part
        identified by its id
      parameters:
        - name: id
          in: path
          required: true
          description: The id of the part
          schema:
            type: string
      responses:
        '200':
          description: Successfully retrieved aggregate details
          content:
            application/json:
              schema:
                type: object
                properties:
                  traceId:
                    type: string
                    description: The trace id of the request
                    durationInMillis:
                      type: integer
                      description: The duration of the request in milliseconds
                    domainObject:
                      oneOf:
                        - $ref: "#/components/schemas/BuildingAggregate"
                        - $ref: "#/components/schemas/UnitAggregate"

components:
  schemas:
    BuildingAggregate:
      properties:
        application/json:
          schema:
            type: object
            description: the domain object details
            properties:
              type:
                type: string
                enum:
                  - BuildingAggregate
              partType:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - CatalogValue
                  id:
                    type: string
                    enum:
                      - PART_NATURE.BUILDING
                  code:
                    type: string
                    enum:
                      - PART_NATURE
                  value:
                    type: string
                    enum:
                      - BUILDING
                  label:
                    type: string
                required:
                  - type
                  - id
                  - code
                  - value
              id:
                type: string
              easyId:
                type: string
              name:
                type: string
              primaryAddress:
                type: string
                example: 3 Rue du Faubourg-National, 67000, Strasbourg
              secondaryAddress:
                type: string
              partDiagnostics:
                type: object
                properties:
                  energyDiagnosticsData:
                    type: string
                    nullable: true
                  greenHouseGazDiagnosticsData:
                    type: string
                    nullable: true
              equipment:
                $ref: "#/components/schemas/EquipmentSet"
              inMaintenance:
                type: boolean
              acquisitionDate:
                type: string
                format: date
                example: 2024-07-01
              mortgageNumber:
                type: string
                example: NER-3872
              owner:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - PersonNatural
                  id:
                    type: string
                    example: 679787e5a519e75a2fbb5710
                  name:
                    type: string
                    example: Sidney Batard
                  email:
                    type: string
                    format: email
                  address:
                    type: string
                    example: 81 Rue Saint-Germain, 27400, Louviers
                  phone:
                    type: string
                  contractState:
                    type: string
                    nullable: true
              isCondo:
                type: boolean
              self:
                type: string
                format: uri
                example: http://adb-aggregates/contracts/679789415a1d615cde82ef36
    UnitAggregate:
      properties:
        application/json:
          schema:
            type: object
            properties:
              type:
                type: string
                enum:
                  - UnitAggregate
              partType:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - CatalogValue
                  id:
                    type: string
                    enum:
                      - UNIT_NATURE.FLAT
                  code:
                    type: string
                    enum:
                      - UNIT_NATURE
                  value:
                    type: string
                    enum:
                      - FLAT
                  label:
                    type: string
                required:
                  - type
                  - id
                  - code
                  - value
              id:
                type: string
              easyId:
                type: string
              name:
                type: string
              primaryAddress:
                type: string
                example: 3 Rue du Faubourg-National, 67000, Strasbourg
              secondaryAddress:
                type: string
              partDiagnostics:
                type: object
                properties:
                  energyDiagnosticsData:
                    type: string
                    nullable: true
                  greenHouseGazDiagnosticsData:
                    type: string
                    nullable: true
              equipment:
                $ref: "#/components/schemas/EquipmentSet"
              inMaintenance:
                type: boolean
              acquisitionDate:
                type: string
                format: date
                example: 2024-07-01
              mortgageNumber:
                type: string
                example: NER-3872
              owner:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - PersonNatural
                  id:
                    type: string
                    example: 679787e5a519e75a2fbb5710
                  name:
                    type: string
                    example: Sidney Batard
                  email:
                    type: string
                    format: email
                  address:
                    type: string
                    example: 81 Rue Saint-Germain, 27400, Louviers
                  phone:
                    type: string
                  contractState:
                    type: string
                    nullable: true
              isCondo:
                type: boolean
              self:
                type: string
                format: uri
                example: http://adb-aggregates/contracts/679789415a1d615cde82ef36

Get part aggregate back-end implementation

Note: This sequence diagram illustrates the actual number of method calls to the adb-parts and adb-contracts services. The current implementation makes multiple calls, which is suboptimal and can be optimized

sequence_diagram

PARTMODEL FILEMODEL
concreteTargetTypeEquipment typeEquipment Nature Energies costSharing documentType documentNature
BuildingFILE_TYPE.CERTIFICATEFILE_NATURE.MULTI-RISK
BuildingFILE_TYPE.CERTIFICATEFILE_NATURE.FIRE_COMPLIANCY
BuildingEQUIPMENT_TYPE.HEATINGEQUIPMENT_NATURE.FIRE_PLACE ENERGY_TYPE.GAZ, ENERGY_TYPE.ELECTRICITY, ENERGY_TYPE.OTHER, COST_SHARING.COLLECTIVE, COST_SHARING.INDIVIDUAL, COST_SHARING.MIXTE
BuildingFILE_TYPE.CERTIFICATEFILE_NATURE.CHEMINEY
BuildingEQUIPMENT_TYPE.WATER_HEATINGCOST_SHARING.COLLECTIVE, COST_SHARING.INDIVIDUAL, COST_SHARING.MIXTE
BuildingFILE_TYPE.CERTIFICATEFILE_NATURE.BOILER
BuildingEQUIPMENT_TYPE.AIR_CONDITIONINGCOST_SHARING.COLLECTIVE, COST_SHARING.INDIVIDUAL, COST_SHARING.MIXTE
BuildingFILE_TYPE.CERTIFICATEFILE_NATURE.AIR_CONDITIONING
BuildingEQUIPMENT_TYPE.ELEVATORCOST_SHARING.COLLECTIVE, COST_SHARING.INDIVIDUAL, COST_SHARING.MIXTE
BuildingFILE_TYPE.CERTIFICATEFILE_NATURE.ELEVATOR
UnitEQUIPMENT_TYPE.HEATINGEQUIPMENT_NATURE.FIRE_PLACE COST_SHARING.COLLECTIVE, COST_SHARING.INDIVIDUAL, COST_SHARING.MIXTE
UnitFILE_TYPE.CERTIFICATEFILE_NATURE.CHEMINEY
UnitEQUIPMENT_TYPE.WATER_HEATINGCOST_SHARING.COLLECTIVE, COST_SHARING.INDIVIDUAL, COST_SHARING.MIXTE
UnitFILE_TYPE.CERTIFICATEFILE_NATURE.BOILER
UnitEQUIPMENT_TYPE.AIR_CONDITIONINGCOST_SHARING.COLLECTIVE, COST_SHARING.INDIVIDUAL, COST_SHARING.MIXTE
UnitFILE_TYPE.CERTIFICATEFILE_NATURE.AIR_CONDITIONING

Model


public class Equipment {
    private @NotNull 
    @fr.lifeconnect.adb.model.annotation.CatalogValue(
        code = CatalogValueCode.EQUIPMENT_TYPE
    ) 
    CatalogValue equipmentType;

    private LocalDate installationDate;

    private LocalDate lastMaintenanceDate;

    private String status;

    @NotNull
    @fr.lifeconnect.adb.model.annotation.CatalogValue(
        code = CatalogValueCode.COST_SHARING
    ) 
    private CatalogValue costSharing;
}

public class Part {
    @JsonProperty
    private List<Equipment> equipments;
}

Actions

Edit this page
Last Updated:
Contributors: gregory