mobilizon/js/src/graphql/event.ts

677 lines
12 KiB
TypeScript
Raw Normal View History

import gql from "graphql-tag";
import { GROUP_FIELDS_FRAGMENTS } from "./group";
2019-02-22 11:24:41 +01:00
const participantQuery = `
role,
id,
actor {
preferredUsername,
avatar {
id
url
},
name,
id,
domain
},
event {
id,
uuid
},
metadata {
cancellationToken,
message
},
insertedAt
`;
const participantsQuery = `
total,
elements {
${participantQuery}
2019-02-22 11:24:41 +01:00
}
`;
2019-09-09 11:21:42 +02:00
const physicalAddressQuery = `
description,
street,
locality,
postalCode,
region,
country,
geom,
type,
id,
originId
2019-09-09 11:21:42 +02:00
`;
const tagsQuery = `
id,
slug,
title
`;
const optionsQuery = `
maximumAttendeeCapacity,
remainingAttendeeCapacity,
showRemainingAttendeeCapacity,
anonymousParticipation,
showStartTime,
showEndTime,
2019-09-09 11:21:42 +02:00
offers {
price,
priceCurrency,
url
},
participationConditions {
title,
content,
url
},
attendees,
program,
commentModeration,
showParticipationPrice,
hideOrganizerWhenGroupEvent,
__typename
2019-09-09 11:21:42 +02:00
`;
export const FETCH_EVENT = gql`
query($uuid:UUID!) {
2019-02-22 11:24:41 +01:00
event(uuid: $uuid) {
id,
uuid,
url,
local,
title,
description,
beginsOn,
endsOn,
status,
visibility,
joinOptions,
draft,
picture {
id
url
2019-09-09 11:21:42 +02:00
name
},
publishAt,
onlineAddress,
phoneAddress,
physicalAddress {
2019-09-09 11:21:42 +02:00
${physicalAddressQuery}
}
2019-02-22 11:24:41 +01:00
organizerActor {
avatar {
id
url
},
2019-02-22 11:24:41 +01:00
preferredUsername,
domain,
2019-02-22 11:24:41 +01:00
name,
url,
id,
summary
},
contacts {
avatar {
id
url,
}
preferredUsername,
name,
summary,
domain,
url,
id
},
attributedTo {
avatar {
id
url,
}
preferredUsername,
name,
summary,
domain,
url,
id
2019-02-22 11:24:41 +01:00
},
participantStats {
going,
notApproved,
participant
},
tags {
2019-09-09 11:21:42 +02:00
${tagsQuery}
},
relatedEvents {
id
uuid,
title,
beginsOn,
picture {
id,
url
}
physicalAddress {
id
description
},
organizerActor {
id
avatar {
id
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_EVENT_BASIC = gql`
query($uuid: UUID!) {
event(uuid: $uuid) {
id
uuid
joinOptions
participantStats {
going
notApproved
notConfirmed
participant
}
}
}
`;
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 {
id
url
},
2019-02-22 11:24:41 +01:00
preferredUsername,
domain,
2019-02-22 11:24:41 +01:00
name,
},
# attributedTo {
# avatar {
# id
# url
# },
# preferredUsername,
# name,
# },
category,
2019-02-22 11:24:41 +01:00
participants {
${participantsQuery}
},
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!,
$attributedToId: 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,
$draft: Boolean,
2019-09-02 14:35:50 +02:00
$tags: [String],
$picture: MediaInput,
2019-09-09 11:21:42 +02:00
$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,
$contacts: [Contact]
2019-02-22 11:24:41 +01:00
) {
createEvent(
2019-09-09 11:21:42 +02:00
organizerActorId: $organizerActorId,
attributedToId: $attributedToId,
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,
draft: $draft,
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,
contacts: $contacts
) {
2019-02-22 11:24:41 +01:00
id,
uuid,
title,
url,
local,
2019-09-09 11:21:42 +02:00
description,
beginsOn,
endsOn,
status,
visibility,
joinOptions,
draft,
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}
},
attributedTo {
id,
domain,
name,
url,
preferredUsername,
avatar {
id
url
}
},
organizerActor {
avatar {
id
url
},
preferredUsername,
domain,
name,
url,
id,
},
contacts {
avatar {
id
url
},
preferredUsername,
domain,
name,
url,
id,
},
participantStats {
going,
notApproved,
participant
},
2019-09-09 11:21:42 +02:00
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,
$draft: Boolean,
2019-09-09 11:21:42 +02:00
$tags: [String],
$picture: MediaInput,
2019-09-09 11:21:42 +02:00
$onlineAddress: String,
$phoneAddress: String,
$organizerActorId: ID,
$attributedToId: ID,
2019-09-09 11:21:42 +02:00
$category: String,
$physicalAddress: AddressInput,
$options: EventOptionsInput,
$contacts: [Contact]
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,
draft: $draft,
2019-09-09 11:21:42 +02:00
tags: $tags,
picture: $picture,
onlineAddress: $onlineAddress,
phoneAddress: $phoneAddress,
organizerActorId: $organizerActorId,
attributedToId: $attributedToId,
2019-09-09 11:21:42 +02:00
category: $category,
physicalAddress: $physicalAddress
options: $options,
contacts: $contacts
2019-09-09 11:21:42 +02:00
) {
id,
uuid,
title,
url,
local,
2019-09-09 11:21:42 +02:00
description,
beginsOn,
endsOn,
status,
visibility,
joinOptions,
draft,
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}
},
attributedTo {
id,
domain,
name,
url,
preferredUsername,
avatar {
id
url
}
},
contacts {
avatar {
id
url
},
preferredUsername,
domain,
name,
url,
id,
},
organizerActor {
avatar {
id
url
},
preferredUsername,
domain,
name,
url,
id,
},
participantStats {
going,
notApproved,
participant
},
2019-09-09 11:21:42 +02:00
tags {
${tagsQuery}
},
options {
${optionsQuery}
}
}
2019-02-22 11:24:41 +01:00
}
`;
export const JOIN_EVENT = gql`
mutation JoinEvent($eventId: ID!, $actorId: ID!, $email: String, $message: String, $locale: String) {
2019-02-22 11:24:41 +01:00
joinEvent(
eventId: $eventId,
actorId: $actorId,
email: $email,
message: $message,
locale: $locale
2019-02-22 11:24:41 +01:00
) {
${participantQuery}
}
}
`;
export const LEAVE_EVENT = gql`
mutation LeaveEvent($eventId: ID!, $actorId: ID!, $token: String) {
leaveEvent(eventId: $eventId, actorId: $actorId, token: $token) {
2019-02-22 11:24:41 +01:00
actor {
id
}
}
}
`;
export const CONFIRM_PARTICIPATION = gql`
mutation ConfirmParticipation($token: String!) {
confirmParticipation(confirmationToken: $token) {
actor {
id
}
event {
id
uuid
joinOptions
}
role
}
}
`;
export const UPDATE_PARTICIPANT = gql`
mutation UpdateParticipant($id: ID!, $role: ParticipantRoleEnum!) {
updateParticipation(id: $id, role: $role) {
role
id
}
}
`;
2019-02-22 11:24:41 +01:00
export const DELETE_EVENT = gql`
mutation DeleteEvent($eventId: ID!) {
deleteEvent(eventId: $eventId) {
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) {
id,
uuid,
title,
participants(page: $page, limit: $limit, roles: $roles) {
${participantsQuery}
},
participantStats {
going,
notApproved,
rejected,
participant
}
}
}
`;
export const EVENT_PERSON_PARTICIPATION = gql`
query($actorId: ID!, $eventId: ID!) {
person(id: $actorId) {
id
participations(eventId: $eventId) {
total
elements {
id
role
actor {
id
}
event {
id
}
}
}
}
}
`;
export const EVENT_PERSON_PARTICIPATION_SUBSCRIPTION_CHANGED = gql`
subscription($actorId: ID!, $eventId: ID!) {
eventPersonParticipationChanged(personId: $actorId) {
id
participations(eventId: $eventId) {
total
elements {
id
role
actor {
id
}
event {
id
}
}
}
}
}
`;
export const GROUP_MEMBERSHIP_SUBSCRIPTION_CHANGED = gql`
subscription($actorId: ID!) {
groupMembershipChanged(personId: $actorId) {
id
memberships {
total
elements {
id
role
parent {
id
preferredUsername
name
domain
avatar {
id
url
}
}
invitedBy {
id
preferredUsername
name
}
insertedAt
updatedAt
}
}
}
}
`;
export const FETCH_GROUP_EVENTS = gql`
query(
$name: String!
$afterDateTime: DateTime
$beforeDateTime: DateTime
$organisedEventsPage: Int
$organisedEventslimit: Int
) {
group(preferredUsername: $name) {
id
preferredUsername
domain
name
organizedEvents(
afterDatetime: $afterDateTime
beforeDatetime: $beforeDateTime
page: $organisedEventsPage
limit: $organisedEventslimit
) {
elements {
id
uuid
title
beginsOn
draft
options {
maximumAttendeeCapacity
}
participantStats {
participant
notApproved
}
attributedTo {
id
preferredUsername
name
domain
}
organizerActor {
id
preferredUsername
name
domain
}
}
total
}
}
}
`;