eclipse-tractusx / eclipse-tractusx/bpdm

Gate: RelationOutputDto Missing `createdAt` Field

Open
#1,691 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Kotlin
Stars
12
Forks
28
Avg merge
3d 14h
Merged PRs (30d)
41

Description

## Summary

The output DTO for business partner relations (`RelationOutputDto`) is missing the `createdAt` timestamp. The standard data model defines `Created At` as an attribute of a Business Partner Relation. The input-stage DTO (`RelationDto`) already carries this field correctly; the output stage does not.

## Standard Reference

> **CX-0074 §1.5.2.5 BUSINESS PARTNER RELATION**
>
> | Attribute | Description | Type |
> |---|---|---|
> | Created At | The date and time when the business partner relation data record has been created. | Date / Time |
> | Updated At | The date and time when the business partner relation data record has been last updated. | Date / Time |

## Current State

`RelationOutputDto` (`bpdm-gate-api/.../model/RelationOutputDto.kt`) only exposes `updatedAt`:

```kotlin
data class RelationOutputDto(
val externalId: String,
val relationType: SharableRelationType,
val sourceBpn: String,
val targetBpn: String,
val validityPeriods: Collection,
val reasonCode: String?,
val updatedAt: Instant // ← present
// createdAt is absent // ← missing
)
```

The input-stage counterpart `RelationDto` correctly includes both:

```kotlin
data class RelationDto(
...
val updatedAt: Instant,
val createdAt: Instant // ← present on input
)
```

## Impact

Consumers reading the output stage to reconcile or audit relation data cannot determine when a relation was originally created. This breaks symmetry with the input stage response and deviates from the standard's data model.

## Proposed Fix

Add `createdAt: Instant` to `RelationOutputDto`:

```kotlin
data class RelationOutputDto(
val externalId: String,
val relationType: SharableRelationType,
val sourceBpn: String,
val targetBpn: String,
val validityPeriods: Collection,
val reasonCode: String?,
val updatedAt: Instant,
val createdAt: Instant // ← add this
)
```

The underlying database entity already persists a creation timestamp (used to populate `RelationDto.createdAt`), so no schema migration is needed — only the mapping layer and the DTO class require updating.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.