build: switch from yarn to npm to manage js dependencies and move js contents to root
yarn v1 is being deprecated and starts to have some issues Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
488
src/graphql/actor.ts
Normal file
488
src/graphql/actor.ts
Normal file
@@ -0,0 +1,488 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const ACTOR_FRAGMENT = gql`
|
||||
fragment ActorFragment on Actor {
|
||||
id
|
||||
avatar {
|
||||
id
|
||||
url
|
||||
}
|
||||
type
|
||||
preferredUsername
|
||||
name
|
||||
domain
|
||||
summary
|
||||
url
|
||||
}
|
||||
`;
|
||||
|
||||
export const FETCH_PERSON = gql`
|
||||
query FetchPerson($username: String!) {
|
||||
fetchPerson(preferredUsername: $username) {
|
||||
...ActorFragment
|
||||
suspended
|
||||
mediaSize
|
||||
avatar {
|
||||
id
|
||||
name
|
||||
url
|
||||
}
|
||||
banner {
|
||||
id
|
||||
url
|
||||
}
|
||||
feedTokens {
|
||||
token
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const GET_PERSON = gql`
|
||||
query Person(
|
||||
$actorId: ID!
|
||||
$organizedEventsPage: Int
|
||||
$organizedEventsLimit: Int
|
||||
$participationPage: Int
|
||||
$participationLimit: Int
|
||||
$membershipsPage: Int
|
||||
$membershipsLimit: Int
|
||||
) {
|
||||
person(id: $actorId) {
|
||||
...ActorFragment
|
||||
suspended
|
||||
mediaSize
|
||||
avatar {
|
||||
id
|
||||
name
|
||||
url
|
||||
}
|
||||
banner {
|
||||
id
|
||||
url
|
||||
}
|
||||
feedTokens {
|
||||
token
|
||||
}
|
||||
organizedEvents(
|
||||
page: $organizedEventsPage
|
||||
limit: $organizedEventsLimit
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
beginsOn
|
||||
status
|
||||
}
|
||||
}
|
||||
participations(page: $participationPage, limit: $participationLimit) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
event {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
beginsOn
|
||||
status
|
||||
}
|
||||
}
|
||||
}
|
||||
memberships(page: $membershipsPage, limit: $membershipsLimit) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
role
|
||||
insertedAt
|
||||
parent {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
user {
|
||||
id
|
||||
email
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const PERSON_FRAGMENT = gql`
|
||||
fragment PersonFragment on Person {
|
||||
id
|
||||
avatar {
|
||||
id
|
||||
url
|
||||
}
|
||||
type
|
||||
preferredUsername
|
||||
domain
|
||||
name
|
||||
}
|
||||
`;
|
||||
|
||||
export const PERSON_FRAGMENT_FEED_TOKENS = gql`
|
||||
fragment PersonFeedTokensFragment on Person {
|
||||
id
|
||||
feedTokens {
|
||||
token
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const LIST_PROFILES = gql`
|
||||
query ListProfiles(
|
||||
$preferredUsername: String
|
||||
$name: String
|
||||
$domain: String
|
||||
$local: Boolean
|
||||
$suspended: Boolean
|
||||
$page: Int
|
||||
$limit: Int
|
||||
) {
|
||||
persons(
|
||||
preferredUsername: $preferredUsername
|
||||
name: $name
|
||||
domain: $domain
|
||||
local: $local
|
||||
suspended: $suspended
|
||||
page: $page
|
||||
limit: $limit
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const UPDATE_DEFAULT_ACTOR = gql`
|
||||
mutation ChangeDefaultActor($preferredUsername: String!) {
|
||||
changeDefaultActor(preferredUsername: $preferredUsername) {
|
||||
id
|
||||
defaultActor {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const CURRENT_ACTOR_CLIENT = gql`
|
||||
query currentActor {
|
||||
currentActor @client {
|
||||
id
|
||||
preferredUsername
|
||||
name
|
||||
avatar
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_CURRENT_ACTOR_CLIENT = gql`
|
||||
mutation UpdateCurrentActor(
|
||||
$id: String
|
||||
$avatar: String
|
||||
$preferredUsername: String
|
||||
$name: String
|
||||
) {
|
||||
updateCurrentActor(
|
||||
id: $id
|
||||
avatar: $avatar
|
||||
preferredUsername: $preferredUsername
|
||||
name: $name
|
||||
) @client
|
||||
}
|
||||
`;
|
||||
|
||||
export const LOGGED_USER_DRAFTS = gql`
|
||||
query LoggedUserDrafts($page: Int, $limit: Int) {
|
||||
loggedUser {
|
||||
id
|
||||
drafts(page: $page, limit: $limit) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
draft
|
||||
picture {
|
||||
id
|
||||
url
|
||||
alt
|
||||
}
|
||||
beginsOn
|
||||
status
|
||||
visibility
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
participantStats {
|
||||
going
|
||||
notApproved
|
||||
}
|
||||
options {
|
||||
maximumAttendeeCapacity
|
||||
remainingAttendeeCapacity
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const LOGGED_USER_MEMBERSHIPS = gql`
|
||||
query LoggedUserMemberships(
|
||||
$membershipName: String
|
||||
$page: Int
|
||||
$limit: Int
|
||||
) {
|
||||
loggedUser {
|
||||
id
|
||||
memberships(name: $membershipName, page: $page, limit: $limit) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
role
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
parent {
|
||||
...ActorFragment
|
||||
organizedEvents {
|
||||
elements {
|
||||
id
|
||||
title
|
||||
picture {
|
||||
id
|
||||
url
|
||||
}
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
invitedBy {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const IDENTITIES = gql`
|
||||
query Identities {
|
||||
loggedUser {
|
||||
id
|
||||
actors {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const PERSON_MEMBERSHIPS = gql`
|
||||
query PersonMemberships($id: ID!) {
|
||||
person(id: $id) {
|
||||
id
|
||||
memberships {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
role
|
||||
parent {
|
||||
...ActorFragment
|
||||
}
|
||||
invitedBy {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const PERSON_STATUS_GROUP = gql`
|
||||
query PersonMembershipGroup($id: ID!, $group: String!) {
|
||||
person(id: $id) {
|
||||
id
|
||||
memberships(group: $group) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
role
|
||||
parent {
|
||||
...ActorFragment
|
||||
}
|
||||
invitedBy {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
follows(group: $group) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
notify
|
||||
approved
|
||||
target_actor {
|
||||
...ActorFragment
|
||||
}
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const PERSON_GROUP_MEMBERSHIPS = gql`
|
||||
query PersonGroupMemberships($id: ID!, $groupId: ID) {
|
||||
person(id: $id) {
|
||||
id
|
||||
memberships(groupId: $groupId) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
role
|
||||
parent {
|
||||
...ActorFragment
|
||||
}
|
||||
invitedBy {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const GROUP_MEMBERSHIP_SUBSCRIPTION_CHANGED = gql`
|
||||
subscription GroupMembershipSubscriptionChanged(
|
||||
$actorId: ID!
|
||||
$group: String!
|
||||
) {
|
||||
groupMembershipChanged(personId: $actorId, group: $group) {
|
||||
id
|
||||
memberships {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
role
|
||||
parent {
|
||||
...ActorFragment
|
||||
}
|
||||
invitedBy {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CREATE_PERSON = gql`
|
||||
mutation CreatePerson(
|
||||
$preferredUsername: String!
|
||||
$name: String!
|
||||
$summary: String
|
||||
$avatar: MediaInput
|
||||
) {
|
||||
createPerson(
|
||||
preferredUsername: $preferredUsername
|
||||
name: $name
|
||||
summary: $summary
|
||||
avatar: $avatar
|
||||
) {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const UPDATE_PERSON = gql`
|
||||
mutation UpdatePerson(
|
||||
$id: ID!
|
||||
$name: String
|
||||
$summary: String
|
||||
$avatar: MediaInput
|
||||
) {
|
||||
updatePerson(id: $id, name: $name, summary: $summary, avatar: $avatar) {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const DELETE_PERSON = gql`
|
||||
mutation DeletePerson($id: ID!) {
|
||||
deletePerson(id: $id) {
|
||||
preferredUsername
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* This one is used only to register the first account.
|
||||
* Prefer CREATE_PERSON when creating another identity
|
||||
*/
|
||||
export const REGISTER_PERSON = gql`
|
||||
mutation (
|
||||
$preferredUsername: String!
|
||||
$name: String!
|
||||
$summary: String!
|
||||
$email: String!
|
||||
) {
|
||||
registerPerson(
|
||||
preferredUsername: $preferredUsername
|
||||
name: $name
|
||||
summary: $summary
|
||||
email: $email
|
||||
) {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const SUSPEND_PROFILE = gql`
|
||||
mutation SuspendProfile($id: ID!) {
|
||||
suspendProfile(id: $id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UNSUSPEND_PROFILE = gql`
|
||||
mutation UnSuspendProfile($id: ID!) {
|
||||
unsuspendProfile(id: $id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
61
src/graphql/address.ts
Normal file
61
src/graphql/address.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const ADDRESS_FRAGMENT = gql`
|
||||
fragment AdressFragment on Address {
|
||||
id
|
||||
description
|
||||
geom
|
||||
street
|
||||
locality
|
||||
postalCode
|
||||
region
|
||||
country
|
||||
type
|
||||
url
|
||||
originId
|
||||
timezone
|
||||
pictureInfo {
|
||||
url
|
||||
author {
|
||||
name
|
||||
url
|
||||
}
|
||||
source {
|
||||
name
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const ADDRESS = gql`
|
||||
query SearchAddress(
|
||||
$query: String!
|
||||
$locale: String
|
||||
$type: AddressSearchType
|
||||
) {
|
||||
searchAddress(query: $query, locale: $locale, type: $type) {
|
||||
...AdressFragment
|
||||
}
|
||||
}
|
||||
${ADDRESS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const REVERSE_GEOCODE = gql`
|
||||
query ReverseGeocode(
|
||||
$latitude: Float!
|
||||
$longitude: Float!
|
||||
$zoom: Int
|
||||
$locale: String
|
||||
) {
|
||||
reverseGeocode(
|
||||
latitude: $latitude
|
||||
longitude: $longitude
|
||||
zoom: $zoom
|
||||
locale: $locale
|
||||
) {
|
||||
...AdressFragment
|
||||
}
|
||||
}
|
||||
${ADDRESS_FRAGMENT}
|
||||
`;
|
||||
275
src/graphql/admin.ts
Normal file
275
src/graphql/admin.ts
Normal file
@@ -0,0 +1,275 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
|
||||
export const DASHBOARD = gql`
|
||||
query Dashboard {
|
||||
dashboard {
|
||||
lastPublicEventPublished {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
beginsOn
|
||||
picture {
|
||||
id
|
||||
alt
|
||||
url
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
lastGroupCreated {
|
||||
...ActorFragment
|
||||
}
|
||||
numberOfUsers
|
||||
numberOfEvents
|
||||
numberOfComments
|
||||
numberOfReports
|
||||
numberOfGroups
|
||||
numberOfFollowers
|
||||
numberOfFollowings
|
||||
numberOfConfirmedParticipationsToLocalEvents
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const RELAY_FRAGMENT = gql`
|
||||
fragment relayFragment on Follower {
|
||||
id
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
targetActor {
|
||||
...ActorFragment
|
||||
}
|
||||
approved
|
||||
insertedAt
|
||||
updatedAt
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const RELAY_FOLLOWERS = gql`
|
||||
query relayFollowers($page: Int, $limit: Int) {
|
||||
relayFollowers(page: $page, limit: $limit) {
|
||||
elements {
|
||||
...relayFragment
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
${RELAY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const RELAY_FOLLOWINGS = gql`
|
||||
query relayFollowings($page: Int, $limit: Int) {
|
||||
relayFollowings(page: $page, limit: $limit) {
|
||||
elements {
|
||||
...relayFragment
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
${RELAY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const INSTANCE_FRAGMENT = gql`
|
||||
fragment InstanceFragment on Instance {
|
||||
domain
|
||||
hasRelay
|
||||
relayAddress
|
||||
followerStatus
|
||||
followedStatus
|
||||
eventCount
|
||||
personCount
|
||||
groupCount
|
||||
followersCount
|
||||
followingsCount
|
||||
reportsCount
|
||||
mediaSize
|
||||
}
|
||||
`;
|
||||
|
||||
export const INSTANCE = gql`
|
||||
query instance($domain: ID!) {
|
||||
instance(domain: $domain) {
|
||||
...InstanceFragment
|
||||
}
|
||||
}
|
||||
${INSTANCE_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const INSTANCES = gql`
|
||||
query Instances(
|
||||
$page: Int
|
||||
$limit: Int
|
||||
$orderBy: InstancesSortFields
|
||||
$direction: String
|
||||
$filterDomain: String
|
||||
$filterFollowStatus: InstanceFilterFollowStatus
|
||||
$filterSuspendStatus: InstanceFilterSuspendStatus
|
||||
) {
|
||||
instances(
|
||||
page: $page
|
||||
limit: $limit
|
||||
orderBy: $orderBy
|
||||
direction: $direction
|
||||
filterDomain: $filterDomain
|
||||
filterFollowStatus: $filterFollowStatus
|
||||
filterSuspendStatus: $filterSuspendStatus
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
...InstanceFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${INSTANCE_FRAGMENT}
|
||||
`;
|
||||
export const ADD_INSTANCE = gql`
|
||||
mutation addInstance($domain: String!) {
|
||||
addInstance(domain: $domain) {
|
||||
...InstanceFragment
|
||||
}
|
||||
}
|
||||
${INSTANCE_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const REMOVE_RELAY = gql`
|
||||
mutation removeRelay($address: String!) {
|
||||
removeRelay(address: $address) {
|
||||
...relayFragment
|
||||
}
|
||||
}
|
||||
${RELAY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const ACCEPT_RELAY = gql`
|
||||
mutation acceptRelay($address: String!) {
|
||||
acceptRelay(address: $address) {
|
||||
...relayFragment
|
||||
}
|
||||
}
|
||||
${RELAY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const REJECT_RELAY = gql`
|
||||
mutation rejectRelay($address: String!) {
|
||||
rejectRelay(address: $address) {
|
||||
...relayFragment
|
||||
}
|
||||
}
|
||||
${RELAY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const LANGUAGES = gql`
|
||||
query Languages {
|
||||
languages {
|
||||
code
|
||||
name
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const LANGUAGES_CODES = gql`
|
||||
query LanguagesCodes($codes: [String!]) {
|
||||
languages(codes: $codes) {
|
||||
code
|
||||
name
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const ADMIN_SETTINGS_FRAGMENT = gql`
|
||||
fragment adminSettingsFragment on AdminSettings {
|
||||
instanceName
|
||||
instanceDescription
|
||||
instanceLongDescription
|
||||
instanceSlogan
|
||||
contact
|
||||
instanceTerms
|
||||
instanceTermsType
|
||||
instanceTermsUrl
|
||||
instancePrivacyPolicy
|
||||
instancePrivacyPolicyType
|
||||
instancePrivacyPolicyUrl
|
||||
instanceRules
|
||||
registrationsOpen
|
||||
instanceLanguages
|
||||
}
|
||||
`;
|
||||
|
||||
export const ADMIN_SETTINGS = gql`
|
||||
query AdminSettings {
|
||||
adminSettings {
|
||||
...adminSettingsFragment
|
||||
}
|
||||
}
|
||||
${ADMIN_SETTINGS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const SAVE_ADMIN_SETTINGS = gql`
|
||||
mutation SaveAdminSettings(
|
||||
$instanceName: String
|
||||
$instanceDescription: String
|
||||
$instanceLongDescription: String
|
||||
$instanceSlogan: String
|
||||
$contact: String
|
||||
$instanceTerms: String
|
||||
$instanceTermsType: InstanceTermsType
|
||||
$instanceTermsUrl: String
|
||||
$instancePrivacyPolicy: String
|
||||
$instancePrivacyPolicyType: InstancePrivacyType
|
||||
$instancePrivacyPolicyUrl: String
|
||||
$instanceRules: String
|
||||
$registrationsOpen: Boolean
|
||||
$instanceLanguages: [String]
|
||||
) {
|
||||
saveAdminSettings(
|
||||
instanceName: $instanceName
|
||||
instanceDescription: $instanceDescription
|
||||
instanceLongDescription: $instanceLongDescription
|
||||
instanceSlogan: $instanceSlogan
|
||||
contact: $contact
|
||||
instanceTerms: $instanceTerms
|
||||
instanceTermsType: $instanceTermsType
|
||||
instanceTermsUrl: $instanceTermsUrl
|
||||
instancePrivacyPolicy: $instancePrivacyPolicy
|
||||
instancePrivacyPolicyType: $instancePrivacyPolicyType
|
||||
instancePrivacyPolicyUrl: $instancePrivacyPolicyUrl
|
||||
instanceRules: $instanceRules
|
||||
registrationsOpen: $registrationsOpen
|
||||
instanceLanguages: $instanceLanguages
|
||||
) {
|
||||
...adminSettingsFragment
|
||||
}
|
||||
}
|
||||
${ADMIN_SETTINGS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const ADMIN_UPDATE_USER = gql`
|
||||
mutation AdminUpdateUser(
|
||||
$id: ID!
|
||||
$email: String
|
||||
$role: UserRole
|
||||
$confirmed: Boolean
|
||||
$notify: Boolean
|
||||
) {
|
||||
adminUpdateUser(
|
||||
id: $id
|
||||
email: $email
|
||||
role: $role
|
||||
confirmed: $confirmed
|
||||
notify: $notify
|
||||
) {
|
||||
id
|
||||
email
|
||||
role
|
||||
confirmedAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
88
src/graphql/application.ts
Normal file
88
src/graphql/application.ts
Normal file
@@ -0,0 +1,88 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const AUTH_APPLICATION = gql`
|
||||
query AuthApplication($clientId: String!) {
|
||||
authApplication(clientId: $clientId) {
|
||||
id
|
||||
clientId
|
||||
name
|
||||
website
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const AUTORIZE_APPLICATION = gql`
|
||||
mutation AuthorizeApplication(
|
||||
$applicationClientId: String!
|
||||
$redirectURI: String!
|
||||
$state: String
|
||||
$scope: String!
|
||||
) {
|
||||
authorizeApplication(
|
||||
clientId: $applicationClientId
|
||||
redirectURI: $redirectURI
|
||||
state: $state
|
||||
scope: $scope
|
||||
) {
|
||||
code
|
||||
state
|
||||
clientId
|
||||
scope
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const AUTORIZE_DEVICE_APPLICATION = gql`
|
||||
mutation AuthorizeDeviceApplication(
|
||||
$applicationClientId: String!
|
||||
$userCode: String!
|
||||
) {
|
||||
authorizeDeviceApplication(
|
||||
clientId: $applicationClientId
|
||||
userCode: $userCode
|
||||
) {
|
||||
clientId
|
||||
scope
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const AUTH_AUTHORIZED_APPLICATIONS = gql`
|
||||
query AuthAuthorizedApplications {
|
||||
loggedUser {
|
||||
id
|
||||
authAuthorizedApplications {
|
||||
id
|
||||
application {
|
||||
name
|
||||
website
|
||||
}
|
||||
lastUsedAt
|
||||
insertedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const REVOKED_AUTHORIZED_APPLICATION = gql`
|
||||
mutation RevokeApplicationToken($appTokenId: String!) {
|
||||
revokeApplicationToken(appTokenId: $appTokenId) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DEVICE_ACTIVATION = gql`
|
||||
mutation DeviceActivation($userCode: String!) {
|
||||
deviceActivation(userCode: $userCode) {
|
||||
id
|
||||
application {
|
||||
id
|
||||
clientId
|
||||
name
|
||||
website
|
||||
}
|
||||
scope
|
||||
}
|
||||
}
|
||||
`;
|
||||
54
src/graphql/auth.ts
Normal file
54
src/graphql/auth.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const LOGIN = gql`
|
||||
mutation Login($email: String!, $password: String!) {
|
||||
login(email: $email, password: $password) {
|
||||
accessToken
|
||||
refreshToken
|
||||
user {
|
||||
id
|
||||
email
|
||||
role
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SEND_RESET_PASSWORD = gql`
|
||||
mutation SendResetPassword($email: String!) {
|
||||
sendResetPassword(email: $email)
|
||||
}
|
||||
`;
|
||||
|
||||
export const RESET_PASSWORD = gql`
|
||||
mutation ResetPassword($token: String!, $password: String!) {
|
||||
resetPassword(token: $token, password: $password) {
|
||||
accessToken
|
||||
refreshToken
|
||||
user {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const RESEND_CONFIRMATION_EMAIL = gql`
|
||||
mutation ResendConfirmationEmail($email: String!) {
|
||||
resendConfirmationEmail(email: $email)
|
||||
}
|
||||
`;
|
||||
|
||||
export const REFRESH_TOKEN = gql`
|
||||
mutation RefreshToken($refreshToken: String!) {
|
||||
refreshToken(refreshToken: $refreshToken) {
|
||||
accessToken
|
||||
refreshToken
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const LOGOUT = gql`
|
||||
mutation Logout($refreshToken: String!) {
|
||||
logout(refreshToken: $refreshToken)
|
||||
}
|
||||
`;
|
||||
121
src/graphql/comment.ts
Normal file
121
src/graphql/comment.ts
Normal file
@@ -0,0 +1,121 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
|
||||
export const COMMENT_FIELDS_FRAGMENT_NAME = "CommentFields";
|
||||
export const COMMENT_FIELDS_FRAGMENT = gql`
|
||||
fragment CommentFields on Comment {
|
||||
id
|
||||
uuid
|
||||
url
|
||||
text
|
||||
visibility
|
||||
local
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
totalReplies
|
||||
insertedAt
|
||||
updatedAt
|
||||
deletedAt
|
||||
publishedAt
|
||||
isAnnouncement
|
||||
language
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const COMMENT_RECURSIVE_FRAGMENT = gql`
|
||||
fragment CommentRecursive on Comment {
|
||||
...CommentFields
|
||||
inReplyToComment {
|
||||
...CommentFields
|
||||
}
|
||||
originComment {
|
||||
...CommentFields
|
||||
}
|
||||
replies {
|
||||
...CommentFields
|
||||
inReplyToComment {
|
||||
...CommentFields
|
||||
}
|
||||
originComment {
|
||||
...CommentFields
|
||||
}
|
||||
replies {
|
||||
...CommentFields
|
||||
}
|
||||
}
|
||||
}
|
||||
${COMMENT_FIELDS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const FETCH_THREAD_REPLIES = gql`
|
||||
query FetchThreadReplies($threadId: ID!) {
|
||||
thread(id: $threadId) {
|
||||
...CommentRecursive
|
||||
}
|
||||
}
|
||||
${COMMENT_RECURSIVE_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const COMMENTS_THREADS = gql`
|
||||
query CommentThreads($eventUUID: UUID!) {
|
||||
event(uuid: $eventUUID) {
|
||||
id
|
||||
uuid
|
||||
comments {
|
||||
...CommentFields
|
||||
}
|
||||
}
|
||||
}
|
||||
${COMMENT_FIELDS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const COMMENTS_THREADS_WITH_REPLIES = gql`
|
||||
query CommentThreadsWithReplies($eventUUID: UUID!) {
|
||||
event(uuid: $eventUUID) {
|
||||
id
|
||||
uuid
|
||||
comments {
|
||||
...CommentRecursive
|
||||
}
|
||||
}
|
||||
}
|
||||
${COMMENT_RECURSIVE_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CREATE_COMMENT_FROM_EVENT = gql`
|
||||
mutation CreateCommentFromEvent(
|
||||
$eventId: ID!
|
||||
$text: String!
|
||||
$inReplyToCommentId: ID
|
||||
$isAnnouncement: Boolean
|
||||
) {
|
||||
createComment(
|
||||
eventId: $eventId
|
||||
text: $text
|
||||
inReplyToCommentId: $inReplyToCommentId
|
||||
isAnnouncement: $isAnnouncement
|
||||
) {
|
||||
...CommentRecursive
|
||||
}
|
||||
}
|
||||
${COMMENT_RECURSIVE_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const DELETE_COMMENT = gql`
|
||||
mutation DeleteComment($commentId: ID!) {
|
||||
deleteComment(commentId: $commentId) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_COMMENT = gql`
|
||||
mutation UpdateComment($commentId: ID!, $text: String!) {
|
||||
updateComment(commentId: $commentId, text: $text) {
|
||||
...CommentFields
|
||||
}
|
||||
}
|
||||
${COMMENT_FIELDS_FRAGMENT}
|
||||
`;
|
||||
467
src/graphql/config.ts
Normal file
467
src/graphql/config.ts
Normal file
@@ -0,0 +1,467 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const CONFIG = gql`
|
||||
query FullConfig {
|
||||
config {
|
||||
name
|
||||
description
|
||||
slogan
|
||||
version
|
||||
registrationsOpen
|
||||
registrationsAllowlist
|
||||
demoMode
|
||||
countryCode
|
||||
languages
|
||||
eventCategories {
|
||||
id
|
||||
label
|
||||
}
|
||||
anonymous {
|
||||
participation {
|
||||
allowed
|
||||
validation {
|
||||
email {
|
||||
enabled
|
||||
confirmationRequired
|
||||
}
|
||||
captcha {
|
||||
enabled
|
||||
}
|
||||
}
|
||||
}
|
||||
eventCreation {
|
||||
allowed
|
||||
validation {
|
||||
email {
|
||||
enabled
|
||||
confirmationRequired
|
||||
}
|
||||
captcha {
|
||||
enabled
|
||||
}
|
||||
}
|
||||
}
|
||||
reports {
|
||||
allowed
|
||||
}
|
||||
actorId
|
||||
}
|
||||
location {
|
||||
latitude
|
||||
longitude
|
||||
# accuracyRadius
|
||||
}
|
||||
maps {
|
||||
tiles {
|
||||
endpoint
|
||||
attribution
|
||||
}
|
||||
routing {
|
||||
type
|
||||
}
|
||||
}
|
||||
geocoding {
|
||||
provider
|
||||
autocomplete
|
||||
}
|
||||
resourceProviders {
|
||||
type
|
||||
endpoint
|
||||
software
|
||||
}
|
||||
features {
|
||||
groups
|
||||
eventCreation
|
||||
eventExternal
|
||||
antispam
|
||||
}
|
||||
restrictions {
|
||||
onlyAdminCanCreateGroups
|
||||
onlyGroupsCanCreateEvents
|
||||
}
|
||||
auth {
|
||||
ldap
|
||||
databaseLogin
|
||||
oauthProviders {
|
||||
id
|
||||
label
|
||||
}
|
||||
}
|
||||
uploadLimits {
|
||||
default
|
||||
avatar
|
||||
banner
|
||||
}
|
||||
instanceFeeds {
|
||||
enabled
|
||||
}
|
||||
webPush {
|
||||
enabled
|
||||
publicKey
|
||||
}
|
||||
analytics {
|
||||
id
|
||||
enabled
|
||||
configuration {
|
||||
key
|
||||
value
|
||||
type
|
||||
}
|
||||
}
|
||||
search {
|
||||
global {
|
||||
isEnabled
|
||||
isDefault
|
||||
}
|
||||
}
|
||||
exportFormats {
|
||||
eventParticipants
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const CONFIG_EDIT_EVENT = gql`
|
||||
query EditEventConfig {
|
||||
config {
|
||||
timezones
|
||||
features {
|
||||
groups
|
||||
}
|
||||
eventCategories {
|
||||
id
|
||||
label
|
||||
}
|
||||
anonymous {
|
||||
participation {
|
||||
allowed
|
||||
validation {
|
||||
email {
|
||||
enabled
|
||||
confirmationRequired
|
||||
}
|
||||
captcha {
|
||||
enabled
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const TERMS = gql`
|
||||
query Terms($locale: String) {
|
||||
config {
|
||||
terms(locale: $locale) {
|
||||
type
|
||||
url
|
||||
bodyHtml
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const ABOUT = gql`
|
||||
query About {
|
||||
config {
|
||||
name
|
||||
description
|
||||
longDescription
|
||||
slogan
|
||||
contact
|
||||
languages
|
||||
registrationsOpen
|
||||
registrationsAllowlist
|
||||
anonymous {
|
||||
participation {
|
||||
allowed
|
||||
}
|
||||
}
|
||||
version
|
||||
federating
|
||||
instanceFeeds {
|
||||
enabled
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const CONTACT = gql`
|
||||
query Contact {
|
||||
config {
|
||||
name
|
||||
contact
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const RULES = gql`
|
||||
query Rules {
|
||||
config {
|
||||
rules
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const PRIVACY = gql`
|
||||
query Privacy($locale: String) {
|
||||
config {
|
||||
privacy(locale: $locale) {
|
||||
type
|
||||
url
|
||||
bodyHtml
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const TIMEZONES = gql`
|
||||
query Timezones {
|
||||
config {
|
||||
timezones
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const WEB_PUSH = gql`
|
||||
query WebPush {
|
||||
config {
|
||||
webPush {
|
||||
enabled
|
||||
publicKey
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const EVENT_PARTICIPANTS = gql`
|
||||
query EventParticipants {
|
||||
config {
|
||||
exportFormats {
|
||||
eventParticipants
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const ANONYMOUS_PARTICIPATION_CONFIG = gql`
|
||||
query AnonymousParticipationConfig {
|
||||
config {
|
||||
anonymous {
|
||||
participation {
|
||||
allowed
|
||||
validation {
|
||||
email {
|
||||
enabled
|
||||
confirmationRequired
|
||||
}
|
||||
captcha {
|
||||
enabled
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const ANONYMOUS_REPORTS_CONFIG = gql`
|
||||
query AnonymousParticipationConfig {
|
||||
config {
|
||||
anonymous {
|
||||
reports {
|
||||
allowed
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const INSTANCE_NAME = gql`
|
||||
query InstanceName {
|
||||
config {
|
||||
name
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const ANONYMOUS_ACTOR_ID = gql`
|
||||
query AnonymousActorId {
|
||||
config {
|
||||
anonymous {
|
||||
actorId
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPLOAD_LIMITS = gql`
|
||||
query UploadLimits {
|
||||
config {
|
||||
uploadLimits {
|
||||
default
|
||||
avatar
|
||||
banner
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const EVENT_CATEGORIES = gql`
|
||||
query EventCategories {
|
||||
config {
|
||||
eventCategories {
|
||||
id
|
||||
label
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const RESTRICTIONS = gql`
|
||||
query OnlyGroupsCanCreateEvents {
|
||||
config {
|
||||
restrictions {
|
||||
onlyGroupsCanCreateEvents
|
||||
onlyAdminCanCreateGroups
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GEOCODING_AUTOCOMPLETE = gql`
|
||||
query GeoCodingAutocomplete {
|
||||
config {
|
||||
geocoding {
|
||||
autocomplete
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const MAPS_TILES = gql`
|
||||
query MapsTiles {
|
||||
config {
|
||||
maps {
|
||||
tiles {
|
||||
endpoint
|
||||
attribution
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const ROUTING_TYPE = gql`
|
||||
query RoutingType {
|
||||
config {
|
||||
maps {
|
||||
routing {
|
||||
type
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const FEATURES = gql`
|
||||
query Features {
|
||||
config {
|
||||
features {
|
||||
groups
|
||||
eventCreation
|
||||
eventExternal
|
||||
antispam
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const RESOURCE_PROVIDERS = gql`
|
||||
query ResourceProviders {
|
||||
config {
|
||||
resourceProviders {
|
||||
type
|
||||
endpoint
|
||||
software
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const LOGIN_CONFIG = gql`
|
||||
query LoginConfig {
|
||||
config {
|
||||
auth {
|
||||
databaseLogin
|
||||
oauthProviders {
|
||||
id
|
||||
label
|
||||
}
|
||||
}
|
||||
registrationsOpen
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const LOCATION = gql`
|
||||
query Location {
|
||||
config {
|
||||
location {
|
||||
latitude
|
||||
longitude
|
||||
# accuracyRadius
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DEMO_MODE = gql`
|
||||
query DemoMode {
|
||||
config {
|
||||
demoMode
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const ANALYTICS = gql`
|
||||
query Analytics {
|
||||
config {
|
||||
analytics {
|
||||
id
|
||||
enabled
|
||||
configuration {
|
||||
key
|
||||
value
|
||||
type
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SEARCH_CONFIG = gql`
|
||||
query SearchConfig {
|
||||
config {
|
||||
search {
|
||||
global {
|
||||
isEnabled
|
||||
isDefault
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const REGISTRATIONS = gql`
|
||||
query Registrations {
|
||||
config {
|
||||
registrationsOpen
|
||||
registrationsAllowlist
|
||||
auth {
|
||||
databaseLogin
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
166
src/graphql/conversations.ts
Normal file
166
src/graphql/conversations.ts
Normal file
@@ -0,0 +1,166 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
import { COMMENT_FIELDS_FRAGMENT } from "./comment";
|
||||
|
||||
export const CONVERSATION_QUERY_FRAGMENT = gql`
|
||||
fragment ConversationQuery on Conversation {
|
||||
id
|
||||
conversationParticipantId
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
lastComment {
|
||||
...CommentFields
|
||||
}
|
||||
participants {
|
||||
...ActorFragment
|
||||
}
|
||||
event {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
picture {
|
||||
id
|
||||
url
|
||||
name
|
||||
metadata {
|
||||
width
|
||||
height
|
||||
blurhash
|
||||
}
|
||||
}
|
||||
}
|
||||
unread
|
||||
insertedAt
|
||||
updatedAt
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
${COMMENT_FIELDS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CONVERSATIONS_QUERY_FRAGMENT = gql`
|
||||
fragment ConversationsQuery on PaginatedConversationList {
|
||||
total
|
||||
elements {
|
||||
...ConversationQuery
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const SEND_EVENT_PRIVATE_MESSAGE_MUTATION = gql`
|
||||
mutation SendEventPrivateMessageMutation(
|
||||
$text: String!
|
||||
$actorId: ID!
|
||||
$eventId: ID!
|
||||
$roles: [ParticipantRoleEnum]
|
||||
$attributedToId: ID
|
||||
$language: String
|
||||
) {
|
||||
sendEventPrivateMessage(
|
||||
text: $text
|
||||
actorId: $actorId
|
||||
eventId: $eventId
|
||||
roles: $roles
|
||||
attributedToId: $attributedToId
|
||||
language: $language
|
||||
) {
|
||||
...ConversationQuery
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const GET_CONVERSATION = gql`
|
||||
query GetConversation($id: ID!, $page: Int, $limit: Int) {
|
||||
conversation(id: $id) {
|
||||
...ConversationQuery
|
||||
comments(page: $page, limit: $limit) @connection(key: "comments") {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
text
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
updatedAt
|
||||
deletedAt
|
||||
publishedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const POST_PRIVATE_MESSAGE_MUTATION = gql`
|
||||
mutation PostPrivateMessageMutation(
|
||||
$text: String!
|
||||
$actorId: ID!
|
||||
$language: String
|
||||
$mentions: [String]
|
||||
) {
|
||||
postPrivateMessage(
|
||||
text: $text
|
||||
actorId: $actorId
|
||||
language: $language
|
||||
mentions: $mentions
|
||||
) {
|
||||
...ConversationQuery
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const REPLY_TO_PRIVATE_MESSAGE_MUTATION = gql`
|
||||
mutation ReplyToPrivateMessageMutation(
|
||||
$text: String!
|
||||
$actorId: ID!
|
||||
$attributedToId: ID
|
||||
$language: String
|
||||
$conversationId: ID!
|
||||
$mentions: [String]
|
||||
) {
|
||||
postPrivateMessage(
|
||||
text: $text
|
||||
actorId: $actorId
|
||||
attributedToId: $attributedToId
|
||||
language: $language
|
||||
conversationId: $conversationId
|
||||
mentions: $mentions
|
||||
) {
|
||||
...ConversationQuery
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CONVERSATION_COMMENT_CHANGED = gql`
|
||||
subscription ConversationCommentChanged($id: ID!) {
|
||||
conversationCommentChanged(id: $id) {
|
||||
id
|
||||
lastComment {
|
||||
id
|
||||
text
|
||||
updatedAt
|
||||
insertedAt
|
||||
deletedAt
|
||||
publishedAt
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const MARK_CONVERSATION_AS_READ = gql`
|
||||
mutation MarkConversationAsRead($id: ID!, $read: Boolean!) {
|
||||
updateConversation(conversationId: $id, read: $read) {
|
||||
...ConversationQuery
|
||||
}
|
||||
}
|
||||
${CONVERSATION_QUERY_FRAGMENT}
|
||||
`;
|
||||
172
src/graphql/discussion.ts
Normal file
172
src/graphql/discussion.ts
Normal file
@@ -0,0 +1,172 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
|
||||
export const DISCUSSION_BASIC_FIELDS_FRAGMENT = gql`
|
||||
fragment DiscussionBasicFields on Discussion {
|
||||
id
|
||||
title
|
||||
slug
|
||||
insertedAt
|
||||
updatedAt
|
||||
lastComment {
|
||||
id
|
||||
text
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
publishedAt
|
||||
deletedAt
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const DISCUSSION_FIELDS_FOR_REPLY_FRAGMENT = gql`
|
||||
fragment DiscussionFieldsReply on Discussion {
|
||||
id
|
||||
title
|
||||
slug
|
||||
lastComment {
|
||||
id
|
||||
text
|
||||
updatedAt
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
creator {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const DISCUSSION_FIELDS_FRAGMENT = gql`
|
||||
fragment DiscussionFields on Discussion {
|
||||
id
|
||||
title
|
||||
slug
|
||||
lastComment {
|
||||
id
|
||||
text
|
||||
insertedAt
|
||||
updatedAt
|
||||
deletedAt
|
||||
publishedAt
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
creator {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CREATE_DISCUSSION = gql`
|
||||
mutation createDiscussion($title: String!, $actorId: ID!, $text: String!) {
|
||||
createDiscussion(title: $title, text: $text, actorId: $actorId) {
|
||||
...DiscussionFields
|
||||
}
|
||||
}
|
||||
${DISCUSSION_FIELDS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const REPLY_TO_DISCUSSION = gql`
|
||||
mutation replyToDiscussion($discussionId: ID!, $text: String!) {
|
||||
replyToDiscussion(discussionId: $discussionId, text: $text) {
|
||||
...DiscussionFields
|
||||
}
|
||||
}
|
||||
${DISCUSSION_FIELDS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const GET_DISCUSSION = gql`
|
||||
query getDiscussion($slug: String!, $page: Int, $limit: Int) {
|
||||
discussion(slug: $slug) {
|
||||
comments(page: $page, limit: $limit) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
text
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
updatedAt
|
||||
deletedAt
|
||||
publishedAt
|
||||
}
|
||||
}
|
||||
...DiscussionFields
|
||||
}
|
||||
}
|
||||
${DISCUSSION_FIELDS_FRAGMENT}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const UPDATE_DISCUSSION = gql`
|
||||
mutation updateDiscussion($discussionId: ID!, $title: String!) {
|
||||
updateDiscussion(discussionId: $discussionId, title: $title) {
|
||||
...DiscussionFields
|
||||
}
|
||||
}
|
||||
${DISCUSSION_FIELDS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const DELETE_DISCUSSION = gql`
|
||||
mutation deleteDiscussion($discussionId: ID!) {
|
||||
deleteDiscussion(discussionId: $discussionId) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DISCUSSION_COMMENT_CHANGED = gql`
|
||||
subscription ($slug: String!) {
|
||||
discussionCommentChanged(slug: $slug) {
|
||||
id
|
||||
lastComment {
|
||||
id
|
||||
text
|
||||
updatedAt
|
||||
insertedAt
|
||||
deletedAt
|
||||
publishedAt
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const GROUP_DISCUSSIONS_LIST = gql`
|
||||
query GroupDiscussionsList(
|
||||
$name: String!
|
||||
$discussionsPage: Int
|
||||
$discussionsLimit: Int
|
||||
) {
|
||||
group(preferredUsername: $name) {
|
||||
id
|
||||
preferredUsername
|
||||
name
|
||||
domain
|
||||
discussions(page: $discussionsPage, limit: $discussionsLimit) {
|
||||
total
|
||||
elements {
|
||||
...DiscussionBasicFields
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${DISCUSSION_BASIC_FIELDS_FRAGMENT}
|
||||
`;
|
||||
542
src/graphql/event.ts
Normal file
542
src/graphql/event.ts
Normal file
@@ -0,0 +1,542 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
import { ADDRESS_FRAGMENT } from "./address";
|
||||
import { EVENT_OPTIONS_FRAGMENT } from "./event_options";
|
||||
import {
|
||||
PARTICIPANTS_QUERY_FRAGMENT,
|
||||
PARTICIPANT_QUERY_FRAGMENT,
|
||||
} from "./participant";
|
||||
import { TAG_FRAGMENT } from "./tags";
|
||||
import { CONVERSATIONS_QUERY_FRAGMENT } from "./conversations";
|
||||
|
||||
const FULL_EVENT_FRAGMENT = gql`
|
||||
fragment FullEvent on Event {
|
||||
id
|
||||
uuid
|
||||
url
|
||||
local
|
||||
title
|
||||
description
|
||||
beginsOn
|
||||
endsOn
|
||||
status
|
||||
visibility
|
||||
joinOptions
|
||||
externalParticipationUrl
|
||||
draft
|
||||
language
|
||||
category
|
||||
picture {
|
||||
id
|
||||
url
|
||||
name
|
||||
metadata {
|
||||
width
|
||||
height
|
||||
blurhash
|
||||
}
|
||||
}
|
||||
publishAt
|
||||
onlineAddress
|
||||
phoneAddress
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
contacts {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
participantStats {
|
||||
going
|
||||
notApproved
|
||||
participant
|
||||
}
|
||||
tags {
|
||||
...TagFragment
|
||||
}
|
||||
relatedEvents {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
beginsOn
|
||||
status
|
||||
language
|
||||
picture {
|
||||
id
|
||||
url
|
||||
name
|
||||
metadata {
|
||||
width
|
||||
height
|
||||
blurhash
|
||||
}
|
||||
}
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
tags {
|
||||
...TagFragment
|
||||
}
|
||||
}
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
metadata {
|
||||
key
|
||||
title
|
||||
value
|
||||
type
|
||||
}
|
||||
}
|
||||
${ADDRESS_FRAGMENT}
|
||||
${TAG_FRAGMENT}
|
||||
${EVENT_OPTIONS_FRAGMENT}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const FETCH_EVENT = gql`
|
||||
query FetchEvent($uuid: UUID!) {
|
||||
event(uuid: $uuid) {
|
||||
...FullEvent
|
||||
}
|
||||
}
|
||||
${FULL_EVENT_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const FETCH_EVENT_BASIC = gql`
|
||||
query FetchEventBasic($uuid: UUID!) {
|
||||
event(uuid: $uuid) {
|
||||
id
|
||||
uuid
|
||||
joinOptions
|
||||
externalParticipationUrl
|
||||
participantStats {
|
||||
going
|
||||
notApproved
|
||||
notConfirmed
|
||||
participant
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const FETCH_EVENTS = gql`
|
||||
query FetchEvents(
|
||||
$orderBy: EventOrderBy
|
||||
$direction: SortDirection
|
||||
$page: Int
|
||||
$limit: Int
|
||||
) {
|
||||
events(
|
||||
orderBy: $orderBy
|
||||
direction: $direction
|
||||
page: $page
|
||||
limit: $limit
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
uuid
|
||||
url
|
||||
local
|
||||
title
|
||||
description
|
||||
beginsOn
|
||||
endsOn
|
||||
status
|
||||
visibility
|
||||
insertedAt
|
||||
language
|
||||
picture {
|
||||
id
|
||||
url
|
||||
}
|
||||
publishAt
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
category
|
||||
tags {
|
||||
...TagFragment
|
||||
}
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ADDRESS_FRAGMENT}
|
||||
${TAG_FRAGMENT}
|
||||
${EVENT_OPTIONS_FRAGMENT}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CREATE_EVENT = gql`
|
||||
mutation createEvent(
|
||||
$organizerActorId: ID!
|
||||
$attributedToId: ID
|
||||
$title: String!
|
||||
$description: String!
|
||||
$beginsOn: DateTime!
|
||||
$endsOn: DateTime
|
||||
$status: EventStatus
|
||||
$visibility: EventVisibility
|
||||
$joinOptions: EventJoinOptions
|
||||
$externalParticipationUrl: String
|
||||
$draft: Boolean
|
||||
$tags: [String]
|
||||
$picture: MediaInput
|
||||
$onlineAddress: String
|
||||
$phoneAddress: String
|
||||
$category: EventCategory
|
||||
$physicalAddress: AddressInput
|
||||
$options: EventOptionsInput
|
||||
$contacts: [Contact]
|
||||
$metadata: [EventMetadataInput]
|
||||
) {
|
||||
createEvent(
|
||||
organizerActorId: $organizerActorId
|
||||
attributedToId: $attributedToId
|
||||
title: $title
|
||||
description: $description
|
||||
beginsOn: $beginsOn
|
||||
endsOn: $endsOn
|
||||
status: $status
|
||||
visibility: $visibility
|
||||
joinOptions: $joinOptions
|
||||
externalParticipationUrl: $externalParticipationUrl
|
||||
draft: $draft
|
||||
tags: $tags
|
||||
picture: $picture
|
||||
onlineAddress: $onlineAddress
|
||||
phoneAddress: $phoneAddress
|
||||
category: $category
|
||||
physicalAddress: $physicalAddress
|
||||
options: $options
|
||||
contacts: $contacts
|
||||
metadata: $metadata
|
||||
) {
|
||||
...FullEvent
|
||||
}
|
||||
}
|
||||
${FULL_EVENT_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const EDIT_EVENT = gql`
|
||||
mutation updateEvent(
|
||||
$id: ID!
|
||||
$title: String
|
||||
$description: String
|
||||
$beginsOn: DateTime
|
||||
$endsOn: DateTime
|
||||
$status: EventStatus
|
||||
$visibility: EventVisibility
|
||||
$joinOptions: EventJoinOptions
|
||||
$externalParticipationUrl: String
|
||||
$draft: Boolean
|
||||
$tags: [String]
|
||||
$picture: MediaInput
|
||||
$onlineAddress: String
|
||||
$phoneAddress: String
|
||||
$organizerActorId: ID
|
||||
$attributedToId: ID
|
||||
$category: EventCategory
|
||||
$physicalAddress: AddressInput
|
||||
$options: EventOptionsInput
|
||||
$contacts: [Contact]
|
||||
$metadata: [EventMetadataInput]
|
||||
) {
|
||||
updateEvent(
|
||||
eventId: $id
|
||||
title: $title
|
||||
description: $description
|
||||
beginsOn: $beginsOn
|
||||
endsOn: $endsOn
|
||||
status: $status
|
||||
visibility: $visibility
|
||||
joinOptions: $joinOptions
|
||||
externalParticipationUrl: $externalParticipationUrl
|
||||
draft: $draft
|
||||
tags: $tags
|
||||
picture: $picture
|
||||
onlineAddress: $onlineAddress
|
||||
phoneAddress: $phoneAddress
|
||||
organizerActorId: $organizerActorId
|
||||
attributedToId: $attributedToId
|
||||
category: $category
|
||||
physicalAddress: $physicalAddress
|
||||
options: $options
|
||||
contacts: $contacts
|
||||
metadata: $metadata
|
||||
) {
|
||||
...FullEvent
|
||||
}
|
||||
}
|
||||
${FULL_EVENT_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const JOIN_EVENT = gql`
|
||||
mutation JoinEvent(
|
||||
$eventId: ID!
|
||||
$actorId: ID!
|
||||
$email: String
|
||||
$message: String
|
||||
$locale: String
|
||||
$timezone: Timezone
|
||||
) {
|
||||
joinEvent(
|
||||
eventId: $eventId
|
||||
actorId: $actorId
|
||||
email: $email
|
||||
message: $message
|
||||
locale: $locale
|
||||
timezone: $timezone
|
||||
) {
|
||||
...ParticipantQuery
|
||||
}
|
||||
}
|
||||
${PARTICIPANT_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const LEAVE_EVENT = gql`
|
||||
mutation LeaveEvent($eventId: ID!, $actorId: ID!, $token: String) {
|
||||
leaveEvent(eventId: $eventId, actorId: $actorId, token: $token) {
|
||||
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
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_EVENT = gql`
|
||||
mutation DeleteEvent($eventId: ID!) {
|
||||
deleteEvent(eventId: $eventId) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const PARTICIPANTS = gql`
|
||||
query Participants($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
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${PARTICIPANTS_QUERY_FRAGMENT}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const EVENT_PERSON_PARTICIPATION = gql`
|
||||
query EventPersonParticipation($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 EventPersonParticipationSubscriptionChanged(
|
||||
$actorId: ID!
|
||||
$eventId: ID!
|
||||
) {
|
||||
eventPersonParticipationChanged(personId: $actorId) {
|
||||
id
|
||||
participations(eventId: $eventId) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
role
|
||||
actor {
|
||||
id
|
||||
}
|
||||
event {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const FETCH_GROUP_EVENTS = gql`
|
||||
query FetchGroupEvents(
|
||||
$name: String!
|
||||
$afterDateTime: DateTime
|
||||
$beforeDateTime: DateTime
|
||||
$order: EventOrderBy
|
||||
$orderDirection: SortDirection
|
||||
$organisedEventsPage: Int
|
||||
$organisedEventsLimit: Int
|
||||
) {
|
||||
group(preferredUsername: $name) {
|
||||
organizedEvents(
|
||||
afterDatetime: $afterDateTime
|
||||
beforeDatetime: $beforeDateTime
|
||||
order: $order
|
||||
orderDirection: $orderDirection
|
||||
page: $organisedEventsPage
|
||||
limit: $organisedEventsLimit
|
||||
) {
|
||||
elements {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
beginsOn
|
||||
status
|
||||
draft
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
participantStats {
|
||||
participant
|
||||
notApproved
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
picture {
|
||||
url
|
||||
id
|
||||
}
|
||||
}
|
||||
total
|
||||
}
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
${EVENT_OPTIONS_FRAGMENT}
|
||||
${ACTOR_FRAGMENT}
|
||||
${ADDRESS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const EXPORT_EVENT_PARTICIPATIONS = gql`
|
||||
mutation ExportEventParticipants(
|
||||
$eventId: ID!
|
||||
$format: ExportFormatEnum
|
||||
$roles: [ParticipantRoleEnum]
|
||||
) {
|
||||
exportEventParticipants(eventId: $eventId, format: $format, roles: $roles) {
|
||||
path
|
||||
format
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const EVENT_CONVERSATIONS = gql`
|
||||
query EventConversations($uuid: UUID!, $page: Int, $limit: Int) {
|
||||
event(uuid: $uuid) {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
conversations(page: $page, limit: $limit) {
|
||||
...ConversationsQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
${CONVERSATIONS_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const USER_CONVERSATIONS = gql`
|
||||
query UserConversations($page: Int, $limit: Int) {
|
||||
loggedUser {
|
||||
id
|
||||
conversations(page: $page, limit: $limit) {
|
||||
...ConversationsQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
${CONVERSATIONS_QUERY_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const PROFILE_CONVERSATIONS = gql`
|
||||
query ProfileConversations($page: Int, $limit: Int) {
|
||||
loggedPerson {
|
||||
id
|
||||
conversations(page: $page, limit: $limit) {
|
||||
...ConversationsQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
${CONVERSATIONS_QUERY_FRAGMENT}
|
||||
`;
|
||||
29
src/graphql/event_options.ts
Normal file
29
src/graphql/event_options.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const EVENT_OPTIONS_FRAGMENT = gql`
|
||||
fragment EventOptions on EventOptions {
|
||||
maximumAttendeeCapacity
|
||||
remainingAttendeeCapacity
|
||||
showRemainingAttendeeCapacity
|
||||
anonymousParticipation
|
||||
showStartTime
|
||||
showEndTime
|
||||
timezone
|
||||
offers {
|
||||
price
|
||||
priceCurrency
|
||||
url
|
||||
}
|
||||
participationConditions {
|
||||
title
|
||||
content
|
||||
url
|
||||
}
|
||||
attendees
|
||||
program
|
||||
commentModeration
|
||||
showParticipationPrice
|
||||
hideOrganizerWhenGroupEvent
|
||||
isOnline
|
||||
}
|
||||
`;
|
||||
42
src/graphql/feed_tokens.ts
Normal file
42
src/graphql/feed_tokens.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const CREATE_FEED_TOKEN_ACTOR = gql`
|
||||
mutation createFeedToken($actor_id: ID!) {
|
||||
createFeedToken(actorId: $actor_id) {
|
||||
token
|
||||
actor {
|
||||
id
|
||||
}
|
||||
user {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const CREATE_FEED_TOKEN = gql`
|
||||
mutation CreateFeedToken {
|
||||
createFeedToken {
|
||||
token
|
||||
actor {
|
||||
id
|
||||
}
|
||||
user {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_FEED_TOKEN = gql`
|
||||
mutation DeleteFeedToken($token: String!) {
|
||||
deleteFeedToken(token: $token) {
|
||||
actor {
|
||||
id
|
||||
}
|
||||
user {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
70
src/graphql/followers.ts
Normal file
70
src/graphql/followers.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
|
||||
export const GROUP_FOLLOWERS = gql`
|
||||
query GroupFollowers(
|
||||
$name: String!
|
||||
$followersPage: Int
|
||||
$followersLimit: Int
|
||||
$approved: Boolean
|
||||
) {
|
||||
group(preferredUsername: $name) {
|
||||
...ActorFragment
|
||||
followers(
|
||||
page: $followersPage
|
||||
limit: $followersLimit
|
||||
approved: $approved
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
approved
|
||||
insertedAt
|
||||
updatedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const UPDATE_FOLLOWER = gql`
|
||||
mutation UpdateFollower($id: ID!, $approved: Boolean!) {
|
||||
updateFollower(id: $id, approved: $approved) {
|
||||
id
|
||||
approved
|
||||
actor {
|
||||
id
|
||||
preferredUsername
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const FOLLOW_GROUP = gql`
|
||||
mutation FollowGroup($groupId: ID!, $notify: Boolean) {
|
||||
followGroup(groupId: $groupId, notify: $notify) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UNFOLLOW_GROUP = gql`
|
||||
mutation UnfollowGroup($groupId: ID!) {
|
||||
unfollowGroup(groupId: $groupId) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_GROUP_FOLLOW = gql`
|
||||
mutation UpdateGroupFollow($followId: ID!, $notify: Boolean) {
|
||||
updateGroupFollow(followId: $followId, notify: $notify) {
|
||||
id
|
||||
notify
|
||||
}
|
||||
}
|
||||
`;
|
||||
11
src/graphql/fragmentTypes.json
Normal file
11
src/graphql/fragmentTypes.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"__schema": {
|
||||
"types": [
|
||||
{
|
||||
"possibleTypes": [{ "name": "Event" }, { "name": "Actor" }],
|
||||
"name": "SearchResult",
|
||||
"kind": "UNION"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
452
src/graphql/group.ts
Normal file
452
src/graphql/group.ts
Normal file
@@ -0,0 +1,452 @@
|
||||
import gql from "graphql-tag";
|
||||
import { RESOURCE_METADATA_BASIC_FIELDS_FRAGMENT } from "./resources";
|
||||
import { POST_BASIC_FIELDS } from "./post";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
import { ADDRESS_FRAGMENT } from "./address";
|
||||
import { TAG_FRAGMENT } from "./tags";
|
||||
import { EVENT_OPTIONS_FRAGMENT } from "./event_options";
|
||||
|
||||
export const LIST_GROUPS = gql`
|
||||
query ListGroups(
|
||||
$preferredUsername: String
|
||||
$name: String
|
||||
$domain: String
|
||||
$local: Boolean
|
||||
$suspended: Boolean
|
||||
$page: Int
|
||||
$limit: Int
|
||||
) {
|
||||
groups(
|
||||
preferredUsername: $preferredUsername
|
||||
name: $name
|
||||
domain: $domain
|
||||
local: $local
|
||||
suspended: $suspended
|
||||
page: $page
|
||||
limit: $limit
|
||||
) {
|
||||
elements {
|
||||
...ActorFragment
|
||||
suspended
|
||||
avatar {
|
||||
id
|
||||
url
|
||||
}
|
||||
banner {
|
||||
id
|
||||
url
|
||||
}
|
||||
organizedEvents {
|
||||
elements {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
status
|
||||
beginsOn
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const GROUP_VERY_BASIC_FIELDS_FRAGMENTS = gql`
|
||||
fragment GroupVeryBasicFields on Group {
|
||||
...ActorFragment
|
||||
suspended
|
||||
visibility
|
||||
openness
|
||||
manuallyApprovesFollowers
|
||||
physicalAddress {
|
||||
description
|
||||
street
|
||||
locality
|
||||
postalCode
|
||||
region
|
||||
country
|
||||
geom
|
||||
type
|
||||
id
|
||||
originId
|
||||
url
|
||||
}
|
||||
avatar {
|
||||
id
|
||||
url
|
||||
name
|
||||
metadata {
|
||||
width
|
||||
height
|
||||
blurhash
|
||||
}
|
||||
}
|
||||
banner {
|
||||
id
|
||||
url
|
||||
name
|
||||
metadata {
|
||||
width
|
||||
height
|
||||
blurhash
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const GROUP_BASIC_FIELDS_FRAGMENTS = gql`
|
||||
fragment GroupBasicFields on Group {
|
||||
...ActorFragment
|
||||
suspended
|
||||
visibility
|
||||
openness
|
||||
manuallyApprovesFollowers
|
||||
physicalAddress {
|
||||
description
|
||||
street
|
||||
locality
|
||||
postalCode
|
||||
region
|
||||
country
|
||||
geom
|
||||
type
|
||||
id
|
||||
originId
|
||||
url
|
||||
}
|
||||
avatar {
|
||||
id
|
||||
url
|
||||
name
|
||||
metadata {
|
||||
width
|
||||
height
|
||||
blurhash
|
||||
}
|
||||
}
|
||||
banner {
|
||||
id
|
||||
url
|
||||
name
|
||||
metadata {
|
||||
width
|
||||
height
|
||||
blurhash
|
||||
}
|
||||
}
|
||||
organizedEvents(
|
||||
afterDatetime: $afterDateTime
|
||||
beforeDatetime: $beforeDateTime
|
||||
page: $organisedEventsPage
|
||||
limit: $organisedEventsLimit
|
||||
) {
|
||||
elements {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
beginsOn
|
||||
status
|
||||
draft
|
||||
language
|
||||
options {
|
||||
maximumAttendeeCapacity
|
||||
}
|
||||
participantStats {
|
||||
participant
|
||||
notApproved
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
picture {
|
||||
id
|
||||
url
|
||||
}
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
tags {
|
||||
...TagFragment
|
||||
}
|
||||
}
|
||||
total
|
||||
}
|
||||
posts(page: $postsPage, limit: $postsLimit) {
|
||||
total
|
||||
elements {
|
||||
...PostBasicFields
|
||||
}
|
||||
}
|
||||
members {
|
||||
total
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
${ADDRESS_FRAGMENT}
|
||||
${EVENT_OPTIONS_FRAGMENT}
|
||||
${TAG_FRAGMENT}
|
||||
${POST_BASIC_FIELDS}
|
||||
`;
|
||||
|
||||
export const GROUP_FIELDS_FRAGMENTS = gql`
|
||||
fragment GroupFullFields on Group {
|
||||
...GroupBasicFields
|
||||
members(page: $membersPage, limit: $membersLimit) {
|
||||
elements {
|
||||
id
|
||||
role
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
}
|
||||
total
|
||||
}
|
||||
resources(page: 1, limit: 3) {
|
||||
elements {
|
||||
id
|
||||
title
|
||||
resourceUrl
|
||||
summary
|
||||
updatedAt
|
||||
type
|
||||
path
|
||||
metadata {
|
||||
...ResourceMetadataBasicFields
|
||||
}
|
||||
}
|
||||
total
|
||||
}
|
||||
todoLists {
|
||||
elements {
|
||||
id
|
||||
title
|
||||
todos {
|
||||
elements {
|
||||
id
|
||||
title
|
||||
status
|
||||
dueDate
|
||||
assignedTo {
|
||||
id
|
||||
preferredUsername
|
||||
}
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
${GROUP_BASIC_FIELDS_FRAGMENTS}
|
||||
${RESOURCE_METADATA_BASIC_FIELDS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const FETCH_GROUP_PUBLIC = gql`
|
||||
query FetchGroupPublic(
|
||||
$name: String!
|
||||
$afterDateTime: DateTime
|
||||
$beforeDateTime: DateTime
|
||||
$organisedEventsPage: Int
|
||||
$organisedEventsLimit: Int
|
||||
$postsPage: Int
|
||||
$postsLimit: Int
|
||||
) {
|
||||
group(preferredUsername: $name) {
|
||||
...GroupBasicFields
|
||||
}
|
||||
}
|
||||
${GROUP_BASIC_FIELDS_FRAGMENTS}
|
||||
`;
|
||||
|
||||
export const GET_GROUP = gql`
|
||||
query GetGroup(
|
||||
$id: ID!
|
||||
$afterDateTime: DateTime
|
||||
$beforeDateTime: DateTime
|
||||
$organisedEventsPage: Int
|
||||
$organisedEventsLimit: Int
|
||||
$postsPage: Int
|
||||
$postsLimit: Int
|
||||
$membersPage: Int
|
||||
$membersLimit: Int
|
||||
) {
|
||||
getGroup(id: $id) {
|
||||
mediaSize
|
||||
...GroupFullFields
|
||||
}
|
||||
}
|
||||
${GROUP_FIELDS_FRAGMENTS}
|
||||
`;
|
||||
|
||||
export const CREATE_GROUP = gql`
|
||||
mutation CreateGroup(
|
||||
$preferredUsername: String!
|
||||
$name: String!
|
||||
$summary: String
|
||||
$avatar: MediaInput
|
||||
$banner: MediaInput
|
||||
$physicalAddress: AddressInput
|
||||
$visibility: GroupVisibility
|
||||
$openness: Openness
|
||||
$manuallyApprovesFollowers: Boolean
|
||||
) {
|
||||
createGroup(
|
||||
preferredUsername: $preferredUsername
|
||||
name: $name
|
||||
summary: $summary
|
||||
banner: $banner
|
||||
avatar: $avatar
|
||||
physicalAddress: $physicalAddress
|
||||
visibility: $visibility
|
||||
openness: $openness
|
||||
manuallyApprovesFollowers: $manuallyApprovesFollowers
|
||||
) {
|
||||
...ActorFragment
|
||||
banner {
|
||||
id
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const UPDATE_GROUP = gql`
|
||||
mutation UpdateGroup(
|
||||
$id: ID!
|
||||
$name: String
|
||||
$summary: String
|
||||
$avatar: MediaInput
|
||||
$banner: MediaInput
|
||||
$visibility: GroupVisibility
|
||||
$openness: Openness
|
||||
$physicalAddress: AddressInput
|
||||
$manuallyApprovesFollowers: Boolean
|
||||
) {
|
||||
updateGroup(
|
||||
id: $id
|
||||
name: $name
|
||||
summary: $summary
|
||||
banner: $banner
|
||||
avatar: $avatar
|
||||
visibility: $visibility
|
||||
openness: $openness
|
||||
physicalAddress: $physicalAddress
|
||||
manuallyApprovesFollowers: $manuallyApprovesFollowers
|
||||
) {
|
||||
...GroupVeryBasicFields
|
||||
}
|
||||
}
|
||||
${GROUP_VERY_BASIC_FIELDS_FRAGMENTS}
|
||||
`;
|
||||
|
||||
export const DELETE_GROUP = gql`
|
||||
mutation DeleteGroup($groupId: ID!) {
|
||||
deleteGroup(groupId: $groupId) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const LEAVE_GROUP = gql`
|
||||
mutation LeaveGroup($groupId: ID!) {
|
||||
leaveGroup(groupId: $groupId) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const REFRESH_PROFILE = gql`
|
||||
mutation RefreshProfile($actorId: ID!) {
|
||||
refreshProfile(id: $actorId) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const GROUP_TIMELINE = gql`
|
||||
query GroupTimeline(
|
||||
$preferredUsername: String!
|
||||
$type: ActivityType
|
||||
$author: ActivityAuthor
|
||||
$page: Int
|
||||
$limit: Int
|
||||
) {
|
||||
group(preferredUsername: $preferredUsername) {
|
||||
...ActorFragment
|
||||
activity(type: $type, author: $author, page: $page, limit: $limit) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
insertedAt
|
||||
subject
|
||||
subjectParams {
|
||||
key
|
||||
value
|
||||
}
|
||||
type
|
||||
author {
|
||||
...ActorFragment
|
||||
}
|
||||
group {
|
||||
...ActorFragment
|
||||
}
|
||||
object {
|
||||
... on Event {
|
||||
id
|
||||
title
|
||||
}
|
||||
... on Post {
|
||||
id
|
||||
title
|
||||
}
|
||||
... on Member {
|
||||
id
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
... on Resource {
|
||||
id
|
||||
title
|
||||
path
|
||||
type
|
||||
}
|
||||
... on Discussion {
|
||||
id
|
||||
title
|
||||
slug
|
||||
}
|
||||
... on Comment {
|
||||
id
|
||||
}
|
||||
... on Group {
|
||||
...ActorFragment
|
||||
visibility
|
||||
openness
|
||||
physicalAddress {
|
||||
id
|
||||
originId
|
||||
}
|
||||
banner {
|
||||
id
|
||||
url
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
111
src/graphql/home.ts
Normal file
111
src/graphql/home.ts
Normal file
@@ -0,0 +1,111 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
import { ADDRESS_FRAGMENT } from "./address";
|
||||
import { EVENT_OPTIONS_FRAGMENT } from "./event_options";
|
||||
import { TAG_FRAGMENT } from "./tags";
|
||||
import { USER_SETTINGS_FRAGMENT } from "./user";
|
||||
|
||||
export const HOME_USER_QUERIES = gql`
|
||||
query HomeUserQueries(
|
||||
$afterDateTime: DateTime
|
||||
$beforeDateTime: DateTime
|
||||
$page: Int
|
||||
$limit: Int
|
||||
) {
|
||||
loggedUser {
|
||||
id
|
||||
locale
|
||||
settings {
|
||||
...UserSettingFragment
|
||||
}
|
||||
participations(
|
||||
afterDatetime: $afterDateTime
|
||||
beforeDatetime: $beforeDateTime
|
||||
page: $page
|
||||
limit: $limit
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
event {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
picture {
|
||||
id
|
||||
url
|
||||
alt
|
||||
}
|
||||
beginsOn
|
||||
status
|
||||
visibility
|
||||
language
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
participantStats {
|
||||
going
|
||||
notApproved
|
||||
participant
|
||||
}
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
tags {
|
||||
...TagFragment
|
||||
}
|
||||
}
|
||||
id
|
||||
role
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
followedGroupEvents {
|
||||
total
|
||||
elements {
|
||||
profile {
|
||||
id
|
||||
}
|
||||
group {
|
||||
...ActorFragment
|
||||
}
|
||||
event {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
beginsOn
|
||||
status
|
||||
picture {
|
||||
url
|
||||
}
|
||||
language
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
tags {
|
||||
...TagFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${USER_SETTINGS_FRAGMENT}
|
||||
${ADDRESS_FRAGMENT}
|
||||
${TAG_FRAGMENT}
|
||||
${EVENT_OPTIONS_FRAGMENT}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
34
src/graphql/location.ts
Normal file
34
src/graphql/location.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const CURRENT_USER_LOCATION_CLIENT = gql`
|
||||
query currentUserLocation {
|
||||
currentUserLocation @client {
|
||||
lat
|
||||
lon
|
||||
accuracy
|
||||
isIPLocation
|
||||
name
|
||||
picture
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_CURRENT_USER_LOCATION_CLIENT = gql`
|
||||
mutation UpdateCurrentUserLocation(
|
||||
$lat: Float
|
||||
$lon: Float
|
||||
$accuracy: Int
|
||||
$isIPLocation: Boolean
|
||||
$name: String
|
||||
$picture: pictureInfoElement
|
||||
) {
|
||||
updateCurrentUserLocation(
|
||||
lat: $lat
|
||||
lon: $lon
|
||||
accuracy: $accuracy
|
||||
isIPLocation: $isIPLocation
|
||||
name: $name
|
||||
picture: $picture
|
||||
) @client
|
||||
}
|
||||
`;
|
||||
105
src/graphql/member.ts
Normal file
105
src/graphql/member.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
|
||||
export const MEMBER_FRAGMENT = gql`
|
||||
fragment MemberFragment on Member {
|
||||
id
|
||||
role
|
||||
parent {
|
||||
...ActorFragment
|
||||
}
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const INVITE_MEMBER = gql`
|
||||
mutation InviteMember($groupId: ID!, $targetActorUsername: String!) {
|
||||
inviteMember(groupId: $groupId, targetActorUsername: $targetActorUsername) {
|
||||
...MemberFragment
|
||||
}
|
||||
}
|
||||
${MEMBER_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const ACCEPT_INVITATION = gql`
|
||||
mutation AcceptInvitation($id: ID!) {
|
||||
acceptInvitation(id: $id) {
|
||||
...MemberFragment
|
||||
}
|
||||
}
|
||||
${MEMBER_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const REJECT_INVITATION = gql`
|
||||
mutation RejectInvitation($id: ID!) {
|
||||
rejectInvitation(id: $id) {
|
||||
...MemberFragment
|
||||
}
|
||||
}
|
||||
${MEMBER_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const GROUP_MEMBERS = gql`
|
||||
query GroupMembers(
|
||||
$groupName: String!
|
||||
$name: String
|
||||
$roles: String
|
||||
$page: Int
|
||||
$limit: Int
|
||||
) {
|
||||
group(preferredUsername: $groupName) {
|
||||
...ActorFragment
|
||||
members(name: $name, page: $page, limit: $limit, roles: $roles) {
|
||||
elements {
|
||||
id
|
||||
role
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const UPDATE_MEMBER = gql`
|
||||
mutation UpdateMember($memberId: ID!, $role: MemberRoleEnum!) {
|
||||
updateMember(memberId: $memberId, role: $role) {
|
||||
id
|
||||
role
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const REMOVE_MEMBER = gql`
|
||||
mutation RemoveMember($memberId: ID!, $exclude: Boolean) {
|
||||
removeMember(memberId: $memberId, exclude: $exclude) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const APPROVE_MEMBER = gql`
|
||||
mutation ApproveMember($memberId: ID!) {
|
||||
approveMember(memberId: $memberId) {
|
||||
...MemberFragment
|
||||
}
|
||||
}
|
||||
${MEMBER_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const JOIN_GROUP = gql`
|
||||
mutation JoinGroup($groupId: ID!) {
|
||||
joinGroup(groupId: $groupId) {
|
||||
...MemberFragment
|
||||
}
|
||||
}
|
||||
${MEMBER_FRAGMENT}
|
||||
`;
|
||||
213
src/graphql/participant.ts
Normal file
213
src/graphql/participant.ts
Normal file
@@ -0,0 +1,213 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
import { ADDRESS_FRAGMENT } from "./address";
|
||||
import { EVENT_OPTIONS_FRAGMENT } from "./event_options";
|
||||
import { TAG_FRAGMENT } from "./tags";
|
||||
|
||||
export const LOGGED_USER_PARTICIPATIONS = gql`
|
||||
query LoggedUserParticipations(
|
||||
$afterDateTime: DateTime
|
||||
$beforeDateTime: DateTime
|
||||
$page: Int
|
||||
$limit: Int
|
||||
) {
|
||||
loggedUser {
|
||||
id
|
||||
participations(
|
||||
afterDatetime: $afterDateTime
|
||||
beforeDatetime: $beforeDateTime
|
||||
page: $page
|
||||
limit: $limit
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
event {
|
||||
id
|
||||
uuid
|
||||
url
|
||||
title
|
||||
picture {
|
||||
id
|
||||
url
|
||||
alt
|
||||
}
|
||||
beginsOn
|
||||
status
|
||||
visibility
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
participantStats {
|
||||
going
|
||||
notApproved
|
||||
participant
|
||||
}
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
tags {
|
||||
id
|
||||
slug
|
||||
title
|
||||
}
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
}
|
||||
id
|
||||
role
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
${ADDRESS_FRAGMENT}
|
||||
${EVENT_OPTIONS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const LOGGED_USER_UPCOMING_EVENTS = gql`
|
||||
query LoggedUserUpcomingEvents(
|
||||
$afterDateTime: DateTime
|
||||
$beforeDateTime: DateTime
|
||||
$page: Int
|
||||
$limit: Int
|
||||
) {
|
||||
loggedUser {
|
||||
id
|
||||
participations(
|
||||
afterDatetime: $afterDateTime
|
||||
beforeDatetime: $beforeDateTime
|
||||
page: $page
|
||||
limit: $limit
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
event {
|
||||
id
|
||||
uuid
|
||||
url
|
||||
title
|
||||
picture {
|
||||
id
|
||||
url
|
||||
alt
|
||||
}
|
||||
beginsOn
|
||||
status
|
||||
visibility
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
participantStats {
|
||||
going
|
||||
notApproved
|
||||
rejected
|
||||
participant
|
||||
}
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
tags {
|
||||
id
|
||||
slug
|
||||
title
|
||||
}
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
}
|
||||
id
|
||||
role
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
followedGroupEvents(afterDatetime: $afterDateTime) {
|
||||
total
|
||||
elements {
|
||||
profile {
|
||||
id
|
||||
}
|
||||
group {
|
||||
...ActorFragment
|
||||
}
|
||||
event {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
beginsOn
|
||||
status
|
||||
picture {
|
||||
url
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
tags {
|
||||
...TagFragment
|
||||
}
|
||||
participantStats {
|
||||
going
|
||||
notApproved
|
||||
rejected
|
||||
participant
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
${ADDRESS_FRAGMENT}
|
||||
${EVENT_OPTIONS_FRAGMENT}
|
||||
${TAG_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const PARTICIPANT_QUERY_FRAGMENT = gql`
|
||||
fragment ParticipantQuery on Participant {
|
||||
role
|
||||
id
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
event {
|
||||
id
|
||||
uuid
|
||||
}
|
||||
metadata {
|
||||
cancellationToken
|
||||
message
|
||||
}
|
||||
insertedAt
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const PARTICIPANTS_QUERY_FRAGMENT = gql`
|
||||
fragment ParticipantsQuery on PaginatedParticipantList {
|
||||
total
|
||||
elements {
|
||||
...ParticipantQuery
|
||||
}
|
||||
}
|
||||
${PARTICIPANT_QUERY_FRAGMENT}
|
||||
`;
|
||||
156
src/graphql/post.ts
Normal file
156
src/graphql/post.ts
Normal file
@@ -0,0 +1,156 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
import { TAG_FRAGMENT } from "./tags";
|
||||
|
||||
export const POST_FRAGMENT = gql`
|
||||
fragment PostFragment on Post {
|
||||
id
|
||||
title
|
||||
slug
|
||||
url
|
||||
body
|
||||
draft
|
||||
author {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
updatedAt
|
||||
publishAt
|
||||
draft
|
||||
visibility
|
||||
language
|
||||
tags {
|
||||
...TagFragment
|
||||
}
|
||||
picture {
|
||||
id
|
||||
url
|
||||
name
|
||||
metadata {
|
||||
height
|
||||
width
|
||||
blurhash
|
||||
}
|
||||
}
|
||||
}
|
||||
${TAG_FRAGMENT}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const POST_BASIC_FIELDS = gql`
|
||||
fragment PostBasicFields on Post {
|
||||
id
|
||||
title
|
||||
slug
|
||||
url
|
||||
author {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
updatedAt
|
||||
publishAt
|
||||
draft
|
||||
visibility
|
||||
language
|
||||
picture {
|
||||
id
|
||||
url
|
||||
name
|
||||
}
|
||||
tags {
|
||||
...TagFragment
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
${TAG_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const FETCH_GROUP_POSTS = gql`
|
||||
query GroupPosts($preferredUsername: String!, $page: Int, $limit: Int) {
|
||||
group(preferredUsername: $preferredUsername) {
|
||||
...ActorFragment
|
||||
posts(page: $page, limit: $limit) {
|
||||
total
|
||||
elements {
|
||||
...PostBasicFields
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${POST_BASIC_FIELDS}
|
||||
`;
|
||||
|
||||
export const FETCH_POST = gql`
|
||||
query Post($slug: String!) {
|
||||
post(slug: $slug) {
|
||||
...PostFragment
|
||||
}
|
||||
}
|
||||
${POST_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CREATE_POST = gql`
|
||||
mutation CreatePost(
|
||||
$title: String!
|
||||
$body: String!
|
||||
$attributedToId: ID!
|
||||
$visibility: PostVisibility
|
||||
$draft: Boolean
|
||||
$tags: [String]
|
||||
$picture: MediaInput
|
||||
) {
|
||||
createPost(
|
||||
title: $title
|
||||
body: $body
|
||||
attributedToId: $attributedToId
|
||||
visibility: $visibility
|
||||
draft: $draft
|
||||
tags: $tags
|
||||
picture: $picture
|
||||
) {
|
||||
...PostFragment
|
||||
}
|
||||
}
|
||||
${POST_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const UPDATE_POST = gql`
|
||||
mutation UpdatePost(
|
||||
$id: ID!
|
||||
$title: String
|
||||
$body: String
|
||||
$attributedToId: ID
|
||||
$visibility: PostVisibility
|
||||
$draft: Boolean
|
||||
$tags: [String]
|
||||
$picture: MediaInput
|
||||
) {
|
||||
updatePost(
|
||||
id: $id
|
||||
title: $title
|
||||
body: $body
|
||||
attributedToId: $attributedToId
|
||||
visibility: $visibility
|
||||
draft: $draft
|
||||
tags: $tags
|
||||
picture: $picture
|
||||
) {
|
||||
...PostFragment
|
||||
}
|
||||
}
|
||||
${POST_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const DELETE_POST = gql`
|
||||
mutation DeletePost($id: ID!) {
|
||||
deletePost(id: $id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
219
src/graphql/report.ts
Normal file
219
src/graphql/report.ts
Normal file
@@ -0,0 +1,219 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
|
||||
export const REPORTS = gql`
|
||||
query Reports(
|
||||
$status: ReportStatus
|
||||
$domain: String
|
||||
$page: Int
|
||||
$limit: Int
|
||||
) {
|
||||
reports(status: $status, domain: $domain, page: $page, limit: $limit) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
reported {
|
||||
...ActorFragment
|
||||
suspended
|
||||
}
|
||||
reporter {
|
||||
...ActorFragment
|
||||
suspended
|
||||
}
|
||||
events {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
picture {
|
||||
id
|
||||
url
|
||||
}
|
||||
}
|
||||
status
|
||||
content
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
const REPORT_FRAGMENT = gql`
|
||||
fragment ReportFragment on Report {
|
||||
id
|
||||
reported {
|
||||
...ActorFragment
|
||||
suspended
|
||||
... on Person {
|
||||
user {
|
||||
id
|
||||
disabled
|
||||
}
|
||||
}
|
||||
}
|
||||
reporter {
|
||||
...ActorFragment
|
||||
suspended
|
||||
}
|
||||
events {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
description
|
||||
beginsOn
|
||||
picture {
|
||||
id
|
||||
url
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
comments {
|
||||
id
|
||||
text
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
updatedAt
|
||||
deletedAt
|
||||
uuid
|
||||
event {
|
||||
id
|
||||
uuid
|
||||
title
|
||||
}
|
||||
conversation {
|
||||
id
|
||||
participants {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
notes {
|
||||
id
|
||||
content
|
||||
moderator {
|
||||
...ActorFragment
|
||||
}
|
||||
insertedAt
|
||||
}
|
||||
insertedAt
|
||||
updatedAt
|
||||
status
|
||||
content
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const REPORT = gql`
|
||||
query Report($id: ID!) {
|
||||
report(id: $id) {
|
||||
...ReportFragment
|
||||
}
|
||||
}
|
||||
${REPORT_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CREATE_REPORT = gql`
|
||||
mutation CreateReport(
|
||||
$eventsIds: [ID]
|
||||
$reportedId: ID!
|
||||
$content: String
|
||||
$commentsIds: [ID]
|
||||
$forward: Boolean
|
||||
) {
|
||||
createReport(
|
||||
eventsIds: $eventsIds
|
||||
reportedId: $reportedId
|
||||
content: $content
|
||||
commentsIds: $commentsIds
|
||||
forward: $forward
|
||||
) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_REPORT = gql`
|
||||
mutation UpdateReport(
|
||||
$reportId: ID!
|
||||
$status: ReportStatus!
|
||||
$antispamFeedback: AntiSpamFeedback
|
||||
) {
|
||||
updateReportStatus(
|
||||
reportId: $reportId
|
||||
status: $status
|
||||
antispamFeedback: $antispamFeedback
|
||||
) {
|
||||
...ReportFragment
|
||||
}
|
||||
}
|
||||
${REPORT_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CREATE_REPORT_NOTE = gql`
|
||||
mutation CreateReportNote($reportId: ID!, $content: String!) {
|
||||
createReportNote(reportId: $reportId, content: $content) {
|
||||
id
|
||||
content
|
||||
insertedAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const LOGS = gql`
|
||||
query ActionLogs($page: Int, $limit: Int) {
|
||||
actionLogs(page: $page, limit: $limit) {
|
||||
elements {
|
||||
id
|
||||
action
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
object {
|
||||
... on Report {
|
||||
id
|
||||
}
|
||||
... on ReportNote {
|
||||
report {
|
||||
id
|
||||
}
|
||||
}
|
||||
... on Event {
|
||||
id
|
||||
title
|
||||
}
|
||||
... on Comment {
|
||||
id
|
||||
text
|
||||
event {
|
||||
id
|
||||
title
|
||||
uuid
|
||||
}
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
... on Person {
|
||||
...ActorFragment
|
||||
}
|
||||
... on Group {
|
||||
...ActorFragment
|
||||
}
|
||||
... on User {
|
||||
id
|
||||
email
|
||||
confirmedAt
|
||||
}
|
||||
}
|
||||
insertedAt
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
194
src/graphql/resources.ts
Normal file
194
src/graphql/resources.ts
Normal file
@@ -0,0 +1,194 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
|
||||
export const RESOURCE_METADATA_BASIC_FIELDS_FRAGMENT = gql`
|
||||
fragment ResourceMetadataBasicFields on ResourceMetadata {
|
||||
imageRemoteUrl
|
||||
height
|
||||
width
|
||||
type
|
||||
faviconUrl
|
||||
}
|
||||
`;
|
||||
|
||||
export const GET_RESOURCE = gql`
|
||||
query GetResource(
|
||||
$path: String!
|
||||
$username: String!
|
||||
$page: Int
|
||||
$limit: Int
|
||||
) {
|
||||
resource(path: $path, username: $username) {
|
||||
id
|
||||
title
|
||||
summary
|
||||
url
|
||||
path
|
||||
type
|
||||
metadata {
|
||||
...ResourceMetadataBasicFields
|
||||
authorName
|
||||
authorUrl
|
||||
providerName
|
||||
providerUrl
|
||||
html
|
||||
}
|
||||
parent {
|
||||
id
|
||||
path
|
||||
type
|
||||
}
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
children(page: $page, limit: $limit) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
title
|
||||
summary
|
||||
url
|
||||
type
|
||||
path
|
||||
resourceUrl
|
||||
parent {
|
||||
id
|
||||
path
|
||||
type
|
||||
}
|
||||
publishedAt
|
||||
updatedAt
|
||||
insertedAt
|
||||
metadata {
|
||||
...ResourceMetadataBasicFields
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
${RESOURCE_METADATA_BASIC_FIELDS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CREATE_RESOURCE = gql`
|
||||
mutation CreateResource(
|
||||
$title: String!
|
||||
$parentId: ID
|
||||
$summary: String
|
||||
$actorId: ID!
|
||||
$resourceUrl: String
|
||||
$type: String
|
||||
) {
|
||||
createResource(
|
||||
title: $title
|
||||
parentId: $parentId
|
||||
summary: $summary
|
||||
actorId: $actorId
|
||||
resourceUrl: $resourceUrl
|
||||
type: $type
|
||||
) {
|
||||
id
|
||||
title
|
||||
summary
|
||||
url
|
||||
resourceUrl
|
||||
updatedAt
|
||||
path
|
||||
type
|
||||
metadata {
|
||||
...ResourceMetadataBasicFields
|
||||
authorName
|
||||
authorUrl
|
||||
providerName
|
||||
providerUrl
|
||||
html
|
||||
}
|
||||
}
|
||||
}
|
||||
${RESOURCE_METADATA_BASIC_FIELDS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const UPDATE_RESOURCE = gql`
|
||||
mutation UpdateResource(
|
||||
$id: ID!
|
||||
$title: String
|
||||
$summary: String
|
||||
$parentId: ID
|
||||
$resourceUrl: String
|
||||
) {
|
||||
updateResource(
|
||||
id: $id
|
||||
title: $title
|
||||
parentId: $parentId
|
||||
summary: $summary
|
||||
resourceUrl: $resourceUrl
|
||||
) {
|
||||
id
|
||||
title
|
||||
summary
|
||||
url
|
||||
path
|
||||
type
|
||||
resourceUrl
|
||||
parent {
|
||||
id
|
||||
path
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_RESOURCE = gql`
|
||||
mutation DeleteResource($id: ID!) {
|
||||
deleteResource(id: $id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const PREVIEW_RESOURCE_LINK = gql`
|
||||
mutation PreviewResourceLink($resourceUrl: String!) {
|
||||
previewResourceLink(resourceUrl: $resourceUrl) {
|
||||
title
|
||||
description
|
||||
...ResourceMetadataBasicFields
|
||||
authorName
|
||||
authorUrl
|
||||
providerName
|
||||
providerUrl
|
||||
html
|
||||
}
|
||||
}
|
||||
${RESOURCE_METADATA_BASIC_FIELDS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const GROUP_RESOURCES_LIST = gql`
|
||||
query GroupResourcesList(
|
||||
$name: String!
|
||||
$resourcesPage: Int
|
||||
$resourcesLimit: Int
|
||||
) {
|
||||
group(preferredUsername: $name) {
|
||||
id
|
||||
preferredUsername
|
||||
name
|
||||
domain
|
||||
resources(page: $resourcesPage, limit: $resourcesLimit) {
|
||||
elements {
|
||||
id
|
||||
title
|
||||
resourceUrl
|
||||
summary
|
||||
updatedAt
|
||||
type
|
||||
path
|
||||
metadata {
|
||||
...ResourceMetadataBasicFields
|
||||
}
|
||||
}
|
||||
total
|
||||
}
|
||||
}
|
||||
}
|
||||
${RESOURCE_METADATA_BASIC_FIELDS_FRAGMENT}
|
||||
`;
|
||||
303
src/graphql/search.ts
Normal file
303
src/graphql/search.ts
Normal file
@@ -0,0 +1,303 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
import { ADDRESS_FRAGMENT } from "./address";
|
||||
import { EVENT_OPTIONS_FRAGMENT } from "./event_options";
|
||||
import { TAG_FRAGMENT } from "./tags";
|
||||
|
||||
export const GROUP_RESULT_FRAGMENT = gql`
|
||||
fragment GroupResultFragment on GroupSearchResult {
|
||||
id
|
||||
avatar {
|
||||
id
|
||||
url
|
||||
}
|
||||
type
|
||||
preferredUsername
|
||||
name
|
||||
domain
|
||||
summary
|
||||
url
|
||||
}
|
||||
`;
|
||||
|
||||
export const SEARCH_EVENTS_AND_GROUPS = gql`
|
||||
query SearchEventsAndGroups(
|
||||
$location: String
|
||||
$radius: Float
|
||||
$tags: String
|
||||
$term: String
|
||||
$type: EventType
|
||||
$categoryOneOf: [String]
|
||||
$statusOneOf: [EventStatus]
|
||||
$languageOneOf: [String]
|
||||
$searchTarget: SearchTarget
|
||||
$beginsOn: DateTime
|
||||
$endsOn: DateTime
|
||||
$bbox: String
|
||||
$zoom: Int
|
||||
$eventPage: Int
|
||||
$groupPage: Int
|
||||
$limit: Int
|
||||
$sortByEvents: SearchEventSortOptions
|
||||
$sortByGroups: SearchGroupSortOptions
|
||||
$boostLanguages: [String]
|
||||
) {
|
||||
searchEvents(
|
||||
location: $location
|
||||
radius: $radius
|
||||
tags: $tags
|
||||
term: $term
|
||||
type: $type
|
||||
categoryOneOf: $categoryOneOf
|
||||
statusOneOf: $statusOneOf
|
||||
languageOneOf: $languageOneOf
|
||||
searchTarget: $searchTarget
|
||||
beginsOn: $beginsOn
|
||||
endsOn: $endsOn
|
||||
bbox: $bbox
|
||||
zoom: $zoom
|
||||
page: $eventPage
|
||||
limit: $limit
|
||||
sortBy: $sortByEvents
|
||||
boostLanguages: $boostLanguages
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
title
|
||||
uuid
|
||||
beginsOn
|
||||
picture {
|
||||
id
|
||||
url
|
||||
}
|
||||
url
|
||||
status
|
||||
tags {
|
||||
...TagFragment
|
||||
}
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
participantStats {
|
||||
participant
|
||||
}
|
||||
options {
|
||||
isOnline
|
||||
}
|
||||
__typename
|
||||
}
|
||||
}
|
||||
searchGroups(
|
||||
term: $term
|
||||
location: $location
|
||||
radius: $radius
|
||||
languageOneOf: $languageOneOf
|
||||
searchTarget: $searchTarget
|
||||
bbox: $bbox
|
||||
zoom: $zoom
|
||||
page: $groupPage
|
||||
limit: $limit
|
||||
sortBy: $sortByGroups
|
||||
boostLanguages: $boostLanguages
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
__typename
|
||||
id
|
||||
avatar {
|
||||
id
|
||||
url
|
||||
}
|
||||
type
|
||||
preferredUsername
|
||||
name
|
||||
domain
|
||||
summary
|
||||
url
|
||||
...GroupResultFragment
|
||||
banner {
|
||||
id
|
||||
url
|
||||
}
|
||||
followersCount
|
||||
membersCount
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${TAG_FRAGMENT}
|
||||
${ADDRESS_FRAGMENT}
|
||||
${GROUP_RESULT_FRAGMENT}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const SEARCH_EVENTS = gql`
|
||||
query SearchEvents(
|
||||
$location: String
|
||||
$radius: Float
|
||||
$tags: String
|
||||
$term: String
|
||||
$type: EventType
|
||||
$category: String
|
||||
$beginsOn: DateTime
|
||||
$endsOn: DateTime
|
||||
$eventPage: Int
|
||||
$limit: Int
|
||||
) {
|
||||
searchEvents(
|
||||
location: $location
|
||||
radius: $radius
|
||||
tags: $tags
|
||||
term: $term
|
||||
type: $type
|
||||
category: $category
|
||||
beginsOn: $beginsOn
|
||||
endsOn: $endsOn
|
||||
page: $eventPage
|
||||
limit: $limit
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
title
|
||||
uuid
|
||||
beginsOn
|
||||
picture {
|
||||
id
|
||||
url
|
||||
}
|
||||
status
|
||||
tags {
|
||||
...TagFragment
|
||||
}
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
organizerActor {
|
||||
...ActorFragment
|
||||
}
|
||||
attributedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
options {
|
||||
...EventOptions
|
||||
}
|
||||
__typename
|
||||
}
|
||||
}
|
||||
}
|
||||
${EVENT_OPTIONS_FRAGMENT}
|
||||
${TAG_FRAGMENT}
|
||||
${ADDRESS_FRAGMENT}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const SEARCH_GROUPS = gql`
|
||||
query SearchGroups(
|
||||
$location: String
|
||||
$radius: Float
|
||||
$term: String
|
||||
$groupPage: Int
|
||||
$limit: Int
|
||||
) {
|
||||
searchGroups(
|
||||
term: $term
|
||||
location: $location
|
||||
radius: $radius
|
||||
page: $groupPage
|
||||
limit: $limit
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
...ActorFragment
|
||||
banner {
|
||||
id
|
||||
url
|
||||
}
|
||||
membersCount
|
||||
followersCount
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ADDRESS_FRAGMENT}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const SEARCH_PERSONS = gql`
|
||||
query SearchPersons($searchText: String!, $page: Int, $limit: Int) {
|
||||
searchPersons(term: $searchText, page: $page, limit: $limit) {
|
||||
total
|
||||
elements {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const SEARCH_PERSON_AND_GROUPS = gql`
|
||||
query SearchPersonsAndGroups($searchText: String!, $page: Int, $limit: Int) {
|
||||
searchPersons(term: $searchText, page: $page, limit: $limit) {
|
||||
total
|
||||
elements {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
searchGroups(term: $searchText, page: $page, limit: $limit) {
|
||||
total
|
||||
elements {
|
||||
...ActorFragment
|
||||
banner {
|
||||
id
|
||||
url
|
||||
}
|
||||
membersCount
|
||||
followersCount
|
||||
physicalAddress {
|
||||
...AdressFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ADDRESS_FRAGMENT}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const INTERACT = gql`
|
||||
query Interact($uri: String!) {
|
||||
interact(uri: $uri) {
|
||||
... on Event {
|
||||
id
|
||||
title
|
||||
uuid
|
||||
beginsOn
|
||||
status
|
||||
picture {
|
||||
id
|
||||
url
|
||||
}
|
||||
tags {
|
||||
slug
|
||||
title
|
||||
}
|
||||
__typename
|
||||
}
|
||||
... on Group {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
26
src/graphql/statistics.ts
Normal file
26
src/graphql/statistics.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const STATISTICS = gql`
|
||||
query Statistics {
|
||||
statistics {
|
||||
numberOfUsers
|
||||
numberOfEvents
|
||||
numberOfLocalEvents
|
||||
numberOfComments
|
||||
numberOfLocalComments
|
||||
numberOfGroups
|
||||
numberOfLocalGroups
|
||||
numberOfInstanceFollowings
|
||||
numberOfInstanceFollowers
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const CATEGORY_STATISTICS = gql`
|
||||
query CategoryStatistics {
|
||||
categoryStatistics {
|
||||
key
|
||||
number
|
||||
}
|
||||
}
|
||||
`;
|
||||
30
src/graphql/tags.ts
Normal file
30
src/graphql/tags.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const TAG_FRAGMENT = gql`
|
||||
fragment TagFragment on Tag {
|
||||
id
|
||||
slug
|
||||
title
|
||||
}
|
||||
`;
|
||||
|
||||
export const TAGS = gql`
|
||||
query Tags {
|
||||
tags {
|
||||
related {
|
||||
...TagFragment
|
||||
}
|
||||
...TagFragment
|
||||
}
|
||||
}
|
||||
${TAG_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const FILTER_TAGS = gql`
|
||||
query FilterTags($filter: String!) {
|
||||
tags(filter: $filter) {
|
||||
...TagFragment
|
||||
}
|
||||
}
|
||||
${TAG_FRAGMENT}
|
||||
`;
|
||||
122
src/graphql/todos.ts
Normal file
122
src/graphql/todos.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
|
||||
export const GET_TODO = gql`
|
||||
query GetTodo($id: ID!) {
|
||||
todo(id: $id) {
|
||||
id
|
||||
title
|
||||
status
|
||||
dueDate
|
||||
todoList {
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
title
|
||||
id
|
||||
}
|
||||
assignedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const FETCH_TODO_LIST = gql`
|
||||
query FetchTodoList($id: ID!) {
|
||||
todoList(id: $id) {
|
||||
id
|
||||
title
|
||||
todos {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
title
|
||||
status
|
||||
assignedTo {
|
||||
...ActorFragment
|
||||
}
|
||||
dueDate
|
||||
}
|
||||
}
|
||||
actor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CREATE_TODO_LIST = gql`
|
||||
mutation CreateTodoList($title: String!, $groupId: ID!) {
|
||||
createTodoList(title: $title, groupId: $groupId) {
|
||||
id
|
||||
title
|
||||
todos {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const CREATE_TODO = gql`
|
||||
mutation createTodo(
|
||||
$title: String!
|
||||
$todoListId: ID!
|
||||
$status: Boolean
|
||||
$assignedToId: ID
|
||||
$dueDate: DateTime
|
||||
) {
|
||||
createTodo(
|
||||
title: $title
|
||||
todoListId: $todoListId
|
||||
status: $status
|
||||
assignedToId: $assignedToId
|
||||
dueDate: $dueDate
|
||||
) {
|
||||
id
|
||||
title
|
||||
status
|
||||
assignedTo {
|
||||
id
|
||||
}
|
||||
creator {
|
||||
id
|
||||
}
|
||||
dueDate
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_TODO = gql`
|
||||
mutation updateTodo(
|
||||
$id: ID!
|
||||
$title: String
|
||||
$status: Boolean
|
||||
$assignedToId: ID
|
||||
$dueDate: DateTime
|
||||
) {
|
||||
updateTodo(
|
||||
id: $id
|
||||
title: $title
|
||||
status: $status
|
||||
assignedToId: $assignedToId
|
||||
dueDate: $dueDate
|
||||
) {
|
||||
id
|
||||
title
|
||||
status
|
||||
assignedTo {
|
||||
id
|
||||
}
|
||||
creator {
|
||||
id
|
||||
}
|
||||
dueDate
|
||||
}
|
||||
}
|
||||
`;
|
||||
18
src/graphql/upload.ts
Normal file
18
src/graphql/upload.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const UPLOAD_MEDIA = gql`
|
||||
mutation UploadMedia($file: Upload!, $alt: String, $name: String!) {
|
||||
uploadMedia(file: $file, alt: $alt, name: $name) {
|
||||
url
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const REMOVE_MEDIA = gql`
|
||||
mutation RemoveMedia($id: ID!) {
|
||||
removeMedia(id: $id) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
332
src/graphql/user.ts
Normal file
332
src/graphql/user.ts
Normal file
@@ -0,0 +1,332 @@
|
||||
import gql from "graphql-tag";
|
||||
import { ACTOR_FRAGMENT } from "./actor";
|
||||
|
||||
export const CREATE_USER = gql`
|
||||
mutation CreateUser($email: String!, $password: String!, $locale: String) {
|
||||
createUser(email: $email, password: $password, locale: $locale) {
|
||||
email
|
||||
confirmationSentAt
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const VALIDATE_USER = gql`
|
||||
mutation ValidateUser($token: String!) {
|
||||
validateUser(token: $token) {
|
||||
accessToken
|
||||
refreshToken
|
||||
user {
|
||||
id
|
||||
email
|
||||
defaultActor {
|
||||
...ActorFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const LOGGED_USER = gql`
|
||||
query LoggedUserQuery {
|
||||
loggedUser {
|
||||
id
|
||||
email
|
||||
defaultActor {
|
||||
...ActorFragment
|
||||
}
|
||||
provider
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const CHANGE_PASSWORD = gql`
|
||||
mutation ChangePassword($oldPassword: String!, $newPassword: String!) {
|
||||
changePassword(oldPassword: $oldPassword, newPassword: $newPassword) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const CHANGE_EMAIL = gql`
|
||||
mutation ChangeEmail($email: String!, $password: String!) {
|
||||
changeEmail(email: $email, password: $password) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const VALIDATE_EMAIL = gql`
|
||||
mutation ValidateEmail($token: String!) {
|
||||
validateEmail(token: $token) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_ACCOUNT = gql`
|
||||
mutation DeleteAccount($password: String, $userId: ID) {
|
||||
deleteAccount(password: $password, userId: $userId) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SUSPEND_USER = gql`
|
||||
mutation SuspendUser($userId: ID) {
|
||||
deleteAccount(userId: $userId) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const CURRENT_USER_CLIENT = gql`
|
||||
query CurrentUserClient {
|
||||
currentUser @client {
|
||||
id
|
||||
email
|
||||
isLoggedIn
|
||||
role
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_CURRENT_USER_CLIENT = gql`
|
||||
mutation UpdateCurrentUser(
|
||||
$id: String
|
||||
$email: String
|
||||
$isLoggedIn: Boolean
|
||||
$role: UserRole
|
||||
) {
|
||||
updateCurrentUser(
|
||||
id: $id
|
||||
email: $email
|
||||
isLoggedIn: $isLoggedIn
|
||||
role: $role
|
||||
) @client
|
||||
}
|
||||
`;
|
||||
|
||||
export const USER_SETTINGS_FRAGMENT = gql`
|
||||
fragment UserSettingFragment on UserSettings {
|
||||
timezone
|
||||
notificationOnDay
|
||||
notificationEachWeek
|
||||
notificationBeforeEvent
|
||||
notificationPendingParticipation
|
||||
notificationPendingMembership
|
||||
groupNotifications
|
||||
location {
|
||||
range
|
||||
geohash
|
||||
name
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const USER_SETTINGS = gql`
|
||||
query UserSetting {
|
||||
loggedUser {
|
||||
id
|
||||
locale
|
||||
settings {
|
||||
...UserSettingFragment
|
||||
}
|
||||
}
|
||||
}
|
||||
${USER_SETTINGS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const LOGGED_USER_TIMEZONE = gql`
|
||||
query LoggedUserTimezone {
|
||||
loggedUser {
|
||||
id
|
||||
settings {
|
||||
timezone
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const SET_USER_SETTINGS = gql`
|
||||
mutation SetUserSettings(
|
||||
$timezone: Timezone
|
||||
$notificationOnDay: Boolean
|
||||
$notificationEachWeek: Boolean
|
||||
$notificationBeforeEvent: Boolean
|
||||
$notificationPendingParticipation: NotificationPendingEnum
|
||||
$notificationPendingMembership: NotificationPendingEnum
|
||||
$groupNotifications: NotificationPendingEnum
|
||||
$location: LocationInput
|
||||
) {
|
||||
setUserSettings(
|
||||
timezone: $timezone
|
||||
notificationOnDay: $notificationOnDay
|
||||
notificationEachWeek: $notificationEachWeek
|
||||
notificationBeforeEvent: $notificationBeforeEvent
|
||||
notificationPendingParticipation: $notificationPendingParticipation
|
||||
notificationPendingMembership: $notificationPendingMembership
|
||||
groupNotifications: $groupNotifications
|
||||
location: $location
|
||||
) {
|
||||
...UserSettingFragment
|
||||
}
|
||||
}
|
||||
${USER_SETTINGS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const USER_NOTIFICATIONS = gql`
|
||||
query UserNotifications {
|
||||
loggedUser {
|
||||
id
|
||||
locale
|
||||
settings {
|
||||
...UserSettingFragment
|
||||
}
|
||||
feedTokens {
|
||||
token
|
||||
actor {
|
||||
id
|
||||
}
|
||||
}
|
||||
activitySettings {
|
||||
key
|
||||
method
|
||||
enabled
|
||||
}
|
||||
}
|
||||
}
|
||||
${USER_SETTINGS_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const USER_FRAGMENT_FEED_TOKENS = gql`
|
||||
fragment UserFeedTokensFragment on User {
|
||||
id
|
||||
feedTokens {
|
||||
token
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UPDATE_ACTIVITY_SETTING = gql`
|
||||
mutation UpdateActivitySetting(
|
||||
$key: String!
|
||||
$method: String!
|
||||
$enabled: Boolean!
|
||||
) {
|
||||
updateActivitySetting(key: $key, method: $method, enabled: $enabled) {
|
||||
key
|
||||
method
|
||||
enabled
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const LIST_USERS = gql`
|
||||
query ListUsers(
|
||||
$email: String
|
||||
$currentSignInIp: String
|
||||
$page: Int
|
||||
$limit: Int
|
||||
$sort: SortableUserField
|
||||
$direction: SortDirection
|
||||
) {
|
||||
users(
|
||||
email: $email
|
||||
currentSignInIp: $currentSignInIp
|
||||
page: $page
|
||||
limit: $limit
|
||||
sort: $sort
|
||||
direction: $direction
|
||||
) {
|
||||
total
|
||||
elements {
|
||||
id
|
||||
email
|
||||
locale
|
||||
confirmedAt
|
||||
currentSignInIp
|
||||
currentSignInAt
|
||||
disabled
|
||||
actors {
|
||||
...ActorFragment
|
||||
}
|
||||
settings {
|
||||
timezone
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const GET_USER = gql`
|
||||
query GetUser($id: ID!) {
|
||||
user(id: $id) {
|
||||
id
|
||||
email
|
||||
confirmedAt
|
||||
confirmationSentAt
|
||||
lastSignInAt
|
||||
lastSignInIp
|
||||
currentSignInIp
|
||||
currentSignInAt
|
||||
locale
|
||||
disabled
|
||||
mediaSize
|
||||
defaultActor {
|
||||
id
|
||||
}
|
||||
actors {
|
||||
...ActorFragment
|
||||
}
|
||||
participations {
|
||||
total
|
||||
}
|
||||
role
|
||||
}
|
||||
}
|
||||
${ACTOR_FRAGMENT}
|
||||
`;
|
||||
|
||||
export const UPDATE_USER_LOCALE = gql`
|
||||
mutation UpdateUserLocale($locale: String!) {
|
||||
updateLocale(locale: $locale) {
|
||||
id
|
||||
locale
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const FEED_TOKENS_LOGGED_USER = gql`
|
||||
query FeedTokensLoggedUser {
|
||||
loggedUser {
|
||||
id
|
||||
feedTokens {
|
||||
token
|
||||
actor {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UNREAD_ACTOR_CONVERSATIONS = gql`
|
||||
query LoggedUserUnreadConversations {
|
||||
loggedUser {
|
||||
id
|
||||
defaultActor {
|
||||
id
|
||||
unreadConversationsCount
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const UNREAD_ACTOR_CONVERSATIONS_SUBSCRIPTION = gql`
|
||||
subscription OnUreadActorConversationsChanged($personId: ID!) {
|
||||
personUnreadConversationsCount(personId: $personId)
|
||||
}
|
||||
`;
|
||||
13
src/graphql/webPush.ts
Normal file
13
src/graphql/webPush.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import gql from "graphql-tag";
|
||||
|
||||
export const REGISTER_PUSH_MUTATION = gql`
|
||||
mutation RegisterPush($endpoint: String!, $auth: String!, $p256dh: String!) {
|
||||
registerPush(endpoint: $endpoint, auth: $auth, p256dh: $p256dh)
|
||||
}
|
||||
`;
|
||||
|
||||
export const UNREGISTER_PUSH_MUTATION = gql`
|
||||
mutation UnRegisterPush($endpoint: String!) {
|
||||
unregisterPush(endpoint: $endpoint)
|
||||
}
|
||||
`;
|
||||
Reference in New Issue
Block a user