Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

스페이스 컨트롤러에 가드 적용 #372

Merged
merged 18 commits into from
Dec 24, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class MatchUserProfileGuard implements CanActivate {
async canActivate(context: ExecutionContext): Promise<boolean> {
const request = context.switchToHttp().getRequest();
const userUuid = request.user.uuid;
const profileUuid = request.body.profile_uuid || request.query.profileUuid;
const profileUuid = request.body.profile_uuid || request.query.profile_uuid;
if (!profileUuid || !userUuid) throw new BadRequestException();
const profile =
await this.profilesService.findProfileByProfileUuid(profileUuid);
Expand Down
13 changes: 6 additions & 7 deletions nestjs-BE/server/src/spaces/dto/create-space.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Expose } from 'class-transformer';
import { v4 as uuid } from 'uuid';
import { MAX_NAME_LENGTH } from '../../config/constants';

export class CreateSpaceRequestDto {
export class CreateSpaceDto {
@IsString()
@IsNotEmpty()
@MaxLength(MAX_NAME_LENGTH)
Expand All @@ -14,7 +14,11 @@ export class CreateSpaceRequestDto {
@IsString()
@IsNotEmpty()
@Expose({ name: 'profile_uuid' })
@ApiProperty({ example: uuid(), description: 'Profile uuid' })
@ApiProperty({
name: 'profile_uuid',
example: uuid(),
description: 'Profile uuid',
})
profileUuid: string;

@ApiProperty({
Expand All @@ -23,8 +27,3 @@ export class CreateSpaceRequestDto {
})
icon: string;
}

export class CreateSpacePrismaDto {
name: string;
icon: string;
}
12 changes: 0 additions & 12 deletions nestjs-BE/server/src/spaces/dto/join-space.dto.ts

This file was deleted.

19 changes: 13 additions & 6 deletions nestjs-BE/server/src/spaces/dto/update-space.dto.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional, IsString, MaxLength } from 'class-validator';
import { Expose } from 'class-transformer';
import { v4 as uuid } from 'uuid';
import { MAX_NAME_LENGTH } from '../../config/constants';

export class UpdateSpaceRequestDto {
export class UpdateSpaceDto {
@IsString()
@IsNotEmpty()
@Expose({ name: 'profile_uuid' })
@ApiProperty({
name: 'profile_uuid',
example: uuid(),
description: 'Profile uuid',
})
profileUuid: string;

@IsOptional()
@IsString()
@IsNotEmpty()
Expand All @@ -22,8 +34,3 @@ export class UpdateSpaceRequestDto {
})
icon: string;
}

export class UpdateSpacePrismaDto {
name: string;
icon: string;
}
Loading
Loading