Added Archivable Prop to Datatypes wich are archivable
Added Filtering to SupabaseSelect Composable for Archived
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user