import { eventsBLC } from "~/schema/eventsBLC";
import { db } from "./drizzleClient";
import { users } from "~/schema/users";
import { desc, eq } from "drizzle-orm";
import { useQuery } from "@tanstack/react-query";
import { supabase } from "~/lib/supabaseClient";
// export const getBLCLogs = async () => {
// const data = await db
// .select()
// .from(eventsBLC)
// .limit(4)
// .orderBy(desc(eventsBLC.created_at))
// .leftJoin(users, eq(eventsBLC.userId, users.id));
// return data;
// };
export const supabaseBLC = async () => {
const { data: eventsBLC, error } = await supabase
.from("eventsBLC")
.select("*")
.limit(4)
.order("id", { ascending: false });
return eventsBLC;
};
export function useGetBLCPosts() {
return useQuery({
queryFn: async () => supabaseBLC(),
queryKey: ["logs"],
});
}
import { eventsBLC } from "~/schema/eventsBLC";
import { db } from "./drizzleClient";
import { users } from "~/schema/users";
import { desc, eq } from "drizzle-orm";
import { useQuery } from "@tanstack/react-query";
import { supabase } from "~/lib/supabaseClient";
// export const getBLCLogs = async () => {
// const data = await db
// .select()
// .from(eventsBLC)
// .limit(4)
// .orderBy(desc(eventsBLC.created_at))
// .leftJoin(users, eq(eventsBLC.userId, users.id));
// return data;
// };
export const supabaseBLC = async () => {
const { data: eventsBLC, error } = await supabase
.from("eventsBLC")
.select("*")
.limit(4)
.order("id", { ascending: false });
return eventsBLC;
};
export function useGetBLCPosts() {
return useQuery({
queryFn: async () => supabaseBLC(),
queryKey: ["logs"],
});
}