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 boolean

  • members: Optional array of MemberDto objects

  • locations: Optional array of LocationDto objects

  • timeZone: Optional string

  • note: 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 off

  • holiday: Business holidays

  • break: 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

  1. DTO Validation: Always validate DTOs using class-validator decorators

  2. Type Safety: Use TypeScript interfaces to ensure type safety across layers

  3. Error Handling: Implement proper error handling using domain-specific exceptions

  4. Message Contracts: Maintain consistent message interfaces for event-driven communication

  5. Cache Keys: Use enum-defined cache keys for consistent cache management

  6. Context Propagation: Always pass TenantActorContext for proper authorization and tenancy

Interface Evolution

When modifying interfaces:

  1. Consider backward compatibility

  2. Use optional properties for new fields

  3. Update validation rules accordingly

  4. Document breaking changes

  5. Version the API if necessary

Last updated

Was this helpful?