games_app/backend/dist-test-faq/validation/schemas.js

54 lines
2.7 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.settingsUpdateBodySchema = exports.logoutBodySchema = exports.refreshBodySchema = exports.totpDisableBodySchema = exports.totpEnableBodySchema = exports.transferBodySchema = exports.withdrawBodySchema = exports.changePasswordBodySchema = exports.registerBodySchema = exports.loginBodySchema = void 0;
const zod_1 = require("zod");
exports.loginBodySchema = zod_1.z.object({
email: zod_1.z.string().trim().min(1, 'Email is required').max(255).email(),
password: zod_1.z.string().min(1, 'Password is required').max(256),
totpCode: zod_1.z.string().trim().max(32).optional(),
captchaToken: zod_1.z.string().trim().max(2048).optional(),
});
exports.registerBodySchema = zod_1.z.object({
email: zod_1.z.string().trim().min(1).max(255).email(),
password: zod_1.z.string().min(1).max(256),
fullName: zod_1.z.string().trim().min(2).max(200),
phone: zod_1.z.string().trim().max(32).optional(),
countryOfResidence: zod_1.z.string().trim().length(2),
nationality: zod_1.z.string().trim().length(2).optional(),
gender: zod_1.z.enum(['male', 'female', 'other']),
referralCode: zod_1.z.string().trim().max(32).optional(),
});
exports.changePasswordBodySchema = zod_1.z.object({
currentPassword: zod_1.z.string().min(1).max(256),
newPassword: zod_1.z.string().min(1).max(256),
});
exports.withdrawBodySchema = zod_1.z.object({
walletType: zod_1.z.string().trim().min(1).max(64),
toAddress: zod_1.z.string().trim().min(10).max(255),
amount: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
totpCode: zod_1.z.string().trim().min(6).max(32).optional(),
});
exports.transferBodySchema = zod_1.z.object({
toEmail: zod_1.z.string().trim().min(1).max(255).email(),
walletType: zod_1.z.string().trim().min(1).max(64),
amount: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
totpCode: zod_1.z.string().trim().max(32).optional(),
});
exports.totpEnableBodySchema = zod_1.z.object({
code: zod_1.z.string().trim().min(6).max(12),
});
exports.totpDisableBodySchema = zod_1.z.object({
password: zod_1.z.string().min(1).max(256),
code: zod_1.z.string().trim().min(6).max(32),
});
exports.refreshBodySchema = zod_1.z.object({
refreshToken: zod_1.z.string().trim().min(1).max(512),
});
exports.logoutBodySchema = zod_1.z.object({
refreshToken: zod_1.z.string().trim().min(1).max(512),
});
exports.settingsUpdateBodySchema = zod_1.z
.record(zod_1.z.string(), zod_1.z.unknown())
.refine((obj) => Object.keys(obj).length > 0, 'At least one setting is required')
.refine((obj) => Object.keys(obj).length <= 50, 'Too many settings keys');
//# sourceMappingURL=schemas.js.map