Skip to content

feat(definitions): add first day of the week field #1561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/v3/definition/congregation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ export type CongSettingsType = {
responsabilities?: string;
last_backup: string;
group_publishers_sort?: string;
first_day_of_the_week?: string;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Potential redundancy with existing week start property.

The addition of first_day_of_the_week?: string appears to overlap with the existing week_start_sunday?: string property at line 159. Consider:

  1. Clarifying the distinction between these properties
  2. Using a more specific type (enum or union type) rather than string for better type safety
  3. Adding documentation to explain the expected values and format
+  /** 
+   * Defines the first day of the week for the congregation.
+   * Possible values: "sunday", "monday", etc.
+   */
   first_day_of_the_week?: string;

🏁 Script executed:

#!/bin/bash
# Check for usage of the existing week_start_sunday property
echo "Checking for usage of week_start_sunday property..."
rg "week_start_sunday" -A 2 -B 2

Length of output: 1095


Consolidate week‐start properties

There’s already a week_start_sunday?: string in:

  • src/v3/definition/congregation.ts (line 159)
  • src/v3/classes/Congregation.ts
  • src/v3/services/firebase/congregations.ts

Introducing first_day_of_the_week?: string overlaps with that. To avoid confusion:

• Define a strict union (or enum) for weekdays:

export type Weekday =
  | 'sunday'
  | 'monday'
  | 'tuesday'
  | 'wednesday'
  | 'thursday'
  | 'friday'
  | 'saturday';

• Replace both props with a single field:

- week_start_sunday?: string;
- first_day_of_the_week?: string;
+ /**
+  * First day of the week for the congregation.
+  * Allowed values: 'sunday', 'monday', …, 'saturday'.
+  */
+ first_day_of_the_week?: Weekday;

• Update all references in:

  • src/v3/definition/congregation.ts
  • src/v3/classes/Congregation.ts
  • src/v3/services/firebase/congregations.ts

This will improve type safety and clarify intent.

};

export type BackupData = {
Expand Down