Skip to content

Commit c6469ff

Browse files
authored
Merge pull request #357 from boostcampwm2023/BE-feature/spaces
๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ์ด๋™, ํ…Œ์ŠคํŠธ ๋ธ”๋กํ™”
2 parents b222e6b + c56ed7a commit c6469ff

7 files changed

+597
-655
lines changed

โ€Žnestjs-BE/server/src/invite-codes/invite-codes.controller.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class InviteCodesController {
3737
})
3838
async create(@Body() createInviteCodeDto: CreateInviteCodeDto) {
3939
const spaceUuid = createInviteCodeDto.space_uuid;
40-
const space = await this.spacesService.findSpace(spaceUuid);
40+
const space = await this.spacesService.findSpaceBySpaceUuid(spaceUuid);
4141
if (!space) throw new NotFoundException();
4242
const inviteCode =
4343
await this.inviteCodesService.createInviteCode(spaceUuid);
@@ -70,7 +70,9 @@ export class InviteCodesController {
7070
this.inviteCodesService.deleteInviteCode(inviteCode);
7171
throw new HttpException('Invite code has expired.', HttpStatus.GONE);
7272
}
73-
const space = await this.spacesService.findSpace(inviteCodeData.spaceUuid);
73+
const space = await this.spacesService.findSpaceBySpaceUuid(
74+
inviteCodeData.spaceUuid,
75+
);
7476
return { statusCode: 200, message: 'Success', data: space };
7577
}
7678
}

โ€Žnestjs-BE/server/src/profile-space/profile-space.service.ts

+1-27
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@nestjs/common';
22
import { PrismaService } from '../prisma/prisma.service';
3-
import { Prisma, ProfileSpace } from '@prisma/client';
3+
import { ProfileSpace } from '@prisma/client';
44

55
@Injectable()
66
export class ProfileSpaceService {
@@ -24,32 +24,6 @@ export class ProfileSpaceService {
2424
});
2525
}
2626

27-
async findProfileSpaceByBothUuid(
28-
profileUuid: string,
29-
spaceUuid: string,
30-
): Promise<ProfileSpace | null> {
31-
return this.prisma.profileSpace.findUnique({
32-
where: { spaceUuid_profileUuid: { spaceUuid, profileUuid } },
33-
});
34-
}
35-
36-
async joinSpace(
37-
profileUuid: string,
38-
spaceUuid: string,
39-
): Promise<ProfileSpace | null> {
40-
try {
41-
return await this.prisma.profileSpace.create({
42-
data: { spaceUuid: spaceUuid, profileUuid: profileUuid },
43-
});
44-
} catch (err) {
45-
if (err instanceof Prisma.PrismaClientKnownRequestError) {
46-
return null;
47-
} else {
48-
throw err;
49-
}
50-
}
51-
}
52-
5327
async isSpaceEmpty(spaceUuid: string) {
5428
const first = await this.prisma.profileSpace.findFirst({
5529
where: {

0 commit comments

Comments
ย (0)