feat(fc3c): downloads Pinia store + sources.checkNow action + vitests
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -70,6 +70,20 @@ export const useSourcesStore = defineStore('sources', () => {
|
||||
return await api.get('/api/artists/autocomplete', { params: { q: query, limit } })
|
||||
}
|
||||
|
||||
// FC-3c: trigger a download for one source. Returns {download_event_id,status}.
|
||||
const checkingIds = ref(new Set())
|
||||
|
||||
async function checkNow(id) {
|
||||
checkingIds.value = new Set(checkingIds.value).add(id)
|
||||
try {
|
||||
return await api.post(`/api/sources/${id}/check`)
|
||||
} finally {
|
||||
const next = new Set(checkingIds.value)
|
||||
next.delete(id)
|
||||
checkingIds.value = next
|
||||
}
|
||||
}
|
||||
|
||||
function sourcesByArtistGrouped() {
|
||||
// returns [{artist: {id,name,slug}, sources: [...]}, ...]
|
||||
const arr = byArtist.value.get(null) ?? []
|
||||
@@ -92,8 +106,10 @@ export const useSourcesStore = defineStore('sources', () => {
|
||||
return {
|
||||
byArtist, loading, error,
|
||||
allSources,
|
||||
checkingIds,
|
||||
loadAll, loadForArtist,
|
||||
create, update, remove,
|
||||
checkNow,
|
||||
findOrCreateArtist, autocompleteArtist,
|
||||
sourcesByArtistGrouped,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user