Added Archivable Prop to Datatypes wich are archivable

Added Filtering to SupabaseSelect Composable for Archived
This commit is contained in:
2025-03-16 17:36:16 +01:00
parent b7d64b1f9e
commit 15a889dfcf
2 changed files with 30 additions and 0 deletions

View File

@@ -1,10 +1,13 @@
import {useDataStore} from "~/stores/data.js";
export const useSupabaseSelect = async (relation,select = '*', sortColumn = null, ascending = true) => {
const supabase = useSupabaseClient()
const profileStore = useProfileStore()
let data = null
const dataStore = useDataStore()
const dataType = dataStore.dataTypes[relation]
if(sortColumn !== null ) {
data = (await supabase
@@ -19,6 +22,10 @@ export const useSupabaseSelect = async (relation,select = '*', sortColumn = null
.eq("tenant", profileStore.currentTenant)).data
}
if(dataType && dataType.isArchivable) {
data = data.filter(i => !i.archived)
}
return data
}