Skip to content

Commit

Permalink
Merge pull request #3415 from artsy/staging
Browse files Browse the repository at this point in the history
Deploy
  • Loading branch information
dzucconi authored Sep 15, 2021
2 parents 01852c8 + 76ca5ea commit f830466
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 161 deletions.
19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,8 @@
"author": "Art.sy Inc",
"license": "MIT",
"dependencies": {
"@artsy/morgan": "^1.0.2",
"@artsy/xapp": "1.0.6",
"@babel/cli": "7.14.8",
"@babel/core": "7.15.0",
"@babel/node": "7.14.9",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.14.5",
"@babel/plugin-proposal-optional-chaining": "7.14.5",
"@babel/preset-env": "7.15.0",
"@babel/preset-typescript": "7.15.0",
"@graphql-tools/delegate": "6.0.10",
"@sentry/node": "5.18.1",
"accounting": "0.4.1",
Expand All @@ -54,11 +48,10 @@
"apollo-link-http": "1.5.4",
"apollo-server-express": "2.4.8",
"appmetrics": "5.1.1",
"artsy-morgan": "git://github.com/artsy/artsy-morgan.git",
"babel-plugin-module-resolver": "4.1.0",
"basic-auth": "1.1.0",
"bluebird": "3.5.1",
"body-parser": "1.18.2",
"chalk": "^4.1.2",
"compression": "1.7.2",
"core-js": "2.6.12",
"cors": "2.8.4",
Expand Down Expand Up @@ -113,6 +106,13 @@
"devDependencies": {
"@artsy/express-reloadable": "1.5.0",
"@artsy/update-repo": "0.4.0",
"@babel/cli": "7.14.8",
"@babel/core": "7.15.0",
"@babel/node": "7.14.9",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.14.5",
"@babel/plugin-proposal-optional-chaining": "7.14.5",
"@babel/preset-env": "7.15.0",
"@babel/preset-typescript": "7.15.0",
"@graphql-inspector/core": "1.27.0",
"@heroku/foreman": "2.0.2",
"@types/express-rate-limit": "2.9.3",
Expand All @@ -127,6 +127,7 @@
"@typescript-eslint/eslint-plugin": "4.8.1",
"@typescript-eslint/parser": "4.8.1",
"babel-jest": "24.8.0",
"babel-plugin-module-resolver": "4.1.0",
"danger": "7.0.14",
"deep-equal": "1.0.1",
"diff": "4.0.1",
Expand Down
10 changes: 9 additions & 1 deletion src/data/complete.queryMap.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import express from "express"
import { schema as schemaV1 } from "./schema/v1"
import { schema as schemaV2 } from "./schema/v2"
import moment from "moment-timezone"
import morgan from "artsy-morgan"
import morgan from "@artsy/morgan"
import { fetchPersistedQuery } from "./lib/fetchPersistedQuery"
import {
fetchLoggerSetup,
Expand Down
22 changes: 11 additions & 11 deletions src/schema/v2/__tests__/fair.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,17 @@ describe("Fair", () => {
slug: "aqua-art-miami-2018",
name: "Aqua Art Miami 2018",
exhibitorsGroupedByName: [
{
letter: "A",
exhibitors: [
{
name: "ArtHelix Gallery",
slug: "arthelix-gallery",
partnerID: "1234567890",
profileID: "arthelix-gallery",
},
],
},
{
letter: "#",
exhibitors: [
Expand All @@ -338,17 +349,6 @@ describe("Fair", () => {
},
],
},
{
letter: "A",
exhibitors: [
{
name: "ArtHelix Gallery",
slug: "arthelix-gallery",
partnerID: "1234567890",
profileID: "arthelix-gallery",
},
],
},
],
},
})
Expand Down
10 changes: 9 additions & 1 deletion src/schema/v2/fair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ export const FairType = new GraphQLObjectType<any, ResolverContext>({
partner_id: string
}
const SPECIAL_GROUP_KEY = "#"
const LETTERS_ORDER = "ABCDEFGHIJKLMNOPQRSTUVWXYZ#"
const exhibitor_groups: {
[letter: string]: {
letter: string
Expand Down Expand Up @@ -433,7 +434,14 @@ export const FairType = new GraphQLObjectType<any, ResolverContext>({
]
}

return Object.values(exhibitor_groups)
const values = Object.values(exhibitor_groups).sort((asc, desc) => {
return (
LETTERS_ORDER.indexOf(asc.letter) -
LETTERS_ORDER.indexOf(desc.letter)
)
})

return values
})
},
},
Expand Down
38 changes: 38 additions & 0 deletions src/schema/v2/home/__tests__/home_page_artwork_modules.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable promise/always-return */
import { map, find } from "lodash"
import moment from "moment"
import { runAuthenticatedQuery } from "schema/v2/test/utils"

describe("HomePageArtworkModules", () => {
Expand Down Expand Up @@ -355,4 +356,41 @@ describe("HomePageArtworkModules", () => {
expect(keys).toEqual(["followed_galleries"])
})
})

it("returns first running fair", async () => {
const query = `
{
homePage {
artworkModules(
maxFollowedGeneRails: -1
include: [CURRENT_FAIRS]
) {
key
title
}
}
}`

context.fairsLoader = () =>
Promise.resolve({
body: [
{
start_at: moment().add(1, "day"),
end_at: moment().add(10, "day"),
has_homepage_section: true,
name: "fair-1",
},
{
start_at: moment().subtract(2, "day"),
end_at: moment().add(2, "day"),
has_homepage_section: true,
name: "fair-2",
},
],
})

const { homePage } = await runAuthenticatedQuery(query, context)

expect(homePage.artworkModules[0].title).toBe("fair-1")
})
})
2 changes: 2 additions & 0 deletions src/schema/v2/home/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ export const featuredFair = (
return fairsLoader({
size: 5,
active: true,
sort: "-start_at",
status: "running",
has_homepage_section: true,
}).then(({ body: fairs }) => {
if (fairs.length) {
Expand Down
Loading

0 comments on commit f830466

Please sign in to comment.