This commit is contained in:
2025-09-28 14:32:21 +02:00
parent 1c3c6adcc2
commit 4e61b20ba8
6 changed files with 0 additions and 956 deletions

View File

@@ -1,54 +0,0 @@
import {useDataStore} from "~/stores/data.js";
export const useSupabaseSelect = async (relation,select = '*', sortColumn = null, ascending = true,noArchivedFiltering = false) => {
const supabase = useSupabaseClient()
const profileStore = useProfileStore()
let data = null
const dataStore = useDataStore()
const dataType = dataStore.dataTypes[relation]
if(sortColumn !== null ) {
data = (await supabase
.from(relation)
.select(select)
.eq("tenant", profileStore.currentTenant)
.order(sortColumn, {ascending: ascending})).data
} else {
data = (await supabase
.from(relation)
.select(select)
.eq("tenant", profileStore.currentTenant)).data
}
if(dataType && dataType.isArchivable && !noArchivedFiltering) {
data = data.filter(i => !i.archived)
}
return data
}
export const useSupabaseSelectSingle = async (relation,idToEq,select = '*' ) => {
const supabase = useSupabaseClient()
const profileStore = useProfileStore()
let data = null
if(idToEq !== null) {
data = (await supabase
.from(relation)
.select(select)
.eq("tenant", profileStore.currentTenant)
.eq("id",idToEq)
.single()).data
} else {
data = (await supabase
.from(relation)
.select(select)
.eq("tenant", profileStore.currentTenant)
.single()).data
}
return data
}