refactor: align codebase with EventCrew domain and trim legacy band stack

- Update API: events, users, policies, routes, resources, migrations
- Remove deprecated models/resources (customers, setlists, invitations, etc.)
- Refresh admin app and docs; remove apps/band

Made-with: Cursor
This commit is contained in:
2026-03-29 23:19:06 +02:00
parent 34e12e00b3
commit 1cb7674d52
1034 changed files with 7453 additions and 8743 deletions

View File

@@ -0,0 +1,91 @@
import { computed, ref } from 'vue'
import { apiClient } from '@/lib/api-client'
import { useCurrentOrganisationId } from '@/composables/useOrganisationContext'
import type { ApiResponse, Event, Pagination } from '@/types/events'
interface LaravelPaginatedEventsBody {
data: Event[]
meta: {
current_page: number
per_page: number
total: number
last_page: number
from: number | null
to: number | null
}
}
function requireOrganisationId(organisationId: string | null): string {
if (!organisationId) {
throw new Error('No organisation in session. Log in again.')
}
return organisationId
}
export function useEvents() {
const { organisationId } = useCurrentOrganisationId()
const events = ref<Event[]>([])
const currentEvent = ref<Event | null>(null)
const pagination = ref<Pagination | null>(null)
const isLoading = ref(false)
const error = ref<Error | null>(null)
function eventsPath(): string {
const id = requireOrganisationId(organisationId.value)
return `/organisations/${id}/events`
}
async function fetchEvents(params?: { page?: number; per_page?: number }) {
isLoading.value = true
error.value = null
try {
const { data } = await apiClient.get<LaravelPaginatedEventsBody>(eventsPath(), { params })
events.value = data.data
pagination.value = {
current_page: data.meta.current_page,
per_page: data.meta.per_page,
total: data.meta.total,
last_page: data.meta.last_page,
from: data.meta.from,
to: data.meta.to,
}
}
catch (err) {
error.value = err instanceof Error ? err : new Error('Failed to fetch events')
throw error.value
}
finally {
isLoading.value = false
}
}
async function fetchEvent(id: string) {
isLoading.value = true
error.value = null
try {
const { data } = await apiClient.get<ApiResponse<Event>>(`${eventsPath()}/${id}`)
currentEvent.value = data.data
return data.data
}
catch (err) {
error.value = err instanceof Error ? err : new Error('Failed to fetch event')
throw error.value
}
finally {
isLoading.value = false
}
}
return {
organisationId: computed(() => organisationId.value),
events: computed(() => events.value),
currentEvent: computed(() => currentEvent.value),
pagination: computed(() => pagination.value),
isLoading: computed(() => isLoading.value),
error: computed(() => error.value),
fetchEvents,
fetchEvent,
}
}

View File

@@ -0,0 +1,25 @@
import { useCookie } from '@core/composable/useCookie'
import { computed } from 'vue'
export interface AuthOrganisationSummary {
id: string
name: string
slug: string
role: string
}
export interface AuthUserCookie {
id: string
name: string
email: string
roles?: string[]
organisations?: AuthOrganisationSummary[]
}
export function useCurrentOrganisationId() {
const userData = useCookie<AuthUserCookie | null>('userData')
const organisationId = computed(() => userData.value?.organisations?.[0]?.id ?? null)
return { organisationId }
}