Hello Everyone, Im working on an api to manage a l...
# prisma1-community
m
Hello Everyone, Im working on an api to manage a list of videos, I save each video item in the database like so
Copy code
type Video {
    id: ID! @id
    name: String! @unique
    slug: String @unique
    description: String!
    image: String
    url: String
}

type Playlist {
    id: ID! @id
    name: String!
    slug: String
    videos: [Video]

}
however, I would like to also mix in youtube videos, the data structure will be the same, since the youtube videos don’t exist in the db, I can’t do
Copy code
connect: {
 id: video.id,
},
my question is, do I have to create an item in the db for the youtube video? or can I just add an item to the playlist on the fly?
r
It would all depend on what functionality you need.. I guess that if you ever want to search for that video then you'd want it in your db ...
💯 1
b
I would also probably create a record for each YouTube video in your local db so you can treat it as similar as possible. Aso you might consider adding an enum VideoType { Local, YouTube } that you can use to handle them differently