Compare commits
No commits in common. "main" and "v1.31.0" have entirely different histories.
59 changed files with 212 additions and 887 deletions
|
@ -31,64 +31,3 @@ jobs:
|
|||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
|
||||
build-backend-image:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
name: Build Backend Image
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Ensure full history is available
|
||||
- name: Extract tag
|
||||
run: |
|
||||
TAG=$(git describe --tags --abbrev=0)
|
||||
echo "TAG=$TAG" >> $GITHUB_ENV
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Login
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.kjan.de
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASS }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: backend/
|
||||
file: backend/.docker/Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
git.kjan.de/szut/casino-backend:latest
|
||||
git.kjan.de/szut/casino-backend:${{ env.TAG }}
|
||||
|
||||
build-frontend-image:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
name: Build Frontend Image
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # Ensure full history is available
|
||||
- name: Extract tag
|
||||
run: |
|
||||
TAG=$(git describe --tags --abbrev=0)
|
||||
echo "TAG=$TAG" >> $GITHUB_ENV
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Login
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.kjan.de
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_PASS }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: frontend/
|
||||
file: frontend/.docker/Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
git.kjan.de/szut/casino-frontend:latest
|
||||
git.kjan.de/szut/casino-frontend:${{ env.TAG }}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
FROM gradle:jdk23 AS builder
|
||||
FROM gradle:jdk22 AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY gradlew build.gradle.kts settings.gradle.kts config ./
|
||||
COPY gradlew build.gradle.kts settings.gradle.kts ./
|
||||
COPY gradle gradle
|
||||
|
||||
RUN chmod +x gradlew
|
||||
RUN gradle dependencies
|
||||
RUN ./gradlew dependencies
|
||||
|
||||
COPY src src
|
||||
|
||||
RUN gradle clean build -x test -x checkstyleMain -x checkstyleTest -x compileTestJava
|
||||
RUN ./gradlew clean build -x test
|
||||
|
||||
FROM openjdk:23-jdk-slim AS runtime
|
||||
FROM openjdk:22-jdk-slim
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/build/libs/*.jar app.jar
|
||||
|
|
|
@ -1,10 +1,20 @@
|
|||
package de.szut.casino;
|
||||
|
||||
import de.szut.casino.lootboxes.LootBoxEntity;
|
||||
import de.szut.casino.lootboxes.LootBoxRepository;
|
||||
import de.szut.casino.lootboxes.RewardEntity;
|
||||
import de.szut.casino.lootboxes.RewardRepository;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@SpringBootApplication
|
||||
public class CasinoApplication {
|
||||
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package de.szut.casino.blackjack;
|
||||
|
||||
import de.szut.casino.exceptionHandling.exceptions.InsufficientFundsException;
|
||||
import de.szut.casino.exceptionHandling.exceptions.UserNotFoundException;
|
||||
import de.szut.casino.shared.dto.BetDto;
|
||||
import de.szut.casino.shared.service.BalanceService;
|
||||
import de.szut.casino.blackjack.dto.CreateBlackJackGameDto;
|
||||
import de.szut.casino.user.UserEntity;
|
||||
import de.szut.casino.user.UserService;
|
||||
import jakarta.validation.Valid;
|
||||
|
@ -12,18 +9,19 @@ import org.springframework.http.ResponseEntity;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class BlackJackGameController {
|
||||
|
||||
private final BalanceService balanceService;
|
||||
private final UserService userService;
|
||||
private final BlackJackService blackJackService;
|
||||
|
||||
public BlackJackGameController(BalanceService balanceService, UserService userService, BlackJackService blackJackService) {
|
||||
this.balanceService = balanceService;
|
||||
public BlackJackGameController(UserService userService, BlackJackService blackJackService) {
|
||||
this.blackJackService = blackJackService;
|
||||
this.userService = userService;
|
||||
}
|
||||
|
@ -33,7 +31,7 @@ public class BlackJackGameController {
|
|||
Optional<UserEntity> optionalUser = userService.getCurrentUser(token);
|
||||
|
||||
if (optionalUser.isEmpty()) {
|
||||
throw new UserNotFoundException();
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
UserEntity user = optionalUser.get();
|
||||
|
@ -50,7 +48,7 @@ public class BlackJackGameController {
|
|||
Optional<UserEntity> optionalUser = userService.getCurrentUser(token);
|
||||
|
||||
if (optionalUser.isEmpty()) {
|
||||
throw new UserNotFoundException();
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
UserEntity user = optionalUser.get();
|
||||
|
@ -67,7 +65,7 @@ public class BlackJackGameController {
|
|||
Optional<UserEntity> optionalUser = userService.getCurrentUser(token);
|
||||
|
||||
if (optionalUser.isEmpty()) {
|
||||
throw new UserNotFoundException();
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
UserEntity user = optionalUser.get();
|
||||
|
@ -84,7 +82,7 @@ public class BlackJackGameController {
|
|||
Optional<UserEntity> optionalUser = userService.getCurrentUser(token);
|
||||
|
||||
if (optionalUser.isEmpty()) {
|
||||
throw new UserNotFoundException();
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
UserEntity user = optionalUser.get();
|
||||
|
@ -101,7 +99,7 @@ public class BlackJackGameController {
|
|||
Optional<UserEntity> optionalUser = userService.getCurrentUser(token);
|
||||
|
||||
if (optionalUser.isEmpty()) {
|
||||
throw new UserNotFoundException();
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
UserEntity user = optionalUser.get();
|
||||
|
@ -114,19 +112,29 @@ public class BlackJackGameController {
|
|||
}
|
||||
|
||||
@PostMapping("/blackjack/start")
|
||||
public ResponseEntity<Object> createBlackJackGame(@RequestBody @Valid BetDto betDto, @RequestHeader("Authorization") String token) {
|
||||
public ResponseEntity<Object> createBlackJackGame(@RequestBody @Valid CreateBlackJackGameDto createBlackJackGameDto, @RequestHeader("Authorization") String token) {
|
||||
Optional<UserEntity> optionalUser = userService.getCurrentUser(token);
|
||||
|
||||
if (optionalUser.isEmpty()) {
|
||||
throw new UserNotFoundException();
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
UserEntity user = optionalUser.get();
|
||||
BigDecimal balance = user.getBalance();
|
||||
BigDecimal betAmount = createBlackJackGameDto.getBetAmount();
|
||||
|
||||
if (!this.balanceService.hasFunds(user, betDto)) {
|
||||
throw new InsufficientFundsException();
|
||||
if (betAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
Map<String, String> errorResponse = new HashMap<>();
|
||||
errorResponse.put("error", "Invalid bet amount");
|
||||
return ResponseEntity.badRequest().body(errorResponse);
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(blackJackService.createBlackJackGame(user, betDto.getBetAmount()));
|
||||
if (betAmount.compareTo(balance) > 0) {
|
||||
Map<String, String> errorResponse = new HashMap<>();
|
||||
errorResponse.put("error", "Insufficient funds");
|
||||
return ResponseEntity.badRequest().body(errorResponse);
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(blackJackService.createBlackJackGame(user, betAmount));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package de.szut.casino.blackjack;
|
||||
|
||||
import de.szut.casino.user.UserEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public interface BlackJackGameRepository extends JpaRepository<BlackJackGameEntity, Long> {
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
@Service
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package de.szut.casino.blackjack.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CreateBlackJackGameDto {
|
||||
private BigDecimal betAmount;
|
||||
}
|
|
@ -8,6 +8,7 @@ import de.szut.casino.deposit.dto.AmountDto;
|
|||
import de.szut.casino.deposit.dto.SessionIdDto;
|
||||
import de.szut.casino.user.UserEntity;
|
||||
import de.szut.casino.user.UserRepository;
|
||||
import de.szut.casino.user.UserService;
|
||||
import de.szut.casino.user.dto.KeycloakUserDto;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
@ -15,10 +16,7 @@ import org.springframework.http.HttpEntity;
|
|||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.Optional;
|
||||
|
|
|
@ -5,7 +5,7 @@ import jakarta.persistence.*;
|
|||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
|
@ -26,7 +26,4 @@ public class TransactionEntity {
|
|||
|
||||
@Enumerated(EnumType.STRING)
|
||||
private TransactionStatus status = TransactionStatus.PROCESSING;
|
||||
|
||||
@Column(name = "created_at")
|
||||
private Date createdAt = new Date();
|
||||
}
|
||||
|
|
|
@ -5,20 +5,10 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public interface TransactionRepository extends JpaRepository<TransactionEntity, Long> {
|
||||
@Query("SELECT t FROM TransactionEntity t WHERE t.sessionId = ?1")
|
||||
Optional<TransactionEntity> findOneBySessionID(String sessionId);
|
||||
|
||||
@Query("SELECT t FROM TransactionEntity t WHERE t.user = ?1")
|
||||
List<TransactionEntity> findAllByUserId(UserEntity id);
|
||||
|
||||
@Query("SELECT t FROM TransactionEntity t WHERE t.user = ?1 ORDER BY t.createdAt DESC LIMIT ?2 OFFSET ?3")
|
||||
List<TransactionEntity> findByUserIdWithLimit(UserEntity userEntity, Integer limit, Integer offset);
|
||||
|
||||
@Query("SELECT COUNT(t) > ?2 + ?3 FROM TransactionEntity t WHERE t.user = ?1")
|
||||
Boolean hasMore(UserEntity userEntity, Integer limit, Integer offset);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import de.szut.casino.user.UserEntity;
|
|||
import de.szut.casino.user.UserRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
|
@ -55,7 +55,7 @@ public class TransactionService {
|
|||
UserEntity user = transaction.getUser();
|
||||
Long amountTotal = checkoutSession.getAmountTotal();
|
||||
if (amountTotal != null) {
|
||||
user.addBalance(BigDecimal.valueOf(amountTotal).movePointLeft(2));
|
||||
user.addBalance(amountTotal);
|
||||
}
|
||||
|
||||
userRepository.save(user);
|
||||
|
|
|
@ -1,21 +1,26 @@
|
|||
package de.szut.casino.deposit;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
|
||||
import com.stripe.Stripe;
|
||||
import com.stripe.exception.SignatureVerificationException;
|
||||
import com.stripe.exception.StripeException;
|
||||
import com.stripe.model.Event;
|
||||
import com.stripe.model.*;
|
||||
import com.stripe.model.checkout.Session;
|
||||
import com.stripe.net.Webhook;
|
||||
import com.stripe.param.checkout.SessionRetrieveParams;
|
||||
import de.szut.casino.user.UserEntity;
|
||||
import de.szut.casino.user.UserRepository;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
public class WebhookController {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package de.szut.casino.exceptionHandling;
|
||||
|
||||
import de.szut.casino.exceptionHandling.exceptions.InsufficientFundsException;
|
||||
import de.szut.casino.exceptionHandling.exceptions.UserNotFoundException;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
|
@ -11,17 +12,17 @@ import org.springframework.web.context.request.WebRequest;
|
|||
import java.util.Date;
|
||||
|
||||
@ControllerAdvice
|
||||
@ApiResponses(value = {
|
||||
@ApiResponse(responseCode = "500", description = "invalid JSON posted",
|
||||
content = @Content)
|
||||
})
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
@ExceptionHandler(UserNotFoundException.class)
|
||||
public ResponseEntity<?> handleUserNotFoundException(UserNotFoundException ex, WebRequest request) {
|
||||
@ExceptionHandler(ResourceNotFoundException.class)
|
||||
public ResponseEntity<?> handleHelloEntityNotFoundException(ResourceNotFoundException ex, WebRequest request) {
|
||||
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
|
||||
return new ResponseEntity<>(errorDetails, HttpStatus.NOT_FOUND);
|
||||
}
|
||||
|
||||
@ExceptionHandler(InsufficientFundsException.class)
|
||||
public ResponseEntity<?> handleInsufficientFundsException(InsufficientFundsException ex, WebRequest request) {
|
||||
ErrorDetails errorDetails = new ErrorDetails(new Date(), ex.getMessage(), request.getDescription(false));
|
||||
return new ResponseEntity<>(errorDetails, HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package de.szut.casino.exceptionHandling;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
@ResponseStatus(value = HttpStatus.NOT_FOUND)
|
||||
public class ResourceNotFoundException extends RuntimeException {
|
||||
public ResourceNotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package de.szut.casino.exceptionHandling.exceptions;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
@ResponseStatus(value = HttpStatus.BAD_REQUEST)
|
||||
public class InsufficientFundsException extends RuntimeException {
|
||||
public InsufficientFundsException() {
|
||||
super("insufficient funds");
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package de.szut.casino.exceptionHandling.exceptions;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
@ResponseStatus(value = HttpStatus.NOT_FOUND)
|
||||
public class UserNotFoundException extends RuntimeException {
|
||||
public UserNotFoundException() {
|
||||
super("user not found");
|
||||
}
|
||||
}
|
|
@ -1,7 +1,5 @@
|
|||
package de.szut.casino.lootboxes;
|
||||
|
||||
import de.szut.casino.exceptionHandling.exceptions.InsufficientFundsException;
|
||||
import de.szut.casino.exceptionHandling.exceptions.UserNotFoundException;
|
||||
import de.szut.casino.user.UserEntity;
|
||||
import de.szut.casino.user.UserRepository;
|
||||
import de.szut.casino.user.UserService;
|
||||
|
@ -39,13 +37,15 @@ public class LootBoxController {
|
|||
|
||||
Optional<UserEntity> optionalUser = userService.getCurrentUser(token);
|
||||
if (optionalUser.isEmpty()) {
|
||||
throw new UserNotFoundException();
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
UserEntity user = optionalUser.get();
|
||||
|
||||
if (lootBoxService.hasSufficientBalance(user, lootBox.getPrice())) {
|
||||
throw new InsufficientFundsException();
|
||||
Map<String, String> errorResponse = new HashMap<>();
|
||||
errorResponse.put("error", "Insufficient balance");
|
||||
return ResponseEntity.badRequest().body(errorResponse);
|
||||
}
|
||||
|
||||
RewardEntity reward = lootBoxService.determineReward(lootBox);
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
package de.szut.casino.lootboxes;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
import de.szut.casino.blackjack.CardEntity;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.hibernate.annotations.SQLRestriction;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package de.szut.casino.lootboxes;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package de.szut.casino.security;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.Customizer;
|
||||
|
@ -18,9 +17,6 @@ import java.util.List;
|
|||
@EnableWebSecurity
|
||||
public class SecurityConfig {
|
||||
|
||||
@Value("${app.frontend-host}")
|
||||
private String frontendHost;
|
||||
|
||||
@Bean
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
http
|
||||
|
@ -40,7 +36,7 @@ public class SecurityConfig {
|
|||
@Bean
|
||||
public CorsConfigurationSource corsConfigurationSource() {
|
||||
CorsConfiguration configuration = new CorsConfiguration();
|
||||
configuration.setAllowedOrigins(List.of(this.frontendHost));
|
||||
configuration.setAllowedOrigins(List.of("http://localhost:4200"));
|
||||
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"));
|
||||
configuration.setAllowedHeaders(Arrays.asList("authorization", "content-type", "x-auth-token", "Access-Control-Allow-Origin"));
|
||||
configuration.setExposedHeaders(List.of("x-auth-token"));
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
package de.szut.casino.shared.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class BetDto {
|
||||
@NotNull(message = "Bet amount cannot be null")
|
||||
@Positive(message = "Bet amount must be positive")
|
||||
private BigDecimal betAmount;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
package de.szut.casino.shared.service;
|
||||
|
||||
import de.szut.casino.shared.dto.BetDto;
|
||||
import de.szut.casino.user.UserEntity;
|
||||
import de.szut.casino.user.UserRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Service
|
||||
public class BalanceService {
|
||||
private UserRepository userRepository;
|
||||
|
||||
public BalanceService(UserRepository userRepository) {
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
public boolean hasFunds(UserEntity user, BetDto betDto) {
|
||||
BigDecimal balance = user.getBalance();
|
||||
BigDecimal betAmount = betDto.getBetAmount();
|
||||
|
||||
return betAmount.compareTo(balance) <= 0;
|
||||
}
|
||||
|
||||
public void addFunds(UserEntity user, BigDecimal amount) {
|
||||
user.addBalance(amount);
|
||||
|
||||
this.userRepository.save(user);
|
||||
}
|
||||
|
||||
public void subtractFunds(UserEntity user, BigDecimal amount) {
|
||||
user.subtractBalance(amount);
|
||||
|
||||
this.userRepository.save(user);
|
||||
}
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package de.szut.casino.slots;
|
||||
|
||||
import de.szut.casino.exceptionHandling.exceptions.InsufficientFundsException;
|
||||
import de.szut.casino.exceptionHandling.exceptions.UserNotFoundException;
|
||||
import de.szut.casino.shared.dto.BetDto;
|
||||
import de.szut.casino.shared.service.BalanceService;
|
||||
import de.szut.casino.user.UserEntity;
|
||||
import de.szut.casino.user.UserService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
public class SlotController {
|
||||
private final UserService userService;
|
||||
private final BalanceService balanceService;
|
||||
private final SlotService slotService;
|
||||
|
||||
public SlotController(UserService userService, BalanceService balanceService, SlotService slotService) {
|
||||
this.userService = userService;
|
||||
this.balanceService = balanceService;
|
||||
this.slotService = slotService;
|
||||
}
|
||||
|
||||
@PostMapping("/slots/spin")
|
||||
public ResponseEntity<Object> spinSlots(@RequestBody @Valid BetDto betDto, @RequestHeader("Authorization") String token) {
|
||||
Optional<UserEntity> optionalUser = userService.getCurrentUser(token);
|
||||
|
||||
if (optionalUser.isEmpty()) {
|
||||
throw new UserNotFoundException();
|
||||
}
|
||||
|
||||
UserEntity user = optionalUser.get();
|
||||
|
||||
if (!this.balanceService.hasFunds(user, betDto)) {
|
||||
throw new InsufficientFundsException();
|
||||
}
|
||||
|
||||
SpinResult spinResult = this.slotService.spin(
|
||||
betDto.getBetAmount(),
|
||||
user
|
||||
);
|
||||
|
||||
return ResponseEntity.ok(spinResult);
|
||||
}
|
||||
|
||||
@GetMapping("/slots/info")
|
||||
public ResponseEntity<Object> spinSlots() {
|
||||
Map<String, BigDecimal> info = new HashMap<>();
|
||||
|
||||
for (Symbol symbol : Symbol.values()) {
|
||||
info.put(symbol.getDisplayName(), symbol.getPayoutMultiplier());
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(info);
|
||||
}
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
package de.szut.casino.slots;
|
||||
|
||||
import de.szut.casino.shared.service.BalanceService;
|
||||
import de.szut.casino.user.UserEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static de.szut.casino.slots.Symbol.*;
|
||||
|
||||
@Service
|
||||
public class SlotService {
|
||||
private final int REEL_LENGTH = 32;
|
||||
|
||||
// 98% RTP
|
||||
private final int SEVEN_COUNT = 1;
|
||||
private final int BAR_COUNT = 4;
|
||||
private final int BELL_COUNT = 7;
|
||||
private final int CHERRY_COUNT = 10;
|
||||
private final int BLANK_COUNT = 10;
|
||||
|
||||
private final List<Symbol> firstReel;
|
||||
private final List<Symbol> secondReel;
|
||||
private final List<Symbol> thirdReel;
|
||||
|
||||
private final Random random;
|
||||
private final BalanceService balanceService;
|
||||
|
||||
public SlotService(BalanceService balanceService) {
|
||||
this.random = new Random();
|
||||
this.balanceService = balanceService;
|
||||
|
||||
List<Symbol> reelStrip = createReelStrip();
|
||||
this.firstReel = shuffleReel(reelStrip);
|
||||
this.secondReel = shuffleReel(reelStrip);
|
||||
this.thirdReel = shuffleReel(reelStrip);
|
||||
}
|
||||
|
||||
public SpinResult spin(BigDecimal betAmount, UserEntity user) {
|
||||
int index1 = this.random.nextInt(REEL_LENGTH);
|
||||
int index2 = this.random.nextInt(REEL_LENGTH);
|
||||
int index3 = this.random.nextInt(REEL_LENGTH);
|
||||
|
||||
Symbol symbol1 = getSymbolAt(this.firstReel, index1);
|
||||
Symbol symbol2 = getSymbolAt(this.secondReel, index2);
|
||||
Symbol symbol3 = getSymbolAt(this.thirdReel, index3);
|
||||
|
||||
boolean isWin = symbol1.equals(symbol2) && symbol1.equals(symbol3);
|
||||
|
||||
SpinResult spinResult = processResult(betAmount, user, isWin, symbol1);
|
||||
buildResultMatrix(spinResult, index1, index2, index3);
|
||||
|
||||
return spinResult;
|
||||
}
|
||||
|
||||
private SpinResult processResult(BigDecimal betAmount, UserEntity user, boolean isWin, Symbol winSymbol) {
|
||||
BigDecimal resultAmount;
|
||||
String status;
|
||||
|
||||
if (isWin) {
|
||||
resultAmount = betAmount.multiply(winSymbol.getPayoutMultiplier());
|
||||
status = "win";
|
||||
this.balanceService.addFunds(user, resultAmount);
|
||||
} else {
|
||||
resultAmount = betAmount;
|
||||
status = "lose";
|
||||
this.balanceService.subtractFunds(user, betAmount);
|
||||
}
|
||||
|
||||
SpinResult spinResult = new SpinResult();
|
||||
spinResult.setStatus(status);
|
||||
spinResult.setAmount(resultAmount);
|
||||
spinResult.setWin(isWin);
|
||||
|
||||
return spinResult;
|
||||
}
|
||||
|
||||
private void buildResultMatrix(SpinResult spinResult, int index1, int index2, int index3) {
|
||||
List<List<Symbol>> resultMatrix = new ArrayList<>(3);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
resultMatrix.add(new ArrayList<>(3));
|
||||
}
|
||||
|
||||
resultMatrix.getFirst().add(getSymbolAt(this.firstReel, index1 - 1));
|
||||
resultMatrix.getFirst().add(getSymbolAt(this.secondReel, index2 - 1));
|
||||
resultMatrix.getFirst().add(getSymbolAt(this.thirdReel, index3 - 1));
|
||||
|
||||
resultMatrix.get(1).add(getSymbolAt(this.firstReel, index1));
|
||||
resultMatrix.get(1).add(getSymbolAt(this.secondReel, index2));
|
||||
resultMatrix.get(1).add(getSymbolAt(this.thirdReel, index3));
|
||||
|
||||
resultMatrix.getLast().add(getSymbolAt(this.firstReel, index1 + 1));
|
||||
resultMatrix.getLast().add(getSymbolAt(this.secondReel, index2 + 1));
|
||||
resultMatrix.getLast().add(getSymbolAt(this.thirdReel, index3 + 1));
|
||||
|
||||
spinResult.setResultMatrix(resultMatrix);
|
||||
}
|
||||
|
||||
private List<Symbol> shuffleReel(List<Symbol> reelStrip) {
|
||||
Collections.shuffle(reelStrip, this.random);
|
||||
|
||||
return reelStrip;
|
||||
}
|
||||
|
||||
private List<Symbol> createReelStrip() {
|
||||
List<Symbol> reelStrip = new ArrayList<>(REEL_LENGTH);
|
||||
addSymbolsToStrip(reelStrip, CHERRY, CHERRY_COUNT);
|
||||
addSymbolsToStrip(reelStrip, BELL, BELL_COUNT);
|
||||
addSymbolsToStrip(reelStrip, BAR, BAR_COUNT);
|
||||
addSymbolsToStrip(reelStrip, SEVEN, SEVEN_COUNT);
|
||||
addSymbolsToStrip(reelStrip, BLANK, BLANK_COUNT);
|
||||
return reelStrip;
|
||||
}
|
||||
|
||||
private void addSymbolsToStrip(List<Symbol> strip, Symbol symbol, int count) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
strip.add(symbol);
|
||||
}
|
||||
}
|
||||
|
||||
private Symbol getSymbolAt(List<Symbol> reel, int index) {
|
||||
int effectiveIndex = index % REEL_LENGTH;
|
||||
|
||||
if (effectiveIndex < 0) {
|
||||
effectiveIndex += REEL_LENGTH;
|
||||
}
|
||||
|
||||
return reel.get(effectiveIndex);
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
package de.szut.casino.slots;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
public class SpinResult {
|
||||
public SpinResult(String status, BigDecimal amount, boolean isWin) {
|
||||
this.status = status;
|
||||
this.amount = amount;
|
||||
this.isWin = isWin;
|
||||
}
|
||||
|
||||
private String status;
|
||||
private BigDecimal amount;
|
||||
private boolean isWin;
|
||||
private List<List<Symbol>> resultMatrix;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package de.szut.casino.slots;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Getter
|
||||
public enum Symbol {
|
||||
SEVEN("seven", new BigDecimal("1000")),
|
||||
BAR("bar", new BigDecimal("85")),
|
||||
BELL("bell", new BigDecimal("40")),
|
||||
CHERRY("cherry", new BigDecimal("10")),
|
||||
BLANK("blank", new BigDecimal("0"));
|
||||
|
||||
private final String displayName;
|
||||
private final BigDecimal payoutMultiplier;
|
||||
|
||||
Symbol(String displayName, BigDecimal payoutMultiplier) {
|
||||
this.displayName = displayName;
|
||||
this.payoutMultiplier = payoutMultiplier;
|
||||
}
|
||||
}
|
|
@ -1,15 +1,19 @@
|
|||
package de.szut.casino.user;
|
||||
|
||||
import de.szut.casino.exceptionHandling.exceptions.UserNotFoundException;
|
||||
import de.szut.casino.user.dto.CreateUserDto;
|
||||
import de.szut.casino.user.dto.GetUserDto;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
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.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import de.szut.casino.user.dto.CreateUserDto;
|
||||
import de.szut.casino.user.dto.GetUserDto;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
@ -35,7 +39,7 @@ public class UserController {
|
|||
GetUserDto userData = userService.getCurrentUserAsDto(token);
|
||||
|
||||
if (userData == null) {
|
||||
throw new UserNotFoundException();
|
||||
return ResponseEntity.notFound().build();
|
||||
}
|
||||
|
||||
return ResponseEntity.ok(userData);
|
||||
|
|
|
@ -31,31 +31,13 @@ public class UserEntity {
|
|||
this.balance = balance;
|
||||
}
|
||||
|
||||
public void addBalance(BigDecimal amountToAdd) {
|
||||
if (amountToAdd == null || amountToAdd.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
return;
|
||||
}
|
||||
public void addBalance(long amountInCents) {
|
||||
BigDecimal amountToAdd = BigDecimal.valueOf(amountInCents).movePointLeft(2);
|
||||
|
||||
if (this.balance == null) {
|
||||
this.balance = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
this.balance = amountToAdd;
|
||||
} else {
|
||||
this.balance = this.balance.add(amountToAdd);
|
||||
}
|
||||
|
||||
public void subtractBalance(BigDecimal amountToSubtract) {
|
||||
if (amountToSubtract == null || amountToSubtract.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new IllegalArgumentException("Amount to subtract must be positive.");
|
||||
}
|
||||
|
||||
if (this.balance == null) {
|
||||
this.balance = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
if (this.balance.compareTo(amountToSubtract) < 0) {
|
||||
throw new IllegalStateException("Insufficient funds to subtract " + amountToSubtract);
|
||||
}
|
||||
|
||||
this.balance = this.balance.subtract(amountToSubtract);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
package de.szut.casino.user.transaction;
|
||||
|
||||
import de.szut.casino.deposit.TransactionEntity;
|
||||
import de.szut.casino.deposit.TransactionRepository;
|
||||
import de.szut.casino.user.UserEntity;
|
||||
import de.szut.casino.user.UserService;
|
||||
import de.szut.casino.user.transaction.dto.GetTransactionDto;
|
||||
import de.szut.casino.user.transaction.dto.UserTransactionsDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class GetTransactionService {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private TransactionRepository transactionRepository;
|
||||
|
||||
public UserTransactionsDto getUserTransactionsDto(String authToken, Integer limit, Integer offset) {
|
||||
Optional<UserEntity> user = this.userService.getCurrentUser(authToken);
|
||||
if (user.isPresent()) {
|
||||
List<TransactionEntity> transactionEntities = this.transactionRepository.findByUserIdWithLimit(user.get(), limit, offset);
|
||||
Boolean hasMore = this.transactionRepository.hasMore(user.get(), limit, offset);
|
||||
|
||||
return new UserTransactionsDto(mapTransactionsToDtos(transactionEntities), hasMore);
|
||||
}
|
||||
|
||||
return new UserTransactionsDto(List.of(), false);
|
||||
}
|
||||
|
||||
public List<GetTransactionDto> mapTransactionsToDtos(List<TransactionEntity> transactions) {
|
||||
return transactions.stream()
|
||||
.map(transaction -> new GetTransactionDto(
|
||||
transaction.getAmount(),
|
||||
transaction.getStatus(),
|
||||
transaction.getCreatedAt())
|
||||
).toList();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
package de.szut.casino.user.transaction;
|
||||
|
||||
import de.szut.casino.user.transaction.dto.UserTransactionsDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class TransactionController {
|
||||
|
||||
@Autowired
|
||||
private GetTransactionService transactionService;
|
||||
|
||||
@GetMapping("/user/transactions")
|
||||
public ResponseEntity<UserTransactionsDto> getUserTransactions(
|
||||
@RequestHeader("Authorization") String authToken,
|
||||
@RequestParam(value = "limit", required = false) Integer limit,
|
||||
@RequestParam(value = "offset", required = false) Integer offset
|
||||
) {
|
||||
UserTransactionsDto transactionEntities = this.transactionService.getUserTransactionsDto(authToken, limit, offset);
|
||||
|
||||
return ResponseEntity.ok(transactionEntities);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
package de.szut.casino.user.transaction.dto;
|
||||
|
||||
import de.szut.casino.deposit.TransactionStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class GetTransactionDto {
|
||||
public double amount = 0;
|
||||
public TransactionStatus status = TransactionStatus.PROCESSING;
|
||||
public Date createdAt = new Date();
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
package de.szut.casino.user.transaction.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class UserTransactionsDto {
|
||||
public List<GetTransactionDto> transactions;
|
||||
public Boolean hasMore;
|
||||
}
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
spring.datasource.url=jdbc:postgresql://${DB_HOST:localhost}:${DB_PORT:5432}/${DB_NAME:postgresdb}
|
||||
spring.datasource.username=${DB_USER:postgres_user}
|
||||
spring.datasource.password=${DB_PASS:postgres_pass}
|
||||
server.port=${HTTP_PORT:8080}
|
||||
spring.datasource.url=jdbc:postgresql://${DB_HOST:localhost}:5432/postgresdb
|
||||
spring.datasource.username=postgres_user
|
||||
spring.datasource.password=postgres_pass
|
||||
server.port=8080
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
stripe.secret.key=${STRIPE_SECRET_KEY:sk_test_51QrePYIvCfqz7ANgqam8rEwWcMeKiLOof3j6SCMgu2sl4sESP45DJxca16mWcYo1sQaiBv32CMR6Z4AAAGQPCJo300ubuZKO8I}
|
||||
stripe.webhook.secret=${STRIPE_WEBHOOK_SECRET:whsec_746b6a488665f6057118bdb4a2b32f4916f16c277109eeaed5e8f8e8b81b8c15}
|
||||
app.frontend-host=${FE_URL:http://localhost:4200}
|
||||
stripe.webhook.secret=whsec_746b6a488665f6057118bdb4a2b32f4916f16c277109eeaed5e8f8e8b81b8c15
|
||||
app.frontend-host=http://localhost:4200
|
||||
|
||||
spring.application.name=casino
|
||||
spring.application.name=lf12_starter
|
||||
#client registration configuration
|
||||
|
||||
spring.security.oauth2.client.registration.authentik.client-id=${AUTH_CLIENT_ID:MDqjm1kcWKuZfqHJXjxwAV20i44aT7m4VhhTL3Nm}
|
||||
spring.security.oauth2.client.registration.authentik.client-secret=${AUTH_CLIENT_SECRET:GY2F8te6iAVYt1TNAUVLzWZEXb6JoMNp6chbjqaXNq4gS5xTDL54HqBiAlV1jFKarN28LQ7FUsYX4SbwjfEhZhgeoKuBnZKjR9eiu7RawnGgxIK9ffvUfMkjRxnmiGI5}
|
||||
spring.security.oauth2.client.registration.authentik.client-id=MDqjm1kcWKuZfqHJXjxwAV20i44aT7m4VhhTL3Nm
|
||||
spring.security.oauth2.client.registration.authentik.client-secret=GY2F8te6iAVYt1TNAUVLzWZEXb6JoMNp6chbjqaXNq4gS5xTDL54HqBiAlV1jFKarN28LQ7FUsYX4SbwjfEhZhgeoKuBnZKjR9eiu7RawnGgxIK9ffvUfMkjRxnmiGI5
|
||||
spring.security.oauth2.client.registration.authentik.provider=authentik
|
||||
spring.security.oauth2.client.registration.authentik.client-name=Authentik
|
||||
spring.security.oauth2.client.registration.authentik.scope=openid,email,profile
|
||||
|
@ -20,16 +20,16 @@ spring.security.oauth2.client.registration.authentik.authorization-grant-type=au
|
|||
spring.security.oauth2.client.registration.authentik.redirect-uri={baseUrl}/login/oauth2/code/{registrationId}
|
||||
|
||||
# Provider settings
|
||||
spring.security.oauth2.client.provider.authentik.issuer-uri=${AUTH_PROVIDER_ISSUER:https://oauth.simonis.lol/application/o/casino-dev/}
|
||||
spring.security.oauth2.client.provider.authentik.authorization-uri=${AUTH_PROVIDER_AUTHORIZE_URI:https://oauth.simonis.lol/application/o/authorize/}
|
||||
spring.security.oauth2.client.provider.authentik.token-uri=${AUTH_PROVIDER_TOKEN_URI:https://oauth.simonis.lol/application/o/token/}
|
||||
spring.security.oauth2.client.provider.authentik.user-info-uri=${AUTH_PROVIDER_USERINFO_URI:https://oauth.simonis.lol/application/o/userinfo/}
|
||||
spring.security.oauth2.client.provider.authentik.jwk-set-uri=${AUTH_PROVIDER_JWKS_URI:https://oauth.simonis.lol/application/o/casino-dev/jwks/}
|
||||
spring.security.oauth2.client.provider.authentik.user-name-attribute=${AUTH_PROVIDER_NAME_ATTR:preferred_username}
|
||||
spring.security.oauth2.client.provider.authentik.issuer-uri=https://oauth.simonis.lol/application/o/casino-dev/
|
||||
spring.security.oauth2.client.provider.authentik.authorization-uri=https://oauth.simonis.lol/application/o/authorize/
|
||||
spring.security.oauth2.client.provider.authentik.token-uri=https://oauth.simonis.lol/application/o/token/
|
||||
spring.security.oauth2.client.provider.authentik.user-info-uri=https://oauth.simonis.lol/application/o/userinfo/
|
||||
spring.security.oauth2.client.provider.authentik.jwk-set-uri=https://oauth.simonis.lol/application/o/casino-dev/jwks/
|
||||
spring.security.oauth2.client.provider.authentik.user-name-attribute=preferred_username
|
||||
|
||||
# Resource server config
|
||||
spring.security.oauth2.resourceserver.jwt.issuer-uri=${AUTH_JWT_ISSUER_URI:https://oauth.simonis.lol/application/o/casino-dev}/
|
||||
spring.security.oauth2.resourceserver.jwt.jwk-set-uri=${AUTH_JWT_JWT_SET_URI:https://oauth.simonis.lol/application/o/casino-dev/jwks/}
|
||||
spring.security.oauth2.resourceserver.jwt.issuer-uri=https://oauth.simonis.lol/application/o/casino-dev/
|
||||
spring.security.oauth2.resourceserver.jwt.jwk-set-uri=https://oauth.simonis.lol/application/o/casino-dev/jwks/
|
||||
|
||||
#OIDC provider configuration:
|
||||
logging.level.org.springframework.security=DEBUG
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
FROM oven/bun:debian AS build
|
||||
WORKDIR /app
|
||||
|
||||
RUN apt-get update -y && apt-get install nodejs -y
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
COPY package.json bun.lock ./
|
||||
RUN bun install --frozen-lockfile
|
||||
|
||||
COPY . .
|
||||
RUN bun run build
|
||||
|
||||
FROM nginx:alpine AS production
|
||||
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
COPY .docker/casino.conf /etc/nginx/templates/nginx.conf.template
|
||||
COPY .docker/entrypoint.sh /docker-entrypoint.d/40-custom-config-env.sh
|
||||
|
||||
COPY --from=build /app/dist/casino /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
|
@ -1,19 +0,0 @@
|
|||
server {
|
||||
listen 80;
|
||||
root /usr/share/nginx/html/browser;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
add_header Cache-Control "no-cache";
|
||||
}
|
||||
|
||||
location /backend/ {
|
||||
proxy_pass http://${BACKEND_HOST}:${BACKEND_PORT}/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/sh
|
||||
# Default values if not provided
|
||||
: ${BACKEND_HOST:=localhost}
|
||||
: ${BACKEND_PORT:=8080}
|
||||
|
||||
# Wait until the backend host is resolvable
|
||||
echo "Waiting for backend host $BACKEND_HOST..."
|
||||
until getent hosts "$BACKEND_HOST" > /dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
envsubst '$BACKEND_HOST $BACKEND_PORT' < /etc/nginx/templates/nginx.conf.template > /etc/nginx/conf.d/default.conf
|
||||
exec nginx -g 'daemon off;'
|
|
@ -1,15 +0,0 @@
|
|||
node_modules
|
||||
dist
|
||||
.angular
|
||||
.git
|
||||
.github
|
||||
.vscode
|
||||
.idea
|
||||
*.md
|
||||
!README.md
|
||||
.DS_Store
|
||||
.env*
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
bun-debug.log*
|
|
@ -13,7 +13,7 @@
|
|||
"build": {
|
||||
"builder": "@angular-devkit/build-angular:application",
|
||||
"options": {
|
||||
"outputPath": "dist/casino",
|
||||
"outputPath": "dist/lf10-starter2024",
|
||||
"index": "src/index.html",
|
||||
"browser": "src/main.ts",
|
||||
"tsConfig": "tsconfig.app.json",
|
||||
|
|
31
frontend/docker/docker-compose.yml
Normal file
31
frontend/docker/docker-compose.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
version: '3'
|
||||
|
||||
volumes:
|
||||
employee_postgres_data:
|
||||
driver: local
|
||||
|
||||
services:
|
||||
postgres-employee:
|
||||
container_name: postgres_employee
|
||||
image: postgres:17.4
|
||||
volumes:
|
||||
- employee_postgres_data:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_DB: employee_db
|
||||
POSTGRES_USER: employee
|
||||
POSTGRES_PASSWORD: secret
|
||||
ports:
|
||||
- "5432:5432"
|
||||
|
||||
employee:
|
||||
container_name: employee
|
||||
image: berndheidemann/employee-management-service:1.1.3
|
||||
# image: berndheidemann/employee-management-service_without_keycloak:1.1
|
||||
environment:
|
||||
spring.datasource.url: jdbc:postgresql://postgres-employee:5432/employee_db
|
||||
spring.datasource.username: employee
|
||||
spring.datasource.password: secret
|
||||
ports:
|
||||
- "8089:8089"
|
||||
depends_on:
|
||||
- postgres-employee
|
|
@ -6,7 +6,7 @@ import { routes } from './app.routes';
|
|||
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
||||
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
||||
import { OAuthStorage, provideOAuthClient } from 'angular-oauth2-oidc';
|
||||
import { httpInterceptor } from '@shared/interceptor/http.interceptor';
|
||||
import { httpInterceptor } from './shared/interceptor/http.interceptor';
|
||||
|
||||
export const appConfig: ApplicationConfig = {
|
||||
providers: [
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import {
|
||||
AfterViewInit,
|
||||
ChangeDetectionStrategy,
|
||||
ChangeDetectorRef,
|
||||
Component,
|
||||
ElementRef,
|
||||
EventEmitter,
|
||||
inject,
|
||||
Input,
|
||||
OnChanges,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
Output,
|
||||
SimpleChanges,
|
||||
ViewChild,
|
||||
AfterViewInit,
|
||||
OnDestroy,
|
||||
OnChanges,
|
||||
SimpleChanges,
|
||||
ChangeDetectorRef,
|
||||
} from '@angular/core';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { loadStripe, Stripe } from '@stripe/stripe-js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ChangeDetectionStrategy, Component, inject, OnInit, signal } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, inject, signal, OnInit } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Router } from '@angular/router';
|
||||
import { PlayingCardComponent } from './components/playing-card/playing-card.component';
|
||||
|
@ -6,7 +6,7 @@ import { DealerHandComponent } from './components/dealer-hand/dealer-hand.compon
|
|||
import { PlayerHandComponent } from './components/player-hand/player-hand.component';
|
||||
import { GameControlsComponent } from './components/game-controls/game-controls.component';
|
||||
import { GameInfoComponent } from './components/game-info/game-info.component';
|
||||
import { BlackjackGame, Card } from '@blackjack/models/blackjack.model';
|
||||
import { Card, BlackjackGame } from '@blackjack/models/blackjack.model';
|
||||
import { BlackjackService } from '@blackjack/services/blackjack.service';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { GameResultComponent } from '@blackjack/components/game-result/game-result.component';
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import {
|
||||
AfterViewInit,
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
ElementRef,
|
||||
Input,
|
||||
OnChanges,
|
||||
SimpleChanges,
|
||||
ElementRef,
|
||||
ViewChild,
|
||||
AfterViewInit,
|
||||
} from '@angular/core';
|
||||
import { CommonModule, CurrencyPipe } from '@angular/common';
|
||||
import { CountUp } from 'countup.js';
|
||||
|
|
|
@ -5,8 +5,8 @@ import {
|
|||
Input,
|
||||
OnChanges,
|
||||
Output,
|
||||
signal,
|
||||
SimpleChanges,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { CommonModule, CurrencyPipe } from '@angular/common';
|
||||
import { FormGroup, ReactiveFormsModule } from '@angular/forms';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, Input, Output, EventEmitter } from '@angular/core';
|
||||
import { CommonModule, CurrencyPipe } from '@angular/common';
|
||||
import { animate, style, transition, trigger } from '@angular/animations';
|
||||
import { GameState } from '../../enum/gameState';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {
|
||||
AfterViewInit,
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
ElementRef,
|
||||
Input,
|
||||
AfterViewInit,
|
||||
ElementRef,
|
||||
OnChanges,
|
||||
SimpleChanges,
|
||||
} from '@angular/core';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { inject, Injectable } from '@angular/core';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { catchError, Observable } from 'rxjs';
|
||||
import { Observable, catchError } from 'rxjs';
|
||||
import { BlackjackGame } from '@blackjack/models/blackjack.model';
|
||||
|
||||
@Injectable({
|
||||
|
|
|
@ -81,16 +81,12 @@
|
|||
[isOpen]="isDepositModalOpen"
|
||||
(closeModalEmitter)="closeDepositModal()"
|
||||
></app-deposit>
|
||||
<button
|
||||
class="bg-deep-blue-light hover:bg-deep-blue-contrast w-full py-2 rounded"
|
||||
(click)="openTransactionModal()"
|
||||
>
|
||||
<button class="bg-deep-blue-light hover:bg-deep-blue-contrast w-full py-2 rounded">
|
||||
Transaktionen
|
||||
</button>
|
||||
<app-transaction-history
|
||||
[isOpen]="isTransactionModalOpen"
|
||||
(closeEventEmitter)="closeTransactionModal()"
|
||||
/>
|
||||
<button class="bg-deep-blue-light hover:bg-deep-blue-contrast w-full py-2 rounded">
|
||||
Kontoeinstellungen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -104,13 +100,11 @@
|
|||
<div class="space-y-3">
|
||||
<div
|
||||
class="flex justify-between items-center"
|
||||
*ngFor="let transaction of (recentTransactionData | async)?.transactions"
|
||||
*ngFor="let transaction of recentTransactions"
|
||||
>
|
||||
<div>
|
||||
<p class="text-sm font-medium">{{ transaction.status }}</p>
|
||||
<p class="text-xs text-text-secondary">
|
||||
{{ transaction.createdAt | date: 'd.m.Y H:m' }}
|
||||
</p>
|
||||
<p class="text-sm font-medium">{{ transaction.type }}</p>
|
||||
<p class="text-xs text-text-secondary">{{ transaction.date }}</p>
|
||||
</div>
|
||||
<span [class]="transaction.amount > 0 ? 'text-emerald' : 'text-accent-red'">
|
||||
{{ transaction.amount | currency: 'EUR' }}
|
||||
|
|
|
@ -1,36 +1,22 @@
|
|||
import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core';
|
||||
import { AsyncPipe, CurrencyPipe, DatePipe, NgFor } from '@angular/common';
|
||||
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
|
||||
import { CurrencyPipe, NgFor } from '@angular/common';
|
||||
import { DepositComponent } from '../deposit/deposit.component';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { ConfirmationComponent } from '@shared/components/confirmation/confirmation.component';
|
||||
import { Transaction } from 'app/model/Transaction';
|
||||
import { NavbarComponent } from '@shared/components/navbar/navbar.component';
|
||||
import { Game } from 'app/model/Game';
|
||||
import { Observable } from 'rxjs';
|
||||
import { TransactionService } from '@service/transaction.service';
|
||||
import format from 'ajv/dist/vocabularies/format';
|
||||
import { TransactionHistoryComponent } from '../transaction-history/transaction-history.component';
|
||||
import { TransactionData } from '../../model/TransactionData';
|
||||
|
||||
@Component({
|
||||
selector: 'app-homepage',
|
||||
standalone: true,
|
||||
imports: [
|
||||
NavbarComponent,
|
||||
CurrencyPipe,
|
||||
NgFor,
|
||||
DepositComponent,
|
||||
ConfirmationComponent,
|
||||
AsyncPipe,
|
||||
DatePipe,
|
||||
TransactionHistoryComponent,
|
||||
],
|
||||
imports: [NavbarComponent, CurrencyPipe, NgFor, DepositComponent, ConfirmationComponent],
|
||||
templateUrl: './home.component.html',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export default class HomeComponent implements OnInit {
|
||||
isDepositModalOpen = false;
|
||||
isDepositSuccessful = false;
|
||||
isTransactionModalOpen = false;
|
||||
|
||||
constructor(
|
||||
public route: ActivatedRoute,
|
||||
|
@ -88,13 +74,11 @@ export default class HomeComponent implements OnInit {
|
|||
|
||||
allGames: Game[] = [...this.featuredGames];
|
||||
|
||||
recentTransactionData: Observable<TransactionData> =
|
||||
inject(TransactionService).getUsersTransactions(5);
|
||||
recentTransactions: Transaction[] = [];
|
||||
|
||||
openDepositModal() {
|
||||
this.isDepositModalOpen = true;
|
||||
}
|
||||
|
||||
closeDepositModal() {
|
||||
this.isDepositModalOpen = false;
|
||||
}
|
||||
|
@ -102,22 +86,11 @@ export default class HomeComponent implements OnInit {
|
|||
openDepositConfirmationModal() {
|
||||
this.isDepositSuccessful = true;
|
||||
}
|
||||
|
||||
openTransactionModal() {
|
||||
this.isTransactionModalOpen = true;
|
||||
}
|
||||
|
||||
closeDepositConfirmationModal() {
|
||||
this.isDepositSuccessful = false;
|
||||
}
|
||||
|
||||
closeTransactionModal() {
|
||||
this.isTransactionModalOpen = false;
|
||||
}
|
||||
|
||||
navigateToGame(route: string) {
|
||||
this.router.navigate([route]);
|
||||
}
|
||||
|
||||
protected readonly format = format;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { ChangeDetectionStrategy, Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ChangeDetectionStrategy, Component, OnInit, OnDestroy } from '@angular/core';
|
||||
import { NgFor } from '@angular/common';
|
||||
import { NavbarComponent } from '@shared/components/navbar/navbar.component';
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
button[disabled] {
|
||||
cursor: not-allowed;
|
||||
background-color: #077b58;
|
||||
box-shadow: none;
|
||||
}
|
||||
button[disabled]:hover {
|
||||
background-color: #077b58;
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
<div *ngIf="isOpen" [@fadeInOut] class="modal-bg" style="z-index: 1000; position: fixed">
|
||||
<div class="modal-card" [@cardAnimation]>
|
||||
<button
|
||||
type="button"
|
||||
(click)="closeDialog()"
|
||||
class="absolute top-2 right-2 text-text-secondary"
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="2em" height="2em" viewBox="0 0 24 24">
|
||||
<path
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="2"
|
||||
d="M18 6L6 18M6 6l12 12"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<h2 class="modal-heading mb-0">Transaktionen</h2>
|
||||
<p class="pb-1 text-text-secondary mb-4">Hier siehst du alle vergangenen Einzahlungen</p>
|
||||
@for (transaction of (transactionData$ | async)?.transactions; track null) {
|
||||
<div class="flex justify-between items-center mb-4">
|
||||
<div>
|
||||
<p class="text-sm font-medium">{{ transaction.status }}</p>
|
||||
<p class="text-xs text-text-secondary">{{ transaction.createdAt | date: 'd.m.Y H:m' }}</p>
|
||||
</div>
|
||||
<span [class]="transaction.amount > 0 ? 'text-emerald' : 'text-accent-red'">
|
||||
{{ transaction.amount | currency: 'EUR' }}
|
||||
</span>
|
||||
</div>
|
||||
} @empty {
|
||||
<div class="flex justify-center items-center w-full h-32">
|
||||
<div
|
||||
class="spinner-border animate-spin inline-block w-8 h-8 border-4 rounded-full border-gray-300 border-t-gree-600"
|
||||
role="status"
|
||||
>
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="inline inline-flex w-full gap-2">
|
||||
<button
|
||||
type="button"
|
||||
(click)="back()"
|
||||
class="button-primary w-full py-2"
|
||||
[disabled]="offset <= 0"
|
||||
>
|
||||
<
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
(click)="forward()"
|
||||
class="button-primary w-full py-2"
|
||||
[disabled]="!(transactionData$ | async)?.hasMore"
|
||||
>
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,54 +0,0 @@
|
|||
import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
EventEmitter,
|
||||
inject,
|
||||
Input,
|
||||
Output,
|
||||
} from '@angular/core';
|
||||
import { TransactionService } from '@service/transaction.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { AsyncPipe, CurrencyPipe, DatePipe, NgForOf, NgIf } from '@angular/common';
|
||||
import { AnimatedNumberComponent } from '@blackjack/components/animated-number/animated-number.component';
|
||||
import { TransactionData } from '../../model/TransactionData';
|
||||
|
||||
const PER_PAGE = 5;
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
selector: 'app-transaction-history',
|
||||
imports: [NgForOf, AsyncPipe, CurrencyPipe, DatePipe, AnimatedNumberComponent, NgIf],
|
||||
templateUrl: './transaction-history.component.html',
|
||||
styleUrl: './transaction-history.component.css',
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class TransactionHistoryComponent {
|
||||
@Input()
|
||||
isOpen = false;
|
||||
@Output()
|
||||
closeEventEmitter = new EventEmitter<void>();
|
||||
|
||||
protected offset = 0;
|
||||
|
||||
private transactionService: TransactionService = inject(TransactionService);
|
||||
transactionData$: Observable<TransactionData> = this.loadTransactions();
|
||||
|
||||
closeDialog() {
|
||||
this.isOpen = false;
|
||||
this.closeEventEmitter.emit();
|
||||
}
|
||||
|
||||
forward() {
|
||||
this.offset++;
|
||||
this.transactionData$ = this.loadTransactions();
|
||||
}
|
||||
|
||||
back() {
|
||||
this.offset--;
|
||||
this.transactionData$ = this.loadTransactions();
|
||||
}
|
||||
|
||||
loadTransactions() {
|
||||
return this.transactionService.getUsersTransactions(PER_PAGE, this.offset * PER_PAGE);
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
export interface Transaction {
|
||||
status: string;
|
||||
id: string;
|
||||
type: string;
|
||||
amount: number;
|
||||
createdAt: string;
|
||||
date: string;
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import { Transaction } from './Transaction';
|
||||
|
||||
export interface TransactionData {
|
||||
transactions: Transaction[];
|
||||
hasMore: boolean;
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
import { inject, Injectable } from '@angular/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { TransactionData } from '../model/TransactionData';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class TransactionService {
|
||||
private http: HttpClient = inject(HttpClient);
|
||||
|
||||
public getUsersTransactions(limit: number | null = null, offset: number | null = null) {
|
||||
const baseUrl = new URL(`${window.location.origin}/backend/user/transactions`);
|
||||
|
||||
if (limit !== null) {
|
||||
baseUrl.searchParams.append('limit', limit.toString());
|
||||
}
|
||||
|
||||
if (offset !== null) {
|
||||
baseUrl.searchParams.append('offset', offset.toString());
|
||||
}
|
||||
|
||||
return this.http.get<TransactionData>(`${baseUrl}`);
|
||||
}
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
import {
|
||||
AfterViewInit,
|
||||
Component,
|
||||
ElementRef,
|
||||
EventEmitter,
|
||||
Input,
|
||||
OnDestroy,
|
||||
Output,
|
||||
ViewChild,
|
||||
AfterViewInit,
|
||||
OnDestroy,
|
||||
} from '@angular/core';
|
||||
import { ModalAnimationService } from '@shared/services/modal-animation.service';
|
||||
import gsap from 'gsap';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
||||
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
|
||||
import { faCreditCard, faMoneyBillTransfer, faWallet } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faApplePay, faGooglePay, faPaypal } from '@fortawesome/free-brands-svg-icons';
|
||||
import { faMoneyBillTransfer, faCreditCard, faWallet } from '@fortawesome/free-solid-svg-icons';
|
||||
import { faPaypal, faGooglePay, faApplePay } from '@fortawesome/free-brands-svg-icons';
|
||||
|
||||
@Component({
|
||||
selector: 'app-footer',
|
||||
|
|
|
@ -2,8 +2,8 @@ import {
|
|||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
inject,
|
||||
OnDestroy,
|
||||
OnInit,
|
||||
OnDestroy,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue