2020-02-18 08:57:00 +01:00
|
|
|
import gql from "graphql-tag";
|
2018-11-06 10:30:27 +01:00
|
|
|
|
|
|
|
export const CREATE_USER = gql`
|
2020-02-18 08:57:00 +01:00
|
|
|
mutation CreateUser($email: String!, $password: String!, $locale: String) {
|
|
|
|
createUser(email: $email, password: $password, locale: $locale) {
|
|
|
|
email
|
|
|
|
confirmationSentAt
|
|
|
|
}
|
2018-11-06 10:30:27 +01:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const VALIDATE_USER = gql`
|
2020-02-18 08:57:00 +01:00
|
|
|
mutation ValidateUser($token: String!) {
|
|
|
|
validateUser(token: $token) {
|
|
|
|
accessToken
|
|
|
|
refreshToken
|
|
|
|
user {
|
|
|
|
id
|
|
|
|
email
|
|
|
|
defaultActor {
|
|
|
|
id
|
|
|
|
preferredUsername
|
|
|
|
name
|
|
|
|
avatar {
|
2019-10-07 13:47:46 +02:00
|
|
|
url
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
2019-10-07 13:47:46 +02:00
|
|
|
}
|
2019-01-30 15:54:21 +01:00
|
|
|
}
|
2018-11-06 10:30:27 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
2019-01-18 14:47:10 +01:00
|
|
|
|
2020-02-13 15:48:12 +01:00
|
|
|
export const LOGGED_USER = gql`
|
|
|
|
query {
|
|
|
|
loggedUser {
|
2020-02-18 08:57:00 +01:00
|
|
|
id
|
2020-02-13 15:48:12 +01:00
|
|
|
email
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2019-09-24 18:47:35 +02:00
|
|
|
export const CHANGE_PASSWORD = gql`
|
|
|
|
mutation ChangePassword($oldPassword: String!, $newPassword: String!) {
|
|
|
|
changePassword(oldPassword: $oldPassword, newPassword: $newPassword) {
|
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2020-02-13 15:48:12 +01:00
|
|
|
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!) {
|
2020-02-18 08:57:00 +01:00
|
|
|
validateEmail(token: $token) {
|
2020-02-13 15:48:12 +01:00
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const DELETE_ACCOUNT = gql`
|
2020-06-11 19:13:21 +02:00
|
|
|
mutation DeleteAccount($password: String, $userId: ID!) {
|
|
|
|
deleteAccount(password: $password, userId: $userId) {
|
2020-02-13 15:48:12 +01:00
|
|
|
id
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2019-01-18 14:47:10 +01:00
|
|
|
export const CURRENT_USER_CLIENT = gql`
|
2020-02-18 08:57:00 +01:00
|
|
|
query {
|
|
|
|
currentUser @client {
|
|
|
|
id
|
|
|
|
email
|
|
|
|
isLoggedIn
|
|
|
|
role
|
|
|
|
}
|
2019-01-18 14:47:10 +01:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const UPDATE_CURRENT_USER_CLIENT = gql`
|
2020-02-18 08:57:00 +01:00
|
|
|
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
|
2020-06-08 12:28:19 +02:00
|
|
|
notificationPendingParticipation
|
2020-02-18 08:57:00 +01:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const USER_SETTINGS = gql`
|
|
|
|
query UserSetting {
|
|
|
|
loggedUser {
|
2020-06-25 11:36:35 +02:00
|
|
|
id
|
2020-06-16 18:00:27 +02:00
|
|
|
locale
|
2020-02-18 08:57:00 +01:00
|
|
|
settings {
|
|
|
|
...UserSettingFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
${USER_SETTINGS_FRAGMENT}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const SET_USER_SETTINGS = gql`
|
|
|
|
mutation SetUserSettings(
|
|
|
|
$timezone: String
|
|
|
|
$notificationOnDay: Boolean
|
|
|
|
$notificationEachWeek: Boolean
|
|
|
|
$notificationBeforeEvent: Boolean
|
2020-06-08 12:28:19 +02:00
|
|
|
$notificationPendingParticipation: NotificationPendingParticipationEnum
|
2020-02-18 08:57:00 +01:00
|
|
|
) {
|
|
|
|
setUserSettings(
|
|
|
|
timezone: $timezone
|
|
|
|
notificationOnDay: $notificationOnDay
|
|
|
|
notificationEachWeek: $notificationEachWeek
|
|
|
|
notificationBeforeEvent: $notificationBeforeEvent
|
2020-06-08 12:28:19 +02:00
|
|
|
notificationPendingParticipation: $notificationPendingParticipation
|
2020-02-18 08:57:00 +01:00
|
|
|
) {
|
|
|
|
...UserSettingFragment
|
|
|
|
}
|
|
|
|
}
|
|
|
|
${USER_SETTINGS_FRAGMENT}
|
2019-01-30 15:54:21 +01:00
|
|
|
`;
|
2020-06-11 19:13:21 +02:00
|
|
|
|
|
|
|
export const LIST_USERS = gql`
|
|
|
|
query ListUsers($email: String, $page: Int, $limit: Int) {
|
|
|
|
users(email: $email, page: $page, limit: $limit) {
|
|
|
|
total
|
|
|
|
elements {
|
|
|
|
id
|
|
|
|
email
|
|
|
|
locale
|
|
|
|
confirmedAt
|
|
|
|
disabled
|
|
|
|
actors {
|
|
|
|
id
|
|
|
|
preferredUsername
|
|
|
|
avatar {
|
|
|
|
url
|
|
|
|
}
|
|
|
|
name
|
|
|
|
summary
|
|
|
|
}
|
|
|
|
settings {
|
|
|
|
timezone
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export const GET_USER = gql`
|
|
|
|
query GetUser($id: ID!) {
|
|
|
|
user(id: $id) {
|
|
|
|
id
|
|
|
|
email
|
|
|
|
confirmedAt
|
|
|
|
confirmationSentAt
|
|
|
|
locale
|
|
|
|
disabled
|
|
|
|
defaultActor {
|
|
|
|
id
|
|
|
|
}
|
|
|
|
actors {
|
|
|
|
id
|
|
|
|
preferredUsername
|
|
|
|
name
|
|
|
|
avatar {
|
|
|
|
url
|
|
|
|
}
|
|
|
|
}
|
|
|
|
participations {
|
|
|
|
total
|
|
|
|
}
|
|
|
|
role
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
2020-06-16 18:00:27 +02:00
|
|
|
|
|
|
|
export const UPDATE_USER_LOCALE = gql`
|
|
|
|
mutation UpdateUserLocale($locale: String!) {
|
|
|
|
updateLocale(locale: $locale) {
|
|
|
|
id
|
|
|
|
locale
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|