File tree Expand file tree Collapse file tree 20 files changed +961
-242
lines changed
Expand file tree Collapse file tree 20 files changed +961
-242
lines changed Original file line number Diff line number Diff line change @@ -190,7 +190,6 @@ Hooks:
190190- ` download ` - Before and after download hooks
191191- ` delete ` - Before and after delete hooks
192192
193-
194193## File Management
195194
196195### List User Files
Original file line number Diff line number Diff line change @@ -36,14 +36,30 @@ CREATE TABLE `sessions` (
3636);
3737-- > statement-breakpoint
3838CREATE UNIQUE INDEX `sessions_token_unique ` ON ` sessions` (` token` );-- > statement-breakpoint
39+ CREATE TABLE `user_files ` (
40+ ` id` text PRIMARY KEY NOT NULL ,
41+ ` user_id` text NOT NULL ,
42+ ` filename` text NOT NULL ,
43+ ` original_name` text NOT NULL ,
44+ ` content_type` text NOT NULL ,
45+ ` size` integer NOT NULL ,
46+ ` r2_key` text NOT NULL ,
47+ ` uploaded_at` integer NOT NULL ,
48+ ` category` text ,
49+ ` is_public` integer ,
50+ ` description` text ,
51+ FOREIGN KEY (` user_id` ) REFERENCES ` users` (` id` ) ON UPDATE no action ON DELETE cascade
52+ );
53+ -- > statement-breakpoint
3954CREATE TABLE `users ` (
4055 ` id` text PRIMARY KEY NOT NULL ,
4156 ` name` text NOT NULL ,
4257 ` email` text NOT NULL ,
4358 ` email_verified` integer NOT NULL ,
4459 ` image` text ,
4560 ` created_at` integer NOT NULL ,
46- ` updated_at` integer NOT NULL
61+ ` updated_at` integer NOT NULL ,
62+ ` is_anonymous` integer
4763);
4864-- > statement-breakpoint
4965CREATE UNIQUE INDEX `users_email_unique ` ON ` users` (` email` );-- > statement-breakpoint
Original file line number Diff line number Diff line change 11{
22 "version" : " 6" ,
33 "dialect" : " sqlite" ,
4- "id" : " 50ac8e67-9e1b-4538-bd03-be18b10118cc " ,
4+ "id" : " eee5da81-ec71-43a2-889d-a6520936edd0 " ,
55 "prevId" : " 00000000-0000-0000-0000-000000000000" ,
66 "tables" : {
77 "accounts" : {
253253 "uniqueConstraints" : {},
254254 "checkConstraints" : {}
255255 },
256+ "user_files" : {
257+ "name" : " user_files" ,
258+ "columns" : {
259+ "id" : {
260+ "name" : " id" ,
261+ "type" : " text" ,
262+ "primaryKey" : true ,
263+ "notNull" : true ,
264+ "autoincrement" : false
265+ },
266+ "user_id" : {
267+ "name" : " user_id" ,
268+ "type" : " text" ,
269+ "primaryKey" : false ,
270+ "notNull" : true ,
271+ "autoincrement" : false
272+ },
273+ "filename" : {
274+ "name" : " filename" ,
275+ "type" : " text" ,
276+ "primaryKey" : false ,
277+ "notNull" : true ,
278+ "autoincrement" : false
279+ },
280+ "original_name" : {
281+ "name" : " original_name" ,
282+ "type" : " text" ,
283+ "primaryKey" : false ,
284+ "notNull" : true ,
285+ "autoincrement" : false
286+ },
287+ "content_type" : {
288+ "name" : " content_type" ,
289+ "type" : " text" ,
290+ "primaryKey" : false ,
291+ "notNull" : true ,
292+ "autoincrement" : false
293+ },
294+ "size" : {
295+ "name" : " size" ,
296+ "type" : " integer" ,
297+ "primaryKey" : false ,
298+ "notNull" : true ,
299+ "autoincrement" : false
300+ },
301+ "r2_key" : {
302+ "name" : " r2_key" ,
303+ "type" : " text" ,
304+ "primaryKey" : false ,
305+ "notNull" : true ,
306+ "autoincrement" : false
307+ },
308+ "uploaded_at" : {
309+ "name" : " uploaded_at" ,
310+ "type" : " integer" ,
311+ "primaryKey" : false ,
312+ "notNull" : true ,
313+ "autoincrement" : false
314+ },
315+ "category" : {
316+ "name" : " category" ,
317+ "type" : " text" ,
318+ "primaryKey" : false ,
319+ "notNull" : false ,
320+ "autoincrement" : false
321+ },
322+ "is_public" : {
323+ "name" : " is_public" ,
324+ "type" : " integer" ,
325+ "primaryKey" : false ,
326+ "notNull" : false ,
327+ "autoincrement" : false
328+ },
329+ "description" : {
330+ "name" : " description" ,
331+ "type" : " text" ,
332+ "primaryKey" : false ,
333+ "notNull" : false ,
334+ "autoincrement" : false
335+ }
336+ },
337+ "indexes" : {},
338+ "foreignKeys" : {
339+ "user_files_user_id_users_id_fk" : {
340+ "name" : " user_files_user_id_users_id_fk" ,
341+ "tableFrom" : " user_files" ,
342+ "tableTo" : " users" ,
343+ "columnsFrom" : [" user_id" ],
344+ "columnsTo" : [" id" ],
345+ "onDelete" : " cascade" ,
346+ "onUpdate" : " no action"
347+ }
348+ },
349+ "compositePrimaryKeys" : {},
350+ "uniqueConstraints" : {},
351+ "checkConstraints" : {}
352+ },
256353 "users" : {
257354 "name" : " users" ,
258355 "columns" : {
304401 "primaryKey" : false ,
305402 "notNull" : true ,
306403 "autoincrement" : false
404+ },
405+ "is_anonymous" : {
406+ "name" : " is_anonymous" ,
407+ "type" : " integer" ,
408+ "primaryKey" : false ,
409+ "notNull" : false ,
410+ "autoincrement" : false
307411 }
308412 },
309413 "indexes" : {
Original file line number Diff line number Diff line change 55 {
66 "idx" : 0 ,
77 "version" : " 6" ,
8- "when" : 1746913507377 ,
9- "tag" : " 0000_majestic_firestar " ,
8+ "when" : 1749946877776 ,
9+ "tag" : " 0000_aspiring_supreme_intelligence " ,
1010 "breakpoints" : true
1111 }
1212 ]
Original file line number Diff line number Diff line change 66interface CloudflareEnv {
77 DATABASE : D1Database ;
88 KV : KVNamespace < string > ;
9+ R2_BUCKET : R2Bucket ;
910 BETTER_AUTH_SECRET : string ;
1011 BETTER_AUTH_URL : string ;
1112}
Original file line number Diff line number Diff line change 11{
22 "name" : " opennextjs" ,
3- "version" : " 0.1.5 " ,
3+ "version" : " 0.2.0 " ,
44 "private" : true ,
55 "scripts" : {
66 "clean" : " rm -rf .open-next && rm -rf .wrangler && rm -rf node_modules && rm -rf .next" ,
2323 "db:studio:prod" : " NODE_ENV=production drizzle-kit studio"
2424 },
2525 "dependencies" : {
26+ "@radix-ui/react-dialog" : " ^1.1.14" ,
2627 "@radix-ui/react-label" : " ^2.1.6" ,
2728 "@radix-ui/react-slot" : " ^1.2.2" ,
29+ "@radix-ui/react-tabs" : " ^1.1.12" ,
2830 "better-auth" : " ^1.2.7" ,
2931 "better-auth-cloudflare" : " file:../../" ,
3032 "class-variance-authority" : " ^0.7.1" ,
Original file line number Diff line number Diff line change 11"use client" ;
22
3- import { Button } from "@/components/ui/button" ; // Import the shadcn/ui Button
43import authClient from "@/auth/authClient" ; // Assuming default export from your authClient setup
4+ import { Button } from "@/components/ui/button" ; // Import the shadcn/ui Button
55import { useRouter } from "next/navigation" ;
66import { useState , useTransition } from "react" ; // Added useState and useTransition
77
@@ -59,14 +59,13 @@ export default function SignOutButton() {
5959 } ;
6060
6161 return (
62- < div className = "w-full mt-6" >
63- { " " }
62+ < div className = "w-full mt-6 flex flex-col items-center" >
6463 { /* Container for button and error message */ }
6564 < Button
6665 onClick = { handleSignOut }
6766 disabled = { isLoading || isPending }
6867 variant = "destructive" // Use destructive variant for sign out
69- className = "w-full"
68+ className = "w-full max-w-xs "
7069 >
7170 { isLoading || isPending ? "Signing Out..." : "Sign Out" }
7271 </ Button >
You can’t perform that action at this time.
0 commit comments