GET /dashboard/rep retorna meta mensal, comissão (fixa + FLEX), clientes inativos >30 dias e pedidos dos últimos 7 dias. RepTarget model com migration. RafaelPainel conectado à API real via useRepDashboard(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
16 lines
461 B
SQL
16 lines
461 B
SQL
-- CreateTable
|
|
CREATE TABLE "RepTarget" (
|
|
"repId" TEXT NOT NULL,
|
|
"year" INTEGER NOT NULL,
|
|
"month" INTEGER NOT NULL,
|
|
"targetAmount" DECIMAL(15,2) NOT NULL,
|
|
"commissionRate" DECIMAL(5,2) NOT NULL DEFAULT 3,
|
|
"flexRate" DECIMAL(5,2) NOT NULL DEFAULT 1,
|
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
|
|
CONSTRAINT "RepTarget_pkey" PRIMARY KEY ("repId","year","month")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE INDEX "RepTarget_repId_idx" ON "RepTarget"("repId");
|