From 39eb53ae0a3413eda56324f7ff2daade63863ac0 Mon Sep 17 00:00:00 2001 From: Nicolas <20311743+nickscamara@users.noreply.github.com> Date: Tue, 2 Dec 2025 11:41:34 -0300 Subject: [PATCH] Nick: fcParsing --- apps/api/src/controllers/v0/admin/create-user.ts | 3 ++- apps/api/src/lib/parseApi.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/api/src/controllers/v0/admin/create-user.ts b/apps/api/src/controllers/v0/admin/create-user.ts index 61a683602..2d0936d86 100644 --- a/apps/api/src/controllers/v0/admin/create-user.ts +++ b/apps/api/src/controllers/v0/admin/create-user.ts @@ -3,6 +3,7 @@ import { Request, Response } from "express"; import { supabase_service } from "../../../services/supabase"; import crypto from "crypto"; import { z } from "zod"; +import { apiKeyToFcApiKey } from "../../../lib/parseApi"; async function addCoupon(teamId: string, integration: any) { if (!integration.coupon_credits) { @@ -259,7 +260,7 @@ export async function createUserController(req: Request, res: Response) { } return res.status(200).json({ - apiKey, + apiKey: apiKeyToFcApiKey(apiKey), alreadyExisted, }); } catch (error) { diff --git a/apps/api/src/lib/parseApi.ts b/apps/api/src/lib/parseApi.ts index 4479d44d1..153d75f0b 100644 --- a/apps/api/src/lib/parseApi.ts +++ b/apps/api/src/lib/parseApi.ts @@ -12,3 +12,11 @@ export function parseApi(api: string) { .replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5"); return uuid; } + +export function apiKeyToFcApiKey(apiKey: string | null | undefined) { + if (!apiKey) { + return null; + } + const uuidWithoutDashes = apiKey.replace(/-/g, ""); + return `fc-${uuidWithoutDashes}`; +}