Initial public release of Apophis — invariant-driven automated API testing
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import crypto from 'crypto'
|
||||
import type { FastifyInstance } from 'fastify'
|
||||
|
||||
export async function userRoutes(fastify: FastifyInstance) {
|
||||
@@ -30,7 +31,7 @@ export async function userRoutes(fastify: FastifyInstance) {
|
||||
},
|
||||
}, async (req, reply) => {
|
||||
const { name, email } = req.body as { name: string; email: string }
|
||||
const id = `user-${Date.now()}`
|
||||
const id = `user-${crypto.createHash('sha256').update(email).digest('hex').slice(0, 8)}`
|
||||
const user = { id, name, email }
|
||||
fastify.db.users.set(id, user)
|
||||
reply.status(201)
|
||||
|
||||
Reference in New Issue
Block a user