877 lines
16 KiB
TypeScript
877 lines
16 KiB
TypeScript
import { gql } from 'graphql-tag'
|
|
|
|
export const SEND_SMS_CODE = gql`
|
|
mutation SendSmsCode($phone: String!) {
|
|
sendSmsCode(phone: $phone) {
|
|
success
|
|
message
|
|
}
|
|
}
|
|
`
|
|
|
|
export const VERIFY_SMS_CODE = gql`
|
|
mutation VerifySmsCode($phone: String!, $code: String!) {
|
|
verifySmsCode(phone: $phone, code: $code) {
|
|
success
|
|
message
|
|
token
|
|
user {
|
|
id
|
|
phone
|
|
organization {
|
|
id
|
|
inn
|
|
kpp
|
|
name
|
|
fullName
|
|
address
|
|
addressFull
|
|
ogrn
|
|
ogrnDate
|
|
type
|
|
status
|
|
actualityDate
|
|
registrationDate
|
|
liquidationDate
|
|
managementName
|
|
managementPost
|
|
opfCode
|
|
opfFull
|
|
opfShort
|
|
okato
|
|
oktmo
|
|
okpo
|
|
okved
|
|
employeeCount
|
|
revenue
|
|
taxSystem
|
|
phones
|
|
emails
|
|
apiKeys {
|
|
id
|
|
marketplace
|
|
isActive
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const VERIFY_INN = gql`
|
|
mutation VerifyInn($inn: String!) {
|
|
verifyInn(inn: $inn) {
|
|
success
|
|
message
|
|
organization {
|
|
name
|
|
fullName
|
|
address
|
|
isActive
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const REGISTER_FULFILLMENT_ORGANIZATION = gql`
|
|
mutation RegisterFulfillmentOrganization($input: FulfillmentRegistrationInput!) {
|
|
registerFulfillmentOrganization(input: $input) {
|
|
success
|
|
message
|
|
user {
|
|
id
|
|
phone
|
|
organization {
|
|
id
|
|
inn
|
|
kpp
|
|
name
|
|
fullName
|
|
address
|
|
addressFull
|
|
ogrn
|
|
ogrnDate
|
|
type
|
|
status
|
|
actualityDate
|
|
registrationDate
|
|
liquidationDate
|
|
managementName
|
|
managementPost
|
|
opfCode
|
|
opfFull
|
|
opfShort
|
|
okato
|
|
oktmo
|
|
okpo
|
|
okved
|
|
employeeCount
|
|
revenue
|
|
taxSystem
|
|
phones
|
|
emails
|
|
apiKeys {
|
|
id
|
|
marketplace
|
|
isActive
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const REGISTER_SELLER_ORGANIZATION = gql`
|
|
mutation RegisterSellerOrganization($input: SellerRegistrationInput!) {
|
|
registerSellerOrganization(input: $input) {
|
|
success
|
|
message
|
|
user {
|
|
id
|
|
phone
|
|
organization {
|
|
id
|
|
inn
|
|
kpp
|
|
name
|
|
fullName
|
|
address
|
|
addressFull
|
|
ogrn
|
|
ogrnDate
|
|
type
|
|
status
|
|
actualityDate
|
|
registrationDate
|
|
liquidationDate
|
|
managementName
|
|
managementPost
|
|
opfCode
|
|
opfFull
|
|
opfShort
|
|
okato
|
|
oktmo
|
|
okpo
|
|
okved
|
|
employeeCount
|
|
revenue
|
|
taxSystem
|
|
phones
|
|
emails
|
|
apiKeys {
|
|
id
|
|
marketplace
|
|
isActive
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const ADD_MARKETPLACE_API_KEY = gql`
|
|
mutation AddMarketplaceApiKey($input: MarketplaceApiKeyInput!) {
|
|
addMarketplaceApiKey(input: $input) {
|
|
success
|
|
message
|
|
apiKey {
|
|
id
|
|
marketplace
|
|
isActive
|
|
validationData
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const REMOVE_MARKETPLACE_API_KEY = gql`
|
|
mutation RemoveMarketplaceApiKey($marketplace: MarketplaceType!) {
|
|
removeMarketplaceApiKey(marketplace: $marketplace)
|
|
}
|
|
`
|
|
|
|
export const UPDATE_USER_PROFILE = gql`
|
|
mutation UpdateUserProfile($input: UpdateUserProfileInput!) {
|
|
updateUserProfile(input: $input) {
|
|
success
|
|
message
|
|
user {
|
|
id
|
|
phone
|
|
organization {
|
|
id
|
|
inn
|
|
kpp
|
|
name
|
|
fullName
|
|
address
|
|
addressFull
|
|
ogrn
|
|
ogrnDate
|
|
type
|
|
status
|
|
actualityDate
|
|
registrationDate
|
|
liquidationDate
|
|
managementName
|
|
managementPost
|
|
opfCode
|
|
opfFull
|
|
opfShort
|
|
okato
|
|
oktmo
|
|
okpo
|
|
okved
|
|
employeeCount
|
|
revenue
|
|
taxSystem
|
|
phones
|
|
emails
|
|
apiKeys {
|
|
id
|
|
marketplace
|
|
isActive
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const UPDATE_ORGANIZATION_BY_INN = gql`
|
|
mutation UpdateOrganizationByInn($inn: String!) {
|
|
updateOrganizationByInn(inn: $inn) {
|
|
success
|
|
message
|
|
user {
|
|
id
|
|
phone
|
|
organization {
|
|
id
|
|
inn
|
|
kpp
|
|
name
|
|
fullName
|
|
address
|
|
addressFull
|
|
ogrn
|
|
ogrnDate
|
|
type
|
|
status
|
|
actualityDate
|
|
registrationDate
|
|
liquidationDate
|
|
managementName
|
|
managementPost
|
|
opfCode
|
|
opfFull
|
|
opfShort
|
|
okato
|
|
oktmo
|
|
okpo
|
|
okved
|
|
employeeCount
|
|
revenue
|
|
taxSystem
|
|
phones
|
|
emails
|
|
apiKeys {
|
|
id
|
|
marketplace
|
|
isActive
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
// Мутации для контрагентов
|
|
export const SEND_COUNTERPARTY_REQUEST = gql`
|
|
mutation SendCounterpartyRequest($organizationId: ID!, $message: String) {
|
|
sendCounterpartyRequest(organizationId: $organizationId, message: $message) {
|
|
success
|
|
message
|
|
request {
|
|
id
|
|
status
|
|
message
|
|
createdAt
|
|
sender {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
}
|
|
receiver {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const RESPOND_TO_COUNTERPARTY_REQUEST = gql`
|
|
mutation RespondToCounterpartyRequest($requestId: ID!, $accept: Boolean!) {
|
|
respondToCounterpartyRequest(requestId: $requestId, accept: $accept) {
|
|
success
|
|
message
|
|
request {
|
|
id
|
|
status
|
|
message
|
|
createdAt
|
|
sender {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
}
|
|
receiver {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const CANCEL_COUNTERPARTY_REQUEST = gql`
|
|
mutation CancelCounterpartyRequest($requestId: ID!) {
|
|
cancelCounterpartyRequest(requestId: $requestId)
|
|
}
|
|
`
|
|
|
|
export const REMOVE_COUNTERPARTY = gql`
|
|
mutation RemoveCounterparty($organizationId: ID!) {
|
|
removeCounterparty(organizationId: $organizationId)
|
|
}
|
|
`
|
|
|
|
// Мутации для сообщений
|
|
export const SEND_MESSAGE = gql`
|
|
mutation SendMessage($receiverOrganizationId: ID!, $content: String!, $type: MessageType = TEXT) {
|
|
sendMessage(receiverOrganizationId: $receiverOrganizationId, content: $content, type: $type) {
|
|
success
|
|
message
|
|
messageData {
|
|
id
|
|
content
|
|
type
|
|
voiceUrl
|
|
voiceDuration
|
|
fileUrl
|
|
fileName
|
|
fileSize
|
|
fileType
|
|
senderId
|
|
senderOrganization {
|
|
id
|
|
name
|
|
fullName
|
|
type
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
receiverOrganization {
|
|
id
|
|
name
|
|
fullName
|
|
type
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
isRead
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const SEND_VOICE_MESSAGE = gql`
|
|
mutation SendVoiceMessage($receiverOrganizationId: ID!, $voiceUrl: String!, $voiceDuration: Int!) {
|
|
sendVoiceMessage(receiverOrganizationId: $receiverOrganizationId, voiceUrl: $voiceUrl, voiceDuration: $voiceDuration) {
|
|
success
|
|
message
|
|
messageData {
|
|
id
|
|
content
|
|
type
|
|
voiceUrl
|
|
voiceDuration
|
|
fileUrl
|
|
fileName
|
|
fileSize
|
|
fileType
|
|
senderId
|
|
senderOrganization {
|
|
id
|
|
name
|
|
fullName
|
|
type
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
receiverOrganization {
|
|
id
|
|
name
|
|
fullName
|
|
type
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
isRead
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const SEND_IMAGE_MESSAGE = gql`
|
|
mutation SendImageMessage($receiverOrganizationId: ID!, $fileUrl: String!, $fileName: String!, $fileSize: Int!, $fileType: String!) {
|
|
sendImageMessage(receiverOrganizationId: $receiverOrganizationId, fileUrl: $fileUrl, fileName: $fileName, fileSize: $fileSize, fileType: $fileType) {
|
|
success
|
|
message
|
|
messageData {
|
|
id
|
|
content
|
|
type
|
|
voiceUrl
|
|
voiceDuration
|
|
fileUrl
|
|
fileName
|
|
fileSize
|
|
fileType
|
|
senderId
|
|
senderOrganization {
|
|
id
|
|
name
|
|
fullName
|
|
type
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
receiverOrganization {
|
|
id
|
|
name
|
|
fullName
|
|
type
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
isRead
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const SEND_FILE_MESSAGE = gql`
|
|
mutation SendFileMessage($receiverOrganizationId: ID!, $fileUrl: String!, $fileName: String!, $fileSize: Int!, $fileType: String!) {
|
|
sendFileMessage(receiverOrganizationId: $receiverOrganizationId, fileUrl: $fileUrl, fileName: $fileName, fileSize: $fileSize, fileType: $fileType) {
|
|
success
|
|
message
|
|
messageData {
|
|
id
|
|
content
|
|
type
|
|
voiceUrl
|
|
voiceDuration
|
|
fileUrl
|
|
fileName
|
|
fileSize
|
|
fileType
|
|
senderId
|
|
senderOrganization {
|
|
id
|
|
name
|
|
fullName
|
|
type
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
receiverOrganization {
|
|
id
|
|
name
|
|
fullName
|
|
type
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
isRead
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const MARK_MESSAGES_AS_READ = gql`
|
|
mutation MarkMessagesAsRead($conversationId: ID!) {
|
|
markMessagesAsRead(conversationId: $conversationId)
|
|
}
|
|
`
|
|
|
|
// Мутации для услуг
|
|
export const CREATE_SERVICE = gql`
|
|
mutation CreateService($input: ServiceInput!) {
|
|
createService(input: $input) {
|
|
success
|
|
message
|
|
service {
|
|
id
|
|
name
|
|
description
|
|
price
|
|
imageUrl
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const UPDATE_SERVICE = gql`
|
|
mutation UpdateService($id: ID!, $input: ServiceInput!) {
|
|
updateService(id: $id, input: $input) {
|
|
success
|
|
message
|
|
service {
|
|
id
|
|
name
|
|
description
|
|
price
|
|
imageUrl
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const DELETE_SERVICE = gql`
|
|
mutation DeleteService($id: ID!) {
|
|
deleteService(id: $id)
|
|
}
|
|
`
|
|
|
|
// Мутации для расходников
|
|
export const CREATE_SUPPLY = gql`
|
|
mutation CreateSupply($input: SupplyInput!) {
|
|
createSupply(input: $input) {
|
|
success
|
|
message
|
|
supply {
|
|
id
|
|
name
|
|
description
|
|
price
|
|
quantity
|
|
imageUrl
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const UPDATE_SUPPLY = gql`
|
|
mutation UpdateSupply($id: ID!, $input: SupplyInput!) {
|
|
updateSupply(id: $id, input: $input) {
|
|
success
|
|
message
|
|
supply {
|
|
id
|
|
name
|
|
description
|
|
price
|
|
quantity
|
|
imageUrl
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const DELETE_SUPPLY = gql`
|
|
mutation DeleteSupply($id: ID!) {
|
|
deleteSupply(id: $id)
|
|
}
|
|
`
|
|
|
|
// Мутации для товаров оптовика
|
|
export const CREATE_PRODUCT = gql`
|
|
mutation CreateProduct($input: ProductInput!) {
|
|
createProduct(input: $input) {
|
|
success
|
|
message
|
|
product {
|
|
id
|
|
name
|
|
article
|
|
description
|
|
price
|
|
quantity
|
|
category {
|
|
id
|
|
name
|
|
}
|
|
brand
|
|
color
|
|
size
|
|
weight
|
|
dimensions
|
|
material
|
|
images
|
|
mainImage
|
|
isActive
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const UPDATE_PRODUCT = gql`
|
|
mutation UpdateProduct($id: ID!, $input: ProductInput!) {
|
|
updateProduct(id: $id, input: $input) {
|
|
success
|
|
message
|
|
product {
|
|
id
|
|
name
|
|
article
|
|
description
|
|
price
|
|
quantity
|
|
category {
|
|
id
|
|
name
|
|
}
|
|
brand
|
|
color
|
|
size
|
|
weight
|
|
dimensions
|
|
material
|
|
images
|
|
mainImage
|
|
isActive
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const DELETE_PRODUCT = gql`
|
|
mutation DeleteProduct($id: ID!) {
|
|
deleteProduct(id: $id)
|
|
}
|
|
`
|
|
|
|
// Мутации для корзины
|
|
export const ADD_TO_CART = gql`
|
|
mutation AddToCart($productId: ID!, $quantity: Int = 1) {
|
|
addToCart(productId: $productId, quantity: $quantity) {
|
|
success
|
|
message
|
|
cart {
|
|
id
|
|
totalPrice
|
|
totalItems
|
|
items {
|
|
id
|
|
quantity
|
|
totalPrice
|
|
isAvailable
|
|
availableQuantity
|
|
product {
|
|
id
|
|
name
|
|
article
|
|
price
|
|
quantity
|
|
images
|
|
mainImage
|
|
organization {
|
|
id
|
|
name
|
|
fullName
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const UPDATE_CART_ITEM = gql`
|
|
mutation UpdateCartItem($productId: ID!, $quantity: Int!) {
|
|
updateCartItem(productId: $productId, quantity: $quantity) {
|
|
success
|
|
message
|
|
cart {
|
|
id
|
|
totalPrice
|
|
totalItems
|
|
items {
|
|
id
|
|
quantity
|
|
totalPrice
|
|
isAvailable
|
|
availableQuantity
|
|
product {
|
|
id
|
|
name
|
|
article
|
|
price
|
|
quantity
|
|
images
|
|
mainImage
|
|
organization {
|
|
id
|
|
name
|
|
fullName
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const REMOVE_FROM_CART = gql`
|
|
mutation RemoveFromCart($productId: ID!) {
|
|
removeFromCart(productId: $productId) {
|
|
success
|
|
message
|
|
cart {
|
|
id
|
|
totalPrice
|
|
totalItems
|
|
items {
|
|
id
|
|
quantity
|
|
totalPrice
|
|
isAvailable
|
|
availableQuantity
|
|
product {
|
|
id
|
|
name
|
|
article
|
|
price
|
|
quantity
|
|
images
|
|
mainImage
|
|
organization {
|
|
id
|
|
name
|
|
fullName
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const CLEAR_CART = gql`
|
|
mutation ClearCart {
|
|
clearCart
|
|
}
|
|
`
|
|
|
|
// Мутации для избранного
|
|
export const ADD_TO_FAVORITES = gql`
|
|
mutation AddToFavorites($productId: ID!) {
|
|
addToFavorites(productId: $productId) {
|
|
success
|
|
message
|
|
favorites {
|
|
id
|
|
name
|
|
article
|
|
price
|
|
quantity
|
|
images
|
|
mainImage
|
|
category {
|
|
id
|
|
name
|
|
}
|
|
organization {
|
|
id
|
|
name
|
|
fullName
|
|
inn
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const REMOVE_FROM_FAVORITES = gql`
|
|
mutation RemoveFromFavorites($productId: ID!) {
|
|
removeFromFavorites(productId: $productId) {
|
|
success
|
|
message
|
|
favorites {
|
|
id
|
|
name
|
|
article
|
|
price
|
|
quantity
|
|
images
|
|
mainImage
|
|
category {
|
|
id
|
|
name
|
|
}
|
|
organization {
|
|
id
|
|
name
|
|
fullName
|
|
inn
|
|
}
|
|
}
|
|
}
|
|
}
|
|
` |