mobilizon/js/src/graphql/event.ts

378 lines
6.6 KiB
TypeScript
Raw Normal View History

import gql from 'graphql-tag';
2019-02-22 11:24:41 +01:00
const participantQuery = `
role,
id,
2019-02-22 11:24:41 +01:00
actor {
preferredUsername,
avatar {
url
},
name,
id
2019-02-22 11:24:41 +01:00
}
`;
2019-09-09 11:21:42 +02:00
const physicalAddressQuery = `
description,
floor,
street,
locality,
postalCode,
region,
country,
geom,
id
2019-09-09 11:21:42 +02:00
`;
const tagsQuery = `
id,
slug,
title
`;
const optionsQuery = `
maximumAttendeeCapacity,
remainingAttendeeCapacity,
showRemainingAttendeeCapacity,
offers {
price,
priceCurrency,
url
},
participationConditions {
title,
content,
url
},
attendees,
program,
commentModeration,
showParticipationPrice
`;
export const FETCH_EVENT = gql`
query($uuid:UUID!, $roles: String) {
2019-02-22 11:24:41 +01:00
event(uuid: $uuid) {
id,
uuid,
url,
local,
title,
slug,
2019-02-22 11:24:41 +01:00
description,
beginsOn,
endsOn,
status,
visibility,
joinOptions,
picture {
id
url
2019-09-09 11:21:42 +02:00
name
},
publishAt,
category,
onlineAddress,
phoneAddress,
physicalAddress {
2019-09-09 11:21:42 +02:00
${physicalAddressQuery}
}
2019-02-22 11:24:41 +01:00
organizerActor {
avatar {
url
},
2019-02-22 11:24:41 +01:00
preferredUsername,
domain,
2019-02-22 11:24:41 +01:00
name,
url,
id,
2019-02-22 11:24:41 +01:00
},
# attributedTo {
# avatar {
# url,
# }
2019-02-22 11:24:41 +01:00
# preferredUsername,
# name,
# },
participants (roles: $roles) {
2019-02-22 11:24:41 +01:00
${participantQuery}
},
participantStats {
approved,
unapproved
},
tags {
2019-09-09 11:21:42 +02:00
${tagsQuery}
},
relatedEvents {
uuid,
title,
beginsOn,
physicalAddress {
description
},
organizerActor {
avatar {
url,
},
preferredUsername,
domain,
name,
}
},
options {
2019-09-09 11:21:42 +02:00
${optionsQuery}
}
2019-02-22 11:24:41 +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,
picture {
id
url
},
publishAt,
2019-02-22 11:24:41 +01:00
# online_address,
# phone_address,
physicalAddress {
id,
description,
locality
2019-02-22 11:24:41 +01:00
},
organizerActor {
id,
avatar {
url
},
2019-02-22 11:24:41 +01:00
preferredUsername,
name,
},
# attributedTo {
# avatar {
# url
# },
# preferredUsername,
# name,
# },
category,
2019-02-22 11:24:41 +01:00
participants {
${participantQuery}
},
tags {
slug,
title
},
}
2019-02-22 11:24:41 +01:00
}
`;
export const CREATE_EVENT = gql`
2019-09-09 11:21:42 +02:00
mutation createEvent(
$organizerActorId: ID!,
2019-09-02 14:35:50 +02:00
$title: String!,
$description: String!,
$beginsOn: DateTime!,
$endsOn: DateTime,
2019-09-09 11:21:42 +02:00
$status: EventStatus,
$visibility: EventVisibility,
$joinOptions: EventJoinOptions,
2019-09-02 14:35:50 +02:00
$tags: [String],
2019-09-09 11:21:42 +02:00
$picture: PictureInput,
$onlineAddress: String,
$phoneAddress: String,
$category: String,
2019-09-02 14:35:50 +02:00
$physicalAddress: AddressInput,
2019-09-09 11:21:42 +02:00
$options: EventOptionsInput,
2019-02-22 11:24:41 +01:00
) {
createEvent(
2019-09-09 11:21:42 +02:00
organizerActorId: $organizerActorId,
2019-02-22 11:24:41 +01:00
title: $title,
description: $description,
beginsOn: $beginsOn,
endsOn: $endsOn,
2019-09-09 11:21:42 +02:00
status: $status,
visibility: $visibility,
joinOptions: $joinOptions,
2019-09-09 11:21:42 +02:00
tags: $tags,
picture: $picture,
onlineAddress: $onlineAddress,
phoneAddress: $phoneAddress,
category: $category,
2019-09-09 11:21:42 +02:00
physicalAddress: $physicalAddress
options: $options,
) {
2019-02-22 11:24:41 +01:00
id,
uuid,
title,
2019-09-09 11:21:42 +02:00
description,
beginsOn,
endsOn,
status,
visibility,
joinOptions,
picture {
2019-09-09 11:21:42 +02:00
id
url
2019-09-09 11:21:42 +02:00
},
publishAt,
category,
onlineAddress,
phoneAddress,
2019-09-09 11:21:42 +02:00
physicalAddress {
${physicalAddressQuery}
},
tags {
${tagsQuery}
},
options {
${optionsQuery}
}
2019-02-22 11:24:41 +01:00
}
}
`;
export const EDIT_EVENT = gql`
mutation updateEvent(
2019-09-09 11:21:42 +02:00
$id: ID!,
$title: String,
$description: String,
$beginsOn: DateTime,
$endsOn: DateTime,
$status: EventStatus,
$visibility: EventVisibility,
$joinOptions: EventJoinOptions,
2019-09-09 11:21:42 +02:00
$tags: [String],
$picture: PictureInput,
$onlineAddress: String,
$phoneAddress: String,
$category: String,
$physicalAddress: AddressInput,
$options: EventOptionsInput,
2019-02-22 11:24:41 +01:00
) {
2019-09-09 11:21:42 +02:00
updateEvent(
eventId: $id,
title: $title,
description: $description,
beginsOn: $beginsOn,
endsOn: $endsOn,
status: $status,
visibility: $visibility,
joinOptions: $joinOptions,
2019-09-09 11:21:42 +02:00
tags: $tags,
picture: $picture,
onlineAddress: $onlineAddress,
phoneAddress: $phoneAddress,
category: $category,
physicalAddress: $physicalAddress
options: $options,
) {
id,
uuid,
title,
description,
beginsOn,
endsOn,
status,
visibility,
joinOptions,
2019-09-09 11:21:42 +02:00
picture {
id
url
},
publishAt,
category,
onlineAddress,
phoneAddress,
2019-09-09 11:21:42 +02:00
physicalAddress {
${physicalAddressQuery}
},
tags {
${tagsQuery}
},
options {
${optionsQuery}
}
}
2019-02-22 11:24:41 +01:00
}
`;
export const JOIN_EVENT = gql`
mutation JoinEvent($eventId: ID!, $actorId: ID!) {
2019-02-22 11:24:41 +01:00
joinEvent(
eventId: $eventId,
2019-02-22 11:24:41 +01:00
actorId: $actorId
) {
${participantQuery}
}
}
`;
export const LEAVE_EVENT = gql`
mutation LeaveEvent($eventId: ID!, $actorId: ID!) {
2019-02-22 11:24:41 +01:00
leaveEvent(
eventId: $eventId,
2019-02-22 11:24:41 +01:00
actorId: $actorId
) {
2019-02-22 11:24:41 +01:00
actor {
id
}
}
}
`;
export const ACCEPT_PARTICIPANT = gql`
mutation AcceptParticipant($id: ID!, $moderatorActorId: ID!) {
acceptParticipation(id: $id, moderatorActorId: $moderatorActorId) {
role,
id
}
}
`;
export const REJECT_PARTICIPANT = gql`
mutation RejectParticipant($id: ID!, $moderatorActorId: ID!) {
rejectParticipation(id: $id, moderatorActorId: $moderatorActorId) {
id
}
}
`;
2019-02-22 11:24:41 +01:00
export const DELETE_EVENT = gql`
mutation DeleteEvent($eventId: ID!, $actorId: ID!) {
2019-02-22 11:24:41 +01:00
deleteEvent(
eventId: $eventId,
2019-02-22 11:24:41 +01:00
actorId: $actorId
) {
id
}
2019-02-22 11:24:41 +01:00
}
`;
export const PARTICIPANTS = gql`
query($uuid: UUID!, $page: Int, $limit: Int, $roles: String) {
event(uuid: $uuid) {
participants(page: $page, limit: $limit, roles: $roles) {
${participantQuery}
},
participantStats {
approved,
unapproved
}
}
}
`;