Contoh Pembaruan Layanan NestJS

async function update(id: string, user: User): Promise<User> {
    // Update
    await userRepository.update(id, {
      ...(user.name && { name: user.name }),
      ...(user.surname && { surname: user.surname }),
      ...(user.age && { age: user.age }),
    });

    // Return
    return this.repository.findOneOrFail(id);
  }
Simon Wangenye