mirror of
https://github.com/Since-3/since3-portal.git
synced 2026-10-12 19:51:17 +00:00
30 lines
No EOL
958 B
TypeScript
30 lines
No EOL
958 B
TypeScript
import "server-only";
|
|
import { BillingCycle, Plan } from "../lib/internal-costs";
|
|
import { createClient } from "@/lib/supabase/server";
|
|
|
|
|
|
export type InternalCredential = {
|
|
id: string;
|
|
service: string;
|
|
title: string;
|
|
username: string;
|
|
url: string;
|
|
plan: Plan;
|
|
price: number | null;
|
|
billing_cycle: BillingCycle | null;
|
|
updated_at: string;
|
|
}
|
|
|
|
export async function getInternalCredentials() {
|
|
const supabase = await createClient()
|
|
const { data, error } = await supabase
|
|
.from("internal_credentials")
|
|
.select("id, service, title, username, url, plan, price, billing_cycle, updated_at")
|
|
.order("service")
|
|
.order("title")
|
|
|
|
if (error) throw new Error("Interne Zugänge konnten nicht geladen werden.")
|
|
|
|
// Numeric kann je nach Größe als String ankommen
|
|
return (data as InternalCredential[]).map((row) => ({ ...row, price: row.price === null ? null : Number(row.price)}))
|
|
} |