Skip to content

Commit

Permalink
Merge pull request #11 from dartilesm/fix/feedback-table
Browse files Browse the repository at this point in the history
fix(Root): feedback table and permissions
  • Loading branch information
dartilesm authored Nov 21, 2024
2 parents 8d00b12 + 38ba39d commit ca86999
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 208 deletions.
15 changes: 8 additions & 7 deletions apps/chat-with-pdf/app/actions/submit-feedback.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use server";

import { prisma } from "@/lib/prisma";

import { createSupabaseServer } from "@makefy/supabase/server";
export async function submitFeedback({
type,
message,
Expand All @@ -13,10 +12,12 @@ export async function submitFeedback({
throw new Error("Type and message are required");
}

await prisma.feedback.create({
data: {
type,
message,
},
const supabase = createSupabaseServer();

const { data, error } = await supabase.from("Feedback").insert({
type,
message,
});

console.log(data, error);
}
8 changes: 0 additions & 8 deletions apps/chat-with-pdf/utils/prisma.ts

This file was deleted.

Binary file modified bun.lockb
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
alter table "public"."Feedback" alter column "id" set default gen_random_uuid();

alter table "public"."Feedback" alter column "id" set data type uuid using "id"::uuid;

alter table "public"."Feedback" alter column "updatedAt" set default now();

alter table "public"."Feedback" alter column "updatedAt" set data type timestamp with time zone using "updatedAt"::timestamp with time zone;

create policy "Authenticated users can insert a feedback."
on "public"."Feedback"
as permissive
for insert
to authenticated
with check ((( SELECT auth.uid() AS uid) = "userId"));
194 changes: 17 additions & 177 deletions packages/supabase/src/types/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,32 +144,38 @@ export type Database = {
DocumentSections: {
Row: {
chatId: string | null
createdAt: string
documentId: string | null
embedding: string | null
id: string
pageNumber: number | null
text: string | null
textChunk: string | null
updatedAt: string
userId: string
}
Insert: {
chatId?: string | null
createdAt?: string
documentId?: string | null
embedding?: string | null
id?: string
pageNumber?: number | null
text?: string | null
textChunk?: string | null
updatedAt?: string
userId?: string
}
Update: {
chatId?: string | null
createdAt?: string
documentId?: string | null
embedding?: string | null
id?: string
pageNumber?: number | null
text?: string | null
textChunk?: string | null
updatedAt?: string
userId?: string
}
Relationships: [
Expand All @@ -196,23 +202,23 @@ export type Database = {
message: string
type: string
updatedAt: string
userId: string | null
userId: string
}
Insert: {
createdAt?: string
id: string
id?: string
message: string
type: string
updatedAt: string
userId?: string | null
updatedAt?: string
userId?: string
}
Update: {
createdAt?: string
id?: string
message?: string
type?: string
updatedAt?: string
userId?: string | null
userId?: string
}
Relationships: []
}
Expand Down Expand Up @@ -248,117 +254,6 @@ export type Database = {
[_ in never]: never
}
Functions: {
binary_quantize:
| {
Args: {
"": string
}
Returns: unknown
}
| {
Args: {
"": unknown
}
Returns: unknown
}
halfvec_avg: {
Args: {
"": number[]
}
Returns: unknown
}
halfvec_out: {
Args: {
"": unknown
}
Returns: unknown
}
halfvec_send: {
Args: {
"": unknown
}
Returns: string
}
halfvec_typmod_in: {
Args: {
"": unknown[]
}
Returns: number
}
hnsw_bit_support: {
Args: {
"": unknown
}
Returns: unknown
}
hnsw_halfvec_support: {
Args: {
"": unknown
}
Returns: unknown
}
hnsw_sparsevec_support: {
Args: {
"": unknown
}
Returns: unknown
}
hnswhandler: {
Args: {
"": unknown
}
Returns: unknown
}
ivfflat_bit_support: {
Args: {
"": unknown
}
Returns: unknown
}
ivfflat_halfvec_support: {
Args: {
"": unknown
}
Returns: unknown
}
ivfflathandler: {
Args: {
"": unknown
}
Returns: unknown
}
l2_norm:
| {
Args: {
"": unknown
}
Returns: number
}
| {
Args: {
"": unknown
}
Returns: number
}
l2_normalize:
| {
Args: {
"": string
}
Returns: string
}
| {
Args: {
"": unknown
}
Returns: unknown
}
| {
Args: {
"": unknown
}
Returns: unknown
}
match_documents:
| {
Args: {
Expand All @@ -368,12 +263,14 @@ export type Database = {
}
Returns: {
chatId: string | null
createdAt: string
documentId: string | null
embedding: string | null
id: string
pageNumber: number | null
text: string | null
textChunk: string | null
updatedAt: string
userId: string
}[]
}
Expand All @@ -385,12 +282,14 @@ export type Database = {
}
Returns: {
chatId: string | null
createdAt: string
documentId: string | null
embedding: string | null
id: string
pageNumber: number | null
text: string | null
textChunk: string | null
updatedAt: string
userId: string
}[]
}
Expand All @@ -403,76 +302,17 @@ export type Database = {
}
Returns: {
chatId: string | null
createdAt: string
documentId: string | null
embedding: string | null
id: string
pageNumber: number | null
text: string | null
textChunk: string | null
updatedAt: string
userId: string
}[]
}
sparsevec_out: {
Args: {
"": unknown
}
Returns: unknown
}
sparsevec_send: {
Args: {
"": unknown
}
Returns: string
}
sparsevec_typmod_in: {
Args: {
"": unknown[]
}
Returns: number
}
vector_avg: {
Args: {
"": number[]
}
Returns: string
}
vector_dims:
| {
Args: {
"": string
}
Returns: number
}
| {
Args: {
"": unknown
}
Returns: number
}
vector_norm: {
Args: {
"": string
}
Returns: number
}
vector_out: {
Args: {
"": string
}
Returns: unknown
}
vector_send: {
Args: {
"": string
}
Returns: string
}
vector_typmod_in: {
Args: {
"": unknown[]
}
Returns: number
}
}
Enums: {
[_ in never]: never
Expand Down

0 comments on commit ca86999

Please sign in to comment.