Skip to content

Fix production environment to use calendarIdProd from tenantSchema#1134

Closed
Copilot wants to merge 7 commits intomainfrom
copilot/fix-calendar-prod-id-usage
Closed

Fix production environment to use calendarIdProd from tenantSchema#1134
Copilot wants to merge 7 commits intomainfrom
copilot/fix-calendar-prod-id-usage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 2, 2025

Production environment ignored calendarProdId field in tenantSchema, forcing production calendar IDs to be placed in calendarId as a workaround.

Changes

Type definitions

  • Added optional calendarProdId and calendarStagingId fields to Resource and RoomSetting types

tenantSchema API endpoint

  • Maps environment-specific calendar IDs when serving schema to clients
  • In production: uses calendarProdId if available, otherwise falls back to calendarId
  • In staging: uses calendarStagingId if available, otherwise falls back to calendarId
  • In development: uses calendarId

Client components

  • Modified Provider.tsx and SelectRoomPage.tsx to preserve environment-specific calendar ID fields

Implementation

The solution handles calendar ID selection in a single location—the tenantSchema API endpoint—when mapping from Firestore to the response. All downstream code (API endpoints, server utilities, client components) simply uses resource.calendarId without any environment-specific logic.

Usage

// tenantSchema document in Firestore
{
  resources: [
    {
      roomId: 202,
      calendarId: "dev-calendar@example.com",
      calendarStagingId: "staging-calendar@example.com",  // optional
      calendarProdId: "prod-calendar@example.com",        // optional
      // ...
    }
  ]
}

Backward compatible—existing configurations continue working without modification.

Original prompt

This section details on the original issue you should resolve

<issue_title>BUG: Production environment is not using calendarProdId despite being set in tenantSchema</issue_title>
<issue_description>Even though calendarProdId can be configured in the tenantSchema, the production environment is not using this value.
Currently, we are temporarily placing the production calendar ID into calendarId as a workaround.

This needs to be fixed so the production environment correctly references and uses calendarProdId.</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits December 2, 2025 21:03
…nt-specific calendar IDs

Co-authored-by: rlho <5990045+rlho@users.noreply.github.com>
…ific calendar IDs

Co-authored-by: rlho <5990045+rlho@users.noreply.github.com>
…ging

Co-authored-by: rlho <5990045+rlho@users.noreply.github.com>
Co-authored-by: rlho <5990045+rlho@users.noreply.github.com>
Co-authored-by: rlho <5990045+rlho@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix production environment to use calendarProdId Fix production environment to use calendarProdId from tenantSchema Dec 2, 2025
Copilot AI requested a review from rlho December 2, 2025 21:16
@rlho

This comment was marked as resolved.

…apping

Co-authored-by: rlho <5990045+rlho@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 2, 2025

@copilot こんな大掛かりにやらなくても、tenantschemaからroom.calendarIdにマッピングするときにprodの場合だけcalendarProdIdを使うようにすればいいんじゃな��...

その通りです!実装を簡素化しました。tenantSchemaからroom.calendarIdへのマッピング時のみで環境に応じたcalendarIdを選択するようにしました。

Changes in commit e909953:

  • Removed utility function and all API endpoint modifications (12 files reverted)
  • Now handles environment-specific calendar ID selection only in the tenantSchema API endpoint
  • Reduced from 16 files changed to just 5 files (30 lines added vs. 96 before)

All downstream code simply uses resource.calendarId without any environment logic.

@rlho rlho closed this Jan 25, 2026
@rlho rlho deleted the copilot/fix-calendar-prod-id-usage branch February 10, 2026 21:10
@nopivnick nopivnick changed the title Fix production environment to use calendarProdId from tenantSchema Fix production environment to use calendarIdProd from tenantSchema Feb 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Production environment is not using calendarIdProd despite being set in tenantSchema

2 participants