Interface Documentation
Overview
This document describes the interfaces, types, and contracts used in the Absence Management module. These interfaces define the structure of data objects, repository contracts, and service interfaces used throughout the system.
Core Interfaces
IAbsence
The main interface for absence entities, extending the base entity interface.
interface IAbsence extends IBase {
note?: string; // Optional description or notes
start: string; // Start date/time (ISO string)
end: string; // End date/time (ISO string)
entireBusiness?: boolean; // Affects entire business if true
memberIds?: string[]; // Array of member ID strings
members?: IMember[]; // Populated member objects
locations?: ILocation[]; // Affected locations
type: AbsenceTypeEnum; // Type of absence
timeZone: string; // Timezone identifier
meta?: IMeta; // Metadata information
}IAbsenceRepository
Repository interface defining data access operations for absences.
Data Transfer Objects (DTOs)
AbsenceDto
Main DTO for absence data transfer between layers.
Validation Rules:
start: Required string (ISO date format)end: Required string (ISO date format)type: Optional enum value (vacation, holiday, break)entireBusiness: Optional booleanmembers: Optional array of MemberDto objectslocations: Optional array of LocationDto objectstimeZone: Optional stringnote: Optional string
AbsencePaginationDto
DTO for pagination parameters when querying absences.
Enumerations
AbsenceTypeEnum
Defines the types of absences supported by the system.
Values:
vacation: Personal time offholiday: Business holidaysbreak: Short breaks or temporary unavailability
Use Case Interfaces
CreateAbsenceUseCaseParams
GetAbsenceUseCaseParams
GetPagedAbsencesUseCaseParams
UpdateAbsenceUseCaseParams
DeleteAbsenceUseCaseParams
Domain Value Objects
AbsenceSearchCriteria
ISlot
Interface representing a time slot, used in absence conflict detection.
Command and Query Interfaces
Commands
CreateAbsenceCommand
UpdateAbsenceCommand
DeleteAbsenceCommand
Queries
GetAbsenceByIdQuery
GetPagedAbsencesQuery
Message Interfaces
Event Messages
AbsenceCreatedMessage
AbsenceUpdatedMessage
AbsenceDeletedMessage
WebSocket Messages
AbsenceCreatedWsMessage
AbsenceUpdatedWsMessage
AbsenceDeletedWsMessage
Cache Interfaces
AbsenceCacheKeys
Repository Filter Interfaces
GetBusySlotsWithFilterParams
Context Interfaces
TenantActorContext
Validation and Error Interfaces
AbsenceDomainError
AbsenceErrorCode
Integration Interfaces
IMessageQueueService
IWebSocketGateway
Usage Guidelines
DTO Validation: Always validate DTOs using class-validator decorators
Type Safety: Use TypeScript interfaces to ensure type safety across layers
Error Handling: Implement proper error handling using domain-specific exceptions
Message Contracts: Maintain consistent message interfaces for event-driven communication
Cache Keys: Use enum-defined cache keys for consistent cache management
Context Propagation: Always pass TenantActorContext for proper authorization and tenancy
Interface Evolution
When modifying interfaces:
Consider backward compatibility
Use optional properties for new fields
Update validation rules accordingly
Document breaking changes
Version the API if necessary
Last updated
Was this helpful?