feat(ST-qfpqpxzy): DB schema + settings-UI voor min_quota_pct worker-drempel (#118)

- User.min_quota_pct Int @default(20) + ClaudeWorker.last_quota_pct/last_quota_check_at
- Migratie add_worker_quota_gate
- lib/schemas/user.ts: minQuotaPctSchema (int, 1-100)
- actions/settings.ts: updateMinQuotaPctAction met auth/demo/zod-guard
- MinQuotaEditor component met numeric input en DemoTooltip
- Settings-pagina: Worker-instellingen sectie

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Janpeter Visser 2026-05-06 03:45:59 +02:00 committed by GitHub
parent 78543ee796
commit 555ed8fe89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 190 additions and 4 deletions

View file

@ -5,6 +5,7 @@ import { prisma } from '@/lib/prisma'
import { RoleManager } from '@/components/settings/role-manager'
import { LeaveProductButton } from '@/components/settings/leave-product-button'
import { ProfileEditor } from '@/components/settings/profile-editor'
import { MinQuotaEditor } from '@/components/settings/min-quota-editor'
import { ActivateProductButton } from '@/components/shared/activate-product-button'
import Link from 'next/link'
@ -14,7 +15,7 @@ export default async function SettingsPage() {
const [user, userRoles, ownedProducts, memberships] = await Promise.all([
prisma.user.findUnique({
where: { id: session.userId },
select: { username: true, email: true, bio: true, bio_detail: true, avatar_data: true, updated_at: true, active_product_id: true },
select: { username: true, email: true, bio: true, bio_detail: true, avatar_data: true, updated_at: true, active_product_id: true, min_quota_pct: true },
}),
prisma.userRole.findMany({ where: { user_id: session.userId } }),
prisma.product.findMany({
@ -157,6 +158,19 @@ export default async function SettingsPage() {
)}
</div>
<div className="bg-surface-container-low border border-border rounded-xl p-5 space-y-4">
<div>
<h2 className="text-sm font-medium text-foreground">Worker-instellingen</h2>
<p className="text-xs text-muted-foreground mt-0.5">
Drempelwaarden voor de Claude-worker.
</p>
</div>
<MinQuotaEditor
currentValue={user?.min_quota_pct ?? 20}
isDemo={session.isDemo ?? false}
/>
</div>
<div className="bg-surface-container-low border border-border rounded-xl p-5 space-y-3">
<div className="flex items-center justify-between">
<h2 className="text-sm font-medium text-foreground">API Tokens</h2>