20CAKE20.JS
12-fullstack

Fullstack

3

server/db/cake.db.ts

Cake Model

Example

Define the table used by the fullstack page and API.

export const Cake = {
  id: z.id(),
  name: z.string().min(1).max(80),
  price: z.int().min(1),
};

export const seed = async () => {
  const rows = [
    { id: "20", name: "Strawberry Cake", price: 24 },
    { id: "21", name: "Chocolate Cake", price: 28 },
  ];
  return rows;
};