Add one-time code login flow with token sessions

This commit is contained in:
Ruslan Bakiev
2026-04-01 19:09:59 +07:00
parent f135c12785
commit 8c8689a877
5 changed files with 633 additions and 6 deletions

View File

@@ -11,6 +11,12 @@ enum MessengerType {
MAX
}
enum LoginChannel {
EMAIL
TELEGRAM
MAX
}
enum RegistrationStatus {
PENDING
APPROVED
@@ -59,6 +65,19 @@ type User {
company: Company
}
type AuthCodeRequestResult {
challengeToken: String!
channel: LoginChannel!
destination: String!
expiresAt: DateTime!
}
type AuthSession {
accessToken: String!
expiresAt: DateTime!
user: User!
}
type Invitation {
id: ID!
token: String!
@@ -92,6 +111,23 @@ type MessengerConnection {
isActive: Boolean!
}
type MessengerDispatchResult {
type: MessengerType!
channelId: String!
success: Boolean!
detail: String!
sentAt: DateTime!
}
type NotificationHistoryItem {
id: ID!
channel: MessengerType!
title: String!
message: String!
createdAt: DateTime!
orderId: ID
}
type Warehouse {
id: ID!
code: String!
@@ -186,6 +222,9 @@ type ReferralStats {
type Query {
healthcheck: String!
me: User
myMessengerConnections: [MessengerConnection!]!
myNotificationHistory(channel: MessengerType!, limit: Int = 50): [NotificationHistoryItem!]!
managerNotificationHistory(userId: ID!, channel: MessengerType!, limit: Int = 50): [NotificationHistoryItem!]!
clientProducts: [Product!]!
myOrders: [Order!]!
myCurrentOrders: [Order!]!
@@ -194,6 +233,16 @@ type Query {
referralStats: ReferralStats!
}
input RequestLoginCodeInput {
channel: LoginChannel!
destination: String!
}
input VerifyLoginCodeInput {
challengeToken: String!
code: String!
}
input RegisterSelfInput {
companyName: String!
inn: String
@@ -272,11 +321,14 @@ input ReviewRewardWithdrawalInput {
}
type Mutation {
requestLoginCode(input: RequestLoginCodeInput!): AuthCodeRequestResult!
verifyLoginCode(input: VerifyLoginCodeInput!): AuthSession!
registerSelf(input: RegisterSelfInput!): RegistrationRequest!
reviewRegistrationRequest(input: ReviewRegistrationRequestInput!): RegistrationRequest!
createInvitation(input: CreateInvitationInput!): Invitation!
acceptInvitation(input: AcceptInvitationInput!): User!
connectMessenger(input: ConnectMessengerInput!): MessengerConnection!
sendTestMessengerMessage(type: MessengerType!, channelId: String, message: String): MessengerDispatchResult!
submitReadyOrder(input: SubmitReadyOrderInput!): Order!
submitCalculationOrder(input: SubmitCalculationOrderInput!): Order!