File tree Expand file tree Collapse file tree 5 files changed +14
-10
lines changed Expand file tree Collapse file tree 5 files changed +14
-10
lines changed Original file line number Diff line number Diff line change 1
- import type { Config } from '@netlify/functions'
1
+ import type { Config , Context } from '@netlify/functions'
2
+ import { getStore } from '@netlify/blobs'
3
+ import type { Clubs } from '~/types/clubs'
2
4
import updateClubInfo from '~/utils/update-club-info'
3
5
4
- export default async ( ) => {
5
- await updateClubInfo ( )
6
+ export default async ( context : Context ) => {
7
+ const store = getStore ( 'enspire' )
8
+ const clubs : Clubs = await updateClubInfo ( )
9
+ await store . setJSON ( 'clubs' , clubs )
10
+
11
+ return new Response ( 'Done' )
6
12
}
7
13
8
14
export const config : Config = {
Original file line number Diff line number Diff line change @@ -10,10 +10,6 @@ export default defineNuxtConfig({
10
10
dir : '/data' ,
11
11
repo : 'computerization/enspire' ,
12
12
} ,
13
- netlify : {
14
- driver : 'netlify' ,
15
- name : 'enspire' ,
16
- } ,
17
13
} ,
18
14
} ,
19
15
Original file line number Diff line number Diff line change
1
+ import { getStore } from '@netlify/blobs'
2
+
1
3
export default defineCachedEventHandler ( async ( event ) => {
2
4
const { auth } = event . context
3
5
@@ -6,5 +8,5 @@ export default defineCachedEventHandler(async (event) => {
6
8
return
7
9
}
8
10
9
- return await useStorage ( 'netlify ') . getItem ( 'clubs' )
11
+ return await getStore ( 'enspire ') . get ( 'clubs' , { type : 'json' } )
10
12
} , { maxAge : 60 * 60 * 4 /* 4 hours */ } )
Original file line number Diff line number Diff line change @@ -64,7 +64,5 @@ export default async function main(): Promise<Clubs> {
64
64
}
65
65
}
66
66
67
- await useStorage ( 'netlify' ) . setItem ( 'clubs' , output )
68
-
69
67
return output
70
68
}
Original file line number Diff line number Diff line change @@ -127,6 +127,8 @@ export default async function main() {
127
127
// eslint-disable-next-line no-console
128
128
console . log ( `start transaction with length ${ runSequence . length } ` )
129
129
await prisma . $transaction ( runSequence )
130
+
131
+ return clubs
130
132
}
131
133
132
134
main ( )
You can’t perform that action at this time.
0 commit comments