Skip to content

Commit

Permalink
[BE -#106] 실시간 소켓 서버 송수신 데이터 인터페이스 정의 (#107)
Browse files Browse the repository at this point in the history
* feat: 실시간 소켓 서버 요청 데이터 인터페이스 코드 작성

* feat: 실시간 소켓 서버 응답 데이터 인터페이스 코드 작성

* feat: 실시간 소켓 서버 quiz, choice 데이터 인터페이스 코드 작성

* refactor: 타입 관리를 type -> interface로 변경함에 따라 폴더 삭제

* feat: 실시간 소켓 서버 요청 데이터 인터페이스 barrel 파일 작성

* feat: 실시간 소켓 서버 응답 데이터 인터페이스 barrel 파일 작성

* refactor: 인터페이스명 오타 수정

* refactor: 퀴즈 타입 as const로 상수 처리

* refactor: timeEnd -> isEnd로 오타 수정
  • Loading branch information
glaxyt authored Nov 23, 2024
1 parent ac3e37a commit a5a5b1f
Show file tree
Hide file tree
Showing 21 changed files with 103 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/shared/interfaces/request/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export * from './master-entry.request.interface';
export * from './nickname.request.interface';
export * from './participant-entry.request.interface';
export * from './show-quiz.request.interface';
export * from './start-quiz.request.interface';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface MasterEntryRequest {
classId: number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface NicknameRequest {
pinCode: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface ParticipantEntryRequest {
pinCode: string;
nickname: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface ShowQuizRequest {
pinCode: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export interface StartQuizRequest {
sid: string;
pinCode: string;
}
10 changes: 10 additions & 0 deletions packages/shared/interfaces/response/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export * from './master-statistics.response.interface';
export * from './participant-statistics.response.interface';
export * from './time-end.response.interface';
export * from './timer-tick.response.interface';
export * from './pincode.response.interface';
export * from './nickname.response.interface';
export * from './session.response.interface';
export * from './show-quiz.response.interface';
export * from './start-quiz.response.interface';
export * from './submit-answer.request.interface';
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export interface MasterStatisticsResponse {
totalSubmit: number;
solveRate: number;
averageTime: number;
participantRate: number;
choiceStatus: { [key: number]: number };
submitHistory: [string, number][];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface NicknameResponse {
participantList: string[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface ParticipantStatisticsResponse {
totalSubmit: number;
solveRate: number;
averageTime: number;
participantRate: number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface PincodeResponse {
pinCode: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface SessionResponse {
sid: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { QuizData } from '../utils/quizdata.interface';

export interface ShowQuizResponse {
currentQuizData: QuizData;
isLast: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface StartQuizResponse {
isStarted: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface SubmitAnswerRequest {
pinCode: string;
sid: string;
selectedAnswer: number[];
submitTime: number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface TimeEndResponse {
isEnd: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface TimerTickResponse {
curretTime: number;
elaspedTime: number;
remainingTime: number;
}
7 changes: 7 additions & 0 deletions packages/shared/interfaces/utils/choice.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export interface Choice {
id: number;
quizId: number;
content: string;
isCorrect: boolean;
position: number;
}
12 changes: 12 additions & 0 deletions packages/shared/interfaces/utils/quizdata.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Choice } from './choice.interface';
import { QuizType } from '../../types/quiz.types';

export interface QuizData {
id: number;
content: string;
quizType: QuizType;
timeLimit: number;
point: number;
position: number;
choices: Choice[];
}
1 change: 0 additions & 1 deletion packages/shared/types/a.ts

This file was deleted.

6 changes: 6 additions & 0 deletions packages/shared/types/quiz.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const QUIZ_TYPES = {
MULTIPLE_CHOICE: 'MC',
TRUE_FALSE: 'TF',
} as const;

export type QuizType = (typeof QUIZ_TYPES)[keyof typeof QUIZ_TYPES];

0 comments on commit a5a5b1f

Please sign in to comment.