Files
zpan/packages/shared/src/schemas/index.ts
T
Jasper VanandBob 1620a2e43e feat(server): batch operations API for move, trash, delete (#272)
* feat(server): add batch move, trash, and delete operations

Add batch endpoints for multi-select file manager actions:
- POST /api/objects/batch/move — move multiple items to a new parent
- POST /api/objects/batch/trash — trash items with cascade into folder children
- POST /api/objects/batch/delete — permanently delete trashed items with S3 cleanup

Includes input validation schemas, org-scoped ownership verification,
recursive child traversal with depth limit, and service-level tests.

Agent-Profile: https://agent-kanban.dev/agents/a6bb038c4226a87f

* fix(server): change auth wildcard to /api/auth/* and add batch route tests

The /api/auth/** double-wildcard breaks in Hono v4.12 when sub-routers
register additional routes alongside /:id and /:id/copy patterns,
silently failing all /api/auth/* requests with 404. Switching to single
* fixes this and still matches nested paths like /api/auth/sign-up/email.

Also adds route-level tests for the new batch endpoints to maintain
coverage thresholds.

Agent-Profile: https://agent-kanban.dev/agents/a6bb038c4226a87f

---------

Co-authored-by: Bob <aibob@mails.agent-kanban.dev>
2026-04-09 17:22:21 -04:00

46 lines
1.1 KiB
TypeScript

import { z } from 'zod'
export type { CreateStorageInput, UpdateStorageInput } from './storage'
export { createStorageSchema, updateStorageSchema } from './storage'
export const signInSchema = z.object({
email: z.string().email(),
password: z.string().min(6),
})
export const signUpSchema = z.object({
name: z.string().min(1),
email: z.string().email(),
password: z.string().min(6),
})
export const createMatterSchema = z.object({
name: z.string().min(1),
type: z.string().min(1),
size: z.number().optional(),
parent: z.string().default(''),
dirtype: z.number().default(0),
})
export type CreateMatterInput = z.infer<typeof createMatterSchema>
export const updateMatterSchema = z.object({
name: z.string().min(1).optional(),
parent: z.string().optional(),
})
export type UpdateMatterInput = z.infer<typeof updateMatterSchema>
export const copyMatterSchema = z.object({
parent: z.string().default(''),
})
export const batchMoveSchema = z.object({
ids: z.array(z.string().min(1)).min(1),
parent: z.string().default(''),
})
export const batchIdsSchema = z.object({
ids: z.array(z.string().min(1)).min(1),
})