Skip to content

Commit 87d973f

Browse files
authored
Merge pull request #281 from Coffect/feat/jun-follower-following-list-up
fix
2 parents 9f0a685 + 00d8e30 commit 87d973f

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

src/coffeeChat/coffeeChat.Controller.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,15 @@ export class HomeController extends Controller {
219219
},
220220
success: null
221221
})
222+
@Response<ITsoaErrorResponse>(400, 'Bad Request', {
223+
resultType: 'FAIL',
224+
error: {
225+
errorCode: 'HE405',
226+
reason: '이미 존재하는 coffeeChat입니다.',
227+
data: null
228+
},
229+
success: null
230+
})
222231
@Response<ITsoaErrorResponse>(500, 'Internal Server Error', {
223232
resultType: 'FAIL',
224233
error: {

src/coffeeChat/coffeeChat.Message.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,15 @@ export class nonData extends BasicError {
3232
description
3333
);
3434
}
35+
}
36+
37+
export class exsist extends BasicError {
38+
constructor(description: string) {
39+
super (
40+
400,
41+
'HE405',
42+
'이미 존재하는 coffeeChat입니다.',
43+
description
44+
);
45+
}
3546
}

src/coffeeChat/coffeeChat.Model.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,19 @@ export class HomeModel {
446446
):Promise<number> {
447447
const currentDate = KSTtime();
448448

449+
const alreadyExsist = await prisma.coffeeChat.findFirst({
450+
where: {
451+
OR: [
452+
{ firstUserId: myUserId, secondUserId: otherUserId },
453+
{ firstUserId: otherUserId, secondUserId: myUserId }
454+
]
455+
}
456+
});
457+
458+
if(alreadyExsist) {
459+
throw new Error(`이미 존재하는 coffeeChat 제안입니다.`);
460+
}
461+
449462
const coffeeChat = await prisma.coffeeChat.create({
450463
data: {
451464
firstUserId: myUserId,

0 commit comments

Comments
 (0)