mirror of
https://github.com/marcogll/AnchorOS.git
synced 2026-03-15 11:24:26 +00:00
docs: add comprehensive code comments, update README and TASKS, create training and troubleshooting guides
- Add JSDoc comments to API routes and business logic functions - Update README.md with Phase 2 status and deployment/production notes - Enhance TASKS.md with estimated timelines and dependencies - Create docs/STAFF_TRAINING.md for team onboarding - Create docs/CLIENT_ONBOARDING.md for customer experience - Create docs/OPERATIONAL_PROCEDURES.md for daily operations - Create docs/TROUBLESHOOTING.md for common setup issues - Fix TypeScript errors in hq/page.tsx
This commit is contained in:
@@ -14,6 +14,9 @@ type AuthContextType = {
|
||||
|
||||
const AuthContext = createContext<AuthContextType | undefined>(undefined)
|
||||
|
||||
/**
|
||||
* AuthProvider component that manages authentication state and provides it to children.
|
||||
*/
|
||||
export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
const [user, setUser] = useState<User | null>(null)
|
||||
const [session, setSession] = useState<Session | null>(null)
|
||||
@@ -72,6 +75,9 @@ export function AuthProvider({ children }: { children: ReactNode }) {
|
||||
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>
|
||||
}
|
||||
|
||||
/**
|
||||
* useAuth hook that returns the current authentication context.
|
||||
*/
|
||||
export function useAuth() {
|
||||
const context = useContext(AuthContext)
|
||||
if (context === undefined) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Types based on SalonOS database schema
|
||||
|
||||
/** User roles in the system */
|
||||
export type UserRole = 'admin' | 'manager' | 'staff' | 'artist' | 'customer' | 'kiosk'
|
||||
export type CustomerTier = 'free' | 'gold' | 'black' | 'VIP'
|
||||
export type BookingStatus = 'pending' | 'confirmed' | 'cancelled' | 'completed' | 'no_show'
|
||||
@@ -7,6 +8,7 @@ export type InvitationStatus = 'pending' | 'used' | 'expired'
|
||||
export type ResourceType = 'station' | 'room' | 'equipment'
|
||||
export type AuditAction = 'create' | 'update' | 'delete' | 'reset_invitations' | 'payment' | 'status_change'
|
||||
|
||||
/** Represents a salon location with timezone and contact info */
|
||||
export interface Location {
|
||||
id: string
|
||||
name: string
|
||||
@@ -100,6 +102,7 @@ export interface Invitation {
|
||||
inviter?: Customer
|
||||
}
|
||||
|
||||
/** Represents a customer booking with service, staff, and resource assignments */
|
||||
export interface Booking {
|
||||
id: string
|
||||
short_id: string
|
||||
|
||||
@@ -3,8 +3,10 @@ import { createClient } from '@supabase/supabase-js'
|
||||
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!
|
||||
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
||||
|
||||
// Public Supabase client for client-side operations
|
||||
export const supabase = createClient(supabaseUrl, supabaseAnonKey)
|
||||
|
||||
// Admin Supabase client for server-side operations with service role
|
||||
export const supabaseAdmin = createClient(
|
||||
supabaseUrl,
|
||||
process.env.SUPABASE_SERVICE_ROLE_KEY!,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { type ClassValue, clsx } from "clsx"
|
||||
import { twMerge } from "tailwind-merge"
|
||||
|
||||
/**
|
||||
* cn function that merges class names using clsx and tailwind-merge.
|
||||
*/
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { supabaseAdmin } from '@/lib/supabase/client'
|
||||
|
||||
/**
|
||||
* generateShortId function that generates a unique short ID using Supabase RPC.
|
||||
*/
|
||||
export async function generateShortId(): Promise<string> {
|
||||
const { data, error } = await supabaseAdmin.rpc('generate_short_id')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user