The recipes.blue monorepo recipes.blue
recipes appview atproto

feat: time field in db

Changed files
+167 -5
apps
web
src
routes
_.(app)
recipes
libs
+2 -3
apps/web/src/routes/_.(app)/recipes/new.tsx
··· 12 12 import { useFieldArray, useForm } from "react-hook-form"; 13 13 import { z } from "zod"; 14 14 import { zodResolver } from "@hookform/resolvers/zod"; 15 - import { IngredientObject, RecipeRecord } from "@cookware/lexicons"; 15 + import { RecipeRecord } from "@cookware/lexicons"; 16 16 import { 17 17 Form, 18 18 FormControl, ··· 237 237 e.preventDefault(); 238 238 ingredients.append({ 239 239 name: "", 240 - amount: null, 241 - unit: null, 240 + amount: "", 242 241 }); 243 242 }} 244 243 >
+1
libs/database/migrations/0001_icy_killmonger.sql
··· 1 + ALTER TABLE `recipes` ADD `time` integer DEFAULT 0 NOT NULL;
+156
libs/database/migrations/meta/0001_snapshot.json
··· 1 + { 2 + "version": "6", 3 + "dialect": "sqlite", 4 + "id": "2c6fca6c-38c3-4482-b189-6defabb5f8c8", 5 + "prevId": "1c01d686-877c-426c-ac8a-31f47df9385d", 6 + "tables": { 7 + "auth_session": { 8 + "name": "auth_session", 9 + "columns": { 10 + "key": { 11 + "name": "key", 12 + "type": "text", 13 + "primaryKey": true, 14 + "notNull": true, 15 + "autoincrement": false 16 + }, 17 + "session": { 18 + "name": "session", 19 + "type": "text", 20 + "primaryKey": false, 21 + "notNull": true, 22 + "autoincrement": false 23 + } 24 + }, 25 + "indexes": {}, 26 + "foreignKeys": {}, 27 + "compositePrimaryKeys": {}, 28 + "uniqueConstraints": {}, 29 + "checkConstraints": {} 30 + }, 31 + "auth_state": { 32 + "name": "auth_state", 33 + "columns": { 34 + "key": { 35 + "name": "key", 36 + "type": "text", 37 + "primaryKey": true, 38 + "notNull": true, 39 + "autoincrement": false 40 + }, 41 + "state": { 42 + "name": "state", 43 + "type": "text", 44 + "primaryKey": false, 45 + "notNull": true, 46 + "autoincrement": false 47 + } 48 + }, 49 + "indexes": {}, 50 + "foreignKeys": {}, 51 + "compositePrimaryKeys": {}, 52 + "uniqueConstraints": {}, 53 + "checkConstraints": {} 54 + }, 55 + "recipes": { 56 + "name": "recipes", 57 + "columns": { 58 + "id": { 59 + "name": "id", 60 + "type": "integer", 61 + "primaryKey": true, 62 + "notNull": true, 63 + "autoincrement": false 64 + }, 65 + "rkey": { 66 + "name": "rkey", 67 + "type": "text", 68 + "primaryKey": false, 69 + "notNull": true, 70 + "autoincrement": false 71 + }, 72 + "title": { 73 + "name": "title", 74 + "type": "text", 75 + "primaryKey": false, 76 + "notNull": true, 77 + "autoincrement": false 78 + }, 79 + "time": { 80 + "name": "time", 81 + "type": "integer", 82 + "primaryKey": false, 83 + "notNull": true, 84 + "autoincrement": false, 85 + "default": 0 86 + }, 87 + "description": { 88 + "name": "description", 89 + "type": "text", 90 + "primaryKey": false, 91 + "notNull": false, 92 + "autoincrement": false 93 + }, 94 + "ingredients": { 95 + "name": "ingredients", 96 + "type": "text", 97 + "primaryKey": false, 98 + "notNull": true, 99 + "autoincrement": false 100 + }, 101 + "steps": { 102 + "name": "steps", 103 + "type": "text", 104 + "primaryKey": false, 105 + "notNull": true, 106 + "autoincrement": false 107 + }, 108 + "created_at": { 109 + "name": "created_at", 110 + "type": "text", 111 + "primaryKey": false, 112 + "notNull": true, 113 + "autoincrement": false 114 + }, 115 + "author_did": { 116 + "name": "author_did", 117 + "type": "text", 118 + "primaryKey": false, 119 + "notNull": true, 120 + "autoincrement": false 121 + } 122 + }, 123 + "indexes": { 124 + "recipes_id_unique": { 125 + "name": "recipes_id_unique", 126 + "columns": [ 127 + "id" 128 + ], 129 + "isUnique": true 130 + }, 131 + "recipes_rkey_author_did_unique": { 132 + "name": "recipes_rkey_author_did_unique", 133 + "columns": [ 134 + "rkey", 135 + "author_did" 136 + ], 137 + "isUnique": true 138 + } 139 + }, 140 + "foreignKeys": {}, 141 + "compositePrimaryKeys": {}, 142 + "uniqueConstraints": {}, 143 + "checkConstraints": {} 144 + } 145 + }, 146 + "views": {}, 147 + "enums": {}, 148 + "_meta": { 149 + "schemas": {}, 150 + "tables": {}, 151 + "columns": {} 152 + }, 153 + "internal": { 154 + "indexes": {} 155 + } 156 + }
+7
libs/database/migrations/meta/_journal.json
··· 8 8 "when": 1733683012154, 9 9 "tag": "0000_boring_tenebrous", 10 10 "breakpoints": true 11 + }, 12 + { 13 + "idx": 1, 14 + "version": "6", 15 + "when": 1734630004978, 16 + "tag": "0001_icy_killmonger", 17 + "breakpoints": true 11 18 } 12 19 ] 13 20 }
+1 -2
libs/database/src/schema.ts
··· 10 10 }, 11 11 }); 12 12 13 - const nowAsIsoString = sql`(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))`; 14 - 15 13 const dateIsoText = customType<{ data: Date; driverData: string }>({ 16 14 dataType() { 17 15 return "text"; ··· 24 22 id: int('id').primaryKey().notNull().unique(), 25 23 rkey: text('rkey').notNull(), 26 24 title: text('title').notNull(), 25 + time: int('time').notNull().default(0), 27 26 description: text('description'), 28 27 ingredients: text('ingredients', { mode: 'json' }).$type<Partial<Ingredient>[]>().notNull(), 29 28 steps: text('steps', { mode: 'json' }).$type<Partial<Step>[]>().notNull(),