Barnaby
12/29/2021, 2:30 PMBarnaby
12/29/2021, 2:31 PMWinter
12/29/2021, 2:32 PMuser
12/29/2021, 2:51 PMCarlos
12/30/2021, 3:15 AMconst createUserAndPost = await prisma.user.create({
data: {
email: ‘elsa@prisma.io’,
name: ‘Elsa Prisma’,
posts: {
create: [
{ title: ‘How to make an omelette’ },
{ title: ‘How to eat an omelette’ },
],
},
},
})
In this example, I would like to create none, one or more post. So how do I handle if there are no post to create? How can I tell prisma to not throw any errors?Sachin Bhattarai
12/30/2021, 6:32 AMAndrew Ross
12/30/2021, 2:49 PMprisma
package as a regular dependency as well for a container since typedefs references ./node_modules/.prisma/client/index.d.ts
?
yarn run v1.22.15
$ prisma generate node dist/src/nest/main.js
> Downloading Prisma engines for Node-API for linux-musl [] 0%> Downloading Prisma engines for Node-API for linux-musl [] 1%> Downloading Prisma engines for Node-API for linux-musl [] 2%> Downloading Prisma engines for Node-API for linux-musl [] 3%> Downloading Prisma engines for Node-API for linux-musl [] 4%> Downloading Prisma engines for Node-API for linux-musl [] 5%> Downloading Prisma engines for Node-API for linux-musl [] 6%> Downloading Prisma engines for Node-API for linux-musl [] 7%> Downloading Prisma engines for Node-API for linux-musl [] 8%> Downloading Prisma engines for Node-API for linux-musl [] 9%> Downloading Prisma engines for Node-API for linux-musl [] 10%> Downloading Prisma engines for Node-API for linux-musl [] 11%> Downloading Prisma engines for Node-API for linux-musl [] 12%> Downloading Prisma engines for Node-API for linux-musl [] 13%> Downloading Prisma engines for Node-API for linux-musl [] 14%> Downloading Prisma engines for Node-API for linux-musl [] 15%> Downloading Prisma engines for Node-API for linux-musl [] 16%> Downloading Prisma engines for Node-API for linux-musl [] 17%> Downloading Prisma engines for Node-API for linux-musl [] 19%> Downloading Prisma engines for Node-API for linux-musl [] 20%> Downloading Prisma engines for Node-API for linux-musl [] 21%> Downloading Prisma engines for Node-API for linux-musl [] 22%> Downloading Prisma engines for Node-API for linux-musl [] 23%> Downloading Prisma engines for Node-API for linux-musl [] 24%> Downloading Prisma engines for Node-API for linux-musl [] 25%> Downloading Prisma engines for Node-API for linux-musl [] 26%> Downloading Prisma engines for Node-API for linux-musl [] 27%> Downloading Prisma engines for Node-API for linux-musl [] 28%> Downloading Prisma engines for Node-API for linux-musl [] 30%> Downloading Prisma engines for Node-API for linux-musl [] 31%> Downloading Prisma engines for Node-API for linux-musl [] 32%> Downloading Prisma engines for Node-API for linux-musl [] 33%> Downloading Prisma engines for Node-API for linux-musl [] 34%> Downloading Prisma engines for Node-API for linux-musl [] 35%> Downloading Prisma engines for Node-API for linux-musl [] 36%> Downloading Prisma engines for Node-API for linux-musl [] 37%> Downloading Prisma engines for Node-API for linux-musl [] 38%> Downloading Prisma engines for Node-API for linux-musl [] 39%> Downloading Prisma engines for Node-API for linux-musl [] 40%> Downloading Prisma engines for Node-API for linux-musl [] 41%> Downloading Prisma engines for Node-API for linux-musl [] 42%> Downloading Prisma engines for Node-API for linux-musl [] 43%> Downloading Prisma engines for Node-API for linux-musl [] 44%> Downloading Prisma engines for Node-API for linux-musl [] 45%> Downloading Prisma engines for Node-API for linux-musl [] 46%> Downloading Prisma engines for Node-API for linux-musl [] 47%> Downloading Prisma engines for Node-API for linux-musl [] 48%> Downloading Prisma engines for Node-API for linux-musl [] 49%> Downloading Prisma engines for Node-API for linux-musl [] 50%> Downloading Prisma engines for Node-API for linux-musl [] 51%> Downloading Prisma engines for Node-API for linux-musl [] 52%> Downloading Prisma engines for Node-API for linux-musl [] 53%> Downloading Prisma engines for Node-API for linux-musl [] 54%> Downloading Prisma engines for Node-API for linux-musl [] 55%> Downloading Prisma engines for Node-API for linux-musl [] 56%> Downloading Prisma engines for Node-API for linux-musl [] 57%> Downloading Prisma engines for Node-API for linux-musl [] 59%> Downloading Prisma engines for Node-API for linux-musl [] 60%> Downloading Prisma engines for Node-API for linux-musl [] 61%> Downloading Prisma engines for Node-API for linux-musl [] 62%> Downloading Prisma engines for Node-API for linux-musl [] 63%> Downloading Prisma engines for Node-API for linux-musl [] 64%> Downloading Prisma engines for Node-API for linux-musl [] 65%> Downloading Prisma engines for Node-API for linux-musl [] 66%> Downloading Prisma engines for Node-API for linux-musl [] 67%> Downloading Prisma engines for Node-API for linux-musl [] 68%> Downloading Prisma engines for Node-API for linux-musl [] 69%> Downloading Prisma engines for Node-API for linux-musl [] 70%> Downloading Prisma engines for Node-API for linux-musl [] 71%> Downloading Prisma engines for Node-API for linux-musl [] 72%> Downloading Prisma engines for Node-API for linux-musl [] 73%> Downloading Prisma engines for Node-API for linux-musl [] 74%> Downloading Prisma engines for Node-API for linux-musl [] 75%> Downloading Prisma engines for Node-API for linux-musl [] 76%> Downloading Prisma engines for Node-API for linux-musl [] 77%> Downloading Prisma engines for Node-API for linux-musl [] 78%> Downloading Prisma engines for Node-API for linux-musl [] 79%> Downloading Prisma engines for Node-API for linux-musl [] 80%> Downloading Prisma engines for Node-API for linux-musl [] 81%> Downloading Prisma engines for Node-API for linux-musl [] 82%> Downloading Prisma engines for Node-API for linux-musl [] 83%> Downloading Prisma engines for Node-API for linux-musl [] 84%> Downloading Prisma engines for Node-API for linux-musl [] 85%> Downloading Prisma engines for Node-API for linux-musl [] 86%> Downloading Prisma engines for Node-API for linux-musl [] 87%> Downloading Prisma engines for Node-API for linux-musl [] 88%> Downloading Prisma engines for Node-API for linux-musl [] 89%> Downloading Prisma engines for Node-API for linux-musl [] 90%> Downloading Prisma engines for Node-API for linux-musl [] 91%> Downloading Prisma engines for Node-API for linux-musl [] 92%> Downloading Prisma engines for Node-API for linux-musl [] 93%> Downloading Prisma engines for Node-API for linux-musl [] 94%> Downloading Prisma engines for Node-API for linux-musl [] 95%> Downloading Prisma engines for Node-API for linux-musl [] 96%> Downloading Prisma engines for Node-API for linux-musl [] 97%> Downloading Prisma engines for Node-API for linux-musl [] 98%> Downloading Prisma engines for Node-API for linux-musl [] 99%> Downloading Prisma engines for Node-API for linux-musl [] 100%Prisma schema loaded from prisma/schema.prisma
Error:
Error: ENOENT: no such file or directory, copyfile '/node_modules/@prisma/index.d.ts' -> '/node_modules/@prisma/client/index.d.ts'
✔ Generated DBML Schema to ./docs/database in 22ms
✔ Generated Prisma Docs Generator to ./docs/prisma-docs-generated in 93ms
✔ Generated Prisma NestJS/GraphQL to ./src/nest/.generated/prisma-nestjs-graphql in 2.29s
error Command failed with exit code 1.
info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command
Dustin Sorensen
12/30/2021, 5:12 PMDanny SMc
12/30/2021, 5:39 PMmodel Faction {
id String @id @default(dbgenerated()) @map("_id") @db.ObjectId
name String
roleId String
image String @default("#000000")
description String @default("No description has been set.")
colour String?
rules String @default("No rules have been set.")
channels FactionChannel[]
categoryId String
owner User @relation(name: "OwnedFactions", fields: [ownerId], references: [id])
ownerId String
admins String[]
members String[]
guildId String
balance Int @default(0)
wins Int @default(0)
losses Int @default(0)
draws Int @default(0)
warnings FactionWarning[]
bans FactionBan[]
created DateTime @default(now())
updated DateTime @updatedAt
audit FactionAudit[]
}
Faction Channel Model
model FactionChannel {
id String @id @default(dbgenerated()) @map("_id") @db.ObjectId
discordId String @unique
name String
type FactionChannelType @default(TEXT)
isCategory Boolean @default(false)
faction Faction @relation(fields: [factionId], references: [id])
factionId String
claimable Boolean @default(false)
admin Boolean @default(false)
}
So far, all is working fine, I have created two factions with 4 channels each, and this seems to work nicely, but I am trying to figure out how to query the faction based on where a certain channel exists, for example, if a user in a specific discord channel wants to know more about the faction like it's monetary balance, or it's total wins, I need to be able to lookup the faction based on the channel they are in, so at the moment, I have done:
const faction = await this.prisma.faction.findFirst({
where: {
channels: {
some: {
discordId: channelId,
},
},
},
});
The above is failing to return any results, even though the channel IS part of the faction.
Any ideas what I am doing wrong here, help would be appreciated.Vilke
12/30/2021, 8:04 PMcsvToJson.formatValueByType().getJsonFromCsv(fileInputName);
Danny SMc
12/31/2021, 12:44 AMSebastian Messier
12/31/2021, 1:38 AMRobert Fish
12/31/2021, 3:19 AMuser
12/31/2021, 7:50 AMJeffrey Wang
12/31/2021, 6:30 PMAwey
12/31/2021, 11:20 PMupdate
with prisma
prisma.post.update({
where: { id: postId },
data: { ...data }
})
How come they never check that the resource belongs to the person making the call to update?
Even if the route is protected wouldn't that allow anyone who is authenticated to update resources that don't belong to them?esau
01/01/2022, 6:33 AMDregond
01/02/2022, 5:22 AMDregond
01/02/2022, 5:22 AMMischa
01/02/2022, 9:33 AMtstzrange
data type with prisma?Rune Jørgensen
01/02/2022, 11:18 AMAviv Nahum
01/02/2022, 11:39 AMGaurav Sharma
01/02/2022, 1:31 PMGaurav Sharma
01/02/2022, 1:31 PMGaurav Sharma
01/02/2022, 1:31 PMRobert Fish
01/02/2022, 1:38 PMA DSJ
01/02/2022, 2:15 PMezeikel
01/02/2022, 2:52 PMJoshua
01/02/2022, 3:12 PMprisma migrate reset
? I'm finding that the hard reset is screwing with the various permissions I have set up (the credentials I give to my application can no longer access the schema as it's been destroyed / recreated) and I'd much prefer a --prefer-soft-reset
cli option over creating a third set of credentials for the sole purpose calling reset such that they can read/write tables but not destroy the schema and thus triggering a "soft reset".Huzaifah
01/02/2022, 5:08 PM