Skip to content

Commit c3e5a4c

Browse files
authored
Merge pull request #375 from boostcampwm2023/BE-feature/spaces
ν…ŒμŠ€νŠΈ 블둝화, νƒ€μž… μˆ˜μ •
2 parents 5bdf581 + aebc8c4 commit c3e5a4c

File tree

6 files changed

+198
-133
lines changed

6 files changed

+198
-133
lines changed

β€Žnestjs-BE/server/src/auth/guards/is-profile-in-space.guard.tsβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ export class IsProfileInSpaceGuard implements CanActivate {
1313

1414
async canActivate(context: ExecutionContext): Promise<boolean> {
1515
const request = context.switchToHttp().getRequest();
16-
const profileUuid = request.body.profile_uuid || request.query.profile_uuid;
16+
const profileUuid =
17+
request.body.profile_uuid ||
18+
request.query.profile_uuid ||
19+
request.params.profile_uuid;
1720
const spaceUuid = request.params.space_uuid;
1821
if (!profileUuid || !spaceUuid) throw new BadRequestException();
1922
const isProfileInSpace = await this.profileSpaceService.isProfileInSpace(

β€Žnestjs-BE/server/src/auth/guards/match-user-profile.guard.tsβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ export class MatchUserProfileGuard implements CanActivate {
1414
async canActivate(context: ExecutionContext): Promise<boolean> {
1515
const request = context.switchToHttp().getRequest();
1616
const userUuid = request.user.uuid;
17-
const profileUuid = request.body.profile_uuid || request.query.profile_uuid;
17+
const profileUuid =
18+
request.body.profile_uuid ||
19+
request.query.profile_uuid ||
20+
request.params.profile_uuid;
1821
if (!profileUuid || !userUuid) throw new BadRequestException();
1922
const profile =
2023
await this.profilesService.findProfileByProfileUuid(profileUuid);

β€Žnestjs-BE/server/src/spaces/dto/create-space.dto.tsβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class CreateSpaceDto {
2424
@ApiProperty({
2525
example: 'space-icon.png',
2626
description: 'Profile icon for the space',
27+
required: false,
2728
})
28-
icon: string;
29+
icon: Express.Multer.File;
2930
}

β€Žnestjs-BE/server/src/spaces/dto/update-space.dto.tsβ€Ž

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ export class UpdateSpaceDto {
2626
})
2727
name: string;
2828

29-
@IsOptional()
3029
@ApiProperty({
31-
example: 'new image',
32-
description: 'Updated space icon',
30+
example: 'space-icon.png',
31+
description: 'New space icon to change',
3332
required: false,
3433
})
35-
icon: string;
34+
icon: Express.Multer.File;
3635
}

β€Žnestjs-BE/server/src/spaces/spaces.service.tsβ€Ž

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ export class SpacesService {
5959
icon: Express.Multer.File,
6060
updateSpaceDto: UpdateSpaceDto,
6161
): Promise<Space> {
62-
const updateData: Partial<UpdateSpaceDto> = omit(updateSpaceDto, [
63-
'icon',
64-
'profileUuid',
65-
]);
62+
const updateData: Partial<Pick<UpdateSpaceDto, 'name'> & { icon: string }> =
63+
omit(updateSpaceDto, ['icon', 'profileUuid']);
6664
if (icon) {
6765
updateData.icon = await this.uploadService.uploadFile(icon);
6866
}

0 commit comments

Comments
Β (0)