Skip to content

Commit

Permalink
chore: shared 반영
Browse files Browse the repository at this point in the history
- 백엔드 영역 shared 항목 참조 경로 변경
  • Loading branch information
codemario318 authored and joyjhm committed Jan 19, 2025
1 parent 5d07336 commit 537b7c1
Show file tree
Hide file tree
Showing 25 changed files with 27 additions and 34 deletions.
2 changes: 1 addition & 1 deletion apps/backend/src/chat/chat.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Test, TestingModule } from '@nestjs/testing';
import { ChatService } from './chat.service';
import { NotFoundException } from '@nestjs/common';
import { ChatMessage } from './entities/chat-message.entity';
import {ChatMessage} from "@web08-booquiz/shared";

describe('ChatService', () => {
let service: ChatService;
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/chat/chat.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable, Inject, NotFoundException } from '@nestjs/common';
import { ChatRepositoryMemory } from './repository/chat.memory.repository';
import { ChatMessage } from './entities/chat-message.entity';
import {ChatMessage} from "@web08-booquiz/shared";

@Injectable()
export class ChatService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChatRepositoryMemory } from './chat.memory.repository';
import { ChatMessage } from '../entities/chat-message.entity';
import {ChatMessage} from "@web08-booquiz/shared";

// ChatRepositoryMemory 테스트 파일
describe('ChatRepositoryMemory', () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/chat/repository/chat.memory.repository.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Inject, Injectable } from '@nestjs/common';
import { ChatMessage } from '../entities/chat-message.entity';
import {ChatMessage} from "@web08-booquiz/shared";

@Injectable()
export class ChatRepositoryMemory {
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/play/dto/current-quiz.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QUIZ_ZONE_STAGE } from '../../common/constants';
import {QUIZ_ZONE_STAGE} from "@web08-booquiz/shared";

/**
* 현재 진행중인 퀴즈에 대한 DTO
Expand Down
3 changes: 2 additions & 1 deletion apps/backend/src/play/dto/submit-response.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ChatMessage } from 'src/chat/entities/chat-message.entity';
import {ChatMessage} from "@web08-booquiz/shared";

export class SubmitResponseDto {
constructor(
public readonly fastestPlayerIds: string[],
Expand Down
3 changes: 1 addition & 2 deletions apps/backend/src/play/play.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import { ClientInfo } from './entities/client-info.entity';
import { WebSocketWithSession } from '../core/SessionWsAdapter';
import { RuntimeException } from '@nestjs/core/errors/exceptions';
import { SubmitResponseDto } from './dto/submit-response.dto';
import { ChatMessage } from 'src/chat/entities/chat-message.entity';
import { ChatService } from '../chat/chat.service';
import { CLOSE_CODE } from '../common/constants'; // 경로 수정
import {ChatMessage, CLOSE_CODE} from "@web08-booquiz/shared";

/**
* 퀴즈 게임에 대한 WebSocket 연결을 관리하는 Gateway입니다.
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/play/play.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { PlayService } from './play.service';
import { QuizZoneService } from '../quiz-zone/quiz-zone.service';
import { QuizZone } from '../quiz-zone/entities/quiz-zone.entity';
import { SubmittedQuiz } from '../quiz-zone/entities/submitted-quiz.entity';
import { PLAYER_STATE, QUIZ_TYPE, QUIZ_ZONE_STAGE } from '../common/constants';
import { RuntimeException } from '@nestjs/core/errors/exceptions';
import {PLAYER_STATE, QUIZ_TYPE, QUIZ_ZONE_STAGE} from "@web08-booquiz/shared";

describe('PlayService', () => {
let service: PlayService;
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/play/play.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { QuizZoneService } from '../quiz-zone/quiz-zone.service';
import { SubmittedQuiz } from '../quiz-zone/entities/submitted-quiz.entity';
import { QuizZone } from '../quiz-zone/entities/quiz-zone.entity';
import { CurrentQuizDto } from './dto/current-quiz.dto';
import { PLAYER_STATE, QUIZ_ZONE_STAGE } from '../common/constants';
import { WINSTON_MODULE_PROVIDER } from 'nest-winston';
import { RuntimeException } from '@nestjs/core/errors/exceptions';
import { clearTimeout } from 'node:timers';
import { Player } from '../quiz-zone/entities/player.entity';
import { CurrentQuizResultDto } from './dto/current-quiz-result.dto';
import {PLAYER_STATE, QUIZ_ZONE_STAGE} from "@web08-booquiz/shared";

@Injectable()
export class PlayService {
Expand Down

This file was deleted.

3 changes: 2 additions & 1 deletion apps/backend/src/quiz-zone/dto/create-quiz-zone.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IsInt, IsNotEmpty, IsString, Length, Matches, Max, Min } from 'class-validator';
import {RequestCreateQuizZone} from "@web08-booquiz/shared";

/**
* 퀴즈존을 생성할 때 사용하는 DTO 클래스
Expand All @@ -8,7 +9,7 @@ import { IsInt, IsNotEmpty, IsString, Length, Matches, Max, Min } from 'class-va
* - 숫자와 알파벳 조합
* - 중복 불가 (중복 체크 로직 추가 예정)
*/
export class CreateQuizZoneDto {
export class CreateQuizZoneDto implements RequestCreateQuizZone {
@IsString({ message: '핀번호가 없습니다.' })
@Length(5, 10, { message: '핀번호는 5글자 이상 10글자 이하로 입력해주세요.' })
@Matches(RegExp('^[a-zA-Z0-9]*$'), { message: '숫자와 알파벳 조합만 가능합니다.' })
Expand Down
3 changes: 1 addition & 2 deletions apps/backend/src/quiz-zone/dto/find-quiz-zone.dto.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { PLAYER_STATE, QUIZ_ZONE_STAGE } from '../../common/constants';
import { CurrentQuizDto } from '../../play/dto/current-quiz.dto';
import { SubmittedQuiz } from '../entities/submitted-quiz.entity';
import { ChatMessage } from 'src/chat/entities/chat-message.entity';
import { Rank } from '../../play/entities/rank.entity';
import { Quiz } from '../entities/quiz.entity';
import {ChatMessage, PLAYER_STATE, QUIZ_ZONE_STAGE} from "@web08-booquiz/shared";

/**
* 퀴즈 게임에 참여하는 플레이어 엔티티
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/quiz-zone/entities/player.entity.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SubmittedQuiz } from './submitted-quiz.entity';
import { PLAYER_STATE } from '../../common/constants';
import {PLAYER_STATE} from "@web08-booquiz/shared";

/**
* 퀴즈 게임에 참여하는 플레이어 엔티티
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/quiz-zone/entities/quiz-zone.entity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Quiz } from './quiz.entity';
import { Player } from './player.entity';
import { QUIZ_ZONE_STAGE } from '../../common/constants';
import { QuizSummary } from '../../play/entities/quiz-summary.entity';
import {QUIZ_ZONE_STAGE} from "@web08-booquiz/shared";
/**
* 퀴즈 게임을 진행하는 공간을 나타내는 퀴즈존 인터페이스
*
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/quiz-zone/entities/quiz.entity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { QUIZ_TYPE } from '../../common/constants';
import {QUIZ_TYPE} from "@web08-booquiz/shared";

/**
* 퀴즈 엔티티
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/quiz-zone/quiz-zone.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { BadRequestException, ConflictException, NotFoundException } from '@nest
import { QuizZone } from './entities/quiz-zone.entity';
import { IQuizZoneRepository } from './repository/quiz-zone.repository.interface';
import { Quiz } from './entities/quiz.entity';
import { PLAYER_STATE, QUIZ_TYPE, QUIZ_ZONE_STAGE } from '../common/constants';
import { QuizService } from '../quiz/quiz.service';
import { ChatService } from '../chat/chat.service';
import {PLAYER_STATE, QUIZ_TYPE, QUIZ_ZONE_STAGE} from "@web08-booquiz/shared";

const nickNames: string[] = [
'전설의고양이',
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/quiz-zone/quiz-zone.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import { Quiz } from './entities/quiz.entity';
import { Player } from './entities/player.entity';
import { QuizZone } from './entities/quiz-zone.entity';
import { IQuizZoneRepository } from './repository/quiz-zone.repository.interface';
import { getRandomNickName, PLAYER_STATE, QUIZ_ZONE_STAGE } from '../common/constants';
import { FindQuizZoneDto } from './dto/find-quiz-zone.dto';
import { CreateQuizZoneDto } from './dto/create-quiz-zone.dto';
import { QuizService } from '../quiz/quiz.service';
import { ChatService } from '../chat/chat.service';
import {getRandomNickName, PLAYER_STATE, QUIZ_ZONE_STAGE} from "@web08-booquiz/shared";

const INTERVAL_TIME = 5000;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Test, TestingModule } from '@nestjs/testing';
import { QuizZoneRepositoryMemory } from './quiz-zone.memory.repository';
import { QuizZone } from '../entities/quiz-zone.entity';
import { QUIZ_ZONE_STAGE } from '../../common/constants';
import {QUIZ_ZONE_STAGE} from "@web08-booquiz/shared";

describe('QuizZoneRepositoryMemory', () => {
let storage: Map<string, QuizZone>;
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/quiz/dto/create-quiz-set-request.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ApiProperty } from '@nestjs/swagger';
import { QUIZ_TYPE } from '../../common/constants';
import { Quiz } from '../entity/quiz.entitiy';
import { QuizSet } from '../entity/quiz-set.entity';
import {
Expand All @@ -15,6 +14,7 @@ import {
ValidateNested,
} from 'class-validator';
import { Type } from 'class-transformer';
import {QUIZ_TYPE} from "@web08-booquiz/shared";

export class QuizDetailsDto {
@ApiProperty({ description: '퀴즈 질문' })
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/quiz/dto/find-quizzes-response.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { QUIZ_TYPE } from '../../common/constants';
import { ApiProperty } from '@nestjs/swagger';
import {QUIZ_TYPE} from "@web08-booquiz/shared";

export class FindQuizzesResponseDto {
@ApiProperty({ description: '해당 퀴즈 질문' })
Expand Down
4 changes: 2 additions & 2 deletions apps/backend/src/quiz/dto/update-quiz-request.dto.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { QUIZ_TYPE } from '../../common/constants';
import { Quiz } from '../entity/quiz.entitiy';
import { IsEnum, IsNumber, IsString, Length, Max, Min } from 'class-validator';
import {QUIZ_TYPE} from "@web08-booquiz/shared";

export class UpdateQuizRequestDto {
@ApiProperty({ description: '업데이트 하는 퀴즈 질문' })
Expand All @@ -17,7 +17,7 @@ export class UpdateQuizRequestDto {
@Max(60 * 10, {message: '퀴즈 시간은 10분 이하여야 합니다.'})
@IsNumber({}, {message: '퀴즈 시간 값이 숫자가 아닙니다.'})
readonly playTime: number;
@ApiProperty({ description: '업데이트 하는 퀴즈 타입' })
@ApiProperty({description: '업데이트 하는 퀴즈 타입'})
@IsEnum(QUIZ_TYPE, {message: '정해진 퀴즈 타입이 아닙니다.'})
readonly quizType: QUIZ_TYPE;
}
2 changes: 1 addition & 1 deletion apps/backend/src/quiz/entity/quiz.entitiy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { QuizSet } from './quiz-set.entity';
import { QUIZ_TYPE } from '../../common/constants';
import { BaseEntity } from '../../common/base-entity';
import {QUIZ_TYPE} from "@web08-booquiz/shared";

/**
* 퀴즈 엔티티
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/quiz/quiz-set.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { QuizService } from './quiz.service';
import { CreateQuizSetRequestDto } from './dto/create-quiz-set-request.dto';
import { NotFoundException } from '@nestjs/common';
import { QuizSetController } from './quiz-set.controller';
import { QUIZ_TYPE } from '../common/constants';
import {QUIZ_TYPE} from "@web08-booquiz/shared";

describe('QuizController', () => {
let quizSetController: QuizSetController;
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/quiz/quiz.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Test, TestingModule } from '@nestjs/testing';
import { QuizController } from './quiz.controller';
import { QuizService } from './quiz.service';
import { UpdateQuizRequestDto } from './dto/update-quiz-request.dto';
import { QUIZ_TYPE } from '../common/constants';
import {QUIZ_TYPE} from "@web08-booquiz/shared";

describe('QuizController', () => {
let quizController: QuizController;
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/src/quiz/quiz.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { QuizService } from './quiz.service';
import { QuizRepository } from './repository/quiz.repository';
import { QuizSetRepository } from './repository/quiz-set.repository';
import { QuizSet } from './entity/quiz-set.entity';
import { QUIZ_TYPE } from '../common/constants';
import { CreateQuizSetRequestDto } from './dto/create-quiz-set-request.dto';
import { BadRequestException } from '@nestjs/common';
import { UpdateQuizRequestDto } from './dto/update-quiz-request.dto';
import { SearchQuizSetRequestDTO } from './dto/search-quiz-set-request.dto';
import { DataSource } from 'typeorm';
import { addTransactionalDataSource, initializeTransactionalContext } from 'typeorm-transactional';
import {QUIZ_TYPE} from "@web08-booquiz/shared";

describe('QuizService', () => {
let service: QuizService;
Expand Down

0 comments on commit 537b7c1

Please sign in to comment.