Closed otto-jacob closed 1 year ago
Hello human! 👋
This PR was created by Otto to address the issue Create src/types.ts
Please review the PR carefully. Auto-generated code can and will contain subtle bugs and mistakes.
If you identify code that needs to be changed, please reject the PR with a specific reason. Be as detailed as possible in your comments. Otto will take these comments, make changes to the code and push up changes. Please note that this process will take a few minutes.
Once the code looks good, approve the PR and merge the code.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
otto-playground | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 6, 2023 7:17pm |
Summary:
Create a file called types.ts in the src directory that will contain the TypeScript interfaces and Zod schemas for the database. Here is the code:
import { z } from "zod";
export const userSchema = z.object({ id: z.string().default("cuid()"), githubId: z.number(), name: z.string(), email: z.string(), imageUrl: z.string().nullable(), createdAt: z.date().default(() => new Date()), updatedAt: z.date().default(() => new Date()), });
export type User = z.infer;
export const projectSchema = z.object({ id: z.string().default("cuid()"), name: z.string(), description: z.string(), userId: z.string(), githubRepoUrl: z.string().nullable(), slackChannelId: z.string().nullable(), createdAt: z.date().default(() => new Date()), updatedAt: z.date().default(() => new Date()), });
export type Project = z.infer;
export const projectSitemapSchema = z.object({ id: z.string().default("cuid()"), projectId: z.string(), fileName: z.string(), fileDescription: z.string().nullable(), figmaUrl: z.string().nullable(), approved: z.boolean().default(false), createdAt: z.date().default(() => new Date()), updatedAt: z.date().default(() => new Date()), });
export type ProjectSitemap = z.infer;
export const projectDataSchemaSchema = z.object({ id: z.string().default("cuid()"), projectId: z.string(), tableName: z.string(), approved: z.boolean().default(false), createdAt: z.date().default(() => new Date()), updatedAt: z.date().default(() => new Date()), });
export type ProjectDataSchema = z.infer;
export const projectDataColumnSchema = z.object({ id: z.string().default("cuid()"), dataSchemaId: z.string(), columnName: z.string(), columnType: z.string(), columnDescription: z.string().nullable(), createdAt: z.date().default(() => new Date()), updatedAt: z.date().default(() => new Date()), });
export type ProjectDataColumn = z.infer;
export const projectTaskSchema = z.object({ id: z.string().default("cuid()"), projectId: z.string(), taskName: z.string(), taskDescription: z.string(), githubIssueId: z.number().nullable(), approved: z.boolean().default(false), createdAt: z.date().default(() => new Date()), updatedAt: z.date().default(() => new Date()), });
export type ProjectTask = z.infer;