mo
12/14/2018, 2:13 PMsiyfion
12/14/2018, 3:06 PMsiyfion
12/14/2018, 3:07 PM~/Git/onezone-test-server master ● yarn start
yarn run v1.12.3
$ ts-node src/index.ts
🚀 Apollo server running and ready at <http://localhost:3000/>
Query:
query ($where: UserWhereInput) {
users(where: $where) {
id
email
firstName
lastName
location
metadata
role
username
}
}
Variables:
{"where":{"username":"test"}}
siyfion
12/14/2018, 3:07 PMsiyfion
12/14/2018, 3:09 PMRESULT: undefined
from:
return prisma.$exists
.user({ username: args.username })
.then(exists => {
console.log('RESULT:', exists)
return !exists
})
.catch(err => {
console.log('ERROR:', err)
throw err
})
mo
12/14/2018, 3:09 PMAnd the console log output is simplyI had this exact silent failure withfrom:RESULT: undefined
prisma-binding
now switching, damn it.siyfion
12/14/2018, 3:11 PMmo
12/14/2018, 3:16 PMsiyfion
12/14/2018, 3:17 PMmo
12/14/2018, 3:17 PMsiyfion
12/14/2018, 3:18 PMprilutskiy
01/03/2019, 11:53 AM$subscribe
it stops emitting events after some idle periodprilutskiy
01/03/2019, 11:53 AMprilutskiy
01/03/2019, 11:53 AM// Send confirmation email when emailConfirmationToken is created or updated
$subscribe
.userSecurity({
mutation_in: ['UPDATED'],
updatedFields_contains: 'emailConfirmationToken',
})
.node()
.user()
.then(async (iterator) => {
while (true) {
const result = await iterator.next();
const userService = ioc.get<IUserService>(Services.UserService);
const userId = result.value.id;
const user = await userService.getUserById(userId);
if (!user.security.emailConfirmationToken) { continue; }
const emailText = `
Your email confirmation token is ${user.security.emailConfirmationToken}
`;
emailService.sendMessage(user.email, 'Email confirmation', emailText);
}
});
Romain Criton
01/03/2019, 10:44 PMRomain Criton
01/03/2019, 10:44 PMconst usersWithNoName = await prisma
.users({
where: {
name: null
}
})
Romain Criton
01/03/2019, 10:45 PMRomain Criton
01/03/2019, 10:46 PMRomain Criton
01/03/2019, 10:59 PMprisma.$graphql
instead but it would be nice to have that in the clientprilutskiy
01/08/2019, 2:05 PM<http://db.post|db.post>({ id: '123'}).coments();
But is there a way to somehow get the following working?
db.posts().comments();
Elfayer
01/09/2019, 9:01 AMconst { prisma } = require('../src/generated/prisma')
prisma.updateManyPosts({ /* ... */ }).then() // Works
prisma.updateManyPosts({ /* ... */ }) // Doesn't get executed
}
prilutskiy
01/09/2019, 9:03 AMprisma.updateManyPosts()
returns Promise
, so you need either .then((data) => ...)
or await prisma.updateManyPosts()
to access the outputElfayer
01/09/2019, 9:04 AMprilutskiy
01/09/2019, 9:06 AMprilutskiy
01/09/2019, 9:06 AMElfayer
01/09/2019, 9:08 AMElfayer
01/09/2019, 9:30 AMMo
01/09/2019, 5:32 PMMo
01/09/2019, 5:32 PMElfayer
01/10/2019, 5:11 AMwhere
key is always mandatory on mutating many link types? I moved from 1.19 to 1.24, (it didn't work well before), and now I have to mention a where
. What if I want all links to get updated?
Like in:
prisma.updateLoan({
where: { id: args.id },
data: {
items: {
// Here update and updateMany require a where
}
}
})
So it's either I call updateLoan
and I have to mention a where
on loan.items
or I call updateManyLoans
and I can't even call items
inside `data`🤔