package de.fau.amos.virtualledger.server.contacts;

import de.fau.amos.virtualledger.server.persistence.ContactsRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.lang.invoke.MethodHandles;

@Component
public class ContactsController {
    @SuppressWarnings("unused")
    private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

    private final ContactsRepository contactsRepository;

    @Autowired
    public ContactsController(final ContactsRepository contactsRepository) {
        this.contactsRepository = contactsRepository;
    }
}

@@ -45,16 +45,125 @@
 tacts;%0A%0A
+import de.fau.amos.virtualledger.dtos.Contact;%0Aimport de.fau.amos.virtualledger.server.model.ContactsEntity;%0A
 import d
@@ -222,24 +222,24 @@
 Repository;%0A
-
 import org.s
@@ -434,16 +434,90 @@
 Handles;
+%0Aimport java.util.List;%0A%0Aimport static java.util.stream.Collectors.toList;
 %0A%0A@Compo
@@ -842,16 +842,16 @@
 tory) %7B%0A
-
         
@@ -901,11 +901,333 @@
 y;%0A    %7D
+%0A%0A    public List%3CContact%3E getContactsByEmail(final String email) %7B%0A        final List%3CContactsEntity%3E contactEntities = contactsRepository.getContactsByEmail(email);%0A        return contactEntities.stream().map(entity -%3E new Contact(entity.getEmail(), entity.getFirstname(), entity.getLastname())).collect(toList());%0A    %7D
 %0A%7D%0A

Add method to ContactsController to get contacts by email