50 lines
1.4 KiB
JavaScript
50 lines
1.4 KiB
JavaScript
export default defineEventHandler(async (event) => {
|
|
try {
|
|
// TODO: Implement proper user segments table
|
|
// For now, returning mock data since notification tables don't exist in current schema
|
|
|
|
const mockSegments = [
|
|
{
|
|
label: "New Users",
|
|
value: "new_users",
|
|
description: "Users registered within last 30 days",
|
|
criteria: { registration_days: 30 }
|
|
},
|
|
{
|
|
label: "Active Users",
|
|
value: "active_users",
|
|
description: "Users active in last 7 days",
|
|
criteria: { last_activity_days: 7 }
|
|
},
|
|
{
|
|
label: "Premium Subscribers",
|
|
value: "premium_users",
|
|
description: "Users with premium subscription",
|
|
criteria: { subscription_type: "premium" }
|
|
},
|
|
{
|
|
label: "Inactive Users",
|
|
value: "inactive_users",
|
|
description: "Users not active in 30+ days",
|
|
criteria: { inactive_days: 30 }
|
|
},
|
|
{
|
|
label: "High-Value Customers",
|
|
value: "high_value",
|
|
description: "Customers with high lifetime value",
|
|
criteria: { min_order_value: 1000 }
|
|
}
|
|
];
|
|
|
|
return {
|
|
success: true,
|
|
data: mockSegments
|
|
}
|
|
} catch (error) {
|
|
console.error('Error fetching segments:', error)
|
|
throw createError({
|
|
statusCode: 500,
|
|
statusMessage: 'Failed to fetch segments'
|
|
})
|
|
}
|
|
})
|