Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Wakttu/Wakttu_Backend into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
iqeq1945 committed Nov 26, 2024
2 parents 6dc7fdf + 612dc29 commit 37a9acc
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/dictionary/dictionary.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ export class DictionaryService {
const list: string[] = await this.prisma
.$queryRaw`SELECT _id FROM "public"."wakttu_ko" WHERE LENGTH(_id) = ${length} AND wakta = true ORDER BY random() LIMIT 1`;

let isMannerSafe = true;
list[0]['_id'].split('').map(async (word) => {
isMannerSafe = await this.checkManner(word);
});
if (isMannerSafe) {
return list[0]; // 매너 검사를 통과한 단어 반환
const word = list[0]['_id'];

for (const char of word.split('')) {
const isSafe = await this.checkManner(char);
if (!isSafe) {
return '우리모두품어놀자'.slice(0, length);
}
}
return '우리모두품어놀자'.slice(0, length);

return word;
} catch (error) {
throw new Error(`단어 가져오기 중 오류 발생: ${error.message}`);
}
Expand Down

0 comments on commit 37a9acc

Please sign in to comment.