GregoryErrl
GregoryErrl
PPrisma
Created by GregoryErrl on 5/3/2024 in #help-and-questions
Inconsistent query result: Field topics is required to return data, got `null` instead.
All data exists in the db but this still happens.
where: {id},
include: {
author: true,
topics: {
include: {
subTopics: {include: {media: true}},
Steps: {include: {media: true}},
media: true,
where: {id},
include: {
author: true,
topics: {
include: {
subTopics: {include: {media: true}},
Steps: {include: {media: true}},
media: true,
model Course {
id String @id @default(auto()) @map("_id") @db.ObjectId
title String

topics Topic @relation(fields: [topicsId], references: [id])
topicsId String[] @db.ObjectId
author User @relation(fields: [authorId], references: [id])
authorId String @db.ObjectId

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Topic {
id String @id @default(auto()) @map("_id") @db.ObjectId
title String

subTopics SubTopic @relation(fields: [subTopicsId], references: [id])
subTopicsId String[] @db.ObjectId
Steps Step @relation(fields: [StepsId], references: [id])
StepsId String[] @db.ObjectId
media Media @relation(fields: [mediaId], references: [id])
mediaId String @db.ObjectId

course Course[]

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model SubTopic {
id String @id @default(auto()) @map("_id") @db.ObjectId

title String
description String

media Media @relation(fields: [mediaId], references: [id])
mediaId String @db.ObjectId

Topic Topic[]

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Step {
id String @id @default(auto()) @map("_id") @db.ObjectId
title String

media Media @relation(fields: [mediaId], references: [id])
mediaId String @db.ObjectId

Topic Topic[]

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Media {
id String @id @default(auto()) @map("_id") @db.ObjectId
fileName String
type String
link String
Step Step[]
SubTopic SubTopic[]
Topic Topic[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Course {
id String @id @default(auto()) @map("_id") @db.ObjectId
title String

topics Topic @relation(fields: [topicsId], references: [id])
topicsId String[] @db.ObjectId
author User @relation(fields: [authorId], references: [id])
authorId String @db.ObjectId

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Topic {
id String @id @default(auto()) @map("_id") @db.ObjectId
title String

subTopics SubTopic @relation(fields: [subTopicsId], references: [id])
subTopicsId String[] @db.ObjectId
Steps Step @relation(fields: [StepsId], references: [id])
StepsId String[] @db.ObjectId
media Media @relation(fields: [mediaId], references: [id])
mediaId String @db.ObjectId

course Course[]

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model SubTopic {
id String @id @default(auto()) @map("_id") @db.ObjectId

title String
description String

media Media @relation(fields: [mediaId], references: [id])
mediaId String @db.ObjectId

Topic Topic[]

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Step {
id String @id @default(auto()) @map("_id") @db.ObjectId
title String

media Media @relation(fields: [mediaId], references: [id])
mediaId String @db.ObjectId

Topic Topic[]

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Media {
id String @id @default(auto()) @map("_id") @db.ObjectId
fileName String
type String
link String
Step Step[]
SubTopic SubTopic[]
Topic Topic[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
34 replies