Skip to content
This repository was archived by the owner on Mar 28, 2024. It is now read-only.

Commit 9c189de

Browse files
committed
feat: update author create
1 parent c949e89 commit 9c189de

File tree

6 files changed

+19
-5
lines changed

6 files changed

+19
-5
lines changed

packages/server/src/modules/author/author.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ import { AuthorService } from './author.service';
1313
{
1414
DTOClass: AuthorDto,
1515
EntityClass: AuthorEntity,
16+
ServiceClass: AuthorService,
1617
create: { disabled: true },
1718
},
1819
],
20+
services: [AuthorService],
1921
}),
2022
],
2123
providers: [AuthorService],

packages/server/src/modules/author/author.service.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-useless-constructor */
12
import { QueryService } from '@nestjs-query/core';
23
import { TypeOrmQueryService } from '@nestjs-query/query-typeorm';
34
import { InjectRepository } from '@nestjs/typeorm';
@@ -8,12 +9,18 @@ import { AuthorEntity } from '@entities/author.entity';
89
@QueryService(AuthorEntity)
910
export class AuthorService extends TypeOrmQueryService<AuthorEntity> {
1011
constructor(
11-
@InjectRepository(AuthorEntity) authorRepository: Repository<AuthorEntity>
12+
@InjectRepository(AuthorEntity) authorRepository: Repository<AuthorEntity>,
1213
) {
1314
super(authorRepository);
1415
}
1516

16-
async findOrCreate(name: string): Promise<AuthorEntity> {
17+
async findOrCreate(
18+
name: string | undefined,
19+
): Promise<AuthorEntity | undefined> {
20+
if (!name) {
21+
return undefined;
22+
}
23+
1724
const authors: AuthorEntity[] = await this.query({
1825
filter: { name: { eq: name } },
1926
});

packages/server/src/modules/episode/episode.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ import { EpisodeService } from './episode.service';
1313
{
1414
DTOClass: EpisodeDto,
1515
EntityClass: EpisodeEntity,
16+
ServiceClass: EpisodeService,
1617
create: { disabled: true },
1718
},
1819
],
20+
services: [EpisodeService],
1921
}),
2022
],
2123
providers: [EpisodeService],

packages/server/src/modules/episode/episode.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ export class EpisodeService extends TypeOrmQueryService<EpisodeEntity> {
1919

2020
episode.title = item.title;
2121
episode.publication = new Date(item.pubDate);
22-
episode.url = item.enclosure.url;
23-
episode.filesize = item.enclosure.length;
22+
episode.url = item.enclosure?.url;
23+
episode.filesize = item.enclosure?.length;
2424
episode.guid = item.guid;
25-
episode.type = item.enclosure.type;
25+
episode.type = item.enclosure?.type;
2626
episode.description = item.content;
2727
episode.image = item.itunes.image;
2828
episode.explicit = item.itunes.explicit === 'clean';

packages/server/src/modules/queue/queue.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ import { QueueService } from './queue.service';
1212
{
1313
DTOClass: QueueEntity,
1414
EntityClass: QueueEntity,
15+
ServiceClass: QueueService,
1516
update: { disabled: true },
1617
},
1718
],
19+
services: [QueueService],
1820
}),
1921
],
2022
providers: [QueueService],

packages/server/src/modules/queue/queue.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-useless-constructor */
12
import { QueryService } from '@nestjs-query/core';
23
import { TypeOrmQueryService } from '@nestjs-query/query-typeorm';
34
import { Repository } from 'typeorm';

0 commit comments

Comments
 (0)