Files
tool-evaluator/lib/db/src/schema/tool-costs.ts
T
opencode 01c70085db
Build & Push Docker Image / build (push) Successful in 6m52s
feat: tiered costs feature + admin tier management + tag selection
- costs: nullable notes (fix create without notes), drop renewalDate
  (schema + API + UI), gate POST/PATCH/DELETE to admin + costs feature
- feature middleware: admin-aware hasFeature + getEntitlements union;
  /auth/me and login return resolved entitlements
- users: tier enum (free/premium/enterprise) in create/update/list,
  admin UI tier select + tier badge
- tags: GET /tags/all, TagInput autocomplete in new/edit tool forms,
  feature suggestions on focus, query invalidation on create/update
- openapi: nullable ToolUpdate urls, ToolUpdate tier fields, listAllTags
- Dockerfile: push-force to drop renewal_date column
2026-08-02 01:10:47 +02:00

16 lines
870 B
TypeScript

import { pgTable, text, serial, integer, numeric, timestamp } from "drizzle-orm/pg-core";
import { toolsTable } from "./tools";
import { usersTable } from "./users";
export const toolCostsTable = pgTable("tool_costs", {
id: serial("id").primaryKey(),
toolId: integer("tool_id").notNull().references(() => toolsTable.id, { onDelete: "cascade" }),
licenseType: text("license_type", { enum: ["free", "subscription", "one_time", "usage_based"] }).notNull().default("free"),
billingPeriod: text("billing_period", { enum: ["monthly", "quarterly", "yearly"] }),
cost: numeric("cost", { precision: 10, scale: 2 }),
currency: text("currency").default("EUR"),
notes: text("notes"),
createdBy: integer("created_by").references(() => usersTable.id, { onDelete: "set null" }),
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
});