Skip to main content

Overview

BarberApp uses strongly-typed TypeScript interfaces to define its domain models. All models are located in src/app/core/models/ and follow Angular’s Clean Architecture principles.

User Models

UserBase

The base interface for all user types in the system. Location: src/app/core/models/user-base.model.ts:3
interface UserBase {
  id: string;
  firstName: string;
  lastName: string;
  dni: string;
  sex: Sex;
  birthDate: Date;
  email: string;
  password?: string;
  phone?: string;
  profilePictureUrl: string;
  registrationDate: Date;
  role: UserRoles;
  status: UserStatus;
}
id
string
required
Unique identifier for the user
firstName
string
required
User’s first name
lastName
string
required
User’s last name
dni
string
required
National identity document number (DNI)
sex
Sex
required
User’s sex: male, female, other, or unspecified
birthDate
Date
required
User’s date of birth
email
string
required
User’s email address (used for authentication)
password
string
User’s password (optional, not stored in Firestore)
phone
string
User’s phone number
profilePictureUrl
string
required
Cloudinary URL for the user’s profile picture
registrationDate
Date
required
When the user registered in the system
role
UserRoles
required
User’s role: admin, client, specialist, or user
status
UserStatus
required
Account status: active, inactive, or disabled

Client

Extends UserBase with client-specific fields. Location: src/app/core/models/client.model.ts:3
interface Client extends UserBase {
  height?: number;
  weight?: number;
}
height
number
Client’s height in centimeters
weight
number
Client’s weight in kilograms

Specialist

Extends UserBase with specialist-specific fields. Location: src/app/core/models/specialist.model.ts:3
interface Specialist extends UserBase {
  specialties: Specialty[];
  availability: Availability[];
  availabilityName: string;
}
specialties
Specialty[]
required
Array of specialties the specialist can perform
availability
Availability[]
required
Weekly availability schedule for appointments
availabilityName
string
required
Name of the availability preset (from AVAILABILITY_PRESETS_OPTIONS)

Appointment Model

Appointment

Core model representing a scheduled appointment between a client and a specialist. Location: src/app/core/models/appointment.model.ts:4
interface Appointment {
  id: string;
  clientId: string;
  specialistId: string;
  specialistFirstName: string;
  specialistLastName: string;
  clientFirstName: string;
  clientLastName: string;
  status: AppointmentStatus;
  date: Date;
  specialty: Specialty;
  creationDate: Date;
  cancellationReason?: string;
  canceledBy?: UserRoles;
  diagnosis?: Diagnosis;
  rating?: Rating;
}
id
string
required
Unique appointment identifier (generated with AutoId.newId())
clientId
string
required
ID of the client who booked the appointment
specialistId
string
required
ID of the specialist performing the service
specialistFirstName
string
required
Denormalized specialist first name for quick display
specialistLastName
string
required
Denormalized specialist last name for quick display
clientFirstName
string
required
Denormalized client first name for quick display
clientLastName
string
required
Denormalized client last name for quick display
status
AppointmentStatus
required
Current status: pending, canceled, or completed
date
Date
required
Scheduled date and time of the appointment
specialty
Specialty
required
The specialty/service being performed
creationDate
Date
required
When the appointment was created
cancellationReason
string
Reason provided when appointment was canceled
canceledBy
UserRoles
Who canceled the appointment: client or specialist
diagnosis
Diagnosis
Medical diagnosis added after completion
rating
Rating
Client rating provided after completion

Supporting Models

Specialty

Represents a service or specialty offered by specialists. Location: src/app/core/models/specialty.model.ts:1
interface Specialty {
  id: string;
  name: string;
  description: string;
  active: boolean;
}
id
string
required
Unique specialty identifier
name
string
required
Display name of the specialty
description
string
required
Detailed description of the specialty
active
boolean
required
Whether this specialty is currently available for booking

Availability

Defines a specialist’s weekly availability schedule. Location: src/app/core/models/availability.model.ts:1
interface Availability {
  day: WeekDay;
  intervals: TimeInterval[];
}

interface TimeInterval {
  start: string;
  end: string;
}

type WeekDay = 
  | 'monday' 
  | 'tuesday' 
  | 'wednesday' 
  | 'thursday' 
  | 'friday' 
  | 'saturday' 
  | 'sunday' 
  | 'unknown';
day
WeekDay
required
Day of the week
intervals
TimeInterval[]
required
Array of time intervals when the specialist is available
start
string
required
Start time in HH:MM format (e.g., “09:00”)
end
string
required
End time in HH:MM format (e.g., “17:00”)

Diagnosis

Medical diagnosis information added to completed appointments. Location: src/app/core/models/diagnosis.model.ts:1
interface Diagnosis {
  details: string;
  anotations?: string;
}
details
string
required
Main diagnosis details
anotations
string
Additional notes or observations

Rating

Client rating for a completed appointment. Location: src/app/core/models/rating.model.ts:1
interface Rating {
  score: AllowedScore;
  comment?: string;
}

type AllowedScore = 1 | 2 | 3 | 4 | 5;
score
AllowedScore
required
Rating score from 1 to 5 stars
comment
string
Optional comment explaining the rating

Enums

AppointmentStatus

enum AppointmentStatus {
  PENDING = 'pending',
  CANCELED = 'canceled',
  COMPLETED = 'completed',
}

UserRoles

enum UserRoles {
  ADMIN = 'admin',
  CLIENT = 'client',
  SPECIALIST = 'specialist',
  USER = 'user',
}

UserStatus

enum UserStatus {
  ACTIVE = 'active',
  INACTIVE = 'inactive',
  DISABLED = 'disabled',
}

Sex

enum Sex {
  MALE = 'male',
  FEMALE = 'female',
  OTHER = 'other',
  UNSPECIFIED = 'unspecified',
}
All enums are located in src/app/core/enums/ and are exported from the main index file.

Build docs developers (and LLMs) love