Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-dev-environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
env:
ENCRYPTION_KEY: hwJdNY1/yC3miXQR+Vw2V3qtt1e3FPJ2y62BKtROUJs=
ENCRYPTION_IV: DKKyySzj8ao5WgraQpwj+A==
run: mvn --batch-mode clean package
run: mvn --batch-mode clean package -T 6

- name: Publish Package Artifacts
uses: actions/upload-artifact@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
server-password: MAVEN_PASSWORD

- name: Publish to the Maven Central Repository
run: mvn --batch-mode clean deploy
run: mvn --batch-mode clean deploy -T 6
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
cache: maven

- name: Build with Maven
run: mvn --batch-mode clean package
run: mvn --batch-mode clean package -T 6

- name: Publish Package Artifacts
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
cache: maven

- name: Build with Maven
run: mvn --batch-mode --update-snapshots clean verify -Dmaven.javadoc.skip -Dgpg.skip
run: mvn --batch-mode --update-snapshots clean verify -Dmaven.javadoc.skip -Dgpg.skip -T 6
2 changes: 1 addition & 1 deletion .github/workflows/sonarqube-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=FunixProductions_FunixAPI_AYNRa2sBsXlKxBk9mU9x
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=FunixProductions_FunixAPI_AYNRa2sBsXlKxBk9mU9x -T 6
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG service_name
ARG service_base_dir
ENV SERVICE_NAME=${service_name}
ENV SERVICE_BASE_DIR=${service_base_dir}
ENV APP_VERSION=1.3.0.7
ENV APP_VERSION=1.3.0.8

WORKDIR /container/java

Expand Down
2 changes: 1 addition & 1 deletion modules/core/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>fr.funixgaming.api.core</groupId>
<artifactId>funixgaming-core</artifactId>
<version>1.3.0.7</version>
<version>1.3.0.8</version>
</parent>

<groupId>fr.funixgaming.api.core.client</groupId>
Expand Down
2 changes: 1 addition & 1 deletion modules/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>fr.funixgaming.api</groupId>
<artifactId>funixgaming-api</artifactId>
<version>1.3.0.7</version>
<version>1.3.0.8</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/core/service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>fr.funixgaming.api.core</groupId>
<artifactId>funixgaming-core</artifactId>
<version>1.3.0.7</version>
<version>1.3.0.8</version>
</parent>

<groupId>fr.funixgaming.api.core.service</groupId>
Expand Down
2 changes: 1 addition & 1 deletion modules/core/test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>fr.funixgaming.api.core</groupId>
<artifactId>funixgaming-core</artifactId>
<version>1.3.0.7</version>
<version>1.3.0.8</version>
</parent>

<groupId>fr.funixgaming.api.core.test</groupId>
Expand Down
2 changes: 1 addition & 1 deletion modules/funixbot/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>fr.funixgaming.api.funixbot</groupId>
<artifactId>funixgaming-funixbot</artifactId>
<version>1.3.0.7</version>
<version>1.3.0.8</version>
</parent>

<groupId>fr.funixgaming.api.funixbot.client</groupId>
Expand Down
2 changes: 1 addition & 1 deletion modules/funixbot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>fr.funixgaming.api</groupId>
<artifactId>funixgaming-api</artifactId>
<version>1.3.0.7</version>
<version>1.3.0.8</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/funixbot/service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>fr.funixgaming.api.funixbot</groupId>
<artifactId>funixgaming-funixbot</artifactId>
<version>1.3.0.7</version>
<version>1.3.0.8</version>
</parent>

<groupId>fr.funixgaming.api.funixbot.service</groupId>
Expand Down
2 changes: 1 addition & 1 deletion modules/twitch/client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>fr.funixgaming.api.twitch</groupId>
<artifactId>funixgaming-twitch</artifactId>
<version>1.3.0.7</version>
<version>1.3.0.8</version>
</parent>

<groupId>fr.funixgaming.api.twitch.client</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ public interface FunixGamingTwitchUserClient {
/**
* Check if a user is following a streamer
* @param userId viewer id to check
* @param streamerId streamer id to check
* @return a single element list if the user is following otherwise not following
*/
@GetMapping("isFollowing")
TwitchDataResponseDTO<TwitchFollowDTO> isUserFollowingStreamer(@RequestParam(name = "user_id") String userId,
@RequestParam(name = "streamer_id") String streamerId);
TwitchDataResponseDTO<TwitchFollowDTO> isUserFollowingStreamer(@RequestParam(name = "user_id") String userId);

@GetMapping("usersByName")
TwitchDataResponseDTO<TwitchUserDTO> getUsersByName(@RequestParam(name = "login") List<String> name);
Expand Down
2 changes: 1 addition & 1 deletion modules/twitch/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>fr.funixgaming.api</groupId>
<artifactId>funixgaming-api</artifactId>
<version>1.3.0.7</version>
<version>1.3.0.8</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion modules/twitch/service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>fr.funixgaming.api.twitch</groupId>
<artifactId>funixgaming-twitch</artifactId>
<version>1.3.0.7</version>
<version>1.3.0.8</version>
</parent>

<groupId>fr.funixgaming.api.twitch.service</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.funixproductions.api.twitch.reference.client.clients.game.TwitchGameClient;
import com.funixproductions.api.twitch.reference.client.dtos.responses.TwitchDataResponseDTO;
import com.funixproductions.api.twitch.reference.client.dtos.responses.game.TwitchGameDTO;
import com.funixproductions.core.exceptions.ApiException;
import fr.funixgaming.api.twitch.client.clients.FunixGamingTwitchGameClient;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
Expand All @@ -17,11 +18,23 @@ public class TwitchGameResource implements FunixGamingTwitchGameClient {

@Override
public TwitchDataResponseDTO<TwitchGameDTO> getGameByName(String name) {
return twitchGameClient.getGameByName(name);
try {
return twitchGameClient.getGameByName(name);
} catch (ApiException e) {
throw e;
} catch (Exception e) {
throw new ApiException("Erreur interne: " + e.getMessage(), e);
}
}

@Override
public TwitchDataResponseDTO<TwitchGameDTO> getGameById(String id) {
return twitchGameClient.getGameById(id);
try {
return twitchGameClient.getGameById(id);
} catch (ApiException e) {
throw e;
} catch (Exception e) {
throw new ApiException("Erreur interne: " + e.getMessage(), e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.funixproductions.api.twitch.reference.client.dtos.responses.channel.chat.TwitchChannelChattersDTO;
import com.funixproductions.api.twitch.reference.client.dtos.responses.channel.stream.TwitchStreamDTO;
import com.funixproductions.core.exceptions.ApiBadRequestException;
import com.funixproductions.core.exceptions.ApiException;
import fr.funixgaming.api.twitch.client.clients.FunixGamingTwitchStreamClient;
import fr.funixgaming.api.twitch.service.services.DrakkadesTwitchStreamService;
import fr.funixgaming.api.twitch.service.services.FunixGamingTwitchStreamService;
Expand All @@ -21,17 +22,29 @@ public class TwitchStreamResource implements FunixGamingTwitchStreamClient {

@Override
public TwitchDataResponseDTO<TwitchStreamDTO> getStream(String channel) {
if (channel.equals("funixgaming")) {
return funixTwitchStreamService.getCacheStream();
} else if (channel.equals("drakkades")) {
return drakkadesTwitchStreamService.getCacheStream();
} else {
throw new ApiBadRequestException("Le nom du stream est invalide ou ne fait pas parti de la liste des streams autorisés.");
try {
if (channel.equals("funixgaming")) {
return funixTwitchStreamService.getCacheStream();
} else if (channel.equals("drakkades")) {
return drakkadesTwitchStreamService.getCacheStream();
} else {
throw new ApiBadRequestException("Le nom du stream est invalide ou ne fait pas parti de la liste des streams autorisés.");
}
} catch (ApiException e) {
throw e;
} catch (Exception e) {
throw new ApiException("Erreur interne: " + e.getMessage(), e);
}
}

@Override
public TwitchDataResponseDTO<TwitchChannelChattersDTO> getChatters(String channel) {
return funixTwitchStreamService.getCacheChatters();
try {
return funixTwitchStreamService.getCacheChatters();
} catch (ApiException e) {
throw e;
} catch (Exception e) {
throw new ApiException("Erreur interne: " + e.getMessage(), e);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package fr.funixgaming.api.twitch.service.ressources;

import com.funixproductions.api.twitch.reference.client.clients.channel.TwitchChannelClient;
import com.funixproductions.api.twitch.reference.client.clients.users.TwitchUsersClient;
import com.funixproductions.api.twitch.reference.client.dtos.responses.TwitchDataResponseDTO;
import com.funixproductions.api.twitch.reference.client.dtos.responses.user.TwitchFollowDTO;
import com.funixproductions.api.twitch.reference.client.dtos.responses.user.TwitchUserDTO;
import com.funixproductions.api.user.client.dtos.UserDTO;
import com.funixproductions.core.exceptions.ApiException;
import fr.funixgaming.api.twitch.client.clients.FunixGamingTwitchUserClient;
import fr.funixgaming.api.twitch.service.services.FunixGamingInformationService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -16,20 +20,42 @@
@RequiredArgsConstructor
public class TwitchUserResource implements FunixGamingTwitchUserClient {

private final TwitchUsersClient service;
private final TwitchUsersClient usersClient;
private final TwitchChannelClient channelClient;
private final FunixGamingInformationService funixGamingInformationService;

@Override
public TwitchDataResponseDTO<TwitchFollowDTO> isUserFollowingStreamer(String userId, String streamerId) {
return service.isUserFollowingStreamer(userId, streamerId);
public TwitchDataResponseDTO<TwitchFollowDTO> isUserFollowingStreamer(String userId) {
try {
final UserDTO userDTO = funixGamingInformationService.getFunixGamingUser();

return channelClient.getChannelFollowers(null, null, userId, userDTO.getId().toString());
} catch (ApiException e) {
throw e;
} catch (Exception e) {
throw new ApiException("Erreur interne: " + e.getMessage(), e);
}
}

@Override
public TwitchDataResponseDTO<TwitchUserDTO> getUsersByName(List<String> name) {
return service.getUsersByName(name);
try {
return usersClient.getUsersByName(name);
} catch (ApiException e) {
throw e;
} catch (Exception e) {
throw new ApiException("Erreur interne: " + e.getMessage(), e);
}
}

@Override
public TwitchDataResponseDTO<TwitchUserDTO> getUsersById(List<String> id) {
return service.getUsersById(id);
try {
return usersClient.getUsersById(id);
} catch (ApiException e) {
throw e;
} catch (Exception e) {
throw new ApiException("Erreur interne: " + e.getMessage(), e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

import com.funixproductions.api.twitch.reference.client.clients.chat.TwitchChatClient;
import com.funixproductions.api.twitch.reference.client.clients.game.TwitchGameClient;
import com.funixproductions.api.twitch.reference.client.clients.stream.TwitchStreamsClient;
import com.funixproductions.api.twitch.reference.client.dtos.responses.TwitchDataResponseDTO;
import com.funixproductions.api.user.client.clients.InternalUserCrudClient;
import com.funixproductions.api.user.client.clients.UserAuthClient;
import com.funixproductions.api.user.client.dtos.UserDTO;
import com.funixproductions.api.user.client.enums.UserRole;
import com.funixproductions.core.crud.dtos.PageDTO;
import fr.funixgaming.api.twitch.service.services.FunixGamingInformationService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -16,10 +20,10 @@
import org.springframework.test.web.servlet.MockMvc;

import java.util.Date;
import java.util.List;
import java.util.UUID;

import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
Expand All @@ -34,9 +38,18 @@ class TwitchGameResourceTest {
@MockBean
private UserAuthClient userAuthClient;

@MockBean
private InternalUserCrudClient internalUserCrudClient;

@MockBean
private TwitchChatClient twitchChatClient;

@MockBean
private TwitchStreamsClient twitchStreamsClient;

@Autowired
private FunixGamingInformationService funixGamingInformationService;

@Autowired
private MockMvc mockMvc;

Expand All @@ -53,6 +66,16 @@ void setupMocks() {
when(twitchGameClient.getGameById(anyString())).thenReturn(new TwitchDataResponseDTO<>());
when(userAuthClient.current(anyString())).thenReturn(userDTO);
when(twitchChatClient.getChannelChatters(anyInt(), anyString(), anyString())).thenReturn(new TwitchDataResponseDTO<>());
when(twitchStreamsClient.getStreams(anyString())).thenReturn(new TwitchDataResponseDTO<>());

final PageDTO<UserDTO> pageDTO = new PageDTO<>();
pageDTO.setActualPage(0);
pageDTO.setTotalPages(1);
pageDTO.setContent(List.of(userDTO));
pageDTO.setTotalElementsThisPage(1);
pageDTO.setTotalElementsDatabase(1L);
when(internalUserCrudClient.getAll(any(), any(), any(), any())).thenReturn(pageDTO);
funixGamingInformationService.fetchUserInfos();

}

Expand Down
Loading