import {
ServiceApiContract,
ServiceDependencies,
} from "@ethicdevs/react-monolith";
import { FastifyRequest } from "fastify";
import { User } from "@prisma/client";
import type { CryptoServiceAPI } from "../crypto/types";
export interface AuthServiceCreateUserDTO {
emailAddress: string;
username: string;
password: string;
}
export interface AuthServiceAPI extends ServiceApiContract {
createUser(dto: AuthServiceCreateUserDTO): Promise<User>;
isExistingUsername(username: string): Promise<boolean>;
isExistingEmailAddress(emailAddress: string): Promise<boolean>;
isUserLoginAllowed(
emailAddress: string,
password: string
): Promise<[boolean, User | null]>;
}
export interface AuthServiceDeps extends ServiceDependencies {
cryptoService: CryptoServiceAPI;
request: FastifyRequest;
}