-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: channel gateway, game gateway 수정
- Loading branch information
1 parent
4bce1f0
commit 57cc309
Showing
12 changed files
with
225 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export class CreateGameParamDto { | ||
invitedUserId: number; | ||
invitationId: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export class GatewayJoinRoomParamDto { | ||
invitingUserId: number; | ||
invitedUserId: number; | ||
roomName: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,33 @@ | ||
import { DataSource, Repository } from 'typeorm'; | ||
import { GameInvitation } from './entities/game-invitation.entity'; | ||
import { InjectRepository } from '@nestjs/typeorm'; | ||
import { CreateGameInvitationParamDto } from './dto/create-invitation-param.dto'; | ||
import { DBUpdateFailureException } from '../common/exception/custom-exception'; | ||
|
||
export class GameInvitationRepository extends Repository<GameInvitation> { | ||
constructor( | ||
@InjectRepository(GameInvitation) private dataSource: DataSource, | ||
) { | ||
super(GameInvitation, dataSource.manager); | ||
} | ||
|
||
async createGameInvitation( | ||
gameInvitationDto: CreateGameInvitationParamDto, | ||
) { | ||
const gameInvitation = this.create({ | ||
invitingUserId: gameInvitationDto.invitingUser.id, | ||
invitedUserId: gameInvitationDto.invitedUserId, | ||
gameType: gameInvitationDto.gameType, | ||
}); | ||
const result = await this.save(gameInvitation); | ||
if (!result) | ||
throw DBUpdateFailureException('create game invitation failed'); | ||
return result; | ||
} | ||
|
||
async deleteGameInvitaiton(invitationId: number) { | ||
const result = await this.softDelete(invitationId); | ||
if (result.affected !== 1) | ||
throw DBUpdateFailureException('delete user from channel failed'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.