MAJOR UPPDATE: "First Ai"
feat: add AI categorization for products and enhance user management - Integrated AI service for category suggestions in receipt import and product management. - Added premium subscription feature for users with corresponding API endpoints. - Implemented admin interface for managing pending product suggestions. - Enhanced user management to include premium status and corresponding UI updates. - Updated database schema to support new fields for premium status and product status.
This commit is contained in:
@@ -19,6 +19,22 @@ export async function PATCH(
|
||||
if (!session) return NextResponse.json({ message: 'Förbjuden' }, { status: 403 });
|
||||
|
||||
const body = await request.json();
|
||||
|
||||
// Om body innehåller isPremium → anropa /premium-endpoint
|
||||
if ('isPremium' in body) {
|
||||
const res = await fetch(`${API_BASE}/api/users/${id}/premium`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Bearer ${session.accessToken}`,
|
||||
},
|
||||
body: JSON.stringify({ isPremium: body.isPremium }),
|
||||
});
|
||||
const data = await res.json();
|
||||
return NextResponse.json(data, { status: res.status });
|
||||
}
|
||||
|
||||
// Annars → roll-byte
|
||||
const res = await fetch(`${API_BASE}/api/users/${id}/role`, {
|
||||
method: 'PATCH',
|
||||
headers: {
|
||||
|
||||
Reference in New Issue
Block a user