You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
917 B
34 lines
917 B
package org.ros.chatto.service;
|
|
|
|
import java.time.Instant;
|
|
|
|
import org.ros.chatto.repository.ChatMessageRepository;
|
|
import org.ros.chatto.repository.UserRepository;
|
|
import org.ros.chatto.repository.UserSessionRepository;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
@RequiredArgsConstructor
|
|
@Service
|
|
public class StatisticsService {
|
|
private final ChatMessageRepository chatMessageRepository;
|
|
private final UserRepository userRepo;
|
|
private final UserSessionRepository userSessionRepo;
|
|
|
|
public Long totalMessage() {
|
|
return chatMessageRepository.totalMessages();
|
|
}
|
|
|
|
public Long totalUsers() {
|
|
return userRepo.totalUsers();
|
|
}
|
|
|
|
public Long totalUsersOnline() {
|
|
return userSessionRepo.totalOnlineUsers();
|
|
}
|
|
|
|
public Long messagesOnDay(Instant date) {
|
|
return chatMessageRepository.messagesOnDate(date);
|
|
}
|
|
}
|