Добавлены модели и мутации для управления заказами поставок расходников. Обновлены схемы GraphQL с новыми типами и полями для SupplyOrder и SupplyOrderItem. Реализована логика создания заказов поставок с соответствующими полями и статусами. Обновлены компоненты интерфейса для улучшения навигации и взаимодействия с новыми функциями.

This commit is contained in:
Veronika Smirnova
2025-07-21 12:45:11 +03:00
parent 39c1499f72
commit 96a328b3ac
7 changed files with 2982 additions and 1680 deletions

View File

@ -1,4 +1,4 @@
import { gql } from 'graphql-tag'
import { gql } from "graphql-tag";
export const typeDefs = gql`
scalar DateTime
@ -6,56 +6,63 @@ export const typeDefs = gql`
type Query {
me: User
organization(id: ID!): Organization
# Поиск организаций по типу для добавления в контрагенты
searchOrganizations(type: OrganizationType, search: String): [Organization!]!
searchOrganizations(
type: OrganizationType
search: String
): [Organization!]!
# Мои контрагенты
myCounterparties: [Organization!]!
# Входящие заявки
incomingRequests: [CounterpartyRequest!]!
# Исходящие заявки
outgoingRequests: [CounterpartyRequest!]!
# Сообщения с контрагентом
messages(counterpartyId: ID!, limit: Int, offset: Int): [Message!]!
# Список чатов (последние сообщения с каждым контрагентом)
conversations: [Conversation!]!
# Услуги организации
myServices: [Service!]!
# Расходники организации
mySupplies: [Supply!]!
# Логистика организации
myLogistics: [Logistics!]!
# Товары оптовика
myProducts: [Product!]!
# Все товары всех оптовиков для маркета
allProducts(search: String, category: String): [Product!]!
# Все категории
categories: [Category!]!
# Корзина пользователя
myCart: Cart
# Избранные товары пользователя
myFavorites: [Product!]!
# Сотрудники организации
myEmployees: [Employee!]!
employee(id: ID!): Employee
# Табель сотрудника за месяц
employeeSchedule(employeeId: ID!, year: Int!, month: Int!): [EmployeeSchedule!]!
employeeSchedule(
employeeId: ID!
year: Int!
month: Int!
): [EmployeeSchedule!]!
# Админ запросы
adminMe: Admin
allUsers(search: String, limit: Int, offset: Int): UsersResponse!
@ -65,81 +72,114 @@ export const typeDefs = gql`
# Авторизация через SMS
sendSmsCode(phone: String!): SmsResponse!
verifySmsCode(phone: String!, code: String!): AuthResponse!
# Валидация ИНН
verifyInn(inn: String!): InnValidationResponse!
# Обновление профиля пользователя
updateUserProfile(input: UpdateUserProfileInput!): UpdateUserProfileResponse!
updateUserProfile(
input: UpdateUserProfileInput!
): UpdateUserProfileResponse!
# Обновление данных организации по ИНН
updateOrganizationByInn(inn: String!): UpdateOrganizationResponse!
# Регистрация организации
registerFulfillmentOrganization(input: FulfillmentRegistrationInput!): AuthResponse!
registerFulfillmentOrganization(
input: FulfillmentRegistrationInput!
): AuthResponse!
registerSellerOrganization(input: SellerRegistrationInput!): AuthResponse!
# Работа с API ключами
addMarketplaceApiKey(input: MarketplaceApiKeyInput!): ApiKeyResponse!
removeMarketplaceApiKey(marketplace: MarketplaceType!): Boolean!
# Выход из системы
logout: Boolean!
# Работа с контрагентами
sendCounterpartyRequest(organizationId: ID!, message: String): CounterpartyRequestResponse!
respondToCounterpartyRequest(requestId: ID!, accept: Boolean!): CounterpartyRequestResponse!
sendCounterpartyRequest(
organizationId: ID!
message: String
): CounterpartyRequestResponse!
respondToCounterpartyRequest(
requestId: ID!
accept: Boolean!
): CounterpartyRequestResponse!
cancelCounterpartyRequest(requestId: ID!): Boolean!
removeCounterparty(organizationId: ID!): Boolean!
# Работа с сообщениями
sendMessage(receiverOrganizationId: ID!, content: String, type: MessageType = TEXT): MessageResponse!
sendVoiceMessage(receiverOrganizationId: ID!, voiceUrl: String!, voiceDuration: Int!): MessageResponse!
sendImageMessage(receiverOrganizationId: ID!, fileUrl: String!, fileName: String!, fileSize: Int!, fileType: String!): MessageResponse!
sendFileMessage(receiverOrganizationId: ID!, fileUrl: String!, fileName: String!, fileSize: Int!, fileType: String!): MessageResponse!
sendMessage(
receiverOrganizationId: ID!
content: String
type: MessageType = TEXT
): MessageResponse!
sendVoiceMessage(
receiverOrganizationId: ID!
voiceUrl: String!
voiceDuration: Int!
): MessageResponse!
sendImageMessage(
receiverOrganizationId: ID!
fileUrl: String!
fileName: String!
fileSize: Int!
fileType: String!
): MessageResponse!
sendFileMessage(
receiverOrganizationId: ID!
fileUrl: String!
fileName: String!
fileSize: Int!
fileType: String!
): MessageResponse!
markMessagesAsRead(conversationId: ID!): Boolean!
# Работа с услугами
createService(input: ServiceInput!): ServiceResponse!
updateService(id: ID!, input: ServiceInput!): ServiceResponse!
deleteService(id: ID!): Boolean!
# Работа с расходниками
createSupply(input: SupplyInput!): SupplyResponse!
updateSupply(id: ID!, input: SupplyInput!): SupplyResponse!
deleteSupply(id: ID!): Boolean!
# Заказы поставок расходников
createSupplyOrder(input: SupplyOrderInput!): SupplyOrderResponse!
# Работа с логистикой
createLogistics(input: LogisticsInput!): LogisticsResponse!
updateLogistics(id: ID!, input: LogisticsInput!): LogisticsResponse!
deleteLogistics(id: ID!): Boolean!
# Работа с товарами (для оптовиков)
createProduct(input: ProductInput!): ProductResponse!
updateProduct(id: ID!, input: ProductInput!): ProductResponse!
deleteProduct(id: ID!): Boolean!
# Работа с категориями
createCategory(input: CategoryInput!): CategoryResponse!
updateCategory(id: ID!, input: CategoryInput!): CategoryResponse!
deleteCategory(id: ID!): Boolean!
# Работа с корзиной
addToCart(productId: ID!, quantity: Int = 1): CartResponse!
updateCartItem(productId: ID!, quantity: Int!): CartResponse!
removeFromCart(productId: ID!): CartResponse!
clearCart: Boolean!
# Работа с избранным
addToFavorites(productId: ID!): FavoritesResponse!
removeFromFavorites(productId: ID!): FavoritesResponse!
# Работа с сотрудниками
createEmployee(input: CreateEmployeeInput!): EmployeeResponse!
updateEmployee(id: ID!, input: UpdateEmployeeInput!): EmployeeResponse!
deleteEmployee(id: ID!): Boolean!
updateEmployeeSchedule(input: UpdateScheduleInput!): Boolean!
# Админ мутации
adminLogin(username: String!, password: String!): AdminAuthResponse!
adminLogout: Boolean!
@ -208,14 +248,14 @@ export const typeDefs = gql`
input UpdateUserProfileInput {
# Аватар пользователя
avatar: String
# Контактные данные организации
orgPhone: String
managerName: String
telegram: String
whatsapp: String
email: String
# Банковские данные
bankName: String
bik: String
@ -414,6 +454,55 @@ export const typeDefs = gql`
supply: Supply
}
# Типы для заказов поставок расходников
type SupplyOrder {
id: ID!
partnerId: ID!
partner: Organization!
deliveryDate: DateTime!
status: SupplyOrderStatus!
totalAmount: Float!
totalItems: Int!
items: [SupplyOrderItem!]!
createdAt: DateTime!
updatedAt: DateTime!
organization: Organization!
}
type SupplyOrderItem {
id: ID!
productId: ID!
product: Product!
quantity: Int!
price: Float!
totalPrice: Float!
}
enum SupplyOrderStatus {
PENDING
CONFIRMED
IN_TRANSIT
DELIVERED
CANCELLED
}
input SupplyOrderInput {
partnerId: ID!
deliveryDate: DateTime!
items: [SupplyOrderItemInput!]!
}
input SupplyOrderItemInput {
productId: ID!
quantity: Int!
}
type SupplyOrderResponse {
success: Boolean!
message: String!
order: SupplyOrder
}
# Типы для логистики
type Logistics {
id: ID!
@ -693,4 +782,4 @@ export const typeDefs = gql`
total: Int!
hasMore: Boolean!
}
`
`;