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

@@ -11,6 +11,18 @@ import authV2MaskDark from '@images/pages/misc-mask-dark.png'
import authV2MaskLight from '@images/pages/misc-mask-light.png'
import { VNodeRenderer } from '@layouts/components/VNodeRenderer'
import { themeConfig } from '@themeConfig'
import { getUserAbilityRules } from '@/utils/auth-ability'
import type { Rule } from '@/plugins/casl/ability'
import type { AuthUserCookie } from '@/composables/useOrganisationContext'
interface LoginApiPayload {
success: boolean
data: {
user: AuthUserCookie & Record<string, unknown>
token: string
}
message?: string
}
const authThemeImg = useGenerateImageVariant(authV2LoginIllustrationLight, authV2LoginIllustrationDark, authV2LoginIllustrationBorderedLight, authV2LoginIllustrationBorderedDark, true)
@@ -46,7 +58,7 @@ const rememberMe = ref(false)
const login = async () => {
try {
const res = await $api('/auth/login', {
const res = await $api<LoginApiPayload>('/auth/login', {
method: 'POST',
body: {
email: credentials.value.email,
@@ -71,14 +83,14 @@ const login = async () => {
const userData = data.user
const accessToken = data.token
// Set ability rules based on user role
const userAbilityRules = getUserAbilityRules(userData.role)
const roles = Array.isArray(userData.roles) ? userData.roles : []
const userAbilityRules = getUserAbilityRules(roles)
useCookie('userAbilityRules').value = userAbilityRules
useCookie<Rule[]>('userAbilityRules').value = userAbilityRules
ability.update(userAbilityRules)
useCookie('userData').value = userData
useCookie('accessToken').value = accessToken
useCookie<AuthUserCookie>('userData').value = userData
useCookie<string>('accessToken').value = accessToken
// Redirect to `to` query if exist or redirect to index route
await nextTick()
@@ -89,42 +101,6 @@ const login = async () => {
}
}
// Generate ability rules based on user role
function getUserAbilityRules(role: string | null) {
// Admin can do everything
if (role === 'admin') {
return [{ action: 'manage', subject: 'all' }]
}
// Booking agent can manage events and customers
if (role === 'booking_agent') {
return [
{ action: 'read', subject: 'all' },
{ action: 'manage', subject: 'Event' },
{ action: 'manage', subject: 'Customer' },
{ action: 'manage', subject: 'Location' },
{ action: 'manage', subject: 'BookingRequest' },
]
}
// Music manager can manage music and setlists
if (role === 'music_manager') {
return [
{ action: 'read', subject: 'all' },
{ action: 'manage', subject: 'MusicNumber' },
{ action: 'manage', subject: 'Setlist' },
]
}
// Default member permissions
return [
{ action: 'read', subject: 'Event' },
{ action: 'read', subject: 'MusicNumber' },
{ action: 'read', subject: 'Setlist' },
{ action: 'manage', subject: 'User', conditions: { id: '{{ user.id }}' } },
]
}
const onSubmit = () => {
refVForm.value?.validate()
.then(({ valid: isValid }) => {