romain.charretteur
03/27/2020, 8:42 AMLars Ivar Igesund
03/27/2020, 9:23 AMLars Ivar Igesund
03/27/2020, 9:58 AMjoar
03/27/2020, 11:35 AMSoumak Dev
03/27/2020, 11:51 AMPrashant
03/28/2020, 10:29 AMMike SOK
03/28/2020, 11:01 PMconst CREATE_RATING_MUTATION = gql`
mutation CREATE_RATING_MUTATION (
$ratingSubject: String!
$ratingImage: String!
$ratingDescription: String!
$ratingStar: Int!
){
createRating(
data: {
ratingSubject: $ratingSubject
ratingImage: $ratingImage
ratingDescription: $ratingDescription
ratingStar: $ratingStar
item: { connect: { id: "ck7guni5wavx90986moqstcm3" }}
}) {
id
ratingSubject
ratingImage
ratingDescription
ratingStar
item {
id
}
}
}
`;
Any advice would be greatly appreciated. 🙂Ezequiel Pereira
03/29/2020, 12:17 AMFelinto
03/29/2020, 10:00 AMFelinto
03/29/2020, 10:00 AMFelinto
03/29/2020, 10:01 AMFelinto
03/29/2020, 10:01 AMFelinto
03/29/2020, 10:01 AMFelinto
03/29/2020, 10:02 AMFelinto
03/29/2020, 10:02 AMDavide Berdin
03/30/2020, 1:30 PMDavide Berdin
03/30/2020, 1:36 PMtype Alert {
id: Int! @id
name: String!
description: String!
imageUrl: String
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type AlertSet {
id: Int! @id
organization: Organization!
alert: Alert!
parameters: String!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
and I'd like to retrieve the Alert
when I am retrieving the AlertSet
. Basically I want to fetch the relationships. My go
code looks like the following
func GetAlertSet(pc *prisma.Client, alertSetID string) (*prisma.AlertSet, error) {
ctx := context.Background()
as, err := pc.AlertSet(prisma.AlertSetWhereUniqueInput{
ID: utils.ConvertStringToInt32(alertSetID),
}).Exec(ctx)
if err != nil {
return nil, nil, err
}
return as, nil
}
func GetAllAlertSets(pc *prisma.Client, orgID int32) ([]prisma.AlertSet, error) {
ctx := context.Background()
as, err := pc.AlertSets(&prisma.AlertSetsParams{
Where: &prisma.AlertSetWhereInput{
Organization: &prisma.OrganizationWhereInput{
ID: prisma.Int32(orgID),
},
},
}).Exec(ctx)
if err != nil {
return nil, err
}
return as, nil
}
However, the result never contains the relationships inside. I checked this link (https://www.prisma.io/docs/get-started/03-build-graphql-servers-with-prisma-GO-g201/) but the generator throws so many errors. Can somebody point me out maybe how to write a QueryResolver
or something similar? Thank you in advance 🙂Rain
03/30/2020, 2:41 PMtype User {
id: ID! @id
email: String! @unique
username: String! @unique
password: String!
chatrooms: [Chatroom!]!
followedRooms: [Chatroom!]! @relation(name: "RoomMember")
}
type Chatroom {
id: ID! @id
name: String!
description: String
isPrivate: Boolean! @default(value: false)
owner: User! @relation(link: INLINE)
members: [User!]! @relation(link: TABLE, name: "RoomMember")
}
type RoomMember @relationTable {
user: User!
room: Chatroom!
}
It give the following error
Errors:
User
✖ The relation field `chatrooms` must specify a `@relation` directive: `@relation(name: "MyRelation")`
Chatroom
✖ The relation field `owner` must specify a `@relation` directive: `@relation(name: "MyRelation")`
Rain
03/30/2020, 3:06 PMprisma delete
first hmmmDaniel Esteves
03/30/2020, 4:49 PMPaul
03/30/2020, 8:53 PMScott
03/31/2020, 1:49 AMAshiqur Rahman
03/31/2020, 6:49 AMArcticSpaceFox
03/31/2020, 9:24 AMSamson Amaugo
03/31/2020, 1:00 PMSamson Amaugo
03/31/2020, 1:01 PMSamson Amaugo
03/31/2020, 1:30 PMjohhansantana
03/31/2020, 4:38 PMjohhansantana
03/31/2020, 4:39 PMadrianmg
03/31/2020, 5:25 PM