gstore-node icon indicating copy to clipboard operation
gstore-node copied to clipboard

Support for HABTM

Open Startouf opened this issue 5 years ago • 0 comments

Is it possible to add habtm (has and belongs to many) support ? Or maybe this is already supported in a different way ?

The use case is to avoid intermediate tables when it's not necessary, so we'd be able to write something like that

interface TagType {
  name: string;
}

const tagSchema = new Schema<TagType>({
  name: { type: String },
})

interface UserType {
  tags: entity.Key[]
}

const userSchema = new Schema<EventType>({
  teachers: { type: Schema.Types.Keys, ref: 'Tag' },
})

Startouf avatar Jul 13 '20 19:07 Startouf