mobilizon/js/src/graphql/event.ts

332 lines
5.5 KiB
TypeScript
Raw Normal View History

import gql from 'graphql-tag';
2019-02-22 11:24:41 +01:00
const participantQuery = `
role,
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
`;
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`
2019-02-22 11:24:41 +01:00
query($uuid:UUID!) {
event(uuid: $uuid) {
id,
uuid,
url,
local,
title,
slug,
2019-02-22 11:24:41 +01:00
description,
beginsOn,
endsOn,
status,
visibility,
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 {
${participantQuery}
},
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 {
description,
locality
}
2019-02-22 11:24:41 +01:00
organizerActor {
avatar {
url
},
2019-02-22 11:24:41 +01:00
preferredUsername,
name,
},
attributedTo {
avatar {
url
},
2019-02-22 11:24:41 +01:00
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
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,
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,
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,
2019-09-09 11:21:42 +02:00
$visibility: EventVisibility
$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,
tags: $tags,
picture: $picture,
onlineAddress: $onlineAddress,
phoneAddress: $phoneAddress,
category: $category,
physicalAddress: $physicalAddress
options: $options,
) {
id,
uuid,
title,
description,
beginsOn,
endsOn,
status,
visibility,
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 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
}
`;