{"path":"lib/db/src/schema/jobs.ts","size":1319,"locked":false,"binary":false,"truncated":false,"content":"import { pgTable, serial, text, timestamp, pgEnum } from \"drizzle-orm/pg-core\";\nimport { createInsertSchema, createSelectSchema } from \"drizzle-zod\";\nimport { z } from \"zod/v4\";\n\nexport const jobStatusEnum = pgEnum(\"job_status\", [\"pending\", \"completed\", \"cancelled\"]);\n\nexport const jobsTable = pgTable(\"jobs\", {\n  id:                serial(\"id\").primaryKey(),\n  jobId:             text(\"job_id\").notNull().unique(),\n  clientPubkey:      text(\"client_pubkey\").notNull(),\n  freelancerPubkey:  text(\"freelancer_pubkey\").notNull(),\n  oraclePubkey:      text(\"oracle_pubkey\").notNull(),\n  amountLamports:    text(\"amount_lamports\").notNull(),\n  status:            jobStatusEnum(\"status\").notNull().default(\"pending\"),\n  description:       text(\"description\"),\n  acceptanceCriteria: text(\"acceptance_criteria\"),\n  txSig:             text(\"tx_sig\"),\n  createdAt:         timestamp(\"created_at\", { withTimezone: true }).notNull().defaultNow(),\n  updatedAt:         timestamp(\"updated_at\", { withTimezone: true }).notNull().defaultNow(),\n});\n\nexport const insertJobSchema = createInsertSchema(jobsTable).omit({ id: true, createdAt: true, updatedAt: true });\nexport const selectJobSchema = createSelectSchema(jobsTable);\n\nexport type InsertJob = z.infer<typeof insertJobSchema>;\nexport type Job = typeof jobsTable.$inferSelect;\n"}