Menu

Post image 1
Post image 2
1 / 2
0

I found a silent data bug that returned the wrong analytics

DEV Community: nestjs·Miguel Esteves·3 days ago
#uKFIJk1j
#dev#shifts#workers#output#first_page#article
Reading 0:00
15s threshold

I was working on a take-home assessment for a staffing platform API — a NestJS + Prisma + SQLite application that managed workers, workplaces, and shifts. The task was simple: implement two scripts that return the top 3 currently-active workplaces and workers by number of completed shifts. Simple enough. Except the output was wrong. The system The API had three tables: Workers, Workplaces, and Shifts. Status was an integer enum — ACTIVE = 0, SUSPENDED = 1, CLOSED = 2. Shifts had a workerId (nullable), a cancelledAt (nullable) , and startAt/endAt timestamps. No explicit "completed" flag — you derive state from the fields. List endpoints returned paginated responses with a links.next URL to follow, and a sharding system on top. The design was clean. The bug was quiet. What wrong looked like The scripts ran. They returned valid JSON. They just returned the wrong entities.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More