295 lines
5.1 KiB
GraphQL
295 lines
5.1 KiB
GraphQL
scalar DateTime
|
|
scalar JSON
|
|
|
|
enum UserRole {
|
|
CLIENT
|
|
MANAGER
|
|
}
|
|
|
|
enum MessengerType {
|
|
TELEGRAM
|
|
MAX
|
|
}
|
|
|
|
enum RegistrationStatus {
|
|
PENDING
|
|
APPROVED
|
|
REJECTED
|
|
}
|
|
|
|
enum OrderKind {
|
|
READY
|
|
CALCULATION
|
|
}
|
|
|
|
enum OrderStatus {
|
|
NEW
|
|
MANAGER_PROCESSING
|
|
WAITING_DOUBLE_CONFIRM
|
|
CLIENT_REJECTED
|
|
MANAGER_REJECTED
|
|
MANAGER_BLOCKED
|
|
CONFIRMED
|
|
IN_PROGRESS
|
|
COMPLETED
|
|
}
|
|
|
|
enum WithdrawalStatus {
|
|
PENDING
|
|
APPROVED
|
|
REJECTED
|
|
}
|
|
|
|
enum Decision {
|
|
APPROVE
|
|
REJECT
|
|
}
|
|
|
|
type Company {
|
|
id: ID!
|
|
name: String!
|
|
inn: String
|
|
}
|
|
|
|
type User {
|
|
id: ID!
|
|
email: String!
|
|
fullName: String!
|
|
role: UserRole!
|
|
company: Company
|
|
}
|
|
|
|
type Invitation {
|
|
id: ID!
|
|
token: String!
|
|
email: String!
|
|
companyName: String!
|
|
managerId: ID!
|
|
acceptedById: ID
|
|
expiresAt: DateTime!
|
|
acceptedAt: DateTime
|
|
createdAt: DateTime!
|
|
}
|
|
|
|
type RegistrationRequest {
|
|
id: ID!
|
|
companyName: String!
|
|
inn: String
|
|
contactName: String!
|
|
email: String!
|
|
status: RegistrationStatus!
|
|
rejectionReason: String
|
|
reviewedById: ID
|
|
createdAt: DateTime!
|
|
updatedAt: DateTime!
|
|
}
|
|
|
|
type MessengerConnection {
|
|
id: ID!
|
|
userId: ID!
|
|
type: MessengerType!
|
|
channelId: String!
|
|
isActive: Boolean!
|
|
}
|
|
|
|
type Warehouse {
|
|
id: ID!
|
|
code: String!
|
|
name: String!
|
|
}
|
|
|
|
type ProductWarehouseBalance {
|
|
warehouse: Warehouse!
|
|
availableQty: Float!
|
|
}
|
|
|
|
type Product {
|
|
id: ID!
|
|
sku: String!
|
|
name: String!
|
|
description: String
|
|
isCustomizable: Boolean!
|
|
isActive: Boolean!
|
|
availableInWarehouses: [ProductWarehouseBalance!]!
|
|
}
|
|
|
|
type OrderItem {
|
|
id: ID!
|
|
productId: ID
|
|
productName: String!
|
|
quantity: Float!
|
|
}
|
|
|
|
type OrderStatusEvent {
|
|
id: ID!
|
|
status: OrderStatus!
|
|
actorUserId: ID!
|
|
note: String
|
|
createdAt: DateTime!
|
|
}
|
|
|
|
type Order {
|
|
id: ID!
|
|
code: String!
|
|
kind: OrderKind!
|
|
status: OrderStatus!
|
|
customerId: ID!
|
|
managerId: ID
|
|
clientApproved: Boolean
|
|
managerApproved: Boolean
|
|
blockReason: String
|
|
deliveryTerms: String
|
|
deliveryFee: Float
|
|
totalPrice: Float
|
|
calculationPayload: JSON
|
|
items: [OrderItem!]!
|
|
history: [OrderStatusEvent!]!
|
|
createdAt: DateTime!
|
|
updatedAt: DateTime!
|
|
}
|
|
|
|
type ReferralLink {
|
|
id: ID!
|
|
referrerId: ID!
|
|
refereeId: ID!
|
|
createdAt: DateTime!
|
|
}
|
|
|
|
type BonusTransaction {
|
|
id: ID!
|
|
userId: ID!
|
|
amount: Float!
|
|
reason: String!
|
|
orderId: ID
|
|
createdAt: DateTime!
|
|
}
|
|
|
|
type RewardWithdrawalRequest {
|
|
id: ID!
|
|
requesterId: ID!
|
|
amount: Float!
|
|
status: WithdrawalStatus!
|
|
reviewedById: ID
|
|
reviewComment: String
|
|
createdAt: DateTime!
|
|
updatedAt: DateTime!
|
|
}
|
|
|
|
type ReferralStats {
|
|
referrerId: ID!
|
|
availableBalance: Float!
|
|
referralsCount: Int!
|
|
transactions: [BonusTransaction!]!
|
|
pendingWithdrawals: [RewardWithdrawalRequest!]!
|
|
}
|
|
|
|
type Query {
|
|
healthcheck: String!
|
|
me: User
|
|
clientProducts: [Product!]!
|
|
myOrders: [Order!]!
|
|
myCurrentOrders: [Order!]!
|
|
managerOrders(status: OrderStatus): [Order!]!
|
|
registrationRequests(status: RegistrationStatus): [RegistrationRequest!]!
|
|
referralStats: ReferralStats!
|
|
}
|
|
|
|
input RegisterSelfInput {
|
|
companyName: String!
|
|
inn: String
|
|
contactName: String!
|
|
email: String!
|
|
}
|
|
|
|
input ReviewRegistrationRequestInput {
|
|
requestId: ID!
|
|
decision: Decision!
|
|
rejectionReason: String
|
|
}
|
|
|
|
input CreateInvitationInput {
|
|
email: String!
|
|
companyName: String!
|
|
expiresInDays: Int = 7
|
|
}
|
|
|
|
input AcceptInvitationInput {
|
|
token: String!
|
|
fullName: String!
|
|
}
|
|
|
|
input ConnectMessengerInput {
|
|
type: MessengerType!
|
|
channelId: String!
|
|
}
|
|
|
|
input ReadyOrderItemInput {
|
|
productId: ID!
|
|
quantity: Float!
|
|
}
|
|
|
|
input SubmitReadyOrderInput {
|
|
items: [ReadyOrderItemInput!]!
|
|
}
|
|
|
|
input SubmitCalculationOrderInput {
|
|
productName: String!
|
|
quantity: Float!
|
|
parameters: JSON!
|
|
}
|
|
|
|
input SetOrderOfferInput {
|
|
orderId: ID!
|
|
deliveryTerms: String!
|
|
deliveryFee: Float!
|
|
totalPrice: Float!
|
|
}
|
|
|
|
input BlockOrderInput {
|
|
orderId: ID!
|
|
reason: String!
|
|
}
|
|
|
|
input CreateReferralInput {
|
|
refereeUserId: ID!
|
|
}
|
|
|
|
input AddBonusTransactionInput {
|
|
userId: ID!
|
|
amount: Float!
|
|
reason: String!
|
|
orderId: ID
|
|
}
|
|
|
|
input RequestRewardWithdrawalInput {
|
|
amount: Float!
|
|
}
|
|
|
|
input ReviewRewardWithdrawalInput {
|
|
withdrawalId: ID!
|
|
decision: Decision!
|
|
reviewComment: String
|
|
}
|
|
|
|
type Mutation {
|
|
registerSelf(input: RegisterSelfInput!): RegistrationRequest!
|
|
reviewRegistrationRequest(input: ReviewRegistrationRequestInput!): RegistrationRequest!
|
|
createInvitation(input: CreateInvitationInput!): Invitation!
|
|
acceptInvitation(input: AcceptInvitationInput!): User!
|
|
connectMessenger(input: ConnectMessengerInput!): MessengerConnection!
|
|
|
|
submitReadyOrder(input: SubmitReadyOrderInput!): Order!
|
|
submitCalculationOrder(input: SubmitCalculationOrderInput!): Order!
|
|
managerSetOrderOffer(input: SetOrderOfferInput!): Order!
|
|
clientReviewOrder(orderId: ID!, decision: Decision!): Order!
|
|
managerFinalizeOrder(orderId: ID!, decision: Decision!): Order!
|
|
blockOrder(input: BlockOrderInput!): Order!
|
|
startOrderWork(orderId: ID!): Order!
|
|
completeOrder(orderId: ID!): Order!
|
|
|
|
createReferral(input: CreateReferralInput!): ReferralLink!
|
|
addBonusTransaction(input: AddBonusTransactionInput!): BonusTransaction!
|
|
requestRewardWithdrawal(input: RequestRewardWithdrawalInput!): RewardWithdrawalRequest!
|
|
reviewRewardWithdrawal(input: ReviewRewardWithdrawalInput!): RewardWithdrawalRequest!
|
|
}
|