2025-03-06 17:45:51 -03:00
|
|
|
import { supabase_rr_service, supabase_service } from "../../services/supabase";
|
2025-01-07 17:49:21 -03:00
|
|
|
import { logger } from "../logger";
|
|
|
|
|
|
2025-03-13 13:05:12 -04:00
|
|
|
import { withAuth } from "../withAuth";
|
|
|
|
|
|
|
|
|
|
async function getTeamIdSyncBOriginal(teamId: string) {
|
2025-01-07 17:49:21 -03:00
|
|
|
try {
|
2025-03-06 17:45:51 -03:00
|
|
|
const { data, error } = await supabase_rr_service
|
2025-01-07 17:49:21 -03:00
|
|
|
.from("eb-sync")
|
|
|
|
|
.select("team_id")
|
|
|
|
|
.eq("team_id", teamId)
|
|
|
|
|
.limit(1);
|
|
|
|
|
if (error) {
|
|
|
|
|
throw new Error("Error getting team id (sync b)");
|
|
|
|
|
}
|
|
|
|
|
return data[0] ?? null;
|
|
|
|
|
} catch (error) {
|
|
|
|
|
logger.error("Error getting team id (sync b)", error);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-03-13 13:05:12 -04:00
|
|
|
|
|
|
|
|
export const getTeamIdSyncB = withAuth(getTeamIdSyncBOriginal, null);
|