Skip to content

Commit

Permalink
switch stav mealtime report to gh pages
Browse files Browse the repository at this point in the history
  • Loading branch information
drewvolz authored May 23, 2024
1 parent dc13fd8 commit 3602d79
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 196 deletions.
15 changes: 13 additions & 2 deletions source/ccci-stolaf-college/v1/gh-pages.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
export const GH_PAGES = (filename: string) =>
new URL(`https://stodevx.github.io/AAO-React-Native/${filename}`)
const BASE_URL = 'https://stodevx.github.io'

export const GH_PAGES = (filename: string) => {
const url = new URL(BASE_URL)
url.pathname = `/AAO-React-Native/${filename}`
return url
}

export const GH_PAGES_FROM_REPO = (reponame: string, filename: string) => {
const url = new URL(BASE_URL)
url.pathname = `${reponame}/${filename}`
return url
}
24 changes: 0 additions & 24 deletions source/ccci-stolaf-college/v1/reports.test.ts

This file was deleted.

15 changes: 9 additions & 6 deletions source/ccci-stolaf-college/v1/reports.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import {get} from '../../ccc-lib/http.js'
import {ONE_HOUR} from '../../ccc-lib/constants.js'
import * as report from '../../reports-bonapp/index.js'
import {GH_PAGES_FROM_REPO} from './gh-pages.js'
import mem from 'memoize'
import type {Context} from '../../ccc-server/context.js'

const getReport = mem(report.report, {maxAge: ONE_HOUR})
const GET = mem(get, {maxAge: ONE_HOUR})

export const REPORT_URLS = {
stav: 'https://www.stolaf.edu/apps/mealtimes/',
} as const
let stavMealtimesUrl = GH_PAGES_FROM_REPO('stav-mealtimes', 'two-weeks.json')

export function getStavMealtimes() {
return GET(stavMealtimesUrl).json()
}

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

ctx.body = await getReport(REPORT_URLS.stav)
ctx.body = await getStavMealtimes()
}
11 changes: 0 additions & 11 deletions source/reports-bonapp/helpers.ts

This file was deleted.

14 changes: 0 additions & 14 deletions source/reports-bonapp/index.test.ts

This file was deleted.

113 changes: 0 additions & 113 deletions source/reports-bonapp/index.ts

This file was deleted.

26 changes: 0 additions & 26 deletions source/reports-bonapp/types.ts

This file was deleted.

0 comments on commit 3602d79

Please sign in to comment.