Compare commits

..

4 Commits

Author SHA1 Message Date
Sascha Kühl 7788369b73 removed unused variable 2025-04-21 21:49:56 +02:00
Sascha Kühl 3b873c62b0 added readme 2025-04-21 21:49:16 +02:00
Sascha Kühl d10b7efed9 backend fixes 2025-04-21 21:49:03 +02:00
Sascha Kühl 05ead54051 app progress 2025-04-21 21:48:46 +02:00
9 changed files with 18 additions and 21 deletions

View File

@ -5,7 +5,7 @@ class BackendService {
return localStorage.getItem("server") !== null; return localStorage.getItem("server") !== null;
} }
getServer(): Server { getServer(): Server {
return JSON.parse(localStorage.getItem("server") || '{"protocol":"https","host":"localhost","port":8080}'); return JSON.parse(localStorage.getItem("server") || '{"protocol":"https","host":"localhost","port":8124}');
} }
updateServer(server: Server): void { updateServer(server: Server): void {
localStorage.setItem("server", JSON.stringify(server)); localStorage.setItem("server", JSON.stringify(server));

View File

@ -15,11 +15,9 @@ export class BullpenSessionService {
} }
public save(bullpen: Bullpen): Promise<Bullpen> { public save(bullpen: Bullpen): Promise<Bullpen> {
console.log(JSON.stringify(bullpen, null, 2));
return api return api
.post('/bullpen_session', bullpen) .post('/bullpen_session', bullpen)
.then(response => { .then(response => {
console.log(JSON.stringify(response.data, null, 2));
return response.data; return response.data;
}, (error) => { }, (error) => {
console.log(JSON.stringify(error, null, 2)); console.log(JSON.stringify(error, null, 2));

View File

@ -22,7 +22,6 @@ class TokenService {
} }
setUser(user: UserInfo) { setUser(user: UserInfo) {
console.log(JSON.stringify(user));
localStorage.setItem("auth", JSON.stringify(user)); localStorage.setItem("auth", JSON.stringify(user));
} }

View File

@ -29,8 +29,6 @@ const pitcher = computed(() => store.state.auth.user);
const pitchTypes = computed(() => store.state.pitchTypes.pitchTypes); const pitchTypes = computed(() => store.state.pitchTypes.pitchTypes);
const bullpen = computed(() => store.state.bullpen); const bullpen = computed(() => store.state.bullpen);
console.log(JSON.stringify(bullpen.value.bullpen, null, 2));
const determinePitchTypeName = (id: number): string => { const determinePitchTypeName = (id: number): string => {
const pitchType = pitchTypes.value.find((pitchType: PitchType) => pitchType.id === id); const pitchType = pitchTypes.value.find((pitchType: PitchType) => pitchType.id === id);
@ -52,7 +50,7 @@ const gotoHome = () => {
<ion-title v-else>Bullpen Summary</ion-title> <ion-title v-else>Bullpen Summary</ion-title>
</ion-toolbar> </ion-toolbar>
</ion-header> </ion-header>
<ion-content> <ion-content v-if="bullpen.bullpen">
<ion-card v-for="(pitch, index) in bullpen.bullpen.pitches" :key="index"> <ion-card v-for="(pitch, index) in bullpen.bullpen.pitches" :key="index">
<ion-card-header> <ion-card-header>
<ion-card-title>Pitch {{index+1}}</ion-card-title> <ion-card-title>Pitch {{index+1}}</ion-card-title>

View File

@ -15,28 +15,23 @@ const userImage = ref(null);
const pitcher = computed(() => store.state.auth.user); const pitcher = computed(() => store.state.auth.user);
const isAuthenticated = computed(() => store.state.auth.isAuthenticated); const isAuthenticated = computed(() => store.state.auth.isAuthenticated);
console.log('user', pitcher.value);
if (pitcher.value === undefined || pitcher.value === null || pitcher.value === '') { if (pitcher.value === undefined || pitcher.value === null || pitcher.value === '') {
router.push({ path: '/login' }); router.push({ path: '/login' });
} }
const startBullpen = () => { const startBullpen = () => {
console.log('Starting bullpen session');
router.push({ path: '/bullpen' }); router.push({ path: '/bullpen' });
}; };
const showStats = () => { const showStats = () => {
console.log('Showing bullpen stats');
router.push({ path: '/stats' }); router.push({ path: '/stats' });
}; };
const showProfile = () => { const showProfile = () => {
console.log('Showing profile');
router.push({ path: '/profile' }); router.push({ path: '/profile' });
}; };
const logout = () => { const logout = () => {
console.log('Logout');
store.dispatch('auth/logout').then(() => { store.dispatch('auth/logout').then(() => {
router.push({ path: '/' }); router.push({ path: '/' });
}, error => { }, error => {

View File

@ -1,4 +1,3 @@
.idea .idea
node_modules node_modules
npm-debug.log npm-debug.log
.env.*

View File

@ -24,7 +24,7 @@ RUN --mount=type=bind,source=package.json,target=package.json \
npm ci --include=dev npm ci --include=dev
USER node USER node
COPY . . COPY . .
CMD ["npm", "run", "dev"] CMD ["npm", "run", "start:dev"]
#FROM node:20-alpine as build #FROM node:20-alpine as build

View File

@ -6,11 +6,13 @@ services:
secrets: secrets:
- db-password - db-password
environment: environment:
POSTGRES_DB: bullpen-prod POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: test POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD_FILE: /run/secrets/db-password POSTGRES_PASSWORD_FILE: /run/secrets/db-password
expose: expose:
- 5432 - 5432
ports:
- "15432:5432"
volumes: volumes:
- db_data:/var/lib/postgresql/data - db_data:/var/lib/postgresql/data
healthcheck: healthcheck:
@ -29,12 +31,12 @@ services:
- "8124:8080" - "8124:8080"
container_name: bullpen container_name: bullpen
environment: environment:
NODE_ENV: production NODE_ENV: development
POSTGRES_HOST: db POSTGRES_HOST: ${DB_HOST}
POSTGRES_USER: test POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD_FILE: /run/secrets/db-password POSTGRES_PASSWORD_FILE: /run/secrets/db-password
POSTGRES_DB: bullpen-prod POSTGRES_DB: ${DB_NAME}
POSTGRES_PORT: 5432 POSTGRES_PORT: ${DB_PORT}
secrets: secrets:
- db-password - db-password
volumes: volumes:

6
backend/readme.md Normal file
View File

@ -0,0 +1,6 @@
docker-compose up --build -d
docker-compose exec app npx sequelize-cli db:migrate
docker-compose exec app npx sequelize-cli db:seed:all
docker-compose exec app sh