Multiple account type datamodel


#1

I have a data model that’s not too complex, I have 90% of it done, but I’m just not sure how I would go about connecting my UserProfile to a Account type. I believe I maybe overthinking here, but any guidance would be helpful.

I’ve listed desired db design, and my prisma data model below.

https://gyazo.com/f7aeca9f9840aee0e579bdcaa98a9804

type UserAccount {
  id: ID! @id
  email: String! @unique
  password: String
  profile: UserProfile! 
}

type GoogleAccount {
  id: ID! @id
  accountId: ID! @unique
  profile: UserProfile!
}

type FacebookAccount {
  id: ID! @id
  accountId: ID! @unique
  profile: UserProfile!
}

type TwitterAccount {
  id: ID! @id
  accountId: ID! @unique
  profile: UserProfile!
}

type UserProfile {
  id: ID! @id
  user: // not sure to do here?
  email: String! @unique
  firstName: String
  lastName: String
  profileImage: String
  city: String
  zip: String
  address: String
  state: String
  aptNumber: String
  projects: [Project!]
}

type Project {
  id: ID! @id
  profile: UserProfile!
  name: String!
  description: String!
  address: String!
  state: String!
  zip: String!
  city: String!
  goalAmount: Float!
  amountFunded: Float! @default(value: 0)
}