Skip to content
Open
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
5 changes: 3 additions & 2 deletions packages/server/src/module/game/game.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { Module } from '@nestjs/common';
import { GameController } from './games/game.controller';
import { GameService } from './games/game.service';
import { GameGateway } from './games/game.gateway';
import { GameGatewayService } from './games/game.gateway.service';
import { QuizModule } from '../quiz/quiz.module';
import { RedisModule } from '../../config/database/redis/redis.module';

@Module({
imports: [QuizModule, RedisModule],
controllers: [GameController],
providers: [GameService, GameGateway],
exports: [GameService, GameGateway],
providers: [GameService, GameGatewayService, GameGateway],
exports: [GameService, GameGatewayService, GameGateway],
})
export class GameModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Expose } from 'class-transformer';
import { EmojiType } from '@shared/types/emoji.types';

export class EmojiResponseDto {
@Expose()
emojiStatus: EmojiType;

constructor(emojiStatus: EmojiType) {
this.emojiStatus = emojiStatus;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Expose } from 'class-transformer';

export class EndQuizResponseDto {
@Expose()
isEnded: Boolean;

constructor(isEnd: Boolean) {
this.isEnded = isEnd;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Expose } from 'class-transformer';

export class MasterStatisticsResponseDto {
@Expose()
totalSubmit: number;

@Expose()
solveRate: number;

@Expose()
averageTime: number;

@Expose()
participantRate: number;

@Expose()
choiceStatus: Record<number, number>;

@Expose()
submitHistory: [string, number][];

@Expose()
participantLength: number;

constructor(
total: number,
solveRate: number,
averageTime: number,
participantRate: number,
choiceStatus: Record<number, number>,
submitHistory: [string, number][],
participantLength: number,
) {
this.totalSubmit = total;
this.solveRate = solveRate;
this.averageTime = averageTime;
this.participantRate = participantRate;
this.choiceStatus = choiceStatus;
this.submitHistory = submitHistory;
this.participantLength = participantLength;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Expose } from 'class-transformer';

export class MessageResponseDto {
@Expose()
message: string;

@Expose()
position: number;

constructor(message: string, position: number) {
this.message = message;
this.position = position;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Expose } from 'class-transformer';
import { ParticipantInfo } from '../../interfaces/participantInfo.interface';

export class MyPositionDataResponseDto {
@Expose()
participantList: ParticipantInfo[];

@Expose()
myPosition: number;

constructor(participantList: ParticipantInfo[], myPosition: number) {
this.participantList = participantList;
this.myPosition = myPosition;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Expose } from 'class-transformer';
import { ParticipantInfo } from '../../interfaces/participantInfo.interface';

export class NicknameEventDataResponseDto {
@Expose()
participantList: ParticipantInfo[];

constructor(participantList: ParticipantInfo[]) {
this.participantList = participantList;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Expose } from 'class-transformer';
import { NicknameEventDataResponseDto } from './nicknameEventData.response.dto';
import { MyPositionDataResponseDto } from './myPositionData.response.dto';

export class ParticipantEntryResponseDto {
@Expose()
nicknameEventData: NicknameEventDataResponseDto;

@Expose()
myPositionData: MyPositionDataResponseDto;

constructor(
nicknameEventData: NicknameEventDataResponseDto,
myPositionData: MyPositionDataResponseDto,
) {
this.nicknameEventData = nicknameEventData;
this.myPositionData = myPositionData;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Expose } from 'class-transformer';

export class ParticipantStatisticsResponseDto {
@Expose()
totalSubmit: number;

@Expose()
solveRate: number;

@Expose()
averageTime: number;

@Expose()
participantRate: number;

constructor(total: number, solveRate: number, averageTime: number, participantRate: number) {
this.totalSubmit = total;
this.solveRate = solveRate;
this.averageTime = averageTime;
this.participantRate = participantRate;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Expose } from 'class-transformer';

export class ShowRankingResponseDto {
@Expose()
rankerData: { nickname: any; score: string }[];

@Expose()
myRank: number;

@Expose()
myScore: string;

@Expose()
myNickname: string;

constructor(
rankerData: { nickname: string; score: string }[],
myRank: number,
myScore: string,
myNickname: string,
) {
this.rankerData = rankerData;
this.myRank = myRank;
this.myScore = myScore;
this.myNickname = myNickname;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Expose } from 'class-transformer';

export class StartQuizResponseDto {
@Expose()
isStarted: Boolean;

constructor(isStarted: Boolean) {
this.isStarted = isStarted;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Expose } from 'class-transformer';
import { ParticipantStatisticsResponseDto } from './participantStatistics.response.dto';
import { MasterStatisticsResponseDto } from './masterStatistics.response.dto';

export class SubmitAnswerResponseDto {
@Expose()
participantStatistics: ParticipantStatisticsResponseDto;

@Expose()
masterStatistics: MasterStatisticsResponseDto;

@Expose()
submitOrder: number;

constructor(
participantStatistics: ParticipantStatisticsResponseDto,
masterStatistics: MasterStatisticsResponseDto,
totalSubmit: number,
) {
this.participantStatistics = participantStatistics;
this.masterStatistics = masterStatistics;
this.submitOrder = totalSubmit;
}
}
Loading