Queries in the service layer

The service owns the queries β€” controllers never see Prisma

Inject PrismaService into WalkersService the same way you injected any provider: a constructor parameter. Now the service's methods run real queries instead of poking an array β€” but the boundary from module 05 holds firm. The controller still never touches Prisma. It calls this.walkers.findAll(); whether that answer comes from an array or a database is the service's private business.

That line β€” controllers talk to services, only services talk to Prisma β€” is the repository boundary. Keep it and you can swap the data layer, mock the service in a controller test, or move a query to a cache without the HTTP layer noticing.

Red flag in a review: a PrismaService injected straight into a controller, with prisma.walker.findMany() inside a @Get(). Say the controller is the HTTP adapter; persistence lives behind the service and keep the query out of the route.