Skip to content

Commit

Permalink
feat: expose Gravity's viewingRoomsConnection to replace deprecated v…
Browse files Browse the repository at this point in the history
…iewingRooms query (#6030)
  • Loading branch information
nickskalkin authored Sep 20, 2024
1 parent 55db42f commit a063615
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 28 deletions.
42 changes: 21 additions & 21 deletions _schemaV2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -15963,27 +15963,6 @@ type Query {
last: Int
userId: ID!
): UserAddressConnection

# List viewing rooms
_unused_gravity_viewingRoomsConnection(
# Returns the elements in the list that come after the specified cursor.
after: String

# Returns the elements in the list that come before the specified cursor.
before: String
featured: Boolean

# Returns the first _n_ elements from the list.
first: Int
ids: [ID!]

# Returns the last _n_ elements from the list.
last: Int
partnerID: ID

# Returns only viewing rooms with these statuses
statuses: [ViewingRoomStatusEnum!] = [live]
): ViewingRoomsConnection
admin: Admin

# Find an agreement by ID
Expand Down Expand Up @@ -17257,6 +17236,27 @@ type Query {
# Returns only viewing rooms with these statuses
statuses: [ViewingRoomStatusEnum!] = [live]
): ViewingRoomConnection @deprecated(reason: "Use viewingRoomsConnection")

# List viewing rooms
viewingRoomsConnection(
# Returns the elements in the list that come after the specified cursor.
after: String

# Returns the elements in the list that come before the specified cursor.
before: String
featured: Boolean

# Returns the first _n_ elements from the list.
first: Int
ids: [ID!]

# Returns the last _n_ elements from the list.
last: Int
partnerID: ID

# Returns only viewing rooms with these statuses
statuses: [ViewingRoomStatusEnum!] = [live]
): ViewingRoomsConnection
}

type Quiz {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/stitching/gravity/__tests__/stitching.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ describe("gravity/stitching", () => {
expect(info.mergeInfo.delegateToSchema).toHaveBeenCalledWith({
args: { partnerID: "partner-id", first: 2 },
operation: "query",
fieldName: "_unused_gravity_viewingRoomsConnection",
fieldName: "viewingRoomsConnection",
schema: expect.anything(),
context: expect.anything(),
info: expect.anything(),
Expand Down Expand Up @@ -497,7 +497,7 @@ describe("gravity/stitching", () => {
expect(info.mergeInfo.delegateToSchema).toHaveBeenCalledWith({
args: { ids: ["view-lots-of-cats-id"] },
operation: "query",
fieldName: "_unused_gravity_viewingRoomsConnection",
fieldName: "viewingRoomsConnection",
schema: expect.anything(),
context: expect.anything(),
info: expect.anything(),
Expand Down
7 changes: 6 additions & 1 deletion src/lib/stitching/gravity/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import {
} from "graphql-tools"
import { readFileSync } from "fs"

const rootFieldsAllowList = ["agreement", "viewingRoom", "viewingRooms"]
const rootFieldsAllowList = [
"agreement",
"viewingRoom",
"viewingRooms",
"viewingRoomsConnection",
]

export const executableGravitySchema = () => {
const gravityTypeDefs = readFileSync("src/data/gravity.graphql", "utf8")
Expand Down
8 changes: 4 additions & 4 deletions src/lib/stitching/gravity/v2/stitching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export const gravityStitchingEnvironment = (
return info.mergeInfo.delegateToSchema({
schema: gravitySchema,
operation: "query",
fieldName: "_unused_gravity_viewingRoomsConnection",
fieldName: "viewingRoomsConnection",
args: {
partnerID,
...args,
Expand All @@ -203,7 +203,7 @@ export const gravityStitchingEnvironment = (
return info.mergeInfo.delegateToSchema({
schema: gravitySchema,
operation: "query",
fieldName: "_unused_gravity_viewingRoomsConnection",
fieldName: "viewingRoomsConnection",
args: {
ids,
},
Expand Down Expand Up @@ -428,7 +428,7 @@ export const gravityStitchingEnvironment = (
return info.mergeInfo.delegateToSchema({
schema: gravitySchema,
operation: "query",
fieldName: "_unused_gravity_viewingRoomsConnection",
fieldName: "viewingRoomsConnection",
args: {
...args,
ids,
Expand All @@ -449,7 +449,7 @@ export const gravityStitchingEnvironment = (
return info.mergeInfo.delegateToSchema({
schema: gravitySchema,
operation: "query",
fieldName: "_unused_gravity_viewingRoomsConnection",
fieldName: "viewingRoomsConnection",
args,
context,
info,
Expand Down

0 comments on commit a063615

Please sign in to comment.