809 lines
13 KiB
TypeScript
809 lines
13 KiB
TypeScript
import { gql } from 'graphql-tag'
|
|
|
|
export const GET_ME = gql`
|
|
query GetMe {
|
|
me {
|
|
id
|
|
phone
|
|
avatar
|
|
managerName
|
|
createdAt
|
|
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
|
|
apiKey
|
|
isActive
|
|
validationData
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_MY_SERVICES = gql`
|
|
query GetMyServices {
|
|
myServices {
|
|
id
|
|
name
|
|
description
|
|
price
|
|
imageUrl
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_MY_SUPPLIES = gql`
|
|
query GetMySupplies {
|
|
mySupplies {
|
|
id
|
|
name
|
|
description
|
|
price
|
|
quantity
|
|
unit
|
|
category
|
|
status
|
|
date
|
|
supplier
|
|
minStock
|
|
currentStock
|
|
imageUrl
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_MY_LOGISTICS = gql`
|
|
query GetMyLogistics {
|
|
myLogistics {
|
|
id
|
|
fromLocation
|
|
toLocation
|
|
priceUnder1m3
|
|
priceOver1m3
|
|
description
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_MY_PRODUCTS = gql`
|
|
query GetMyProducts {
|
|
myProducts {
|
|
id
|
|
name
|
|
article
|
|
description
|
|
price
|
|
quantity
|
|
category {
|
|
id
|
|
name
|
|
}
|
|
brand
|
|
color
|
|
size
|
|
weight
|
|
dimensions
|
|
material
|
|
images
|
|
mainImage
|
|
isActive
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
// Запросы для контрагентов
|
|
export const SEARCH_ORGANIZATIONS = gql`
|
|
query SearchOrganizations($type: OrganizationType, $search: String) {
|
|
searchOrganizations(type: $type, search: $search) {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
address
|
|
phones
|
|
emails
|
|
createdAt
|
|
isCounterparty
|
|
isCurrentUser
|
|
hasOutgoingRequest
|
|
hasIncomingRequest
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_MY_COUNTERPARTIES = gql`
|
|
query GetMyCounterparties {
|
|
myCounterparties {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
managementName
|
|
type
|
|
address
|
|
phones
|
|
emails
|
|
createdAt
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_INCOMING_REQUESTS = gql`
|
|
query GetIncomingRequests {
|
|
incomingRequests {
|
|
id
|
|
status
|
|
message
|
|
createdAt
|
|
sender {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
address
|
|
phones
|
|
emails
|
|
createdAt
|
|
users {
|
|
id
|
|
avatar
|
|
}
|
|
}
|
|
receiver {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
users {
|
|
id
|
|
avatar
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_OUTGOING_REQUESTS = gql`
|
|
query GetOutgoingRequests {
|
|
outgoingRequests {
|
|
id
|
|
status
|
|
message
|
|
createdAt
|
|
sender {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
users {
|
|
id
|
|
avatar
|
|
}
|
|
}
|
|
receiver {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
address
|
|
phones
|
|
emails
|
|
createdAt
|
|
users {
|
|
id
|
|
avatar
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_ORGANIZATION = gql`
|
|
query GetOrganization($id: ID!) {
|
|
organization(id: $id) {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
address
|
|
type
|
|
apiKeys {
|
|
id
|
|
marketplace
|
|
apiKey
|
|
isActive
|
|
validationData
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
// Запросы для сообщений
|
|
export const GET_MESSAGES = gql`
|
|
query GetMessages($counterpartyId: ID!, $limit: Int, $offset: Int) {
|
|
messages(counterpartyId: $counterpartyId, limit: $limit, offset: $offset) {
|
|
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 GET_CONVERSATIONS = gql`
|
|
query GetConversations {
|
|
conversations {
|
|
id
|
|
counterparty {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
address
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
lastMessage {
|
|
id
|
|
content
|
|
type
|
|
voiceUrl
|
|
voiceDuration
|
|
fileUrl
|
|
fileName
|
|
fileSize
|
|
fileType
|
|
senderId
|
|
isRead
|
|
createdAt
|
|
}
|
|
unreadCount
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_CATEGORIES = gql`
|
|
query GetCategories {
|
|
categories {
|
|
id
|
|
name
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_ALL_PRODUCTS = gql`
|
|
query GetAllProducts($search: String, $category: String) {
|
|
allProducts(search: $search, category: $category) {
|
|
id
|
|
name
|
|
article
|
|
description
|
|
price
|
|
quantity
|
|
category {
|
|
id
|
|
name
|
|
}
|
|
brand
|
|
color
|
|
size
|
|
weight
|
|
dimensions
|
|
material
|
|
images
|
|
mainImage
|
|
isActive
|
|
createdAt
|
|
updatedAt
|
|
organization {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
address
|
|
phones
|
|
emails
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_MY_CART = gql`
|
|
query GetMyCart {
|
|
myCart {
|
|
id
|
|
totalPrice
|
|
totalItems
|
|
items {
|
|
id
|
|
quantity
|
|
totalPrice
|
|
isAvailable
|
|
availableQuantity
|
|
createdAt
|
|
updatedAt
|
|
product {
|
|
id
|
|
name
|
|
article
|
|
description
|
|
price
|
|
quantity
|
|
brand
|
|
color
|
|
size
|
|
images
|
|
mainImage
|
|
isActive
|
|
category {
|
|
id
|
|
name
|
|
}
|
|
organization {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
address
|
|
phones
|
|
emails
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
}
|
|
}
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_MY_FAVORITES = gql`
|
|
query GetMyFavorites {
|
|
myFavorites {
|
|
id
|
|
name
|
|
article
|
|
description
|
|
price
|
|
quantity
|
|
brand
|
|
color
|
|
size
|
|
images
|
|
mainImage
|
|
isActive
|
|
createdAt
|
|
updatedAt
|
|
category {
|
|
id
|
|
name
|
|
}
|
|
organization {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
address
|
|
phones
|
|
emails
|
|
users {
|
|
id
|
|
avatar
|
|
managerName
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
// Запросы для сотрудников
|
|
export const GET_MY_EMPLOYEES = gql`
|
|
query GetMyEmployees {
|
|
myEmployees {
|
|
id
|
|
firstName
|
|
lastName
|
|
middleName
|
|
birthDate
|
|
avatar
|
|
passportSeries
|
|
passportNumber
|
|
passportIssued
|
|
passportDate
|
|
address
|
|
position
|
|
department
|
|
hireDate
|
|
salary
|
|
status
|
|
phone
|
|
email
|
|
telegram
|
|
whatsapp
|
|
passportPhoto
|
|
emergencyContact
|
|
emergencyPhone
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_EMPLOYEE = gql`
|
|
query GetEmployee($id: ID!) {
|
|
employee(id: $id) {
|
|
id
|
|
firstName
|
|
lastName
|
|
middleName
|
|
birthDate
|
|
avatar
|
|
passportSeries
|
|
passportNumber
|
|
passportIssued
|
|
passportDate
|
|
address
|
|
position
|
|
department
|
|
hireDate
|
|
salary
|
|
status
|
|
phone
|
|
email
|
|
emergencyContact
|
|
emergencyPhone
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_EMPLOYEE_SCHEDULE = gql`
|
|
query GetEmployeeSchedule($employeeId: ID!, $year: Int!, $month: Int!) {
|
|
employeeSchedule(employeeId: $employeeId, year: $year, month: $month) {
|
|
id
|
|
date
|
|
status
|
|
hoursWorked
|
|
notes
|
|
employee {
|
|
id
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_MY_WILDBERRIES_SUPPLIES = gql`
|
|
query GetMyWildberriesSupplies {
|
|
myWildberriesSupplies {
|
|
id
|
|
deliveryDate
|
|
status
|
|
totalAmount
|
|
totalItems
|
|
createdAt
|
|
cards {
|
|
id
|
|
nmId
|
|
vendorCode
|
|
title
|
|
brand
|
|
price
|
|
discountedPrice
|
|
quantity
|
|
selectedQuantity
|
|
selectedMarket
|
|
selectedPlace
|
|
sellerName
|
|
sellerPhone
|
|
deliveryDate
|
|
mediaFiles
|
|
selectedServices
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
// Запросы для получения услуг и расходников от конкретных организаций-контрагентов
|
|
export const GET_COUNTERPARTY_SERVICES = gql`
|
|
query GetCounterpartyServices($organizationId: ID!) {
|
|
counterpartyServices(organizationId: $organizationId) {
|
|
id
|
|
name
|
|
description
|
|
price
|
|
imageUrl
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_COUNTERPARTY_SUPPLIES = gql`
|
|
query GetCounterpartySupplies($organizationId: ID!) {
|
|
counterpartySupplies(organizationId: $organizationId) {
|
|
id
|
|
name
|
|
description
|
|
price
|
|
quantity
|
|
unit
|
|
category
|
|
status
|
|
imageUrl
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
// Wildberries запросы
|
|
export const GET_WILDBERRIES_STATISTICS = gql`
|
|
query GetWildberriesStatistics($period: String, $startDate: String, $endDate: String) {
|
|
getWildberriesStatistics(period: $period, startDate: $startDate, endDate: $endDate) {
|
|
success
|
|
message
|
|
data {
|
|
date
|
|
sales
|
|
orders
|
|
advertising
|
|
refusals
|
|
returns
|
|
revenue
|
|
buyoutPercentage
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_WILDBERRIES_CAMPAIGN_STATS = gql`
|
|
query GetWildberriesCampaignStats($input: WildberriesCampaignStatsInput!) {
|
|
getWildberriesCampaignStats(input: $input) {
|
|
success
|
|
message
|
|
data {
|
|
advertId
|
|
views
|
|
clicks
|
|
ctr
|
|
cpc
|
|
sum
|
|
atbs
|
|
orders
|
|
cr
|
|
shks
|
|
sum_price
|
|
dates
|
|
days {
|
|
date
|
|
views
|
|
clicks
|
|
ctr
|
|
cpc
|
|
sum
|
|
atbs
|
|
orders
|
|
cr
|
|
shks
|
|
sum_price
|
|
}
|
|
boosterStats {
|
|
date
|
|
views
|
|
clicks
|
|
ctr
|
|
cpc
|
|
sum
|
|
atbs
|
|
orders
|
|
cr
|
|
shks
|
|
sum_price
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
// Админ запросы
|
|
export const ADMIN_ME = gql`
|
|
query AdminMe {
|
|
adminMe {
|
|
id
|
|
username
|
|
email
|
|
isActive
|
|
lastLogin
|
|
createdAt
|
|
updatedAt
|
|
}
|
|
}
|
|
`
|
|
|
|
export const ALL_USERS = gql`
|
|
query AllUsers($search: String, $limit: Int, $offset: Int) {
|
|
allUsers(search: $search, limit: $limit, offset: $offset) {
|
|
users {
|
|
id
|
|
phone
|
|
managerName
|
|
avatar
|
|
createdAt
|
|
updatedAt
|
|
organization {
|
|
id
|
|
inn
|
|
name
|
|
fullName
|
|
type
|
|
status
|
|
createdAt
|
|
}
|
|
}
|
|
total
|
|
hasMore
|
|
}
|
|
}
|
|
`
|
|
|
|
export const GET_SUPPLY_ORDERS = gql`
|
|
query GetSupplyOrders {
|
|
supplyOrders {
|
|
id
|
|
organizationId
|
|
deliveryDate
|
|
status
|
|
totalAmount
|
|
totalItems
|
|
fulfillmentCenterId
|
|
createdAt
|
|
updatedAt
|
|
partner {
|
|
id
|
|
name
|
|
fullName
|
|
inn
|
|
address
|
|
phones
|
|
emails
|
|
}
|
|
organization {
|
|
id
|
|
name
|
|
fullName
|
|
type
|
|
}
|
|
fulfillmentCenter {
|
|
id
|
|
name
|
|
fullName
|
|
type
|
|
}
|
|
items {
|
|
id
|
|
quantity
|
|
price
|
|
totalPrice
|
|
product {
|
|
id
|
|
name
|
|
article
|
|
description
|
|
category {
|
|
id
|
|
name
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
` |