diff --git a/package-lock.json b/package-lock.json index d6db2b3d2b0a999da1d9d863faa81b0e0bedeac3..e1b770f1a0bcc6b46eca650a16d932179f0329ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3335,14 +3335,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -3361,7 +3359,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } diff --git a/src/game/game.entity.ts b/src/game/game.entity.ts index d7c42c9f27ba1cdb81cba0e74eaa88ce9b5f23d6..5d36417ebc1e01a31ed02d9d4937c00fe489d1d9 100644 --- a/src/game/game.entity.ts +++ b/src/game/game.entity.ts @@ -6,7 +6,7 @@ import { OneToMany, Timestamp, } from 'typeorm'; -import { PersonEntity } from 'src/user/user.entity'; +import { PersonEntity } from '../user/user.entity'; // table that stores all created games @Entity('Game') diff --git a/src/game/game.module.ts b/src/game/game.module.ts index e6a23cfabcf9fc4d8ed5d230e272ffe44448b025..5926f1ca7a58df1db07a2c64304a8b3030a9a7f0 100644 --- a/src/game/game.module.ts +++ b/src/game/game.module.ts @@ -4,7 +4,7 @@ import { TypeOrmModule } from '@nestjs/typeorm'; import { GameController } from './game.controller'; import { GameService } from './game.service'; import { GameEntity, FactionEntity, Game_PersonEntity } from './game.entity'; -import { PersonEntity } from 'src/user/user.entity'; +import { PersonEntity } from '../user/user.entity'; @Module({ imports: [TypeOrmModule.forFeature([GameEntity, FactionEntity, Game_PersonEntity, PersonEntity])], diff --git a/src/user/user.module.ts b/src/user/user.module.ts index 1dcd7673f17bd313c2a74ca911277e224ebc4756..6cb77a7b735df532d710febc33a4df53f264563a 100644 --- a/src/user/user.module.ts +++ b/src/user/user.module.ts @@ -4,9 +4,10 @@ import { TypeOrmModule } from '@nestjs/typeorm'; import { UserController } from './user.controller'; import { UserService } from './user.service'; import { PersonEntity} from './user.entity'; +import { GameEntity } from '../game/game.entity'; @Module({ - imports: [TypeOrmModule.forFeature([PersonEntity])], + imports: [TypeOrmModule.forFeature([PersonEntity, GameEntity])], controllers: [UserController], providers: [UserService], }) diff --git a/src/user/user.service.ts b/src/user/user.service.ts index 840d8325650894c0e1ec0ffbe47e6b3b703cdc4a..fb1b637e00c2f7774db66f0a89eb8dfd89dd8bee 100644 --- a/src/user/user.service.ts +++ b/src/user/user.service.ts @@ -4,10 +4,17 @@ import { InjectRepository } from "@nestjs/typeorm"; import { PersonEntity } from './user.entity'; import { UserDTO } from './user.dto'; +import { GameEntity } from '../game/game.entity'; +import { GameDTO } from '../game/game.dto'; @Injectable() export class UserService { - constructor(@InjectRepository(PersonEntity) private userRepository: Repository<PersonEntity>){} + constructor( + @InjectRepository(PersonEntity) + private userRepository: Repository<PersonEntity>, + @InjectRepository(GameEntity) + private gameRepository: Repository<GameEntity> + ){} async register(data: UserDTO) { const { name } = data; @@ -41,7 +48,7 @@ export class UserService { try { // etsi peli valinnan mukaan ja otetaan käyttäjän rooli kyseisestä pelistä talteen const role = await this.gameRepository.findOne(); - return gamedata; + return role; } catch (error) { return error.message; }