2018-11-06 10:30:27 +01:00
|
|
|
import gql from 'graphql-tag';
|
|
|
|
|
2019-02-22 11:24:41 +01:00
|
|
|
const participantQuery = `
|
|
|
|
role,
|
|
|
|
actor {
|
|
|
|
preferredUsername,
|
|
|
|
avatarUrl,
|
|
|
|
name
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2018-11-06 10:30:27 +01:00
|
|
|
export const FETCH_EVENT = gql`
|
2019-02-22 11:24:41 +01:00
|
|
|
query($uuid:UUID!) {
|
|
|
|
event(uuid: $uuid) {
|
|
|
|
id,
|
|
|
|
uuid,
|
|
|
|
url,
|
|
|
|
local,
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
beginsOn,
|
|
|
|
endsOn,
|
|
|
|
status,
|
|
|
|
visibility,
|
|
|
|
thumbnail,
|
|
|
|
large_image,
|
|
|
|
publish_at,
|
|
|
|
# online_address,
|
|
|
|
# phone_address,
|
|
|
|
organizerActor {
|
|
|
|
avatarUrl,
|
|
|
|
preferredUsername,
|
|
|
|
name,
|
|
|
|
},
|
|
|
|
# attributedTo {
|
|
|
|
# # avatarUrl,
|
|
|
|
# preferredUsername,
|
|
|
|
# name,
|
|
|
|
# },
|
|
|
|
participants {
|
|
|
|
${participantQuery}
|
|
|
|
},
|
|
|
|
category {
|
|
|
|
title,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2018-11-06 10:30:27 +01:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const FETCH_EVENTS = gql`
|
2019-02-22 11:24:41 +01:00
|
|
|
query {
|
|
|
|
events {
|
|
|
|
id,
|
|
|
|
uuid,
|
|
|
|
url,
|
|
|
|
local,
|
|
|
|
title,
|
|
|
|
description,
|
|
|
|
beginsOn,
|
|
|
|
endsOn,
|
|
|
|
status,
|
|
|
|
visibility,
|
|
|
|
thumbnail,
|
|
|
|
large_image,
|
|
|
|
publish_at,
|
|
|
|
# online_address,
|
|
|
|
# phone_address,
|
|
|
|
organizerActor {
|
|
|
|
avatarUrl,
|
|
|
|
preferredUsername,
|
|
|
|
name,
|
|
|
|
},
|
|
|
|
attributedTo {
|
|
|
|
avatarUrl,
|
|
|
|
preferredUsername,
|
|
|
|
name,
|
|
|
|
},
|
|
|
|
category {
|
2018-11-06 10:30:27 +01:00
|
|
|
title,
|
2019-02-22 11:24:41 +01:00
|
|
|
},
|
|
|
|
participants {
|
|
|
|
${participantQuery}
|
|
|
|
}
|
2018-11-06 10:30:27 +01:00
|
|
|
}
|
2019-02-22 11:24:41 +01:00
|
|
|
}
|
2018-11-06 10:30:27 +01:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const CREATE_EVENT = gql`
|
2019-02-22 11:24:41 +01:00
|
|
|
mutation CreateEvent(
|
|
|
|
$title: String!,
|
|
|
|
$description: String!,
|
|
|
|
$organizerActorId: String!,
|
|
|
|
$category: String!,
|
|
|
|
$beginsOn: DateTime!
|
|
|
|
) {
|
|
|
|
createEvent(
|
|
|
|
title: $title,
|
|
|
|
description: $description,
|
|
|
|
beginsOn: $beginsOn,
|
|
|
|
organizerActorId: $organizerActorId,
|
|
|
|
category: $category
|
2018-11-07 16:09:28 +01:00
|
|
|
) {
|
2019-02-22 11:24:41 +01:00
|
|
|
id,
|
|
|
|
uuid,
|
|
|
|
title
|
|
|
|
}
|
|
|
|
}
|
2018-11-06 10:30:27 +01:00
|
|
|
`;
|
|
|
|
|
|
|
|
export const EDIT_EVENT = gql`
|
2019-02-22 11:24:41 +01:00
|
|
|
mutation EditEvent(
|
|
|
|
$title: String!,
|
|
|
|
$description: String!,
|
|
|
|
$organizerActorId: Int!,
|
|
|
|
$categoryId: Int!
|
|
|
|
) {
|
2018-11-06 10:30:27 +01:00
|
|
|
EditEvent(title: $title, description: $description, organizerActorId: $organizerActorId, categoryId: $categoryId) {
|
2019-02-22 11:24:41 +01:00
|
|
|
uuid
|
2018-11-06 10:30:27 +01:00
|
|
|
}
|
2019-02-22 11:24:41 +01:00
|
|
|
}
|
2018-11-06 10:30:27 +01:00
|
|
|
`;
|
2019-01-21 15:08:22 +01:00
|
|
|
|
|
|
|
export const JOIN_EVENT = gql`
|
2019-02-22 11:24:41 +01:00
|
|
|
mutation JoinEvent($id: Int!, $actorId: Int!) {
|
|
|
|
joinEvent(
|
|
|
|
id: $id,
|
|
|
|
actorId: $actorId
|
|
|
|
) {
|
|
|
|
actor {
|
|
|
|
${participantQuery}
|
|
|
|
},
|
|
|
|
role
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const LEAVE_EVENT = gql`
|
|
|
|
mutation LeaveEvent($id: Int!, $actorId: Int!) {
|
|
|
|
leaveEvent(
|
|
|
|
id: $id,
|
|
|
|
actorId: $actorId
|
2019-01-21 15:08:22 +01:00
|
|
|
) {
|
2019-02-22 11:24:41 +01:00
|
|
|
actor {
|
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const DELETE_EVENT = gql`
|
|
|
|
mutation DeleteEvent($id: Int!, $actorId: Int!) {
|
|
|
|
deleteEvent(
|
|
|
|
id: $id,
|
|
|
|
actorId: $actorId
|
|
|
|
)
|
|
|
|
}
|
2019-01-21 15:08:22 +01:00
|
|
|
`;
|