cory
08/22/2018, 8:05 AMweb
process with /bin/sh -c /app/start.sh
(Docker I’m guessing?)cory
08/22/2018, 8:06 AMGorodov Maksim
08/22/2018, 9:50 AMplayerx
08/22/2018, 10:35 AMprisma:1.8
, lets say schema looks like this:
type User {
id: ID! @unique
accounts: [Account!]!
}
type Account {
id: ID! @unique
}
I’ve updated to prisma:1.14
(also tried `prisma:1.15.0-beta`& prisma:1.16-alpha
) and I’m missing connect
api:
mutation {
updateUser(
where: { id: "123" },
data: { accounts: { connect: { id: "123" } } }
) {
id
}
}
there is only create and I didnt find way how to connect existing nodes (rows) that already exists
thanks 🙂catalinmiron
08/22/2018, 10:43 AMtype User {
id: ID! @unique
accounts: [Account!]! @relation(name: "UserAccounts")
}
type Account {
id: ID! @unique
}
catalinmiron
08/22/2018, 10:46 AMplayerx
08/22/2018, 10:59 AM@relation
without any success, there is still only create
api, I think issue Im having its not related to using @relation
directive in this caseplayerx
08/22/2018, 11:06 AMtype MusicChannel {
id: ID! @unique
name: String! @unique
logoUrl: String!
isFeatured: Boolean!
status: MusicChannelStatus!
activeSource: MusicChannelSource @relation(name: "MusicChannelActiveSource")
sources: [MusicChannelSource!]! @relation(name: "MusicChannelSources")
}
enum MusicChannelStatus {
ACTIVE
DISABLED
}
type MusicChannelSource {
streamUrl: String!
isOffline: Boolean!
channel: MusicChannel! @relation(name: "MusicChannelActiveSource")
songs: [Song!]!
ignoreTitles: [String!]!
}
and I found the issue 🙂 I didn’t set id field for MusicChannelSource
because it was generated automatically, but it caused this api generation issue for me 🙂
with
type MusicChannelSource {
id: ID! @unique
streamUrl: String!
isOffline: Boolean!
channel: MusicChannel! @relation(name: "MusicChannelActiveSource")
songs: [Song!]!
ignoreTitles: [String!]!
}
everything works ok
thanks @catalinmiron for your time one more timecatalinmiron
08/22/2018, 11:29 AMrikki
08/22/2018, 3:28 PMrikki
08/22/2018, 3:29 PMrikki
08/22/2018, 3:30 PMcatalinmiron
08/22/2018, 3:41 PMconst resolvers = {
Query: {
users: forwardTo('db'),
},
}
instead of const resolvers = {
Query: {
posts: forwardTo('db'),
},
}
🙂rikki
08/22/2018, 3:48 PMforwardTo
example over, just noticed it was availablerikki
08/22/2018, 3:50 PMrikki
08/22/2018, 3:53 PMgraphql-js
at the time, so apollo/etc all of this is stellararia
08/22/2018, 5:23 PMaria
08/22/2018, 5:25 PMhas_commented_100_times
, which doesn't exist in the DB, but in the resolver you query for the number of comments associated with them and return true if it's >= 100rikki
08/22/2018, 5:47 PMwesbos
08/22/2018, 6:01 PMwesbos
08/22/2018, 6:02 PMcatalinmiron
08/22/2018, 7:21 PM@default
don't forget to always add the value in double-quotes. Source: https://www.prisma.io/docs/1.4/reference/service-configuration/data-modelling-(sdl)-eiroozae8u/#default-valuearoman
08/22/2018, 11:29 PMzak.singh
08/23/2018, 2:01 AMavg
aggregation? (https://github.com/prisma/prisma/issues/1312) If not, would the best workaround be to just write a SQL query for it?Khoa Huynh
08/23/2018, 2:30 AMkratam
08/23/2018, 9:16 AMlatitude
and longitude
properties. Is it possible to query them based on a distance from a certain coordinate?kratam
08/23/2018, 9:18 AMorderBy
. Do I have to query for every item and do the sorting on the server?catalinmiron
08/23/2018, 9:54 AMcatalinmiron
08/23/2018, 10:01 AMcatalinmiron
08/23/2018, 10:01 AMconst locationCoord = {latitude: 52.516272, longitude: 13.377722};
const radius = 2000; // 2km, 2000m
const currentlocationCoord = geolib.getBoundsOfDistance(locationCoord, radius);
const {maxLat, maxLng, minLat, minLng} = geolib.getBounds(currentlocationCoord)
query {
getLocations(where: {
latitude_gt: minLat,
latitude_lt: maxLat,
longitude_gt: minLng,
longitude_lt: maxLng
}) {
id
}
}