Download shared/models/auth.ts from surekim/tars: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/surekim/tars/resolve/main/shared/models/auth.ts
- Command line
-
hf download hf://spaces/surekim/tars/shared/models/auth.ts
-
curl -L -o auth.ts https://huggingface.co/spaces/surekim/tars/resolve/main/shared/models/auth.ts
1.02 kB
| import { sql } from "drizzle-orm"; | |
| import { index, integer, jsonb, pgTable, timestamp, varchar } from "drizzle-orm/pg-core"; | |
| export const sessions = pgTable( | |
| "sessions", | |
| { | |
| sid: varchar("sid").primaryKey(), | |
| sess: jsonb("sess").notNull(), | |
| expire: timestamp("expire").notNull(), | |
| }, | |
| (table) => [index("IDX_session_expire").on(table.expire)] | |
| ); | |
| export const users = pgTable("users", { | |
| id: varchar("id").primaryKey().default(sql`gen_random_uuid()`), | |
| email: varchar("email").unique(), | |
| firstName: varchar("first_name"), | |
| lastName: varchar("last_name"), | |
| profileImageUrl: varchar("profile_image_url"), | |
| credits: integer("credits").default(0).notNull(), | |
| freeUsesRemaining: integer("free_uses_remaining").default(3).notNull(), | |
| totalAnalyses: integer("total_analyses").default(0).notNull(), | |
| createdAt: timestamp("created_at").defaultNow(), | |
| updatedAt: timestamp("updated_at").defaultNow(), | |
| }); | |
| export type UpsertUser = typeof users.$inferInsert; | |
| export type User = typeof users.$inferSelect; | |