G'morning, y'all. Is there a predefined/best-pract...
# orm-help
m
G'morning, y'all. Is there a predefined/best-practice way w/ Prisma to add metadata to an edge representing a relationship? For example, I would like to use AWS Rekognition to detect objects in user-uploaded images and tag/categorize the images accordingly. Rekognition returns an array of Objects-- i.e., ({ objectName, confidence})--and I would like to leverage that confidence data. So, my thought was that I would add the confidence data to the edge representing the relationship between the label and the picture.
n
You can't add information to an edge. You can use an in-between type, however.
m
Ok. That's sort of what I thought was going to be the answer.
Is that going to make my query/mutation writing life hellish?
n
It adds an additional layer. You can manage this layer on the server side though
you can normalize it in your application API
m
So, something like this? type Media implements Node { id: ID! @unique createdAt: DateTime! updatedAt: DateTime! label: [MediaLabelEdge!]! ... } type RekognitionLabel implements Node { id: ID! @unique createdAt: DateTime! updatedAt: DateTime! name: String! @unique media: [MediaLabelEdge!]! } type MediaLabelEdge implements Node { id: ID! @unique createdAt: DateTime! updatedAt: DateTime! media: Media! label: RekognitionLabel! confidence: Float }
👍 1
And name the relations?