Files
hotelsync/backend/src/types.ts

72 lines
1.6 KiB
TypeScript

export interface JwtPayload {
sub: string // user.id (UUID)
email: string
name: string
role: 'hotel_admin' | 'manager' | 'housekeeper' | 'super_admin' | 'receptionist' | 'accountant' | 'security' | 'technician' | 'agent'
hotelId: string | null
hotelSlug: string | null
}
export interface Hotel {
id: string
name: string
slug: string
plan: 'starter' | 'pro' | 'enterprise'
timezone: string
currency: string
created_at: string
updated_at: string
}
export interface Room {
id: string
hotel_id: string
number: string
type: string
floor: number
capacity: number
price_per_night: number
status: 'clean' | 'dirty' | 'maintenance' | 'out_of_order'
amenities: string[]
notes: string | null
created_at: string
}
export interface Booking {
id: string
hotel_id: string
room_id: string
guest_name: string
guest_email: string | null
guest_phone: string | null
check_in: string
check_out: string
adults: number
children: number
status: 'confirmed' | 'checked_in' | 'checked_out' | 'cancelled' | 'no_show'
source: 'direct' | 'booking_com' | 'airbnb' | 'expedia' | 'vrbo'
total_amount: number | null
notes: string | null
external_id: string | null
created_at: string
updated_at: string
}
// Fastify JWT augmentation
declare module '@fastify/jwt' {
interface FastifyJWT {
payload: JwtPayload
user: JwtPayload
}
}
// Fastify instance augmentation
declare module 'fastify' {
interface FastifyInstance {
authenticate: (
request: import('fastify').FastifyRequest,
reply: import('fastify').FastifyReply,
) => Promise<void>
}
}