Skip to content

Commit

Permalink
[backend] clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
damgouj committed Jan 31, 2025
1 parent 8475cc5 commit d98677e
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ public List<Endpoint> findAssetsForInjectionByHostname(@NotBlank final String ho
return endpoints(EndpointSpecification.findEndpointsForInjectionByHostname(hostname));
}

@Transactional(readOnly = true)
public Optional<Endpoint> findByExternalReference(@NotBlank final String externalReference) {
return this.endpointRepository.findByExternalReference(externalReference);
}

@Transactional(readOnly = true)
public Optional<Endpoint> findEndpointByAgentDetails(
@NotBlank final String hostname,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.openbas.database.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.hypersistence.utils.hibernate.type.array.StringArrayType;
Expand Down Expand Up @@ -96,22 +95,6 @@ public enum PLATFORM_TYPE {
@JsonSerialize(using = MultiModelDeserializer.class)
private List<Agent> agents = new ArrayList<>();

@JsonIgnore
public Executor getExecutor() {
if (this.agents.isEmpty()) {
return null;
}
return this.agents.getFirst().getExecutor();
}

@JsonIgnore
public boolean getActive() {
if (this.agents.isEmpty()) {
return false;
}
return this.agents.getFirst().isActive();
}

public String getHostname() {
return hostname.toLowerCase();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,6 @@ Optional<Endpoint> findByHostnameArchAndPlatform(
@NotBlank final @Param("platform") String platform,
@NotBlank final @Param("arch") String arch);

@Query(
value =
"select e.* from assets e left join agents a on e.asset_id = a.agent_asset where a.agent_external_reference = :externalReference",
nativeQuery = true)
Optional<Endpoint> findByExternalReference(@Param("externalReference") String externalReference);

@Override
@Query(
"select COUNT(DISTINCT a) from Inject i "
Expand Down

0 comments on commit d98677e

Please sign in to comment.