• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

torresj / infosas-api / 87

12 Jan 2026 02:35PM UTC coverage: 76.32% (-15.3%) from 91.648%
87

push

circleci

torresj
Auth API added

70 of 170 new or added lines in 20 files covered. (41.18%)

477 of 625 relevant lines covered (76.32%)

0.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

23.53
/src/main/java/com/torresj/infosas/services/impl/ClientServiceImpl.java
1
package com.torresj.infosas.services.impl;
2

3
import com.torresj.infosas.dtos.ClientDto;
4
import com.torresj.infosas.entities.client.ClientEntity;
5
import com.torresj.infosas.enums.Role;
6
import com.torresj.infosas.exceptions.ClientNotFoundException;
7
import com.torresj.infosas.mappers.ClientMapper;
8
import com.torresj.infosas.repositories.client.ClientRepository;
9
import com.torresj.infosas.security.CustomUserDetails;
10
import com.torresj.infosas.services.ClientService;
11
import lombok.RequiredArgsConstructor;
12
import lombok.extern.slf4j.Slf4j;
13
import org.springframework.security.core.userdetails.UserDetails;
14
import org.springframework.security.core.userdetails.UserDetailsService;
15
import org.springframework.security.core.userdetails.UsernameNotFoundException;
16
import org.springframework.stereotype.Service;
17

18
import java.util.List;
19

20
@Service
21
@Slf4j
1✔
22
@RequiredArgsConstructor
23
public class ClientServiceImpl implements ClientService, UserDetailsService {
24

25
    private final ClientRepository clientRepository;
26
    private final ClientMapper clientMapper;
27

28
    @Override
29
    public ClientDto get(long id) {
NEW
30
        return clientMapper.toClientDto(
×
NEW
31
                clientRepository.findById(id).orElseThrow(
×
NEW
32
                        () -> new ClientNotFoundException(id)
×
33
                )
34
        );
35
    }
36

37
    @Override
38
    public List<ClientDto> get() {
NEW
39
        return clientRepository.findAll().stream().map(clientMapper::toClientDto).toList();
×
40
    }
41

42
    @Override
43
    public ClientDto save(long id, String name, String password, Role role) {
NEW
44
        var client = clientRepository.save(ClientEntity.builder()
×
NEW
45
                .id(id)
×
NEW
46
                .name(name)
×
NEW
47
                .password(password)
×
NEW
48
                .role(role)
×
NEW
49
                .build()
×
50
        );
51

NEW
52
        return clientMapper.toClientDto(client);
×
53
    }
54

55
    @Override
56
    public void delete(long id) {
NEW
57
        clientRepository.deleteById(id);
×
NEW
58
    }
×
59

60
    @Override
61
    public UserDetails loadUserByUsername(String clientName) throws UsernameNotFoundException {
62
        ClientEntity client = clientRepository.findByName(clientName)
1✔
63
                .orElseThrow(() -> new UsernameNotFoundException(clientName));
1✔
64
        return new CustomUserDetails(client);
1✔
65
    }
66
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc