141 lines
2.6 KiB
TypeScript
141 lines
2.6 KiB
TypeScript
import { InputType, Field, ObjectType } from 'type-graphql';
|
|
import { SettingsTypeEnum } from '@src/accounts/account.components';
|
|
import { AvailableTranslation } from '@src/__components/components';
|
|
|
|
@InputType()
|
|
export class LoginInput {
|
|
@Field()
|
|
email: string;
|
|
@Field()
|
|
password: string;
|
|
}
|
|
|
|
@InputType()
|
|
export class LinkEmailInput extends LoginInput {
|
|
@Field()
|
|
idToken: string;
|
|
}
|
|
|
|
@InputType()
|
|
export class ResetPasswordInput {
|
|
@Field()
|
|
email: string;
|
|
}
|
|
|
|
@InputType()
|
|
export class NewPasswordInput {
|
|
@Field()
|
|
oldPassword: string;
|
|
|
|
@Field()
|
|
newPassword: string;
|
|
|
|
@Field()
|
|
newPasswordConfirmation: string;
|
|
}
|
|
|
|
@InputType()
|
|
export class NewEmailInput {
|
|
@Field()
|
|
newEmail: string;
|
|
}
|
|
|
|
@InputType()
|
|
export class SMSVerifInput {
|
|
@Field()
|
|
email: string;
|
|
@Field()
|
|
emailCode: string;
|
|
@Field()
|
|
recaptchaToken: string;
|
|
}
|
|
|
|
export class SMSVerif {
|
|
@Field()
|
|
phoneNumber: string;
|
|
@Field()
|
|
recaptchaToken: string;
|
|
}
|
|
|
|
@InputType('SettingsInput')
|
|
@ObjectType()
|
|
export class SettingsComponent {
|
|
@Field(() => SettingsTypeEnum)
|
|
type: SettingsTypeEnum;
|
|
|
|
@Field({ nullable: true })
|
|
email?: boolean;
|
|
|
|
@Field({ nullable: true })
|
|
pushNotifications?: boolean;
|
|
|
|
@Field({ nullable: true })
|
|
sms?: boolean;
|
|
}
|
|
|
|
@InputType()
|
|
export class CodeRequestInput {
|
|
@Field({ nullable: true })
|
|
firstName?: string;
|
|
@Field({ nullable: true })
|
|
lastName?: string;
|
|
@Field()
|
|
email: string;
|
|
|
|
@Field({ nullable: true })
|
|
phoneNumber?: string;
|
|
|
|
@Field(() => AvailableTranslation, { nullable: true })
|
|
language?: AvailableTranslation;
|
|
}
|
|
|
|
@InputType()
|
|
export class CodeConfirmInput {
|
|
@Field()
|
|
email: string;
|
|
@Field()
|
|
code: number;
|
|
}
|
|
|
|
@ObjectType()
|
|
export class CodeRequest {
|
|
@Field()
|
|
code: number;
|
|
@Field()
|
|
expiresAt: Date;
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/class-name-casing
|
|
export class googleAuthToken {
|
|
refresh_token: string;
|
|
access_token: string;
|
|
scope: string;
|
|
token_type: string;
|
|
expiry_date: number;
|
|
}
|
|
|
|
export class OAuthTokens {
|
|
googleTokens: googleAuthToken;
|
|
}
|
|
|
|
export class SecurityStatusComponent {
|
|
emailVerified: boolean;
|
|
phoneVerified: boolean;
|
|
}
|
|
|
|
export enum SecurityLevelEnum {
|
|
'nothing' = 'nothing', // Nothing
|
|
'email-only' = 'email-only', // Only Email
|
|
'email-phone' = 'email-phone', // Email and phone
|
|
'email-mfa' = 'email-mfa', // Email and other authenticator
|
|
}
|
|
// @ObjectType()
|
|
// export class ProfileCompletion {
|
|
// @Field()
|
|
// type: AccountTypeEnum;
|
|
// @Field()
|
|
// completed: boolean;
|
|
// @Field()
|
|
// currentStep: string;
|
|
// }
|