Back to all reviewers

Configuration access patterns

calcom/cal.com
Based on 4 comments
TSX

Ensure configuration data is accessed through proper service layers with dependency injection rather than direct database calls in presentation components. Configuration settings should be retrieved via dedicated repository classes or service methods, not through direct Prisma interactions in getServerSideProps or component logic.

Configurations TSX

Reviewer Prompt

Ensure configuration data is accessed through proper service layers with dependency injection rather than direct database calls in presentation components. Configuration settings should be retrieved via dedicated repository classes or service methods, not through direct Prisma interactions in getServerSideProps or component logic.

This pattern improves testability, maintainability, and follows proper separation of concerns. Configuration access should be abstracted behind service interfaces that can be easily mocked and tested.

Example of what to avoid:

// Bad: Direct Prisma call in getServerSideProps
const teamSettings = await prisma.team.findUnique({
  where: { id: teamId },
  select: {
    mandatoryCancellationReasonForHost: true,
    mandatoryCancellationReasonForAttendee: true,
  },
});

Example of proper approach:

// Good: Use service layer with dependency injection
const teamSettings = await teamConfigurationService.getTeamCancellationSettings(teamId);

Additionally, avoid hardcoded configuration values like !true and instead use proper boolean constants or configuration objects that clearly express intent and can be easily modified.

4
Comments Analyzed
TSX
Primary Language
Configurations
Category

Source Discussions