Coding task · NestJS course · Module 1: NestJS Basics

Service with CRUD Logic

Create a service with a full set of CRUD operations on the list of legionaries.

Task

Write a LegionService with a private array of legionaries and these methods: findAll() returns the array, findById(id) returns the legionary with that id (or undefined), recruit(data) adds a legionary with a new, unique id and returns it, dismiss(id) removes the legionary with that id.