Skip to content

Commit

Permalink
[all]: Move the query limit setting into app config
Browse files Browse the repository at this point in the history
  • Loading branch information
ThrRip committed Dec 18, 2023
1 parent 0e28c0c commit 2f6ab18
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export default defineAppConfig({

backendBase: 'https://api.mzg.fan/v1',
backendProjectId: '649758e1eb1fa584a04d',
backendQueryResultsLimit: 1000,

biliApiRoomPlayInfoEndpoint: 'https://api.live.bilibili.com/xlive/web-room/v2/index/getRoomPlayInfo',
biliApiRoomPlayInfoEndpointQueries: { room_id: '1267105' }
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/pages/playlist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const backendPlaylist = ref<Playlist>([])
const backendFetchPlaylistState = ref<'processing' | 'succeeded' | 'failed'>('processing')

onBeforeMount(() => {
backendDatabases.listDocuments('home', 'playlist', [Query.limit(1000)])
backendDatabases.listDocuments('home', 'playlist', [Query.limit(useAppConfig().backendQueryResultsLimit)])
.then(
(res) => {
backendFetchPlaylistState.value = 'succeeded'
Expand Down
2 changes: 1 addition & 1 deletion packages/home/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ type Playlist = Array<Song>
const { data: backendPlaylistFetchResponse } = await useAsyncData<Playlist>(
'backend-databases-home-playlist',
() => backendDatabases.listDocuments('home', 'playlist', [Query.limit(1000)]),
() => backendDatabases.listDocuments('home', 'playlist', [Query.limit(useAppConfig().backendQueryResultsLimit)]),
{ transform: (res: { total: number, documents: Playlist }): Playlist => res.documents }
)
const backendPlaylist = ref<Playlist>(backendPlaylistFetchResponse.value ?? [])
Expand Down

0 comments on commit 2f6ab18

Please sign in to comment.