Kinotic-Foundation / structures

Structures is an open-source framework for data storage and retrieval, supporting schema evolution, data management, and providing a user-friendly GUI and OpenAPI interface.
https://kinotic-foundation.github.io/structures/
Other
2 stars 1 forks source link

Detect multiple Id fields on entity error during publishing of Structure. #14

Open NavidMitchell opened 11 months ago

NavidMitchell commented 11 months ago

Currently if you publish the Structures with the shape below you will get an error while trying to persist data. If we are going to consider this and error it should be thrown when the Structure is saved.

@Entity
class User {
  @Id
  public id: string
  public name: string
}

@Entity
class Group {
   @Id
   public id: string
   public name: string
   public users: User[] = []
}

Since Structures does not handle entity associations we need to consider how to best handle this. If all of the data is provided by the user when they save the entity this Structure model could be correct. Additionally, if we wanted to handle the association automatically, with the addition of a few more Decorators similar to spring data, this could also work.