feat(admin): archive users and their profiles permanently
All checks were successful
Build and Release FEDEO / verify (push) Successful in 1m5s
Build and Release FEDEO / build-and-release (push) Successful in 6m53s

This commit is contained in:
2026-10-15 14:22:12 +02:00
parent 5dc9e686fc
commit 4ffafef3f1
26 changed files with 519 additions and 75 deletions

View File

@@ -19,6 +19,7 @@ export const useProfileStore = defineStore("profile", () => {
})
const profiles = ref([])
const allProfiles = ref([])
const ownProfiles = ref([])
const activeProfile = ref(null)
const tenants = ref([])
@@ -60,8 +61,8 @@ export const useProfileStore = defineStore("profile", () => {
}
async function fetchData() {
await fetchOwnProfiles()
await fetchProfiles()
await fetchOwnProfiles()
await fetchTenants()
await fetchOwnTenant()
loaded.value = true
@@ -71,6 +72,7 @@ export const useProfileStore = defineStore("profile", () => {
loaded.value = false
ownTenant.value = {}
profiles.value = []
allProfiles.value = []
ownProfiles.value = []
tenants.value = []
}
@@ -92,10 +94,13 @@ export const useProfileStore = defineStore("profile", () => {
async function fetchProfiles() {
try {
const res = await useNuxtApp().$api("/api/tenant/profiles")
profiles.value = res?.data || []
const res = await useNuxtApp().$api("/api/tenant/profiles", { query: { includeArchived: true } })
// Retain historical names while keeping archived profiles out of selections.
allProfiles.value = res?.data || []
profiles.value = allProfiles.value.filter(profile => profile.active && !profile.archived_at)
} catch (e) {
profiles.value = activeProfile.value ? [activeProfile.value] : []
allProfiles.value = profiles.value
}
}
@@ -112,7 +117,8 @@ export const useProfileStore = defineStore("profile", () => {
})
const getProfileById = computed(() => (itemId) => {
return profiles.value.find((item) => item.id === itemId || item.user_id === itemId)
const profile = allProfiles.value.find((item) => item.id === itemId || item.user_id === itemId)
return profile ? { ...profile, fullName: profile.full_name || profile.fullName } : { fullName: "Unbekanntes Profil" }
})
return {