Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions plans/vertz-core-api-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export const env = vertz.env({
schema: s.object({
NODE_ENV: s.enum(['development', 'staging', 'production']),
PORT: s.number().default(3000),
DATABASE_URL: s.string().url(),
DATABASE_URL: s.url(),
JWT_SECRET: s.string().min(32),
CORS_ORIGINS: s.string().transform((v) => v.split(',')),
LOG_LEVEL: s.enum(['debug', 'info', 'warn', 'error']).default('info'),
Expand Down Expand Up @@ -305,12 +305,12 @@ import { s } from '@vertz/schema';

export const createUserBody = s.object({
name: s.string().min(1).max(100),
email: s.string().email(),
email: s.email(),
password: s.string().min(8),
});

export const createUserResponse = s.object({
id: s.string().uuid(),
id: s.uuid(),
name: s.string(),
email: s.string(),
createdAt: s.date(),
Expand Down Expand Up @@ -390,7 +390,7 @@ userRouter.get('/', {

// GET /users/:id
userRouter.get('/:id', {
params: s.object({ id: s.string().uuid() }), // Inline — simple enough
params: s.object({ id: s.uuid() }), // Inline — simple enough
response: readUserResponse,
middlewares: [authMiddleware],
handler: async (ctx) => {
Expand All @@ -409,7 +409,7 @@ userRouter.post('/', {

// POST /users/:id/reset-password
userRouter.post('/:id/reset-password', {
params: s.object({ id: s.string().uuid() }),
params: s.object({ id: s.uuid() }),
body: resetPasswordBody,
middlewares: [authMiddleware],
handler: async (ctx) => {
Expand All @@ -419,7 +419,7 @@ userRouter.post('/:id/reset-password', {

// POST /users/:id/activate (no body, no response body)
userRouter.post('/:id/activate', {
params: s.object({ id: s.string().uuid() }),
params: s.object({ id: s.uuid() }),
middlewares: [authMiddleware],
handler: async (ctx) => {
ctx.userService.activate(ctx.params.id);
Expand Down
Loading