Enrico
02/14/2020, 8:19 AMPavel Srom
02/14/2020, 8:23 AMYonaides
02/14/2020, 12:42 PMDany Aracena
02/14/2020, 2:47 PMStephan Du Toit
02/15/2020, 6:42 AMStephan Du Toit
02/15/2020, 6:43 AMinput UserWhereUniqueInput {
id: ID
email: String
}
Stephan Du Toit
02/15/2020, 6:43 AMinput UserWhereUniqueInput {
id: ID
email: String
resetPasswordToken: String
}
Efe
02/15/2020, 4:11 PMGiorgio Delgado
02/15/2020, 9:16 PMGiorgio Delgado
02/15/2020, 9:21 PMGiorgio Delgado
02/15/2020, 9:41 PMmikkelsl
02/16/2020, 10:11 AMMatheus Assis Rios
02/16/2020, 11:00 AMexport const currentPosition: = async (root, args, context) => {
return context.prisma
.user({ id: root.user.id })
.posts({ where: { label: root.label }, orderBy: 'createdDate_DESC' })
.post({ id: root.id }) // This doesn't work
.getCurrentIndex() // This doesn't exist, it is just an example
};
I have to await for context.prisma.user({ id: root.user.id }).posts({ where: { label: root.label }, orderBy: 'createdDate_DESC' })
? I didn't want to load all posts in memory. Is there another way? Is it possible using only prisma queries so it does that in the database itself?Pratik
02/16/2020, 8:48 PMwindkomo
02/17/2020, 9:52 AMRuhan Khandakar
02/17/2020, 12:57 PMAske
02/17/2020, 1:14 PMlionbrahh
02/17/2020, 1:57 PMnpx nexus-prisma-generate --output ./src/generated/nexus-prisma
but not genered nexus.ts and schema.graphql, any wrong ?
this is my server.ts
import { GraphQLServer } from "graphql-yoga";
import "./lib/env";
import { prisma } from "./generated/prisma-client";
import * as path from "path";
import { makePrismaSchema } from "nexus-prisma";
import { permissions } from "./permissions";
import * as allTypes from "./resolvers";
import datamodelInfo from "./generated/nexus-prisma";
const schema = makePrismaSchema({
types: allTypes,
prisma: {
datamodelInfo,
client: prisma
},
outputs: {
schema: path.join(__dirname, "./generates/schema.graphql"),
typegen: path.join(__dirname, "./generated/nexus.ts")
},
nonNullDefaults: {
input: false,
output: false
},
typegenAutoConfig: {
sources: [
{
source: path.join(__dirname, "./types.ts"),
alias: "types"
}
],
contextType: "types.Context"
}
});
const server = new GraphQLServer({
schema,
middlewares: [permissions],
context: (request: any) => {
return {
...request,
prisma
};
}
} as any);
const options = {
port: 8100
// cors: {
// credentials: true,
// origin: "<http://localhost:3000/>"
// }
// playground: "off"
};
server.start(options, ({ port }) =>
console.log(`server ready at <http://localhost>:${port}`)
);
flybayer
02/17/2020, 3:35 PMArkangel
02/17/2020, 4:25 PMArkangel
02/17/2020, 4:25 PMArkangel
02/17/2020, 4:25 PMJonathan
02/17/2020, 10:16 PMPavel Srom
02/18/2020, 6:58 AMlionbrahh
02/18/2020, 8:43 AMlionbrahh
02/18/2020, 8:45 AMtype User {
id: ID @id
company: [Company!]
}
type Company {
id: ID @id
company: name @unique
}
prisma.upateUser({
data: {
company: {
connect: companyId
}
},
where:{
id: personId
}
})
i have one company on that user, if i do update like that? would it add more company on that person? so the user now have 2 companies., or it would gonna replace of that company ? so the user only has one now? because another user already on that company also, thatis why i do connect insteade create, because name of company ise unique:)Ruhan Khandakar
02/18/2020, 8:58 AMJahmiamor
02/18/2020, 1:08 PMpoohbar
02/18/2020, 2:04 PMOlle Holmberg
02/18/2020, 5:00 PM