Skip to content

Commit

Permalink
prettier formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
drewvolz committed Nov 25, 2024
1 parent 9a1269e commit 435c7e3
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 33 deletions.
24 changes: 15 additions & 9 deletions source/ccci-stolaf-college/v1/a-z.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ const AllAboutOlafExtraAzResponseSchema = z.object({
),
})

const getOlafAtoZ = mem(async () => {
let url = 'https://wp.stolaf.edu/wp-json/site-data/sidebar/a-z'
const response = await get(url)
return StOlafAzResponseSchema.parse(await response.json())
}, {maxAge: ONE_DAY})
const getOlafAtoZ = mem(
async () => {
let url = 'https://wp.stolaf.edu/wp-json/site-data/sidebar/a-z'
const response = await get(url)
return StOlafAzResponseSchema.parse(await response.json())
},
{maxAge: ONE_DAY},
)

const getPagesAtoZ = mem(async () => {
const response = await get(GH_PAGES('a-to-z.json'))
return AllAboutOlafExtraAzResponseSchema.parse(await response.json())
}, {maxAge: ONE_DAY})
const getPagesAtoZ = mem(
async () => {
const response = await get(GH_PAGES('a-to-z.json'))
return AllAboutOlafExtraAzResponseSchema.parse(await response.json())
},
{maxAge: ONE_DAY},
)

// merge custom entries defined on GH pages with the fetched WP-JSON
function combineResponses(
Expand Down
11 changes: 7 additions & 4 deletions source/ccci-stolaf-college/v1/contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import mem from 'memoize'
import {GH_PAGES} from './gh-pages.js'
import type {Context} from '../../ccc-server/context.js'

const getContacts = mem(async () => {
const response = await get(GH_PAGES('contact-info.json'))
return response.json()
}, {maxAge: ONE_DAY})
const getContacts = mem(
async () => {
const response = await get(GH_PAGES('contact-info.json'))
return response.json()
},
{maxAge: ONE_DAY},
)

export async function contacts(ctx: Context) {
ctx.cacheControl(ONE_DAY)
Expand Down
11 changes: 7 additions & 4 deletions source/ccci-stolaf-college/v1/dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import mem from 'memoize'
import {GH_PAGES} from './gh-pages.js'
import type {Context} from '../../ccc-server/context.js'

const getDictionary = mem(async () => {
const response = await get(GH_PAGES('dictionary.json'))
return response.json()
}, {maxAge: ONE_DAY})
const getDictionary = mem(
async () => {
const response = await get(GH_PAGES('dictionary.json'))
return response.json()
},
{maxAge: ONE_DAY},
)

export async function dictionary(ctx: Context) {
ctx.cacheControl(ONE_DAY)
Expand Down
11 changes: 7 additions & 4 deletions source/ccci-stolaf-college/v1/faqs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import mem from 'memoize'
import {GH_PAGES} from './gh-pages.js'
import type {Context} from '../../ccc-server/context.js'

const getFaqs = mem(async () => {
const response = await get(GH_PAGES('faqs.json'))
return response.json()
}, {maxAge: ONE_DAY})
const getFaqs = mem(
async () => {
const response = await get(GH_PAGES('faqs.json'))
return response.json()
},
{maxAge: ONE_DAY},
)

export async function faqs(ctx: Context) {
ctx.cacheControl(ONE_DAY)
Expand Down
11 changes: 7 additions & 4 deletions source/ccci-stolaf-college/v1/hours.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ import mem from 'memoize'
import {GH_PAGES} from './gh-pages.js'
import type {Context} from '../../ccc-server/context.js'

const getBuildingHours = mem(async () => {
const response = await get(GH_PAGES('building-hours.json'))
return response.json()
}, {maxAge: ONE_HOUR})
const getBuildingHours = mem(
async () => {
const response = await get(GH_PAGES('building-hours.json'))
return response.json()
},
{maxAge: ONE_HOUR},
)

export async function buildingHours(ctx: Context) {
ctx.cacheControl(ONE_HOUR)
Expand Down
22 changes: 14 additions & 8 deletions source/ccci-stolaf-college/v1/transit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,27 @@ import mem from 'memoize'
import {GH_PAGES} from './gh-pages.js'
import type {Context} from '../../ccc-server/context.js'

const getBus = mem(async () => {
const response = await get(GH_PAGES('bus-times.json'))
return response.json()
}, {maxAge: ONE_HOUR})
const getBus = mem(
async () => {
const response = await get(GH_PAGES('bus-times.json'))
return response.json()
},
{maxAge: ONE_HOUR},
)

export async function bus(ctx: Context) {
ctx.cacheControl(ONE_HOUR)

ctx.body = await getBus()
}

const getModes = mem(async () => {
const response = await get(GH_PAGES('transportation.json'))
return response.json()
}, {maxAge: ONE_HOUR})
const getModes = mem(
async () => {
const response = await get(GH_PAGES('transportation.json'))
return response.json()
},
{maxAge: ONE_HOUR},
)

export async function modes(ctx: Context) {
ctx.cacheControl(ONE_HOUR)
Expand Down

0 comments on commit 435c7e3

Please sign in to comment.