Skip to content

Commit 7cee820

Browse files
authored
Merge pull request #374 from Quickchive/develop
Develop to master
2 parents 9da65fd + 673220e commit 7cee820

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed

src/categories/category.service.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,18 @@ export class CategoryService {
193193
}
194194

195195
category.parentId = parentId;
196+
} else {
197+
// 유저 당 대 카테고리 10개 제한
198+
const isOverCategoryLimit =
199+
await this.categoryRepository.isOverCategoryLimit(user);
200+
201+
if (isOverCategoryLimit) {
202+
throw new ConflictException(
203+
"Root categories can't be more than 10 in one user",
204+
);
205+
}
206+
207+
category.parentId = null;
196208
}
197209

198210
await queryRunnerManager.save(category);
@@ -425,7 +437,7 @@ export class CategoryService {
425437

426438
const content = await getLinkContent(link);
427439

428-
let questionLines = [
440+
const questionLines = [
429441
"You are a machine tasked with auto-categorizing articles based on information obtained through web scraping. You can only answer a single category name. Here is the article's information:",
430442
];
431443

@@ -570,7 +582,7 @@ Present your reply options in JSON format below.
570582
*/
571583
const content = await getLinkContent(link);
572584

573-
let questionLines = [
585+
const questionLines = [
574586
"You are a machine tasked with auto-categorizing articles based on information obtained through web scraping. You can only answer a single category name. Here is the article's information:",
575587
];
576588

src/main.ts

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,29 @@ async function bootstrap() {
1616
app.useGlobalPipes(new ValidationPipe());
1717
app.setGlobalPrefix('api');
1818

19-
const config = new DocumentBuilder()
20-
.setTitle('Quickchive')
21-
.setDescription('The API description')
22-
.setVersion('1.0.0')
23-
.addTag('Minimally Viable Product Version')
24-
.addBearerAuth(
25-
{
26-
type: 'http',
27-
scheme: 'bearer',
28-
bearerFormat: 'JWT',
29-
in: 'header',
19+
if (process.env.NODE_ENV === 'dev' || process.env.NODE_ENV === 'local') {
20+
const config = new DocumentBuilder()
21+
.setTitle('Quickchive')
22+
.setDescription('The API description')
23+
.setVersion('1.0.0')
24+
.addTag('Minimally Viable Product Version')
25+
.addBearerAuth(
26+
{
27+
type: 'http',
28+
scheme: 'bearer',
29+
bearerFormat: 'JWT',
30+
in: 'header',
31+
},
32+
'Authorization',
33+
)
34+
.build();
35+
const document = SwaggerModule.createDocument(app, config);
36+
SwaggerModule.setup('docs', app, document, {
37+
swaggerOptions: {
38+
persistAuthorization: true,
3039
},
31-
'Authorization',
32-
)
33-
.build();
34-
const document = SwaggerModule.createDocument(app, config);
35-
SwaggerModule.setup('docs', app, document, {
36-
swaggerOptions: {
37-
persistAuthorization: true,
38-
},
39-
});
40+
});
41+
}
4042

4143
await app.listen(process.env.PORT || 4000);
4244
}

0 commit comments

Comments
 (0)