Skip to content

Commit

Permalink
Merge branch 'main' into backend-ci-cd
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/backend/src/main/java/com/app/gamereview/controller/ImageController.java
  • Loading branch information
haliskunduz committed Oct 31, 2023
2 parents bdf1461 + 78001d0 commit f7e1aec
Show file tree
Hide file tree
Showing 348 changed files with 56,773 additions and 245 deletions.
73 changes: 0 additions & 73 deletions .github/main-backend.yml

This file was deleted.

49 changes: 49 additions & 0 deletions .github/workflows/main-backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy to EC2

on:
push:
branches:
- backend-ci-cd

jobs:
build_and_push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Maven
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'

- name: Build with Maven
run: |
cd app/backend
mvn clean install
- name: Build Docker image
run: |
cd app/backend
docker build -t bounswe2023group5:latest .
- name: Login to Docker Hub
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin

- name: Push to Docker Hub
run: |
docker tag bounswe2023group5:latest unaldenizzz/bounswe2023group5:latest
docker push unaldenizzz/bounswe2023group5:latest
deploy_to_ec2:
needs: build_and_push
runs-on: ubuntu-latest
steps:
- name: Deploy to EC2
env:
PRIVATE_KEY: ${{ secrets.EC2_SSH_PRIVATE_KEY }}
run: |
echo "$PRIVATE_KEY" > private_key.pem
chmod 600 private_key.pem
ssh -o StrictHostKeyChecking=no -i private_key.pem [email protected] 'updateswe'
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class CorsConfig {
@Bean
public CorsConfigurationSource corsConfigurationSource() {
final CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(Arrays.asList("http://localhost:5173", "http://localhost:5173/")); // Replace with your frontend URL
configuration.setAllowedOrigins(Arrays.asList("http://localhost:5173", "http://ec2-51-20-78-40.eu-north-1.compute.amazonaws.com/"));
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS"));
configuration.setAllowCredentials(true);
configuration.setAllowedHeaders(Arrays.asList("Authorization", "Content-Type", "Set-Cookie", "credentials"));
Expand All @@ -26,4 +26,3 @@ public CorsConfigurationSource corsConfigurationSource() {
return source;
}
}

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package com.app.gamereview.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.MediaType;
Expand All @@ -16,7 +17,7 @@ public class ImageController {
@Value("${image.base-directory}")
private String imageBaseDirectory;

@GetMapping("/images/{folder}/{fileName:.+}")
@GetMapping("/api/{folder}/{fileName:.+}")
public ResponseEntity<Resource> serveImage(@PathVariable String folder, @PathVariable String fileName) {
try {
File imageFile = new File(imageBaseDirectory + folder + File.separator + fileName);
Expand All @@ -40,4 +41,4 @@ public ResponseEntity<Resource> serveImage(@PathVariable String folder, @PathVar
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
@Retention(RetentionPolicy.RUNTIME)
public @interface AuthorizationRequired {

}
}
Binary file added app/frontend/assets/images/guru-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions app/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added app/frontend/public/placeholders/minecraft.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions app/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const queryClient = new QueryClient();
function App() {
return (
<QueryClientProvider client={queryClient}>
<AntdConfigProvider>
<RouterProvider router={router} />
</AntdConfigProvider>
<AntdConfigProvider>
<RouterProvider router={router} />
</AntdConfigProvider>
</QueryClientProvider>
);
}
Expand Down
3 changes: 1 addition & 2 deletions app/frontend/src/Components/Game/Game.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import styles from "./Game.module.scss";
import GameConsole from "../../../assets/images/game-console.png";
import { Button } from "antd";
Expand All @@ -22,7 +21,7 @@ function Game(props: any) {
</div>
<div className={styles.content}>
<img
src={game.gameIcon}
src={`${import.meta.env.VITE_APP_IMG_URL}${game?.gameIcon}`}
alt="name of the game"
width={120}
height={100}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@import "../../../colors";

.summary-container {
display: flex;
flex-direction: column;
padding: 10px;
flex-wrap: wrap;
}

.field-container {
display: flex;
flex-wrap: wrap;
gap: 1em;
}

.tag-container {
display: flex;
background-color: $violet-light-90;
height: 60px;
align-items: center;
border-radius: 0.5rem;
gap: 0.5em;
padding: 10px;
}

.summary {
background-color: $violet-light-90;
border: 2px solid $yellow;
border-radius: 0.5rem;
padding: 20px;
margin: 20px 0px 20px 0px;
}

.req {
background-color: $violet-light-90;
min-height: min-content;
width: 300px;
border-radius: 0.5rem;
gap: 0.5em;
padding: 10px;
font-size: 0.8em;
white-space: pre-wrap;
}
71 changes: 71 additions & 0 deletions app/frontend/src/Components/GameDetails/Summary/Summary.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { Typography } from "antd";
import TagRenderer from "../../TagRenderer/TagRenderer";
import styles from "./Summary.module.scss";

function Summary({ game }: { game: any }) {
return (
<div className={styles.summaryContainer}>
<div className={styles.fieldContainer}>
{game?.genre?.length > 0 && (
<div className={styles.tagContainer}>
Genre:
<TagRenderer tags={game.genre} />
</div>
)}
{game?.production && (
<div className={styles.tagContainer}>
Production:
<TagRenderer tags={[game?.production]} />
</div>
)}
{game?.playerTypes?.length > 0 && (
<div className={styles.tagContainer}>
Player Type:
<TagRenderer tags={game?.playerTypes} />
</div>
)}
{game?.duration && (
<div className={styles.tagContainer}>
Duration:
<TagRenderer tags={[game?.duration]} />
</div>
)}
{game?.artStyles?.length > 0 && (
<div className={styles.tagContainer}>
Art Styles:
<TagRenderer tags={game?.artStyles} />
</div>
)}
{game?.platforms?.length > 0 && (
<div className={styles.tagContainer}>
Platforms:
<TagRenderer tags={game?.platforms} />
</div>
)}
{game.developer && (
<div className={styles.tagContainer}>
Developer:
<TagRenderer tags={[game?.developer]} />
</div>
)}
{game?.otherTags?.length > 0 && (
<div className={styles.tagContainer}>
Other:
<TagRenderer tags={game?.otherTags} />
</div>
)}
</div>
<div className={styles.summary}>
<Typography>{game?.gameDescription}</Typography>
</div>
{game.minSystemReq && (
<div className={styles.req}>
<span>Min System Req: </span>
{game.minSystemReq}
</div>
)}
</div>
);
}

export default Summary;
Loading

0 comments on commit f7e1aec

Please sign in to comment.