mobilizon/js/src/graphql/event.ts

219 lines
3.6 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
}
`;
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
},
publishAt,
category,
2019-02-22 11:24:41 +01:00
# online_address,
# phone_address,
physicalAddress {
description,
floor,
street,
locality,
postalCode,
region,
country,
geom
}
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,
},
# attributedTo {
# avatar {
# url,
# }
2019-02-22 11:24:41 +01:00
# preferredUsername,
# name,
# },
participants {
${participantQuery}
},
tags {
slug,
title
},
relatedEvents {
uuid,
title,
beginsOn,
physicalAddress {
description
},
organizerActor {
avatar {
url,
},
preferredUsername,
domain,
name,
}
}
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-02-22 11:24:41 +01:00
mutation CreateEvent(
$title: String!,
$description: String!,
$organizerActorId: ID!,
2019-02-22 11:24:41 +01:00
$category: String!,
$beginsOn: DateTime!,
$picture: PictureInput,
$tags: [String],
$physicalAddress: AddressInput,
$visibility: EventVisibility
2019-02-22 11:24:41 +01:00
) {
createEvent(
title: $title,
description: $description,
beginsOn: $beginsOn,
organizerActorId: $organizerActorId,
category: $category,
picture: $picture,
tags: $tags,
physicalAddress: $physicalAddress,
visibility: $visibility
) {
2019-02-22 11:24:41 +01:00
id,
uuid,
title,
picture {
url
}
2019-02-22 11:24:41 +01:00
}
}
`;
export const EDIT_EVENT = gql`
2019-02-22 11:24:41 +01:00
mutation EditEvent(
$title: String!,
$description: String!,
$organizerActorId: Int!,
$category: String!
2019-02-22 11:24:41 +01:00
) {
EditEvent(title: $title, description: $description, organizerActorId: $organizerActorId, category: $category) {
2019-02-22 11:24:41 +01:00
uuid
}
2019-02-22 11:24:41 +01:00
}
`;
export const JOIN_EVENT = gql`
mutation JoinEvent($eventId: Int!, $actorId: Int!) {
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: Int!, $actorId: Int!) {
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($id: Int!, $actorId: Int!) {
deleteEvent(
eventId: $id,
2019-02-22 11:24:41 +01:00
actorId: $actorId
) {
id
}
2019-02-22 11:24:41 +01:00
}
`;