Expire Telegram login button in bot
All checks were successful
Build and deploy Backend / build (push) Successful in 27s
All checks were successful
Build and deploy Backend / build (push) Successful in 27s
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "TelegramLoginRequest" ADD COLUMN "telegramChatId" TEXT,
|
||||
ADD COLUMN "telegramMessageId" INTEGER;
|
||||
|
||||
@@ -54,15 +54,17 @@ model UserSession {
|
||||
}
|
||||
|
||||
model TelegramLoginRequest {
|
||||
id String @id @default(cuid())
|
||||
tokenHash String @unique
|
||||
status String @default("PENDING")
|
||||
sessionToken String?
|
||||
userId String?
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
expiresAt DateTime
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @id @default(cuid())
|
||||
tokenHash String @unique
|
||||
status String @default("PENDING")
|
||||
sessionToken String?
|
||||
telegramChatId String?
|
||||
telegramMessageId Int?
|
||||
userId String?
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
expiresAt DateTime
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model VoiceExperience {
|
||||
|
||||
@@ -33,7 +33,12 @@ type TelegramFile = {
|
||||
file_path: string;
|
||||
};
|
||||
|
||||
type TelegramSentMessage = {
|
||||
message_id: number;
|
||||
};
|
||||
|
||||
const loginPrefix = 'login_';
|
||||
const loginTimerHandles = new Map<string, ReturnType<typeof setTimeout>>();
|
||||
|
||||
function randomToken() {
|
||||
return randomBytes(32).toString('base64url');
|
||||
@@ -112,36 +117,108 @@ export async function fetchTelegramPhoto(fileId: string) {
|
||||
};
|
||||
}
|
||||
|
||||
function formatLoginLifetime() {
|
||||
const minutes = Math.ceil(config.botLoginMaxAgeSeconds / 60);
|
||||
return `${minutes} мин`;
|
||||
function formatRemaining(expiresAt: Date) {
|
||||
const seconds = Math.max(0, Math.ceil((expiresAt.getTime() - Date.now()) / 1000));
|
||||
const minutes = Math.floor(seconds / 60).toString();
|
||||
const rest = (seconds % 60).toString().padStart(2, '0');
|
||||
return `${minutes}:${rest}`;
|
||||
}
|
||||
|
||||
function loginReplyMarkup(token: string, expiresAt: Date) {
|
||||
return {
|
||||
inline_keyboard: [
|
||||
[
|
||||
{
|
||||
text: `Открыть MapFlow · ${formatRemaining(expiresAt)}`,
|
||||
url: `${config.webAppUrl}?telegram_login=${encodeURIComponent(token)}`,
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
async function sendLoginMessage(
|
||||
chatId: number,
|
||||
text: string,
|
||||
token?: string,
|
||||
expiresAt?: Date,
|
||||
) {
|
||||
const replyMarkup = token
|
||||
? {
|
||||
inline_keyboard: [
|
||||
[
|
||||
{
|
||||
text: `Открыть MapFlow · ${formatLoginLifetime()}`,
|
||||
url: `${config.webAppUrl}?telegram_login=${encodeURIComponent(token)}`,
|
||||
},
|
||||
],
|
||||
],
|
||||
}
|
||||
: undefined;
|
||||
const replyMarkup = token && expiresAt ? loginReplyMarkup(token, expiresAt) : undefined;
|
||||
|
||||
await callTelegram('sendMessage', {
|
||||
return callTelegram<TelegramSentMessage>('sendMessage', {
|
||||
chat_id: chatId,
|
||||
text,
|
||||
reply_markup: replyMarkup,
|
||||
});
|
||||
}
|
||||
|
||||
async function editLoginMessage(
|
||||
chatId: string,
|
||||
messageId: number,
|
||||
text: string,
|
||||
token?: string,
|
||||
expiresAt?: Date,
|
||||
) {
|
||||
const replyMarkup = token && expiresAt
|
||||
? loginReplyMarkup(token, expiresAt)
|
||||
: { inline_keyboard: [] };
|
||||
await callTelegram('editMessageText', {
|
||||
chat_id: chatId,
|
||||
message_id: messageId,
|
||||
text,
|
||||
reply_markup: replyMarkup,
|
||||
});
|
||||
}
|
||||
|
||||
function scheduleLoginMessageTimer(
|
||||
requestId: string,
|
||||
token: string,
|
||||
chatId: string,
|
||||
messageId: number,
|
||||
expiresAt: Date,
|
||||
) {
|
||||
const existingHandle = loginTimerHandles.get(requestId);
|
||||
if (existingHandle) {
|
||||
clearTimeout(existingHandle);
|
||||
}
|
||||
|
||||
const tick = async () => {
|
||||
const request = await prisma.telegramLoginRequest.findUnique({
|
||||
where: { id: requestId },
|
||||
select: { status: true },
|
||||
});
|
||||
|
||||
if (!request || request.status !== 'CONFIRMED') {
|
||||
loginTimerHandles.delete(requestId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (expiresAt <= new Date()) {
|
||||
const updated = await prisma.telegramLoginRequest.updateMany({
|
||||
where: { id: requestId, status: 'CONFIRMED' },
|
||||
data: { status: 'EXPIRED' },
|
||||
});
|
||||
|
||||
loginTimerHandles.delete(requestId);
|
||||
if (updated.count > 0) {
|
||||
await editLoginMessage(chatId, messageId, 'Ссылка входа устарела.');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
await editLoginMessage(chatId, messageId, 'MapFlow', token, expiresAt);
|
||||
const handle = setTimeout(() => {
|
||||
void tick();
|
||||
}, 1000);
|
||||
loginTimerHandles.set(requestId, handle);
|
||||
};
|
||||
|
||||
const handle = setTimeout(() => {
|
||||
void tick();
|
||||
}, 1000);
|
||||
loginTimerHandles.set(requestId, handle);
|
||||
}
|
||||
|
||||
export async function createTelegramBotLogin() {
|
||||
const token = randomToken();
|
||||
const expiresAt = expiresIn(config.botLoginMaxAgeSeconds);
|
||||
@@ -182,6 +259,18 @@ export async function completeTelegramBotLogin(token: string) {
|
||||
throw new Error('Telegram login is not confirmed.');
|
||||
}
|
||||
|
||||
await prisma.telegramLoginRequest.update({
|
||||
where: { id: request.id },
|
||||
data: { status: 'USED' },
|
||||
});
|
||||
if (request.telegramChatId && request.telegramMessageId) {
|
||||
await editLoginMessage(
|
||||
request.telegramChatId,
|
||||
request.telegramMessageId,
|
||||
'Вход выполнен.',
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
sessionToken: request.sessionToken,
|
||||
user: request.user,
|
||||
@@ -233,14 +322,24 @@ export async function handleTelegramBotWebhook(
|
||||
},
|
||||
});
|
||||
|
||||
const sentMessage = await sendLoginMessage(chatId, 'MapFlow', token, request.expiresAt);
|
||||
|
||||
await prisma.telegramLoginRequest.update({
|
||||
where: { id: request.id },
|
||||
data: {
|
||||
status: 'CONFIRMED',
|
||||
sessionToken,
|
||||
telegramChatId: chatId.toString(),
|
||||
telegramMessageId: sentMessage.message_id,
|
||||
userId: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
await sendLoginMessage(chatId, 'MapFlow', token);
|
||||
scheduleLoginMessageTimer(
|
||||
request.id,
|
||||
token,
|
||||
chatId.toString(),
|
||||
sentMessage.message_id,
|
||||
request.expiresAt,
|
||||
);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -157,6 +157,8 @@ exports.Prisma.TelegramLoginRequestScalarFieldEnum = {
|
||||
tokenHash: 'tokenHash',
|
||||
status: 'status',
|
||||
sessionToken: 'sessionToken',
|
||||
telegramChatId: 'telegramChatId',
|
||||
telegramMessageId: 'telegramMessageId',
|
||||
userId: 'userId',
|
||||
expiresAt: 'expiresAt',
|
||||
createdAt: 'createdAt',
|
||||
|
||||
180
src/generated/prisma/index.d.ts
vendored
180
src/generated/prisma/index.d.ts
vendored
@@ -4743,15 +4743,27 @@ export namespace Prisma {
|
||||
|
||||
export type AggregateTelegramLoginRequest = {
|
||||
_count: TelegramLoginRequestCountAggregateOutputType | null
|
||||
_avg: TelegramLoginRequestAvgAggregateOutputType | null
|
||||
_sum: TelegramLoginRequestSumAggregateOutputType | null
|
||||
_min: TelegramLoginRequestMinAggregateOutputType | null
|
||||
_max: TelegramLoginRequestMaxAggregateOutputType | null
|
||||
}
|
||||
|
||||
export type TelegramLoginRequestAvgAggregateOutputType = {
|
||||
telegramMessageId: number | null
|
||||
}
|
||||
|
||||
export type TelegramLoginRequestSumAggregateOutputType = {
|
||||
telegramMessageId: number | null
|
||||
}
|
||||
|
||||
export type TelegramLoginRequestMinAggregateOutputType = {
|
||||
id: string | null
|
||||
tokenHash: string | null
|
||||
status: string | null
|
||||
sessionToken: string | null
|
||||
telegramChatId: string | null
|
||||
telegramMessageId: number | null
|
||||
userId: string | null
|
||||
expiresAt: Date | null
|
||||
createdAt: Date | null
|
||||
@@ -4763,6 +4775,8 @@ export namespace Prisma {
|
||||
tokenHash: string | null
|
||||
status: string | null
|
||||
sessionToken: string | null
|
||||
telegramChatId: string | null
|
||||
telegramMessageId: number | null
|
||||
userId: string | null
|
||||
expiresAt: Date | null
|
||||
createdAt: Date | null
|
||||
@@ -4774,6 +4788,8 @@ export namespace Prisma {
|
||||
tokenHash: number
|
||||
status: number
|
||||
sessionToken: number
|
||||
telegramChatId: number
|
||||
telegramMessageId: number
|
||||
userId: number
|
||||
expiresAt: number
|
||||
createdAt: number
|
||||
@@ -4782,11 +4798,21 @@ export namespace Prisma {
|
||||
}
|
||||
|
||||
|
||||
export type TelegramLoginRequestAvgAggregateInputType = {
|
||||
telegramMessageId?: true
|
||||
}
|
||||
|
||||
export type TelegramLoginRequestSumAggregateInputType = {
|
||||
telegramMessageId?: true
|
||||
}
|
||||
|
||||
export type TelegramLoginRequestMinAggregateInputType = {
|
||||
id?: true
|
||||
tokenHash?: true
|
||||
status?: true
|
||||
sessionToken?: true
|
||||
telegramChatId?: true
|
||||
telegramMessageId?: true
|
||||
userId?: true
|
||||
expiresAt?: true
|
||||
createdAt?: true
|
||||
@@ -4798,6 +4824,8 @@ export namespace Prisma {
|
||||
tokenHash?: true
|
||||
status?: true
|
||||
sessionToken?: true
|
||||
telegramChatId?: true
|
||||
telegramMessageId?: true
|
||||
userId?: true
|
||||
expiresAt?: true
|
||||
createdAt?: true
|
||||
@@ -4809,6 +4837,8 @@ export namespace Prisma {
|
||||
tokenHash?: true
|
||||
status?: true
|
||||
sessionToken?: true
|
||||
telegramChatId?: true
|
||||
telegramMessageId?: true
|
||||
userId?: true
|
||||
expiresAt?: true
|
||||
createdAt?: true
|
||||
@@ -4851,6 +4881,18 @@ export namespace Prisma {
|
||||
* Count returned TelegramLoginRequests
|
||||
**/
|
||||
_count?: true | TelegramLoginRequestCountAggregateInputType
|
||||
/**
|
||||
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
|
||||
*
|
||||
* Select which fields to average
|
||||
**/
|
||||
_avg?: TelegramLoginRequestAvgAggregateInputType
|
||||
/**
|
||||
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
|
||||
*
|
||||
* Select which fields to sum
|
||||
**/
|
||||
_sum?: TelegramLoginRequestSumAggregateInputType
|
||||
/**
|
||||
* {@link https://www.prisma.io/docs/concepts/components/prisma-client/aggregations Aggregation Docs}
|
||||
*
|
||||
@@ -4884,6 +4926,8 @@ export namespace Prisma {
|
||||
take?: number
|
||||
skip?: number
|
||||
_count?: TelegramLoginRequestCountAggregateInputType | true
|
||||
_avg?: TelegramLoginRequestAvgAggregateInputType
|
||||
_sum?: TelegramLoginRequestSumAggregateInputType
|
||||
_min?: TelegramLoginRequestMinAggregateInputType
|
||||
_max?: TelegramLoginRequestMaxAggregateInputType
|
||||
}
|
||||
@@ -4893,11 +4937,15 @@ export namespace Prisma {
|
||||
tokenHash: string
|
||||
status: string
|
||||
sessionToken: string | null
|
||||
telegramChatId: string | null
|
||||
telegramMessageId: number | null
|
||||
userId: string | null
|
||||
expiresAt: Date
|
||||
createdAt: Date
|
||||
updatedAt: Date
|
||||
_count: TelegramLoginRequestCountAggregateOutputType | null
|
||||
_avg: TelegramLoginRequestAvgAggregateOutputType | null
|
||||
_sum: TelegramLoginRequestSumAggregateOutputType | null
|
||||
_min: TelegramLoginRequestMinAggregateOutputType | null
|
||||
_max: TelegramLoginRequestMaxAggregateOutputType | null
|
||||
}
|
||||
@@ -4921,6 +4969,8 @@ export namespace Prisma {
|
||||
tokenHash?: boolean
|
||||
status?: boolean
|
||||
sessionToken?: boolean
|
||||
telegramChatId?: boolean
|
||||
telegramMessageId?: boolean
|
||||
userId?: boolean
|
||||
expiresAt?: boolean
|
||||
createdAt?: boolean
|
||||
@@ -4933,6 +4983,8 @@ export namespace Prisma {
|
||||
tokenHash?: boolean
|
||||
status?: boolean
|
||||
sessionToken?: boolean
|
||||
telegramChatId?: boolean
|
||||
telegramMessageId?: boolean
|
||||
userId?: boolean
|
||||
expiresAt?: boolean
|
||||
createdAt?: boolean
|
||||
@@ -4945,6 +4997,8 @@ export namespace Prisma {
|
||||
tokenHash?: boolean
|
||||
status?: boolean
|
||||
sessionToken?: boolean
|
||||
telegramChatId?: boolean
|
||||
telegramMessageId?: boolean
|
||||
userId?: boolean
|
||||
expiresAt?: boolean
|
||||
createdAt?: boolean
|
||||
@@ -4957,13 +5011,15 @@ export namespace Prisma {
|
||||
tokenHash?: boolean
|
||||
status?: boolean
|
||||
sessionToken?: boolean
|
||||
telegramChatId?: boolean
|
||||
telegramMessageId?: boolean
|
||||
userId?: boolean
|
||||
expiresAt?: boolean
|
||||
createdAt?: boolean
|
||||
updatedAt?: boolean
|
||||
}
|
||||
|
||||
export type TelegramLoginRequestOmit<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetOmit<"id" | "tokenHash" | "status" | "sessionToken" | "userId" | "expiresAt" | "createdAt" | "updatedAt", ExtArgs["result"]["telegramLoginRequest"]>
|
||||
export type TelegramLoginRequestOmit<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = $Extensions.GetOmit<"id" | "tokenHash" | "status" | "sessionToken" | "telegramChatId" | "telegramMessageId" | "userId" | "expiresAt" | "createdAt" | "updatedAt", ExtArgs["result"]["telegramLoginRequest"]>
|
||||
export type TelegramLoginRequestInclude<ExtArgs extends $Extensions.InternalArgs = $Extensions.DefaultArgs> = {
|
||||
user?: boolean | TelegramLoginRequest$userArgs<ExtArgs>
|
||||
}
|
||||
@@ -4984,6 +5040,8 @@ export namespace Prisma {
|
||||
tokenHash: string
|
||||
status: string
|
||||
sessionToken: string | null
|
||||
telegramChatId: string | null
|
||||
telegramMessageId: number | null
|
||||
userId: string | null
|
||||
expiresAt: Date
|
||||
createdAt: Date
|
||||
@@ -5416,6 +5474,8 @@ export namespace Prisma {
|
||||
readonly tokenHash: FieldRef<"TelegramLoginRequest", 'String'>
|
||||
readonly status: FieldRef<"TelegramLoginRequest", 'String'>
|
||||
readonly sessionToken: FieldRef<"TelegramLoginRequest", 'String'>
|
||||
readonly telegramChatId: FieldRef<"TelegramLoginRequest", 'String'>
|
||||
readonly telegramMessageId: FieldRef<"TelegramLoginRequest", 'Int'>
|
||||
readonly userId: FieldRef<"TelegramLoginRequest", 'String'>
|
||||
readonly expiresAt: FieldRef<"TelegramLoginRequest", 'DateTime'>
|
||||
readonly createdAt: FieldRef<"TelegramLoginRequest", 'DateTime'>
|
||||
@@ -7103,6 +7163,8 @@ export namespace Prisma {
|
||||
tokenHash: 'tokenHash',
|
||||
status: 'status',
|
||||
sessionToken: 'sessionToken',
|
||||
telegramChatId: 'telegramChatId',
|
||||
telegramMessageId: 'telegramMessageId',
|
||||
userId: 'userId',
|
||||
expiresAt: 'expiresAt',
|
||||
createdAt: 'createdAt',
|
||||
@@ -7482,6 +7544,8 @@ export namespace Prisma {
|
||||
tokenHash?: StringFilter<"TelegramLoginRequest"> | string
|
||||
status?: StringFilter<"TelegramLoginRequest"> | string
|
||||
sessionToken?: StringNullableFilter<"TelegramLoginRequest"> | string | null
|
||||
telegramChatId?: StringNullableFilter<"TelegramLoginRequest"> | string | null
|
||||
telegramMessageId?: IntNullableFilter<"TelegramLoginRequest"> | number | null
|
||||
userId?: StringNullableFilter<"TelegramLoginRequest"> | string | null
|
||||
expiresAt?: DateTimeFilter<"TelegramLoginRequest"> | Date | string
|
||||
createdAt?: DateTimeFilter<"TelegramLoginRequest"> | Date | string
|
||||
@@ -7494,6 +7558,8 @@ export namespace Prisma {
|
||||
tokenHash?: SortOrder
|
||||
status?: SortOrder
|
||||
sessionToken?: SortOrderInput | SortOrder
|
||||
telegramChatId?: SortOrderInput | SortOrder
|
||||
telegramMessageId?: SortOrderInput | SortOrder
|
||||
userId?: SortOrderInput | SortOrder
|
||||
expiresAt?: SortOrder
|
||||
createdAt?: SortOrder
|
||||
@@ -7509,6 +7575,8 @@ export namespace Prisma {
|
||||
NOT?: TelegramLoginRequestWhereInput | TelegramLoginRequestWhereInput[]
|
||||
status?: StringFilter<"TelegramLoginRequest"> | string
|
||||
sessionToken?: StringNullableFilter<"TelegramLoginRequest"> | string | null
|
||||
telegramChatId?: StringNullableFilter<"TelegramLoginRequest"> | string | null
|
||||
telegramMessageId?: IntNullableFilter<"TelegramLoginRequest"> | number | null
|
||||
userId?: StringNullableFilter<"TelegramLoginRequest"> | string | null
|
||||
expiresAt?: DateTimeFilter<"TelegramLoginRequest"> | Date | string
|
||||
createdAt?: DateTimeFilter<"TelegramLoginRequest"> | Date | string
|
||||
@@ -7521,13 +7589,17 @@ export namespace Prisma {
|
||||
tokenHash?: SortOrder
|
||||
status?: SortOrder
|
||||
sessionToken?: SortOrderInput | SortOrder
|
||||
telegramChatId?: SortOrderInput | SortOrder
|
||||
telegramMessageId?: SortOrderInput | SortOrder
|
||||
userId?: SortOrderInput | SortOrder
|
||||
expiresAt?: SortOrder
|
||||
createdAt?: SortOrder
|
||||
updatedAt?: SortOrder
|
||||
_count?: TelegramLoginRequestCountOrderByAggregateInput
|
||||
_avg?: TelegramLoginRequestAvgOrderByAggregateInput
|
||||
_max?: TelegramLoginRequestMaxOrderByAggregateInput
|
||||
_min?: TelegramLoginRequestMinOrderByAggregateInput
|
||||
_sum?: TelegramLoginRequestSumOrderByAggregateInput
|
||||
}
|
||||
|
||||
export type TelegramLoginRequestScalarWhereWithAggregatesInput = {
|
||||
@@ -7538,6 +7610,8 @@ export namespace Prisma {
|
||||
tokenHash?: StringWithAggregatesFilter<"TelegramLoginRequest"> | string
|
||||
status?: StringWithAggregatesFilter<"TelegramLoginRequest"> | string
|
||||
sessionToken?: StringNullableWithAggregatesFilter<"TelegramLoginRequest"> | string | null
|
||||
telegramChatId?: StringNullableWithAggregatesFilter<"TelegramLoginRequest"> | string | null
|
||||
telegramMessageId?: IntNullableWithAggregatesFilter<"TelegramLoginRequest"> | number | null
|
||||
userId?: StringNullableWithAggregatesFilter<"TelegramLoginRequest"> | string | null
|
||||
expiresAt?: DateTimeWithAggregatesFilter<"TelegramLoginRequest"> | Date | string
|
||||
createdAt?: DateTimeWithAggregatesFilter<"TelegramLoginRequest"> | Date | string
|
||||
@@ -7873,6 +7947,8 @@ export namespace Prisma {
|
||||
tokenHash: string
|
||||
status?: string
|
||||
sessionToken?: string | null
|
||||
telegramChatId?: string | null
|
||||
telegramMessageId?: number | null
|
||||
expiresAt: Date | string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
@@ -7884,6 +7960,8 @@ export namespace Prisma {
|
||||
tokenHash: string
|
||||
status?: string
|
||||
sessionToken?: string | null
|
||||
telegramChatId?: string | null
|
||||
telegramMessageId?: number | null
|
||||
userId?: string | null
|
||||
expiresAt: Date | string
|
||||
createdAt?: Date | string
|
||||
@@ -7895,6 +7973,8 @@ export namespace Prisma {
|
||||
tokenHash?: StringFieldUpdateOperationsInput | string
|
||||
status?: StringFieldUpdateOperationsInput | string
|
||||
sessionToken?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramChatId?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramMessageId?: NullableIntFieldUpdateOperationsInput | number | null
|
||||
expiresAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
createdAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -7906,6 +7986,8 @@ export namespace Prisma {
|
||||
tokenHash?: StringFieldUpdateOperationsInput | string
|
||||
status?: StringFieldUpdateOperationsInput | string
|
||||
sessionToken?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramChatId?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramMessageId?: NullableIntFieldUpdateOperationsInput | number | null
|
||||
userId?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
expiresAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
createdAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -7917,6 +7999,8 @@ export namespace Prisma {
|
||||
tokenHash: string
|
||||
status?: string
|
||||
sessionToken?: string | null
|
||||
telegramChatId?: string | null
|
||||
telegramMessageId?: number | null
|
||||
userId?: string | null
|
||||
expiresAt: Date | string
|
||||
createdAt?: Date | string
|
||||
@@ -7928,6 +8012,8 @@ export namespace Prisma {
|
||||
tokenHash?: StringFieldUpdateOperationsInput | string
|
||||
status?: StringFieldUpdateOperationsInput | string
|
||||
sessionToken?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramChatId?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramMessageId?: NullableIntFieldUpdateOperationsInput | number | null
|
||||
expiresAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
createdAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -7938,6 +8024,8 @@ export namespace Prisma {
|
||||
tokenHash?: StringFieldUpdateOperationsInput | string
|
||||
status?: StringFieldUpdateOperationsInput | string
|
||||
sessionToken?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramChatId?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramMessageId?: NullableIntFieldUpdateOperationsInput | number | null
|
||||
userId?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
expiresAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
createdAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -8303,6 +8391,17 @@ export namespace Prisma {
|
||||
createdAt?: SortOrder
|
||||
}
|
||||
|
||||
export type IntNullableFilter<$PrismaModel = never> = {
|
||||
equals?: number | IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | ListIntFieldRefInput<$PrismaModel> | null
|
||||
notIn?: number[] | ListIntFieldRefInput<$PrismaModel> | null
|
||||
lt?: number | IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | IntFieldRefInput<$PrismaModel>
|
||||
not?: NestedIntNullableFilter<$PrismaModel> | number | null
|
||||
}
|
||||
|
||||
export type UserNullableScalarRelationFilter = {
|
||||
is?: UserWhereInput | null
|
||||
isNot?: UserWhereInput | null
|
||||
@@ -8313,17 +8412,25 @@ export namespace Prisma {
|
||||
tokenHash?: SortOrder
|
||||
status?: SortOrder
|
||||
sessionToken?: SortOrder
|
||||
telegramChatId?: SortOrder
|
||||
telegramMessageId?: SortOrder
|
||||
userId?: SortOrder
|
||||
expiresAt?: SortOrder
|
||||
createdAt?: SortOrder
|
||||
updatedAt?: SortOrder
|
||||
}
|
||||
|
||||
export type TelegramLoginRequestAvgOrderByAggregateInput = {
|
||||
telegramMessageId?: SortOrder
|
||||
}
|
||||
|
||||
export type TelegramLoginRequestMaxOrderByAggregateInput = {
|
||||
id?: SortOrder
|
||||
tokenHash?: SortOrder
|
||||
status?: SortOrder
|
||||
sessionToken?: SortOrder
|
||||
telegramChatId?: SortOrder
|
||||
telegramMessageId?: SortOrder
|
||||
userId?: SortOrder
|
||||
expiresAt?: SortOrder
|
||||
createdAt?: SortOrder
|
||||
@@ -8335,12 +8442,34 @@ export namespace Prisma {
|
||||
tokenHash?: SortOrder
|
||||
status?: SortOrder
|
||||
sessionToken?: SortOrder
|
||||
telegramChatId?: SortOrder
|
||||
telegramMessageId?: SortOrder
|
||||
userId?: SortOrder
|
||||
expiresAt?: SortOrder
|
||||
createdAt?: SortOrder
|
||||
updatedAt?: SortOrder
|
||||
}
|
||||
|
||||
export type TelegramLoginRequestSumOrderByAggregateInput = {
|
||||
telegramMessageId?: SortOrder
|
||||
}
|
||||
|
||||
export type IntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | ListIntFieldRefInput<$PrismaModel> | null
|
||||
notIn?: number[] | ListIntFieldRefInput<$PrismaModel> | null
|
||||
lt?: number | IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | IntFieldRefInput<$PrismaModel>
|
||||
not?: NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null
|
||||
_count?: NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: NestedFloatNullableFilter<$PrismaModel>
|
||||
_sum?: NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: NestedIntNullableFilter<$PrismaModel>
|
||||
_max?: NestedIntNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type IntFilter<$PrismaModel = never> = {
|
||||
equals?: number | IntFieldRefInput<$PrismaModel>
|
||||
in?: number[] | ListIntFieldRefInput<$PrismaModel>
|
||||
@@ -8701,6 +8830,14 @@ export namespace Prisma {
|
||||
connect?: UserWhereUniqueInput
|
||||
}
|
||||
|
||||
export type NullableIntFieldUpdateOperationsInput = {
|
||||
set?: number | null
|
||||
increment?: number
|
||||
decrement?: number
|
||||
multiply?: number
|
||||
divide?: number
|
||||
}
|
||||
|
||||
export type UserUpdateOneWithoutLoginRequestsNestedInput = {
|
||||
create?: XOR<UserCreateWithoutLoginRequestsInput, UserUncheckedCreateWithoutLoginRequestsInput>
|
||||
connectOrCreate?: UserCreateOrConnectWithoutLoginRequestsInput
|
||||
@@ -8889,6 +9026,33 @@ export namespace Prisma {
|
||||
_max?: NestedDateTimeFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedIntNullableWithAggregatesFilter<$PrismaModel = never> = {
|
||||
equals?: number | IntFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | ListIntFieldRefInput<$PrismaModel> | null
|
||||
notIn?: number[] | ListIntFieldRefInput<$PrismaModel> | null
|
||||
lt?: number | IntFieldRefInput<$PrismaModel>
|
||||
lte?: number | IntFieldRefInput<$PrismaModel>
|
||||
gt?: number | IntFieldRefInput<$PrismaModel>
|
||||
gte?: number | IntFieldRefInput<$PrismaModel>
|
||||
not?: NestedIntNullableWithAggregatesFilter<$PrismaModel> | number | null
|
||||
_count?: NestedIntNullableFilter<$PrismaModel>
|
||||
_avg?: NestedFloatNullableFilter<$PrismaModel>
|
||||
_sum?: NestedIntNullableFilter<$PrismaModel>
|
||||
_min?: NestedIntNullableFilter<$PrismaModel>
|
||||
_max?: NestedIntNullableFilter<$PrismaModel>
|
||||
}
|
||||
|
||||
export type NestedFloatNullableFilter<$PrismaModel = never> = {
|
||||
equals?: number | FloatFieldRefInput<$PrismaModel> | null
|
||||
in?: number[] | ListFloatFieldRefInput<$PrismaModel> | null
|
||||
notIn?: number[] | ListFloatFieldRefInput<$PrismaModel> | null
|
||||
lt?: number | FloatFieldRefInput<$PrismaModel>
|
||||
lte?: number | FloatFieldRefInput<$PrismaModel>
|
||||
gt?: number | FloatFieldRefInput<$PrismaModel>
|
||||
gte?: number | FloatFieldRefInput<$PrismaModel>
|
||||
not?: NestedFloatNullableFilter<$PrismaModel> | number | null
|
||||
}
|
||||
|
||||
export type NestedEnumVoiceExperienceStatusFilter<$PrismaModel = never> = {
|
||||
equals?: $Enums.VoiceExperienceStatus | EnumVoiceExperienceStatusFieldRefInput<$PrismaModel>
|
||||
in?: $Enums.VoiceExperienceStatus[] | ListEnumVoiceExperienceStatusFieldRefInput<$PrismaModel>
|
||||
@@ -9040,6 +9204,8 @@ export namespace Prisma {
|
||||
tokenHash: string
|
||||
status?: string
|
||||
sessionToken?: string | null
|
||||
telegramChatId?: string | null
|
||||
telegramMessageId?: number | null
|
||||
expiresAt: Date | string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
@@ -9050,6 +9216,8 @@ export namespace Prisma {
|
||||
tokenHash: string
|
||||
status?: string
|
||||
sessionToken?: string | null
|
||||
telegramChatId?: string | null
|
||||
telegramMessageId?: number | null
|
||||
expiresAt: Date | string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
@@ -9150,6 +9318,8 @@ export namespace Prisma {
|
||||
tokenHash?: StringFilter<"TelegramLoginRequest"> | string
|
||||
status?: StringFilter<"TelegramLoginRequest"> | string
|
||||
sessionToken?: StringNullableFilter<"TelegramLoginRequest"> | string | null
|
||||
telegramChatId?: StringNullableFilter<"TelegramLoginRequest"> | string | null
|
||||
telegramMessageId?: IntNullableFilter<"TelegramLoginRequest"> | number | null
|
||||
userId?: StringNullableFilter<"TelegramLoginRequest"> | string | null
|
||||
expiresAt?: DateTimeFilter<"TelegramLoginRequest"> | Date | string
|
||||
createdAt?: DateTimeFilter<"TelegramLoginRequest"> | Date | string
|
||||
@@ -9512,6 +9682,8 @@ export namespace Prisma {
|
||||
tokenHash: string
|
||||
status?: string
|
||||
sessionToken?: string | null
|
||||
telegramChatId?: string | null
|
||||
telegramMessageId?: number | null
|
||||
expiresAt: Date | string
|
||||
createdAt?: Date | string
|
||||
updatedAt?: Date | string
|
||||
@@ -9555,6 +9727,8 @@ export namespace Prisma {
|
||||
tokenHash?: StringFieldUpdateOperationsInput | string
|
||||
status?: StringFieldUpdateOperationsInput | string
|
||||
sessionToken?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramChatId?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramMessageId?: NullableIntFieldUpdateOperationsInput | number | null
|
||||
expiresAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
createdAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -9565,6 +9739,8 @@ export namespace Prisma {
|
||||
tokenHash?: StringFieldUpdateOperationsInput | string
|
||||
status?: StringFieldUpdateOperationsInput | string
|
||||
sessionToken?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramChatId?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramMessageId?: NullableIntFieldUpdateOperationsInput | number | null
|
||||
expiresAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
createdAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
@@ -9575,6 +9751,8 @@ export namespace Prisma {
|
||||
tokenHash?: StringFieldUpdateOperationsInput | string
|
||||
status?: StringFieldUpdateOperationsInput | string
|
||||
sessionToken?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramChatId?: NullableStringFieldUpdateOperationsInput | string | null
|
||||
telegramMessageId?: NullableIntFieldUpdateOperationsInput | number | null
|
||||
expiresAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
createdAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
updatedAt?: DateTimeFieldUpdateOperationsInput | Date | string
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "prisma-client-65e4a069edb4c226fb6f3923aad6c1fb21050c52278da483488af11504ab8aa3",
|
||||
"name": "prisma-client-410efc9d12118d43a80a319e7db6d1bb75111f120bc5d6445b1056062f5567cd",
|
||||
"main": "index.js",
|
||||
"types": "index.d.ts",
|
||||
"browser": "default.js",
|
||||
|
||||
@@ -54,15 +54,17 @@ model UserSession {
|
||||
}
|
||||
|
||||
model TelegramLoginRequest {
|
||||
id String @id @default(cuid())
|
||||
tokenHash String @unique
|
||||
status String @default("PENDING")
|
||||
sessionToken String?
|
||||
userId String?
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
expiresAt DateTime
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
id String @id @default(cuid())
|
||||
tokenHash String @unique
|
||||
status String @default("PENDING")
|
||||
sessionToken String?
|
||||
telegramChatId String?
|
||||
telegramMessageId Int?
|
||||
userId String?
|
||||
user User? @relation(fields: [userId], references: [id])
|
||||
expiresAt DateTime
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
model VoiceExperience {
|
||||
|
||||
Reference in New Issue
Block a user