Merged PR 154: Create dashboard
This commit is contained in:
@@ -20,8 +20,12 @@ public class ExecutionController {
|
||||
ScenarioExecutionService scenarioExecutionService;
|
||||
|
||||
@GetMapping("/execution")
|
||||
public ScenarioExecution getOldExections(@RequestParam String id){
|
||||
return scenarioExecutionRepository.findById(id).get();
|
||||
public ScenarioExecution getOldExections(@RequestParam String id){
|
||||
ScenarioExecution scenarioExecution = scenarioExecutionRepository.findById(id).get();
|
||||
scenarioExecution.getScenario().getAiModel().setApiKey("**********");
|
||||
scenarioExecution.getScenario().getAiModel().setEndpoint("**********");
|
||||
scenarioExecution.getScenario().getAiModel().setFull_path_endpoint("**********");
|
||||
return scenarioExecution;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.olympus.hermione.controllers.dashboard;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.olympus.hermione.repository.dashboard.DashboardChatModel;
|
||||
import com.olympus.hermione.repository.dashboard.DashboardScenarioChatRepository;
|
||||
|
||||
@RestController
|
||||
public class DashboardChatController {
|
||||
|
||||
@Autowired
|
||||
private DashboardScenarioChatRepository scenarioTestChatRepository;
|
||||
|
||||
// Recupera tutti i messaggi
|
||||
@GetMapping("/chat/all")
|
||||
public List<DashboardChatModel> getAllMessages() {
|
||||
return scenarioTestChatRepository.findAll();
|
||||
}
|
||||
|
||||
// Filtra per userId
|
||||
@GetMapping("/chat/byUser")
|
||||
public List<DashboardChatModel> getByUserId(@RequestParam String userId) {
|
||||
return scenarioTestChatRepository.findByUserId(userId);
|
||||
}
|
||||
|
||||
// Filtra per conversationId
|
||||
@GetMapping("/chat/byConversation")
|
||||
public List<DashboardChatModel> getByConversationId(@RequestParam String conversationId) {
|
||||
return scenarioTestChatRepository.findByConversationId(conversationId);
|
||||
}
|
||||
|
||||
// Filtra per scenarioId
|
||||
@GetMapping("/chat/byScenario")
|
||||
public List<DashboardChatModel> getByScenarioId(@RequestParam String scenarioId) {
|
||||
return scenarioTestChatRepository.findByScenarioId(scenarioId);
|
||||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
public DashboardChatModel saveMessage(@RequestBody DashboardChatModel message) { //salva i nuovi messaggi
|
||||
return scenarioTestChatRepository.save(message);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.olympus.hermione.controllers.dashboard;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.olympus.hermione.dto.DashboardChatInput;
|
||||
import com.olympus.hermione.dto.DashboardInput;
|
||||
import com.olympus.hermione.dto.DashboardResponse;
|
||||
import com.olympus.hermione.models.Scenario;
|
||||
import com.olympus.hermione.models.ScenarioExecution;
|
||||
import com.olympus.hermione.repository.dashboard.DashboardScenarioExecutionRepository;
|
||||
import com.olympus.hermione.repository.dashboard.DashboardScenariosRepository;
|
||||
import com.olympus.hermione.repository.dashboard.DashboardUserRepository;
|
||||
import com.olympus.hermione.security.entity.User;
|
||||
import com.olympus.model.Project;
|
||||
|
||||
@RestController
|
||||
public class DashboardExecutionController {
|
||||
|
||||
@Autowired
|
||||
DashboardScenarioExecutionRepository dashboardScenarioExecutionRepository;
|
||||
|
||||
@Autowired
|
||||
DashboardUserRepository dashboardUserRepository;
|
||||
|
||||
@Autowired
|
||||
DashboardScenariosRepository dashboardScenariosRepository;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(DashboardExecutionController.class);
|
||||
|
||||
@GetMapping("/getExecScenarioByProject")
|
||||
public List<ScenarioExecution> getExecScenarioByProject(@RequestParam String project) {
|
||||
return dashboardScenarioExecutionRepository.findByExecutedByUserId(project);
|
||||
}
|
||||
|
||||
@GetMapping("/projects")
|
||||
public List<Project> getProjects() {
|
||||
return dashboardScenarioExecutionRepository.findAllProjects();
|
||||
}
|
||||
|
||||
@PostMapping("/executions-dash")
|
||||
public ResponseEntity<List<ScenarioExecution>> getExecutions(@RequestBody DashboardInput filters) {
|
||||
try {
|
||||
Date fromDate = null;
|
||||
Date toDate = null;
|
||||
|
||||
// Parsing delle date
|
||||
if (filters.getDateFrom() != null && !filters.getDateFrom().isEmpty()) {
|
||||
fromDate = new SimpleDateFormat("yyyy-MM-dd").parse(filters.getDateFrom());
|
||||
}
|
||||
if (filters.getDateTo() != null && !filters.getDateTo().isEmpty()) {
|
||||
toDate = new SimpleDateFormat("yyyy-MM-dd").parse(filters.getDateTo());
|
||||
}
|
||||
|
||||
// Conversione delle stringhe in liste
|
||||
List<String> projectNameList = filters.getProjectNameList();
|
||||
List<String> scenarioNameList = filters.getScenarioNameList();
|
||||
|
||||
List<ScenarioExecution> executions = dashboardScenarioExecutionRepository.findByFilters(
|
||||
fromDate, toDate, projectNameList, scenarioNameList
|
||||
);
|
||||
|
||||
|
||||
return ResponseEntity.ok(executions);
|
||||
|
||||
} catch (ParseException e) {
|
||||
logger.error("Error parsing date: ", e);
|
||||
return ResponseEntity.badRequest().body(null);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error fetching executions: ", e);
|
||||
return ResponseEntity.internalServerError().body(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/executions-stats-dash")
|
||||
public ResponseEntity<List<DashboardResponse>> getExecutionsStats (@RequestBody DashboardInput filters) {
|
||||
try {
|
||||
Date fromDate = null;
|
||||
Date toDate = null;
|
||||
|
||||
// Parsing delle date
|
||||
if (filters.getDateFrom() != null && !filters.getDateFrom().isEmpty()) {
|
||||
fromDate = new SimpleDateFormat("yyyy-MM-dd").parse(filters.getDateFrom());
|
||||
}
|
||||
if (filters.getDateTo() != null && !filters.getDateTo().isEmpty()) {
|
||||
toDate = new SimpleDateFormat("yyyy-MM-dd").parse(filters.getDateTo());
|
||||
}
|
||||
|
||||
// Conversione delle stringhe in liste
|
||||
List<String> projectNameList = filters.getProjectNameList();
|
||||
List<String> scenarioNameList = filters.getScenarioNameList();
|
||||
|
||||
|
||||
List<DashboardResponse> execStatByFilters = dashboardScenarioExecutionRepository.execStatsByFilters(
|
||||
projectNameList, scenarioNameList, fromDate, toDate
|
||||
);
|
||||
for (DashboardResponse r : execStatByFilters) {
|
||||
logger.info("Query Response: {}", r);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ResponseEntity.ok(execStatByFilters);
|
||||
|
||||
|
||||
|
||||
} catch (ParseException e) {
|
||||
logger.error("Error parsing date: ", e);
|
||||
return ResponseEntity.badRequest().body(null);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error fetching executions: ", e);
|
||||
return ResponseEntity.internalServerError().body(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/users-by-projects")
|
||||
public ResponseEntity<List<User>> getUsersByProjects(@RequestParam String projectIdsArr) {
|
||||
try {
|
||||
|
||||
List<String> ids = Arrays.asList(projectIdsArr.split(","));
|
||||
List<ObjectId> objectIds = ids.stream()
|
||||
.map(ObjectId::new)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<User> users = dashboardUserRepository.findUsersByLstProjectsIn(objectIds);
|
||||
return ResponseEntity.ok(users);
|
||||
} catch (Exception e) {
|
||||
// Log dell'errore
|
||||
logger.error("Error fetching users by projects: ", e);
|
||||
return ResponseEntity.internalServerError().body(null);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/scenarios-filter")
|
||||
public ResponseEntity<List<Scenario>> getScenarios(@RequestParam String selectedAccount) {
|
||||
try {
|
||||
List<Scenario> scenarios = dashboardScenariosRepository.findAllForAccount(selectedAccount);
|
||||
return ResponseEntity.ok(scenarios);
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/dashboard-chat-stats")
|
||||
public ResponseEntity<List<DashboardResponse>> getChatStats (@RequestBody DashboardChatInput filters) {
|
||||
try {
|
||||
Date fromDate = null;
|
||||
Date toDate = null;
|
||||
|
||||
if (filters.getDateFrom() != null && !filters.getDateFrom().isEmpty()) {
|
||||
fromDate = new SimpleDateFormat("yyyy-MM-dd").parse(filters.getDateFrom());
|
||||
}
|
||||
if (filters.getDateTo() != null && !filters.getDateTo().isEmpty()) {
|
||||
toDate = new SimpleDateFormat("yyyy-MM-dd").parse(filters.getDateTo());
|
||||
}
|
||||
|
||||
// Conversione delle stringhe in liste
|
||||
List<String> projectNameList = filters.getProjectNameList();
|
||||
List<String> scenarioIdList = filters.getScenarioIdList();
|
||||
|
||||
|
||||
List<DashboardResponse> execStatByFilters = dashboardScenarioExecutionRepository.execStatsByFilters(
|
||||
projectNameList, scenarioIdList, fromDate, toDate
|
||||
);
|
||||
for (DashboardResponse r : execStatByFilters) {
|
||||
logger.info("Query Response: {}", r);
|
||||
|
||||
}
|
||||
|
||||
|
||||
return ResponseEntity.ok(execStatByFilters);
|
||||
|
||||
|
||||
|
||||
} catch (ParseException e) {
|
||||
logger.error("Error parsing date: ", e);
|
||||
return ResponseEntity.badRequest().body(null);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error fetching executions: ", e);
|
||||
return ResponseEntity.internalServerError().body(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.olympus.hermione.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DashboardChatInput {
|
||||
|
||||
public String dateFrom;
|
||||
public String dateTo;
|
||||
public List <String> projectNameList;
|
||||
public List <String> scenarioIdList;
|
||||
|
||||
}
|
||||
|
||||
18
src/main/java/com/olympus/hermione/dto/DashboardInput.java
Normal file
18
src/main/java/com/olympus/hermione/dto/DashboardInput.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.olympus.hermione.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DashboardInput {
|
||||
public String dateFrom;
|
||||
public String dateTo;
|
||||
public List <String> projectNameList;
|
||||
public List <String> applicationNameList;
|
||||
public List <String> userNameList;
|
||||
public List <String> scenarioNameList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
package com.olympus.hermione.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
|
||||
import com.olympus.hermione.models.ScenarioExecution;
|
||||
|
||||
import lombok.ToString;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
public class DashboardResponse {
|
||||
private long totalTokens;
|
||||
private long totalExecutions;
|
||||
private String projectName;
|
||||
private String scenarioInternalName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.olympus.hermione.repository.dashboard;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.mongodb.repository.Aggregation;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
|
||||
import com.olympus.hermione.dto.DashboardResponse;
|
||||
import com.olympus.model.ChatHistory;
|
||||
|
||||
@RepositoryRestResource(collectionResourceRel = "ChatHistory", path = "ChatHistory")
|
||||
@CrossOrigin
|
||||
public interface DashboardChatHistoryRepository extends MongoRepository<ChatHistory, String> {
|
||||
|
||||
|
||||
@Aggregation(pipeline = {
|
||||
|
||||
"{ '$match': { " +
|
||||
|
||||
"'$and': [" +
|
||||
|
||||
"{ 'conversationId': { '$regex': ?1 } }, " +
|
||||
|
||||
"{ 'lastMessageDate': { '$gte': ?2 } }, " +
|
||||
|
||||
"{ 'lastMessageDate': { '$lte': ?3 } }" +
|
||||
|
||||
"]" +
|
||||
|
||||
"} }",
|
||||
|
||||
"{ '$group': { " +
|
||||
|
||||
"'_id': { " +
|
||||
|
||||
"'project': '$execSharedMap.user_input.selected_project', " +
|
||||
|
||||
"'scenario': '$scenario.name'" +
|
||||
|
||||
"}, " +
|
||||
|
||||
"'totalTokens': { '$sum': '$usedTokens' }, " +
|
||||
|
||||
"'totalExecutions': { '$sum': 1 }" +
|
||||
|
||||
"} }",
|
||||
|
||||
"{ '$project': { " +
|
||||
|
||||
"'projectName': '$_id.project', " +
|
||||
|
||||
"'scenarioInternalName': '$_id.scenario', " +
|
||||
|
||||
"'totalTokens': 1, " +
|
||||
|
||||
"'totalExecutions': 1" +
|
||||
|
||||
"} }"
|
||||
|
||||
})
|
||||
|
||||
List<DashboardResponse> execStatsByFilters(
|
||||
|
||||
List<String> projectNames,
|
||||
|
||||
List<String> scenarioNames,
|
||||
|
||||
Date fromDate,
|
||||
|
||||
Date toDate);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.olympus.hermione.repository.dashboard;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.mongodb.core.mapping.Document;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Document(collection = "ChatHistory")
|
||||
public class DashboardChatModel {
|
||||
|
||||
@Id
|
||||
private String id;
|
||||
private String userId;
|
||||
private String conversationId;
|
||||
private String scenarioId;
|
||||
private String scenarioName;
|
||||
private List<Message> messages;
|
||||
|
||||
// Getters e Setters
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getConversationId() {
|
||||
return conversationId;
|
||||
}
|
||||
|
||||
public void setConversationId(String conversationId) {
|
||||
this.conversationId = conversationId;
|
||||
}
|
||||
|
||||
public String getScenarioId() {
|
||||
return scenarioId;
|
||||
}
|
||||
|
||||
public void setScenarioId(String scenarioId) {
|
||||
this.scenarioId = scenarioId;
|
||||
}
|
||||
|
||||
public String getScenarioName() {
|
||||
return scenarioName;
|
||||
}
|
||||
|
||||
public void setScenarioName(String scenarioName) {
|
||||
this.scenarioName = scenarioName;
|
||||
}
|
||||
|
||||
public List<Message> getMessages() {
|
||||
return messages;
|
||||
}
|
||||
|
||||
public void setMessages(List<Message> messages) {
|
||||
this.messages = messages;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Classe interna per i messaggi
|
||||
public static class Message {
|
||||
private String message;
|
||||
private String type;
|
||||
private Date timestamp;
|
||||
private String conversationId;
|
||||
|
||||
// Getters e Setters
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Date getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public void setTimestamp(Date timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String getConversationId() {
|
||||
return conversationId;
|
||||
}
|
||||
|
||||
public void setConversationId(String conversationId) {
|
||||
this.conversationId = conversationId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.olympus.hermione.repository.dashboard;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
||||
@RepositoryRestResource(collectionResourceRel = "ChatModels", path = "ChatModels")
|
||||
@CrossOrigin
|
||||
public interface DashboardScenarioChatRepository extends MongoRepository<DashboardChatModel, String> {
|
||||
|
||||
List<DashboardChatModel> findByUserId(String userId);
|
||||
List<DashboardChatModel> findByConversationId(String conversationId);
|
||||
List<DashboardChatModel> findByScenarioId(String scenarioId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.olympus.hermione.repository.dashboard;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.bson.Document;
|
||||
import org.springframework.data.mongodb.repository.Aggregation;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.mongodb.repository.Query;
|
||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
|
||||
import com.olympus.hermione.dto.DashboardResponse;
|
||||
import com.olympus.hermione.models.ScenarioExecution;
|
||||
import com.olympus.hermione.security.entity.User;
|
||||
import com.olympus.model.Project;
|
||||
|
||||
//query per trovare esecuzioni tramite IDUtente e progetti
|
||||
@RepositoryRestResource(collectionResourceRel = "scenario_executions", path = "scenario_executions")
|
||||
@CrossOrigin
|
||||
public interface DashboardScenarioExecutionRepository extends MongoRepository<ScenarioExecution, String> {
|
||||
List<ScenarioExecution> findByExecutedByUserId(String project);
|
||||
|
||||
List<ScenarioExecution> findByExecutedByUserIdOrderByStartDateDesc(String userId);
|
||||
|
||||
@Query(value = "{}", fields = "{ 'projectId': 1, 'FE_name': 1 }")
|
||||
List<Project> findAllProjects();
|
||||
|
||||
@Query("{ 'execSharedMap.user_input.selected_project': ?0 }")
|
||||
List<ScenarioExecution> getExecutionByProjectName(String projectName);
|
||||
|
||||
@Query("{'execSharedMap.user_input.selected_project': { $in: ?2 },'endDate': { $gte: ?0, $lte: ?1 }, 'scenario.name' : { $in: ?3} }")
|
||||
List<ScenarioExecution> findByFilters(Date fromDate, Date toDate, List<String> projectNames,
|
||||
List<String> scenarioNames);
|
||||
|
||||
@Query("{ 'lstProjects': { $in: ?0 }}")
|
||||
List<User> findUsersByLstProjectsIn(List<ObjectId> projectIds);
|
||||
|
||||
@Aggregation(pipeline = {
|
||||
|
||||
"{ '$match': { " +
|
||||
|
||||
"'$and': [" +
|
||||
|
||||
"{ 'execSharedMap.user_input.selected_project': { '$in': ?0 } }, " +
|
||||
|
||||
"{ 'scenario.name': { '$in': ?1 } }, " +
|
||||
|
||||
"{ 'endDate': { '$gte': ?2 } }, " +
|
||||
|
||||
"{ 'endDate': { '$lte': ?3 } }" +
|
||||
|
||||
"]" +
|
||||
|
||||
"} }",
|
||||
|
||||
"{ '$group': { " +
|
||||
|
||||
"'_id': { " +
|
||||
|
||||
"'project': '$execSharedMap.user_input.selected_project', " +
|
||||
|
||||
"'scenario': '$scenario.name'" +
|
||||
|
||||
"}, " +
|
||||
|
||||
"'totalTokens': { '$sum': '$usedTokens' }, " +
|
||||
|
||||
"'totalExecutions': { '$sum': 1 }" +
|
||||
|
||||
"} }",
|
||||
|
||||
"{ '$project': { " +
|
||||
|
||||
"'projectName': '$_id.project', " +
|
||||
|
||||
"'scenarioInternalName': '$_id.scenario', " +
|
||||
|
||||
"'totalTokens': 1, " +
|
||||
|
||||
"'totalExecutions': 1" +
|
||||
|
||||
"} }"
|
||||
|
||||
})
|
||||
|
||||
List<DashboardResponse> execStatsByFilters(
|
||||
|
||||
List<String> projectNames,
|
||||
|
||||
List<String> scenarioNames,
|
||||
|
||||
Date fromDate,
|
||||
|
||||
Date toDate);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.olympus.hermione.repository.dashboard;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.mongodb.repository.Query;
|
||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
|
||||
import com.olympus.hermione.models.Scenario;
|
||||
import com.olympus.hermione.models.ScenarioExecution;
|
||||
import com.olympus.hermione.security.entity.User;
|
||||
import com.olympus.model.Project;
|
||||
|
||||
|
||||
|
||||
@RepositoryRestResource(collectionResourceRel = "scenarios", path = "scenarios")
|
||||
@CrossOrigin
|
||||
public interface DashboardScenariosRepository extends MongoRepository<Scenario, String>
|
||||
{
|
||||
@Query("{ 'visible': 'Y', 'account': ?0 }")
|
||||
List<Scenario> findAllForAccount(String account);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.olympus.hermione.repository.dashboard;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.bson.types.ObjectId;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.mongodb.repository.Query;
|
||||
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
|
||||
import com.olympus.hermione.models.ScenarioExecution;
|
||||
import com.olympus.hermione.security.entity.User;
|
||||
import com.olympus.model.Project;
|
||||
|
||||
|
||||
|
||||
@RepositoryRestResource(collectionResourceRel = "users", path = "users")
|
||||
@CrossOrigin
|
||||
public interface DashboardUserRepository extends MongoRepository<User, String>
|
||||
{
|
||||
|
||||
@Query("{ 'lstProjects': { $in: ?0 }}")
|
||||
List<User> findUsersByLstProjectsIn(List<ObjectId> projectIds);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user