import { AppError } from '../../http/errors' import { presentRenterProfile } from './auth.presenter' import * as repo from './auth.renter.repo' import type { output } from 'zod' import { renterUpdateSchema } from './auth.renter.schemas' type RenterUpdateInput = output export function signupDisabled() { throw new AppError('Renter account creation is disabled. Only company owners can sign in to the platform.', 403, 'renter_signup_disabled') } export function loginDisabled() { throw new AppError('Renter sign-in is disabled. Only company owners can sign in to the platform.', 403, 'renter_login_disabled') } export async function getMe(renterId: string) { const renter = await repo.findRenterProfile(renterId) const savedCompanies = await repo.findSavedCompanies(renter.savedCompanies.map((savedCompany: any) => savedCompany.companyId)) return presentRenterProfile(renter, savedCompanies) } export function updateMe(renterId: string, body: RenterUpdateInput) { return repo.updateRenterProfile(renterId, body) } export async function updateFcmToken(renterId: string, fcmToken: string) { await repo.updateRenterFcmToken(renterId, fcmToken) return { success: true } }