PioneerSquareLabs / otto-playground

A playground where Otto can run free while hopefully not accidentally reformatting your hard drive
https://otto-playground.vercel.app
13 stars 0 forks source link

Create src/types.ts #741

Closed otto-jacob closed 1 year ago

otto-jacob commented 1 year ago

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;

otto-jacob commented 1 year ago

Hello human! 👋

This PR was created by Otto to address the issue Create src/types.ts

Next Steps

  1. Please review the PR carefully. Auto-generated code can and will contain subtle bugs and mistakes.

  2. 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.

  3. Once the code looks good, approve the PR and merge the code.

vercel[bot] commented 1 year ago

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