Skip to content
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
12 changes: 6 additions & 6 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 4
}
"semi": false,
"singleQuote": true,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 4
}
2 changes: 1 addition & 1 deletion deploy/project2-backend.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ StartLimitIntervalSec=0
[Service]
Type=simple
WorkingDirectory=%h/T10-project-2
ExecStart=/bin/bash -c 'source "$HOME/.nvm/nvm.sh" && exec node src/backend/server.ts'
ExecStart=/bin/bash -c 'source "$HOME/.nvm/nvm.sh" && exec node src/backend/Server.ts'
Restart=always
RestartSec=5

Expand Down
26 changes: 13 additions & 13 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ import { defineConfig, globalIgnores } from 'eslint/config'
import prettier from 'eslint-config-prettier'

export default defineConfig([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
prettier,
],
languageOptions: {
globals: globals.browser,
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
prettier,
],
languageOptions: {
globals: globals.browser,
},
},
},
])
20 changes: 10 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>t10-project-2</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>t10-project-2</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/Main.tsx"></script>
</body>
</html>
108 changes: 54 additions & 54 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
{
"name": "t10-project-2",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",
"format": "prettier --write \"src/**/*.{ts,tsx,css,md}\"",
"format:check": "prettier --check \"src/**/*.{ts,tsx,css,md}\"",
"test": "vitest",
"test:ui": "vitest --ui",
"test:coverage": "vitest run --coverage",
"server": "node src/backend/server.ts"
},
"dependencies": {
"@apollo/server": "^5.5.1",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@material/card": "^14.0.0",
"@mui/material": "^9.4.0",
"dotenv": "^18.0.7",
"graphql": "^16.14.2",
"lucide-react": "^1.48.0",
"pg": "^8.23.1",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"react-router-dom": "^7.18.4"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.7",
"@types/node": "^24.13.3",
"@types/pg": "^8.23.1",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.7",
"@vitejs/plugin-react": "^6.1.1",
"@vitest/coverage-v8": "^5.0.2",
"@vitest/ui": "^5.0.3",
"eslint": "^10.10.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.6",
"globals": "^17.12.0",
"jsdom": "^29.1.1",
"prettier": "^3.9.8",
"typescript": "~6.0.2",
"typescript-eslint": "^8.69.0",
"vite": "^8.3.0",
"vitest": "^5.0.2"
}
"name": "t10-project-2",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",
"format": "prettier --write \"src/**/*.{ts,tsx,css,md}\"",
"format:check": "prettier --check \"src/**/*.{ts,tsx,css,md}\"",
"test": "vitest",
"test:ui": "vitest --ui",
"test:coverage": "vitest run --coverage",
"server": "node src/backend/Server.ts"
},
"dependencies": {
"@apollo/Server": "^5.5.1",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@material/card": "^14.0.0",
"@mui/material": "^9.4.0",
"dotenv": "^18.0.7",
"graphql": "^16.14.2",
"lucide-react": "^1.48.0",
"pg": "^8.23.1",
"react": "^19.2.8",
"react-dom": "^19.2.8",
"react-router-dom": "^7.18.4"
},
"devDependencies": {
"@eslint/js": "^10.0.1",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/react": "^16.3.3",
"@testing-library/user-event": "^14.6.7",
"@types/node": "^24.13.3",
"@types/pg": "^8.23.1",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.7",
"@vitejs/plugin-react": "^6.1.1",
"@vitest/coverage-v8": "^5.0.2",
"@vitest/ui": "^5.0.3",
"eslint": "^10.10.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-react-hooks": "^7.1.1",
"eslint-plugin-react-refresh": "^0.5.6",
"globals": "^17.12.0",
"jsdom": "^29.1.1",
"prettier": "^3.9.8",
"typescript": "~6.0.2",
"typescript-eslint": "^8.69.0",
"vite": "^8.3.0",
"vitest": "^5.0.2"
}
}
26 changes: 13 additions & 13 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { HashRouter, Routes, Route } from 'react-router-dom'
import MainPage from './pages/mainpage'
import GamePage from './pages/gamepage'
import { SearchPage } from './pages/searchpage'
import SignUpPage from './pages/signup'
import SignInPage from './pages/signin'
import WishlistPage from './pages/wishlistpage'
import ProfilePage from './pages/profilepage'
import MainPage from './pages/MainPage'
import GamePage from './pages/GamePage'
import { SearchPage } from './pages/SearchPage'
import SignUpPage from './pages/SignUp'
import SignInPage from './pages/SignIn'
import WishlistPage from './pages/WishlistPage'
import ProfilePage from './pages/ProfilePage'

function App() {
return (
<HashRouter>
<Routes>
<Route path="/" element={<MainPage />} />
<Route path="/gamepage" element={<GamePage />} />
<Route path="/GamePage" element={<GamePage />} />
<Route path="/gamepage/:gameId" element={<GamePage />} />
<Route path="/searchpage" element={<SearchPage />} />
<Route path="/signup" element={<SignUpPage />} />
<Route path="/signin" element={<SignInPage />} />
<Route path="/wishlistpage" element={<WishlistPage />} />
<Route path="/profilepage" element={<ProfilePage />} />
<Route path="/SearchPage" element={<SearchPage />} />
<Route path="/SignUp" element={<SignUpPage />} />
<Route path="/SignIn" element={<SignInPage />} />
<Route path="/WishlistPage" element={<WishlistPage />} />
<Route path="/ProfilePage" element={<ProfilePage />} />
</Routes>
</HashRouter>
)
Expand Down
4 changes: 2 additions & 2 deletions src/main.tsx → src/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './css/global.css'
import './css/Global.css'
import App from './App.tsx'
import { AuthProvider } from './context/authcontext.tsx'
import { AuthProvider } from './context/AuthContext.tsx'

createRoot(document.getElementById('root')!).render(
<AuthProvider>
Expand Down
25 changes: 17 additions & 8 deletions src/api/fill_db.ts → src/api/FillDb.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import "dotenv/config"
import { pool } from "../backend/db_connection"
import { fetchGames } from "../backend/steam"
import 'dotenv/config'
import { pool } from '../backend/DbConnection'
import { FetchGames } from '../backend/Steam'

const BATCH = 200
const TARGET = 2000
const START = 200 //changed based on wether it crashes or not

async function fill_db() {
async function FillDb() {
try {
for (let offset = START; offset < TARGET; offset += BATCH) {
const games = await fetchGames(BATCH, offset)
for(const g of games) {
const games = await FetchGames(BATCH, offset)
for (const g of games) {
await pool.query(
`INSERT INTO games (game_id, game_name, current_price, initial_price, discount_percent, image_url, genre, description)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
Expand All @@ -22,7 +22,16 @@ async function fill_db() {
image_url = EXCLUDED.image_url,
genre = EXCLUDED.genre,
description = EXCLUDED.description`,
[g.appid, g.name, g.price, g.initialprice, g.discount, g.img, g.genre, g.description]
[
g.appid,
g.name,
g.price,
g.initialprice,
g.discount,
g.img,
g.genre,
g.description,
],
)
}
console.log(`Inserted/updated ${games.length} games`)
Expand All @@ -35,4 +44,4 @@ async function fill_db() {
}
}

fill_db()
FillDb()
Loading