feat: ajout de la gestion des sources de contenu avec création de composants, formulaires et API pour l'importation, l'exportation et la configuration des sources de scraping.

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-06-27 16:40:48 +02:00
parent 32b4e4fbb2
commit dac2f91998
15 changed files with 1364 additions and 15 deletions

View File

@@ -0,0 +1,56 @@
import { computed } from 'vue';
import { useContentSourceStore } from '../../application/store/contentSourceStore';
export function useContentSources() {
const store = useContentSourceStore();
// Computed properties pour un accès facile aux données
const sources = computed(() => store.sources);
const currentSource = computed(() => store.currentSource);
const isLoading = computed(() => store.loadingSources || store.loadingCurrentSource);
const isSaving = computed(() => store.saving);
const hasError = computed(() => store.sourcesError || store.currentSourceError || store.saveError);
// Getters
const getSourceById = (id) => store.getSourceById(id);
const getSourcesByType = (type) => store.getSourcesByType(type);
const htmlSources = computed(() => store.htmlSources);
const javascriptSources = computed(() => store.javascriptSources);
// Actions
const loadSources = () => store.loadSources();
const loadSource = (id) => store.loadSource(id);
const createSource = (data) => store.createSource(data);
const updateSource = (id, data) => store.updateSource(id, data);
const exportSources = () => store.exportSources();
const importSources = (data) => store.importSources(data);
const clearCurrentSource = () => store.clearCurrentSource();
const clearErrors = () => store.clearErrors();
return {
// Data
sources,
currentSource,
// States
isLoading,
isSaving,
hasError,
// Getters
getSourceById,
getSourcesByType,
htmlSources,
javascriptSources,
// Actions
loadSources,
loadSource,
createSource,
updateSource,
exportSources,
importSources,
clearCurrentSource,
clearErrors
};
}