Skip to content

[BE-39] Add Workspace Opening Hours Validator with multi-error reporting #978

@devwums

Description

@devwums

Problem

No validation exists for workspace opening hours configuration. Workspaces can be saved with contradictory schedules (e.g., close time before open time, duplicate days) without any error.

Proposed Solution

Create backend/cntr/opening-hours.validator.ts exporting OpeningHoursEntry interface ({ dayOfWeek: 0|1|2|3|4|5|6, openTime: string, closeTime: string, isClosed: boolean }), ValidationResult interface ({ isValid: boolean, errors: string[] }), and validateOpeningHours(hours: OpeningHoursEntry[]): ValidationResult. Checks: valid HH:MM format, closeTime > openTime (unless isClosed), no duplicate dayOfWeek. All implementation must live inside backend/cntr/.

Acceptance Criteria

  • File at backend/cntr/opening-hours.validator.ts
  • Validates HH:MM format with a regex
  • Rejects closeTime <= openTime when isClosed = false
  • Rejects duplicate dayOfWeek entries
  • Returns ALL errors at once (not fail-fast)
  • Unit test at backend/cntr/opening-hours.validator.spec.ts

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions