Skip to content

Commit 40828a2

Browse files
committed
fix(tag): Fix empty detect
1 parent 9331dc9 commit 40828a2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/namespace-resources/open.resource.controller.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { FileInterceptor } from '@nestjs/platform-express';
1818
import { UserId } from 'omniboxd/decorators/user-id.decorator';
1919
import { OpenCreateResourceDto } from 'omniboxd/namespace-resources/dto/open.create-resource.dto';
2020
import { ResourceType } from 'omniboxd/resources/entities/resource.entity';
21+
import { isEmpty } from 'omniboxd/utils/is-empty';
2122

2223
@Controller('open/api/v1/resources')
2324
export class OpenResourcesController {
@@ -59,16 +60,16 @@ export class OpenResourcesController {
5960
resourceData,
6061
);
6162

62-
if (newResource.content && newResource.content.trim() !== '') {
63-
if (!newResource.name || newResource.name.trim() === '') {
63+
if (!isEmpty(newResource.content?.trim())) {
64+
if (isEmpty(newResource.name?.trim())) {
6465
await this.wizardTaskService.createGenerateTitleTask(
6566
userId,
6667
apiKey.namespaceId,
6768
{ resource_id: newResource.id },
6869
{ text: data.content },
6970
);
7071
}
71-
if (!newResource.tagIds) {
72+
if (isEmpty(newResource.tagIds)) {
7273
await this.wizardTaskService.createExtractTagsTask(
7374
userId,
7475
newResource.id,

0 commit comments

Comments
 (0)