Skip to content

Commit dc04923

Browse files
committed
comiit final
1 parent c963c63 commit dc04923

File tree

7 files changed

+15
-26
lines changed

7 files changed

+15
-26
lines changed

.env

Lines changed: 0 additions & 12 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"scripts": {
99
"build": "nest build",
1010
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
11+
"uwu": "nest start",
1112
"start": "node dist/main",
1213
"start:dev": "nest start --watch",
1314
"start:debug": "nest start --debug --watch",

src/config/constants.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
export const SERVER_PORT = 'SERVER_PORT';
2-
export const DB_HOST = 'DB_HOST';
3-
export const DB_PORT = 'DB_PORT';
4-
export const DB_USERNAME = 'DB_USERNAME';
5-
export const DB_PASSWORD = 'DB_PASSWORD';
6-
export const DB_DATABASE = 'DB_DATABASE';
1+
72
export const JWT_SECRET = 'this is a random shit';
83

94
export enum formats{

src/main.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { NestFactory } from '@nestjs/core';
22
import { AppModule } from './app.module';
33
import { ConfigService } from '@nestjs/config';
4-
import { SERVER_PORT } from './config/constants';
54

65
async function bootstrap() {
76
const app = await NestFactory.create(AppModule, {cors: true});
@@ -13,7 +12,7 @@ async function bootstrap() {
1312
});
1413
app.enableCors()
1514
const configService = app.get(ConfigService);
16-
const port = configService.get<number>(SERVER_PORT);
15+
const port = process.env.SERVER_PORT
1716
await app.listen(port);
1817

1918
}

src/resultsView/resultsView.entity.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { ViewColumn, ViewEntity } from "typeorm";
1010
t.id_tournament AS "id_tournament",
1111
p.name AS "player_name",
1212
p.picture AS "picture",
13+
t.picture AS "t_picture",
1314
t.name AS "tournament_name",
1415
r.place AS "place",
1516
r.points AS "points",
@@ -37,6 +38,9 @@ export class ResultsViewEntity{
3738
@ViewColumn()
3839
picture: string
3940

41+
@ViewColumn()
42+
t_picture: string
43+
4044
@ViewColumn()
4145
tournament_name : string
4246

src/tournament/tournament.entity.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export class TournamentEntity{
1010
@PrimaryColumn()
1111
id_tournament: number
1212

13+
@Column({type: "varchar", length: "256"})
14+
picture: string
15+
1316
@Column({type: "varchar", length: 64})
1417
name: string
1518

src/typeorm/typeorm.service.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Injectable } from '@nestjs/common';
22
import { TypeOrmModuleOptions, TypeOrmOptionsFactory } from '@nestjs/typeorm';
33
import { ConfigService } from '@nestjs/config';
4-
import { DB_DATABASE,DB_HOST,DB_PASSWORD,DB_PORT,DB_USERNAME } from 'src/config/constants';
54

65
@Injectable()
76
export class TypeormService implements TypeOrmOptionsFactory{
@@ -12,11 +11,11 @@ export class TypeormService implements TypeOrmOptionsFactory{
1211
createTypeOrmOptions(): TypeOrmModuleOptions | Promise<TypeOrmModuleOptions> {
1312
return {
1413
type: 'mysql',
15-
host: this.configService.get<string>(DB_HOST),
16-
port: this.configService.get<number>(DB_PORT),
17-
username: this.configService.get<string>(DB_USERNAME),
18-
password: this.configService.get<string>(DB_PASSWORD),
19-
database: this.configService.get<string>(DB_DATABASE),
14+
host: process.env.DB_HOST,
15+
port: Number(process.env.DB_PORT),
16+
username: process.env.DB_USERNAME,
17+
password: process.env.DB_PASSWORD,
18+
database: process.env.DB_DATABASE,
2019
entities: [__dirname + '/../**/*.entity{.js,.ts}'],
2120
synchronize: true,
2221
logging: true

0 commit comments

Comments
 (0)