mirror of
https://github.com/PretendoNetwork/website.git
synced 2026-08-29 12:05:58 -05:00
111 lines
2.3 KiB
TypeScript
111 lines
2.3 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export type GetApiAuthMe = {
|
|
pid: number;
|
|
username: string;
|
|
accessLevel: number;
|
|
serverAccessLevel: 'dev' | 'test' | 'prod';
|
|
discordId: string | null;
|
|
stripeTier: {
|
|
subscriptionId: string;
|
|
priceId: string;
|
|
tierName: string;
|
|
} | null;
|
|
mii: {
|
|
imageUrl: string;
|
|
name: string;
|
|
} | null;
|
|
};
|
|
|
|
export type ProgressItem = {
|
|
title: string;
|
|
githubUrl?: string;
|
|
completion: number;
|
|
tasks: Array<{
|
|
status: 'completed' | 'inprogress' | 'notstarted';
|
|
title: string;
|
|
}>;
|
|
};
|
|
|
|
export type GetProgress = {
|
|
donations: {
|
|
currentCents: number;
|
|
goalCents: number;
|
|
};
|
|
completion: number;
|
|
items: ProgressItem[];
|
|
};
|
|
|
|
export type ApiAuthLogin = {
|
|
accessToken: string;
|
|
refreshToken: string;
|
|
};
|
|
|
|
export type ApiAccountDiscordLink = {
|
|
url: string;
|
|
};
|
|
|
|
export type ApiAccountCheckoutLink = {
|
|
url: string;
|
|
};
|
|
|
|
export type TierItem = {
|
|
priceId: string;
|
|
tierLevel: number;
|
|
priceCents: number;
|
|
thumbnailUrl: string | null;
|
|
name: string;
|
|
description: string | null;
|
|
perks: {
|
|
discordRead: boolean;
|
|
beta: boolean;
|
|
};
|
|
};
|
|
|
|
export type ApiAccountTiers = {
|
|
tiers: TierItem[];
|
|
};
|
|
|
|
export const LoginSchema = z.object({
|
|
username: z.string(),
|
|
password: z.string()
|
|
});
|
|
export type ApiAuthLoginRequest = z.infer<typeof LoginSchema>;
|
|
|
|
export const RegisterSchema = z.object({
|
|
email: z.email(),
|
|
username: z.string(),
|
|
miiName: z.string(),
|
|
password: z.string(),
|
|
captchaResponse: z.string().optional()
|
|
});
|
|
export type ApiAuthRegisterRequest = z.infer<typeof RegisterSchema>;
|
|
|
|
export const AccountUpdateSchema = z.object({
|
|
mii: z.object({
|
|
name: z.string(),
|
|
primary: z.enum(['Y', 'N']),
|
|
data: z.string()
|
|
}).optional(),
|
|
environment: z.enum(['prod', 'test', 'dev']).optional()
|
|
});
|
|
export type ApiAccountUpdateRequest = z.infer<typeof AccountUpdateSchema>;
|
|
|
|
export const ResetPasswordSchema = z.object({
|
|
password: z.string(),
|
|
passwordConfirm: z.string(),
|
|
resetToken: z.string()
|
|
});
|
|
export type ApiAuthResetPasswordRequest = z.infer<typeof ResetPasswordSchema>;
|
|
|
|
export const ForgotPasswordSchema = z.object({
|
|
emailOrPassword: z.string(),
|
|
captchaResponse: z.string().optional()
|
|
});
|
|
export type ApiAuthForgotPasswordRequest = z.infer<typeof ForgotPasswordSchema>;
|
|
|
|
export const CheckoutSchema = z.object({
|
|
priceId: z.string()
|
|
});
|
|
export type ApiAccountCheckoutRequest = z.infer<typeof CheckoutSchema>;
|