feat: complete house plan maker application
Full-featured house/apartment floor plan editor with: - Turborepo monorepo (React/Vite client, Fastify/Prisma server, shared Zod schemas) - 2D room editor with walls, doors, windows, furniture, electrical elements - 3D room preview with Three.js (auto-hide nearest walls, bird's eye default) - Wall projection views with interactive drag (elevation, position) - Apartment floor plan view with room positioning - Copy/paste, alignment tools, measurement tool, annotations - Item-attached annotations with leader lines (visible on projections) - Door open direction (LEFT/RIGHT/INWARD/OUTWARD) with swing arc - Floor type textures (wood, tile, concrete, laminate, herringbone) - Wall color picker for 3D view - Furniture: bed, desk, wardrobe, sofa, table, chair, shelf, nightstand, dresser, bookcase, TV (with stand toggle), AC unit - Furniture elevation support (wall-mounted items) - Auto-save with dirty state tracking, batch save API - Rotation-aware collision detection (SAT/OBB) with 3D elevation check - Rotation-aware hit testing - i18n (English/Russian) with locale-aware number formatting - Dark mode with system preference detection - Undo/redo, keyboard shortcuts, scale bar - PDF/PNG/JSON export and JSON import - Focus trap modal, toast notifications, tooltips - Responsive layout with overlay palettes
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { z } from 'zod';
|
||||
import { FLOOR_TYPES } from '../types/room.js';
|
||||
|
||||
const floorTypeEnum = z.enum(FLOOR_TYPES);
|
||||
|
||||
const pointSchema = z.object({
|
||||
x: z.number(),
|
||||
y: z.number(),
|
||||
});
|
||||
|
||||
export const createRoomSchema = z.object({
|
||||
name: z.string().min(1, 'Name is required').max(255),
|
||||
shape: z.array(pointSchema).optional(),
|
||||
width: z.number().positive('Width must be positive').nullish(),
|
||||
height: z.number().positive('Height must be positive').nullish(),
|
||||
wallHeight: z.number().positive('Wall height must be positive').optional(),
|
||||
plinthHeight: z.number().min(0, 'Plinth height must be non-negative').optional(),
|
||||
plinthThickness: z.number().min(0, 'Plinth thickness must be non-negative').optional(),
|
||||
order: z.number().int().min(0).optional(),
|
||||
posX: z.number().optional(),
|
||||
posY: z.number().optional(),
|
||||
floorType: floorTypeEnum.optional(),
|
||||
wallColor: z.string().max(20).optional(),
|
||||
});
|
||||
|
||||
export const updateRoomSchema = z.object({
|
||||
name: z.string().min(1, 'Name is required').max(255).optional(),
|
||||
shape: z.array(pointSchema).optional(),
|
||||
width: z.number().positive('Width must be positive').nullish(),
|
||||
height: z.number().positive('Height must be positive').nullish(),
|
||||
wallHeight: z.number().positive('Wall height must be positive').optional(),
|
||||
plinthHeight: z.number().min(0, 'Plinth height must be non-negative').optional(),
|
||||
plinthThickness: z.number().min(0, 'Plinth thickness must be non-negative').optional(),
|
||||
order: z.number().int().min(0).optional(),
|
||||
posX: z.number().optional(),
|
||||
posY: z.number().optional(),
|
||||
floorType: floorTypeEnum.optional(),
|
||||
wallColor: z.string().max(20).optional(),
|
||||
});
|
||||
|
||||
export type CreateRoomInput = z.infer<typeof createRoomSchema>;
|
||||
export type UpdateRoomInput = z.infer<typeof updateRoomSchema>;
|
||||
Reference in New Issue
Block a user