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

테스트 블록화, 타입 수정 #375

Merged
merged 5 commits into from
Dec 30, 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 @@ -13,7 +13,10 @@ export class IsProfileInSpaceGuard implements CanActivate {

async canActivate(context: ExecutionContext): Promise<boolean> {
const request = context.switchToHttp().getRequest();
const profileUuid = request.body.profile_uuid || request.query.profile_uuid;
const profileUuid =
request.body.profile_uuid ||
request.query.profile_uuid ||
request.params.profile_uuid;
const spaceUuid = request.params.space_uuid;
if (!profileUuid || !spaceUuid) throw new BadRequestException();
const isProfileInSpace = await this.profileSpaceService.isProfileInSpace(
Expand Down
5 changes: 4 additions & 1 deletion nestjs-BE/server/src/auth/guards/match-user-profile.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ 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.profile_uuid;
const profileUuid =
request.body.profile_uuid ||
request.query.profile_uuid ||
request.params.profile_uuid;
if (!profileUuid || !userUuid) throw new BadRequestException();
const profile =
await this.profilesService.findProfileByProfileUuid(profileUuid);
Expand Down
3 changes: 2 additions & 1 deletion nestjs-BE/server/src/spaces/dto/create-space.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class CreateSpaceDto {
@ApiProperty({
example: 'space-icon.png',
description: 'Profile icon for the space',
required: false,
})
icon: string;
icon: Express.Multer.File;
}
7 changes: 3 additions & 4 deletions nestjs-BE/server/src/spaces/dto/update-space.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ export class UpdateSpaceDto {
})
name: string;

@IsOptional()
@ApiProperty({
example: 'new image',
description: 'Updated space icon',
example: 'space-icon.png',
description: 'New space icon to change',
required: false,
})
icon: string;
icon: Express.Multer.File;
}
6 changes: 2 additions & 4 deletions nestjs-BE/server/src/spaces/spaces.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,8 @@ export class SpacesService {
icon: Express.Multer.File,
updateSpaceDto: UpdateSpaceDto,
): Promise<Space> {
const updateData: Partial<UpdateSpaceDto> = omit(updateSpaceDto, [
'icon',
'profileUuid',
]);
const updateData: Partial<Pick<UpdateSpaceDto, 'name'> & { icon: string }> =
omit(updateSpaceDto, ['icon', 'profileUuid']);
if (icon) {
updateData.icon = await this.uploadService.uploadFile(icon);
}
Expand Down
Loading
Loading