Skip to content

Commit

Permalink
Fix generation and types
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusab committed Sep 2, 2024
1 parent b937476 commit d39d3ab
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 339 deletions.
3 changes: 2 additions & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"login": "supabase login",
"migrate": "supabase migration up",
"seed": "supabase db seed generate && supabase db seed run",
"reset": "supabase db reset"
"reset": "supabase db reset",
"generate": "supabase gen types --lang=typescript --local --schema public > ../../packages/supabase/src/types/db.ts"
},
"dependencies": {
"supabase": "^1.191.3"
Expand Down
3 changes: 1 addition & 2 deletions packages/supabase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"clean": "rm -rf .turbo node_modules",
"lint": "biome check .",
"format": "biome format --write .",
"typecheck": "tsc --noEmit",
"db:generate": "supabase gen types --lang=typescript --project-id $PROJECT_ID --schema public > src/types/db.ts"
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@supabase/ssr": "^0.5.1",
Expand Down
3 changes: 2 additions & 1 deletion packages/supabase/src/mutations/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { logger } from "@v1/logger";
import { createClient } from "@v1/supabase/server";
import type { Database, Tables } from "../types";

export async function updateUser(userId: string, data: unknown) {
export async function updateUser(userId: string, data: Tables<"users">) {
const supabase = createClient();

try {
Expand Down
14 changes: 0 additions & 14 deletions packages/supabase/src/queries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,6 @@ export async function getUser() {
}
}

export async function getUsers() {
const supabase = createClient();

try {
const result = await supabase.from("users").select("*");

return result;
} catch (error) {
logger.error(error);

throw error;
}
}

export async function getPosts() {
const supabase = createClient();

Expand Down
Loading

0 comments on commit d39d3ab

Please sign in to comment.