-
Notifications
You must be signed in to change notification settings - Fork 0
Description
As a developer, I want to specify which GitHub ProjectV2 board reminders should query from, so that we can support multiple projects in the future.
🧠 Context
Currently, the projectV2Items
GraphQL query hardcodes the project number to 18
:
- See:
src/github/graphql/projectV2Items.ts
This means reminder logic is tightly coupled to a single project board. To support multiple GitHub projects (e.g. for different teams, terms, or categories), we need to pass in the project number dynamically via query variables.
The query is executed in
src/infrastructure/github/functions/fetchProjectItems.ts
.
We want to be able to pass in a project ID from this function so that reminders can be scoped per project.
There is no need to install a new GraphQL client — we already support query variables elsewhere in the codebase.
See src/infrastructure/github/functions/updateProjectItemAssignee.ts
for an example of how variables are passed.
🛠️ Implementation Plan
-
Move Default Project Number to a Constant
-
Create a constant named
DEFAULT_PROJECT_NUMBER
insrc/infrastructure/github/constants.ts
:export const DEFAULT_PROJECT_NUMBER = 18;
-
-
Update the GraphQL Query
- In
src/github/graphql/projectV2Items.ts
, replace the hardcodednumber: 18
with a$projectNumber
variable - Declare
$projectNumber
in the query’s variable block and use it in theprojectV2(number: $projectNumber)
field
- In
-
Update Query Invocation
-
In
fetchProjectItems.ts
, accept aprojectNumber
parameter (with a fallback toDEFAULT_PROJECT_NUMBER
) -
Inject this variable into the GraphQL request:
const response = await axios.post( "https://api.github.com/graphql", { query: PROJECT_V2_ITEMS, variables: { projectNumber: projectNumber ?? DEFAULT_PROJECT_NUMBER, }, }, { headers: { Authorization: `Bearer ${TOKEN}` } } );
-
-
Follow Existing Patterns
- Refer to
updateProjectItemAssignee.ts
for how query variables are structured and passed into the request body
- Refer to
-
Write Tests
- Write unit tests for
fetchProjectItems
to confirm it supports variable input - Use a mock query to verify the correct value is passed into the request body
- Write unit tests for
✅ Acceptance Criteria
-
DEFAULT_PROJECT_NUMBER
is defined insrc/infrastructure/github/constants.ts
-
projectV2Items
query insrc/github/graphql/projectV2Items.ts
uses a$projectNumber
variable instead of hardcoding18
-
fetchProjectItems.ts
accepts aprojectNumber
parameter and injects it into the GraphQL request, defaulting toDEFAULT_PROJECT_NUMBER
- A unit test verifies that
projectNumber
can be dynamically passed intofetchProjectItems
- Reminder logic is no longer tied to a single project board
Metadata
Metadata
Assignees
Labels
Type
Projects
Status