Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion apis/api-gateway/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2199,7 +2199,7 @@ type UserRole @join__type(graph: API_JOURNEYS, key: "id") @join__type(graph: AP
roles: [Role!]
}

type AuthenticatedUser @join__type(graph: API_JOURNEYS, key: "id", extension: true) @join__type(graph: API_USERS, key: "id") {
type AuthenticatedUser @join__type(graph: API_JOURNEYS, key: "id", extension: true) @join__type(graph: API_JOURNEYS_MODERN, key: "id", extension: true) @join__type(graph: API_USERS, key: "id") {
id: ID!
firstName: String! @join__field(graph: API_USERS)
lastName: String @join__field(graph: API_USERS)
Expand Down
7 changes: 7 additions & 0 deletions apis/api-journeys-modern/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ interface Action {
parentBlock: Block!
}

type AuthenticatedUser
@key(fields: "id")
@extends
{
id: ID! @external
}

interface Block {
id: ID!
journeyId: ID!
Expand Down
2 changes: 1 addition & 1 deletion apis/api-journeys-modern/src/schema/user/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import './user'

export { UserRef } from './user'
export { AuthenticatedUserRef, UserRef } from './user'
14 changes: 14 additions & 0 deletions apis/api-journeys-modern/src/schema/user/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,17 @@ UserRef.implement({
// No additional fields needed - this is just the external reference
})
})

// Define the federated AuthenticatedUser type reference - this should only be defined once
export const AuthenticatedUserRef = builder.externalRef(
'AuthenticatedUser',
builder.selection<{ id: string }>('id')
)

// Implement the external fields for the AuthenticatedUser type
AuthenticatedUserRef.implement({
externalFields: (t) => ({ id: t.id({ nullable: false }) }),
fields: (t) => ({
// No additional fields needed - this is just the external reference
})
})