Fixed taylordb imports

This commit is contained in:
Umar Adilov 2026-01-20 23:34:23 +05:00
parent c494d0b855
commit d51a2f372f
3 changed files with 10 additions and 17 deletions

View File

@ -59,8 +59,7 @@ Document your design decisions briefly before implementing.
This file contains all database operations. Create type-safe CRUD functions for each table: This file contains all database operations. Create type-safe CRUD functions for each table:
```typescript ```typescript
import pkg from "@taylordb/query-builder"; import { createQueryBuilder } from "@taylordb/query-builder";
const { createQueryBuilder } = pkg;
import type { TaylorDatabase } from "./types.js"; import type { TaylorDatabase } from "./types.js";
export const queryBuilder = createQueryBuilder<TaylorDatabase>({ export const queryBuilder = createQueryBuilder<TaylorDatabase>({
@ -108,7 +107,7 @@ export async function createItem(data: { name: string; status: string }) {
export async function updateItem( export async function updateItem(
id: number, id: number,
data: { name?: string; status?: string } data: { name?: string; status?: string },
) { ) {
return await queryBuilder return await queryBuilder
.update("items") .update("items")
@ -167,7 +166,7 @@ export const appRouter = router({
z.object({ z.object({
name: z.string().min(1), name: z.string().min(1),
status: z.string(), status: z.string(),
}) }),
) )
.mutation(async ({ input }) => { .mutation(async ({ input }) => {
return await db.createItem(input); return await db.createItem(input);
@ -179,7 +178,7 @@ export const appRouter = router({
id: z.number(), id: z.number(),
name: z.string().optional(), name: z.string().optional(),
status: z.string().optional(), status: z.string().optional(),
}) }),
) )
.mutation(async ({ input }) => { .mutation(async ({ input }) => {
const { id, ...data } = input; const { id, ...data } = input;
@ -474,25 +473,21 @@ The dev server should be running. Test:
### Visual Excellence Principles ### Visual Excellence Principles
1. **No Generic Colors**: Never use plain red/blue/green. Use curated HSL palettes. 1. **No Generic Colors**: Never use plain red/blue/green. Use curated HSL palettes.
- ✅ `hsl(262 83% 58%)` (vibrant purple) - ✅ `hsl(262 83% 58%)` (vibrant purple)
- ❌ `#0000ff` (plain blue) - ❌ `#0000ff` (plain blue)
2. **Premium Aesthetics**: Make it feel high-end 2. **Premium Aesthetics**: Make it feel high-end
- Use subtle gradients, shadows, and glassmorphism - Use subtle gradients, shadows, and glassmorphism
- Add smooth transitions (`transition-all duration-200`) - Add smooth transitions (`transition-all duration-200`)
- Implement hover states on interactive elements - Implement hover states on interactive elements
- Use proper spacing and visual hierarchy - Use proper spacing and visual hierarchy
3. **Modern Typography**: 3. **Modern Typography**:
- Import Google Fonts (e.g., Inter, Outfit, Manrope) - Import Google Fonts (e.g., Inter, Outfit, Manrope)
- Use varied font weights (400, 500, 600, 700) - Use varied font weights (400, 500, 600, 700)
- Proper text sizing hierarchy - Proper text sizing hierarchy
4. **Micro-Animations**: 4. **Micro-Animations**:
- Loading spinners with `lucide-react` icons + `animate-spin` - Loading spinners with `lucide-react` icons + `animate-spin`
- Fade-ins on data load - Fade-ins on data load
- Smooth transitions on hover - Smooth transitions on hover

View File

@ -1,5 +1,4 @@
import pkg from "@taylordb/query-builder"; import { createQueryBuilder } from "@taylordb/query-builder";
const { createQueryBuilder } = pkg;
import type { TaylorDatabase } from "./types.js"; import type { TaylorDatabase } from "./types.js";
/** /**

View File

@ -23,8 +23,7 @@ This document provides comprehensive examples of how to use the TaylorDB query b
### Initialize Query Builder ### Initialize Query Builder
```typescript ```typescript
import pkg from "@taylordb/query-builder"; import { createQueryBuilder } from "@taylordb/query-builder";
const { createQueryBuilder } = pkg;
import type { TaylorDatabase } from "./types.js"; import type { TaylorDatabase } from "./types.js";
export const queryBuilder = createQueryBuilder<TaylorDatabase>({ export const queryBuilder = createQueryBuilder<TaylorDatabase>({
@ -308,7 +307,7 @@ export async function updateUser(
name?: string; name?: string;
email?: string; email?: string;
age?: number; age?: number;
} },
) { ) {
return await queryBuilder return await queryBuilder
.update("users") .update("users")
@ -325,7 +324,7 @@ export async function updateUser(
```typescript ```typescript
export async function updateTaskPriority( export async function updateTaskPriority(
id: number, id: number,
priority: "low" | "medium" | "high" priority: "low" | "medium" | "high",
) { ) {
return await queryBuilder return await queryBuilder
.update("tasks") .update("tasks")
@ -343,7 +342,7 @@ export async function updateCardioSession(
data: { data: {
distance?: number; distance?: number;
duration?: number; duration?: number;
} },
) { ) {
// Fetch current record to compute speed // Fetch current record to compute speed
const currentRecord = await queryBuilder const currentRecord = await queryBuilder
@ -583,7 +582,7 @@ export async function createTask(data: {
} }
export async function getTasksByStatus( export async function getTasksByStatus(
status: (typeof TaskStatusOptions)[number] status: (typeof TaskStatusOptions)[number],
) { ) {
return await queryBuilder return await queryBuilder
.selectFrom("tasks") .selectFrom("tasks")