Moving queries into dedicated files (#1210)

* Moving queries into dedicated files

* fix ci
This commit is contained in:
Weiko
2023-08-14 19:31:20 -07:00
committed by GitHub
parent 656f1af15c
commit 24e5132029
149 changed files with 2908 additions and 3094 deletions

View File

@ -0,0 +1,29 @@
import { gql } from '@apollo/client';
export const USER_QUERY_FRAGMENT = gql`
fragment UserQueryFragment on User {
id
email
displayName
firstName
lastName
canImpersonate
supportUserHash
workspaceMember {
id
allowImpersonation
workspace {
id
domainName
displayName
logo
inviteHash
}
}
settings {
id
colorScheme
locale
}
}
`;

View File

@ -0,0 +1,12 @@
import { gql } from '@apollo/client';
export const CHALLENGE = gql`
mutation Challenge($email: String!, $password: String!) {
challenge(email: $email, password: $password) {
loginToken {
expiresAt
token
}
}
}
`;

View File

@ -0,0 +1,22 @@
import { gql } from '@apollo/client';
// TODO: Fragments should be used instead of duplicating the user fields !
export const IMPERSONATE = gql`
mutation Impersonate($userId: String!) {
impersonate(userId: $userId) {
user {
...UserQueryFragment
}
tokens {
accessToken {
token
expiresAt
}
refreshToken {
token
expiresAt
}
}
}
}
`;

View File

@ -0,0 +1,18 @@
import { gql } from '@apollo/client';
export const RENEW_TOKEN = gql`
mutation RenewToken($refreshToken: String!) {
renewToken(refreshToken: $refreshToken) {
tokens {
accessToken {
expiresAt
token
}
refreshToken {
token
expiresAt
}
}
}
}
`;

View File

@ -0,0 +1,20 @@
import { gql } from '@apollo/client';
export const SIGN_UP = gql`
mutation SignUp(
$email: String!
$password: String!
$workspaceInviteHash: String
) {
signUp(
email: $email
password: $password
workspaceInviteHash: $workspaceInviteHash
) {
loginToken {
expiresAt
token
}
}
}
`;

View File

@ -0,0 +1,21 @@
import { gql } from '@apollo/client';
export const VERIFY = gql`
mutation Verify($loginToken: String!) {
verify(loginToken: $loginToken) {
user {
...UserQueryFragment
}
tokens {
accessToken {
token
expiresAt
}
refreshToken {
token
expiresAt
}
}
}
}
`;

View File

@ -1,2 +0,0 @@
export * from './select';
export * from './update';

View File

@ -1,133 +0,0 @@
import { gql } from '@apollo/client';
export const CHALLENGE = gql`
mutation Challenge($email: String!, $password: String!) {
challenge(email: $email, password: $password) {
loginToken {
expiresAt
token
}
}
}
`;
export const SIGN_UP = gql`
mutation SignUp(
$email: String!
$password: String!
$workspaceInviteHash: String
) {
signUp(
email: $email
password: $password
workspaceInviteHash: $workspaceInviteHash
) {
loginToken {
expiresAt
token
}
}
}
`;
export const VERIFY = gql`
mutation Verify($loginToken: String!) {
verify(loginToken: $loginToken) {
user {
id
email
displayName
firstName
lastName
canImpersonate
supportUserHash
workspaceMember {
id
allowImpersonation
workspace {
id
domainName
displayName
logo
inviteHash
}
}
settings {
id
colorScheme
locale
}
}
tokens {
accessToken {
token
expiresAt
}
refreshToken {
token
expiresAt
}
}
}
}
`;
export const RENEW_TOKEN = gql`
mutation RenewToken($refreshToken: String!) {
renewToken(refreshToken: $refreshToken) {
tokens {
accessToken {
expiresAt
token
}
refreshToken {
token
expiresAt
}
}
}
}
`;
// TODO: Fragments should be used instead of duplicating the user fields !
export const IMPERSONATE = gql`
mutation Impersonate($userId: String!) {
impersonate(userId: $userId) {
user {
id
email
displayName
firstName
lastName
canImpersonate
supportUserHash
workspaceMember {
id
allowImpersonation
workspace {
id
domainName
displayName
logo
inviteHash
}
}
settings {
id
colorScheme
locale
}
}
tokens {
accessToken {
token
expiresAt
}
refreshToken {
token
expiresAt
}
}
}
}
`;