Skip to content

Commit

Permalink
Merge pull request #208 from JJongBin/develop
Browse files Browse the repository at this point in the history
대규모 미니 게임 구현 및 버그 수정 및 리팩토링
  • Loading branch information
ktmihs authored Dec 15, 2022
2 parents 2ef12ea + fd41a50 commit e1970e4
Show file tree
Hide file tree
Showing 24 changed files with 1,075 additions and 392 deletions.
1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@types/passport-jwt": "^3.0.7",
"@types/socket.io": "^3.0.2",
"@types/supertest": "^2.0.11",
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.1",
Expand Down
14 changes: 10 additions & 4 deletions backend/src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ export class AuthService {
};
}

verify(accessToken: string) {
verify(accessToken: string): UserDataDto | false {
try {
const userData = this.jwtService.verify(accessToken);
if(!userData.nickname){
const { id, nickname, social, characterName } =
this.jwtService.verify(accessToken);
if (!nickname) {
return false;
}
return userData;
return {
id,
nickname,
social,
characterName,
};
} catch (e) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions backend/src/board/dto/article-data.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { articleCategory } from '../article.enum';
export class ArticleDataDto {
@IsNotEmpty()
@IsString()
@MaxLength(36)
@MaxLength(256)
content: string;

@IsNotEmpty()
@IsString()
@MaxLength(36)
@MaxLength(32)
category: articleCategory;
}
2 changes: 1 addition & 1 deletion backend/src/board/entity/board.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Board {
@Column('varchar', { length: 64 })
userId: string;

@Column('varchar', { length: 128 })
@Column('varchar', { length: 256 })
content: string;

@Column({
Expand Down
6 changes: 3 additions & 3 deletions backend/src/board/pipes/category.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export class articleCategoryValidationPipe implements PipeTransform {
readonly categoryOptions: string[] = Object.values(articleCategory);

transform(value: ArticleDataDto, metadata: ArgumentMetadata) {
const category = value.category.toLowerCase();
if (!this.isValid(category)) {
throw new BadRequestException(`${category} can't be the category`);
const val = value.category;
if (!this.isValid(val)) {
throw new BadRequestException(`${val} can't be the category`);
}
return value;
}
Expand Down
5 changes: 3 additions & 2 deletions backend/src/socket/dto/player.dto.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IsNotEmpty, IsNumber, IsString } from 'class-validator';
import { directionOptions, stateOptions } from '../enum/player.enum';

export class playerMovementDataDto {
@IsNotEmpty()
Expand All @@ -11,9 +12,9 @@ export class playerMovementDataDto {

@IsNotEmpty()
@IsString()
direction: string;
direction: directionOptions;

@IsNotEmpty()
@IsString()
state: string;
state: stateOptions;
}
26 changes: 26 additions & 0 deletions backend/src/socket/enum/player.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,29 @@ export enum stateOptions {
JUMP = 'jump',
ATTACK = 'attack',
}

export enum userStateOptions {
ON = 'on',
OFF = 'off',
BUSY = 'busy',
CALL_REQUESTING = 'callRequesting',
}

export const initPositionByRoomName = {
town: {
x: 800,
y: 800,
},
Maze: {
x: 1000,
y: 1500,
},
Running: {
x: 1750,
y: 1900,
},
Survival: {
x: 1000,
y: 1500,
},
};
Loading

0 comments on commit e1970e4

Please sign in to comment.