Skip to content

Commit

Permalink
Merge branch 'sashankbalusu/tg-16-create-the-plantcard-component' of h…
Browse files Browse the repository at this point in the history
…ttps://github.com/calblueprint/trap-garden into sashankbalusu/tg-16-create-the-plantcard-component
  • Loading branch information
SashankBalusu committed Oct 9, 2024
2 parents b1cda58 + 46749a5 commit b83c8f8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/api/supabase/queries/plant_by_id.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { UUID } from 'crypto';
import { Plant } from '@/types/schema';
import supabase from '../createClient';

export async function get_plant_by_id(
i_state: string,
p_id: UUID,
): Promise<Plant[]> {
const { data, error } = await supabase.rpc('get_plant_by_id', {
input_state: i_state,
plant_id: p_id,
});

if (error) {
throw new Error(`Error getting matching plant: ${error.message}`);
}

return data;
}

0 comments on commit b83c8f8

Please sign in to comment.