podverse-orm 5.1.0-alpha.9 → 5.1.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +5 -0
- package/dist/db/index.d.ts.map +1 -1
- package/dist/db/index.js +0 -2
- package/dist/entities/account/account.d.ts +0 -2
- package/dist/entities/account/account.d.ts.map +1 -1
- package/dist/entities/account/account.js +2 -7
- package/dist/entities/channel/channel.d.ts +2 -1
- package/dist/entities/channel/channel.d.ts.map +1 -1
- package/dist/entities/channel/channel.js +8 -4
- package/dist/entities/channel/channelDescription.js +1 -1
- package/dist/entities/clip.d.ts +2 -0
- package/dist/entities/clip.d.ts.map +1 -1
- package/dist/entities/clip.js +10 -2
- package/dist/entities/item/item.d.ts +1 -0
- package/dist/entities/item/item.d.ts.map +1 -1
- package/dist/entities/item/item.js +6 -2
- package/dist/entities/item/itemChapter.d.ts +1 -0
- package/dist/entities/item/itemChapter.d.ts.map +1 -1
- package/dist/entities/item/itemChapter.js +6 -2
- package/dist/entities/item/itemDescription.js +1 -1
- package/dist/entities/item/itemEnclosure.js +1 -1
- package/dist/entities/item/itemSoundbite.js +2 -2
- package/dist/entities/playlist/playlist.d.ts +5 -0
- package/dist/entities/playlist/playlist.d.ts.map +1 -1
- package/dist/entities/playlist/playlist.js +19 -2
- package/dist/entities/playlist/playlistResource.d.ts +0 -3
- package/dist/entities/playlist/playlistResource.d.ts.map +1 -1
- package/dist/entities/playlist/playlistResource.js +0 -10
- package/dist/entities/queue/queue.d.ts +2 -0
- package/dist/entities/queue/queue.d.ts.map +1 -1
- package/dist/entities/queue/queue.js +10 -2
- package/dist/entities/queue/queueResource.d.ts +0 -3
- package/dist/entities/queue/queueResource.d.ts.map +1 -1
- package/dist/entities/queue/queueResource.js +0 -10
- package/dist/factories/loggerService.d.ts +3 -0
- package/dist/factories/loggerService.d.ts.map +1 -0
- package/dist/factories/loggerService.js +9 -0
- package/dist/index.d.ts +12 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/lib/feedFlagHelpers.d.ts +9 -0
- package/dist/lib/feedFlagHelpers.d.ts.map +1 -0
- package/dist/lib/feedFlagHelpers.js +12 -0
- package/dist/lib/nanoid.d.ts +2 -0
- package/dist/lib/nanoid.d.ts.map +1 -0
- package/dist/lib/nanoid.js +11 -0
- package/dist/lib/password.d.ts +2 -0
- package/dist/lib/password.d.ts.map +1 -0
- package/dist/lib/password.js +24 -0
- package/dist/services/account/account.d.ts +1 -1
- package/dist/services/account/account.d.ts.map +1 -1
- package/dist/services/account/account.js +5 -4
- package/dist/services/account/accountFollowingChannel.d.ts +4 -0
- package/dist/services/account/accountFollowingChannel.d.ts.map +1 -1
- package/dist/services/account/accountFollowingChannel.js +9 -0
- package/dist/services/account/accountFollowingPlaylist.d.ts +1 -0
- package/dist/services/account/accountFollowingPlaylist.d.ts.map +1 -1
- package/dist/services/account/accountFollowingPlaylist.js +9 -0
- package/dist/services/base/baseManyService.d.ts +4 -0
- package/dist/services/base/baseManyService.d.ts.map +1 -1
- package/dist/services/base/baseManyService.js +10 -3
- package/dist/services/base/baseOneService.d.ts.map +1 -1
- package/dist/services/base/baseOneService.js +3 -3
- package/dist/services/category.d.ts.map +1 -1
- package/dist/services/category.js +10 -4
- package/dist/services/channel/channel.d.ts +8 -3
- package/dist/services/channel/channel.d.ts.map +1 -1
- package/dist/services/channel/channel.js +40 -5
- package/dist/services/channel/channelPodroll.d.ts +7 -0
- package/dist/services/channel/channelPodroll.d.ts.map +1 -1
- package/dist/services/channel/channelPodroll.js +74 -0
- package/dist/services/clip.d.ts +3 -3
- package/dist/services/clip.d.ts.map +1 -1
- package/dist/services/clip.js +20 -3
- package/dist/services/feed/feed.js +1 -1
- package/dist/services/item/item.d.ts +13 -3
- package/dist/services/item/item.d.ts.map +1 -1
- package/dist/services/item/item.js +147 -38
- package/dist/services/item/itemChapter.d.ts +6 -0
- package/dist/services/item/itemChapter.d.ts.map +1 -1
- package/dist/services/item/itemChapter.js +44 -3
- package/dist/services/item/itemSoundbite.d.ts +5 -2
- package/dist/services/item/itemSoundbite.d.ts.map +1 -1
- package/dist/services/item/itemSoundbite.js +26 -2
- package/dist/services/item/itemTranscript.d.ts +2 -1
- package/dist/services/item/itemTranscript.d.ts.map +1 -1
- package/dist/services/item/itemTranscript.js +5 -0
- package/dist/services/playlist/playlist.d.ts +9 -5
- package/dist/services/playlist/playlist.d.ts.map +1 -1
- package/dist/services/playlist/playlist.js +55 -8
- package/dist/services/playlist/playlistResource.d.ts +3 -12
- package/dist/services/playlist/playlistResource.d.ts.map +1 -1
- package/dist/services/playlist/playlistResource.js +50 -61
- package/dist/services/queue/queue.d.ts +2 -3
- package/dist/services/queue/queue.d.ts.map +1 -1
- package/dist/services/queue/queue.js +36 -10
- package/dist/services/queue/queueResource.d.ts +19 -23
- package/dist/services/queue/queueResource.d.ts.map +1 -1
- package/dist/services/queue/queueResource.js +181 -102
- package/dist/services/stats/baseStatsAggregated.d.ts +23 -2
- package/dist/services/stats/baseStatsAggregated.d.ts.map +1 -1
- package/dist/services/stats/baseStatsAggregated.js +27 -5
- package/dist/services/stats/statsAggregatedAccount.d.ts.map +1 -1
- package/dist/services/stats/statsAggregatedAccount.js +1 -2
- package/dist/services/stats/statsAggregatedChannel.d.ts +6 -0
- package/dist/services/stats/statsAggregatedChannel.d.ts.map +1 -1
- package/dist/services/stats/statsAggregatedChannel.js +29 -2
- package/dist/services/stats/statsAggregatedClip.d.ts +3 -0
- package/dist/services/stats/statsAggregatedClip.d.ts.map +1 -1
- package/dist/services/stats/statsAggregatedClip.js +22 -2
- package/dist/services/stats/statsAggregatedItem.d.ts +3 -0
- package/dist/services/stats/statsAggregatedItem.d.ts.map +1 -1
- package/dist/services/stats/statsAggregatedItem.js +16 -2
- package/dist/services/stats/statsAggregatedPlaylist.d.ts +7 -0
- package/dist/services/stats/statsAggregatedPlaylist.d.ts.map +1 -1
- package/dist/services/stats/statsAggregatedPlaylist.js +70 -2
- package/dist/services/stats/statsTrackAccountGuid.d.ts.map +1 -1
- package/package.json +16 -13
- package/dist/entities/account/accountAdminRoles.d.ts +0 -8
- package/dist/entities/account/accountAdminRoles.d.ts.map +0 -1
- package/dist/entities/account/accountAdminRoles.js +0 -37
|
@@ -10,8 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ChannelPodrollService = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
13
14
|
const channelPodroll_1 = require("@orm/entities/channel/channelPodroll");
|
|
14
15
|
const baseOneService_1 = require("@orm/services/base/baseOneService");
|
|
16
|
+
const channel_1 = require("./channel");
|
|
17
|
+
const item_1 = require("../item/item");
|
|
15
18
|
class ChannelPodrollService extends baseOneService_1.BaseOneService {
|
|
16
19
|
constructor(transactionalEntityManager) {
|
|
17
20
|
super(channelPodroll_1.ChannelPodroll, 'channel', transactionalEntityManager);
|
|
@@ -40,5 +43,76 @@ class ChannelPodrollService extends baseOneService_1.BaseOneService {
|
|
|
40
43
|
return _super._delete.call(this, channel);
|
|
41
44
|
});
|
|
42
45
|
}
|
|
46
|
+
getPodrollChannels(channel_podroll_remote_items) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const channelService = new channel_1.ChannelService();
|
|
49
|
+
const feed_guids = [];
|
|
50
|
+
for (const channel_podroll_remote_item of channel_podroll_remote_items) {
|
|
51
|
+
if (channel_podroll_remote_item.feed_guid
|
|
52
|
+
&& !channel_podroll_remote_item.item_guid) {
|
|
53
|
+
feed_guids.push(channel_podroll_remote_item.feed_guid);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const podrollChannels = yield channelService.getMany({
|
|
57
|
+
relations: ['channel_images']
|
|
58
|
+
}, {
|
|
59
|
+
podcast_guid: (0, typeorm_1.In)(feed_guids)
|
|
60
|
+
});
|
|
61
|
+
return podrollChannels;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
getPodrollItems(channel_podroll_remote_items) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const itemService = new item_1.ItemService();
|
|
67
|
+
const params = [];
|
|
68
|
+
for (const channel_podroll_remote_item of channel_podroll_remote_items) {
|
|
69
|
+
if (channel_podroll_remote_item.feed_guid
|
|
70
|
+
&& channel_podroll_remote_item.item_guid) {
|
|
71
|
+
params.push({
|
|
72
|
+
podcast_guid: channel_podroll_remote_item.feed_guid,
|
|
73
|
+
item_guid: channel_podroll_remote_item.item_guid
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const podrollItems = yield itemService.getManyByPodcastGuidAndItemGuid(params, {
|
|
78
|
+
relations: [
|
|
79
|
+
'channel',
|
|
80
|
+
'channel.channel_images',
|
|
81
|
+
'item_images'
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
return podrollItems;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
getPodrollForChannel(idOrIdText) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
var _a;
|
|
90
|
+
const channelService = new channel_1.ChannelService();
|
|
91
|
+
const channel = yield channelService.getByIdOrIdText(idOrIdText, {
|
|
92
|
+
channel_podroll: {
|
|
93
|
+
channel_podroll_remote_items: true
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
if (!channel) {
|
|
97
|
+
return {
|
|
98
|
+
podrollChannels: [],
|
|
99
|
+
podrollItems: []
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
const channel_podroll_remote_items = ((_a = channel.channel_podroll) === null || _a === void 0 ? void 0 : _a.channel_podroll_remote_items) || [];
|
|
103
|
+
if (!channel_podroll_remote_items || channel_podroll_remote_items.length === 0) {
|
|
104
|
+
return {
|
|
105
|
+
podrollChannels: [],
|
|
106
|
+
podrollItems: []
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const podrollChannels = yield this.getPodrollChannels(channel_podroll_remote_items);
|
|
110
|
+
const podrollItems = yield this.getPodrollItems(channel_podroll_remote_items);
|
|
111
|
+
return {
|
|
112
|
+
podrollChannels,
|
|
113
|
+
podrollItems
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
}
|
|
43
117
|
}
|
|
44
118
|
exports.ChannelPodrollService = ChannelPodrollService;
|
package/dist/services/clip.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SharableStatusEnum } from 'podverse-helpers';
|
|
2
1
|
import { EntityManager, FindOneOptions, FindManyOptions } from 'typeorm';
|
|
3
2
|
import { Clip } from '@orm/entities/clip';
|
|
4
3
|
import { BaseManyService } from '@orm/services/base/baseManyService';
|
|
@@ -7,9 +6,8 @@ export type ClipDto = {
|
|
|
7
6
|
end_time?: string | null;
|
|
8
7
|
title?: string | null;
|
|
9
8
|
description?: string | null;
|
|
10
|
-
account_id: number;
|
|
11
9
|
item_id_text: string;
|
|
12
|
-
|
|
10
|
+
sharable_status_id: number;
|
|
13
11
|
};
|
|
14
12
|
export declare class ClipService extends BaseManyService<Clip, 'account'> {
|
|
15
13
|
private accountService;
|
|
@@ -20,6 +18,8 @@ export declare class ClipService extends BaseManyService<Clip, 'account'> {
|
|
|
20
18
|
delete(account_id: number, clip_id_text: string): Promise<void>;
|
|
21
19
|
getByIdText(clip_id_text: string, config?: FindOneOptions<Clip>): Promise<Clip | null>;
|
|
22
20
|
getMany(options?: FindManyOptions<Clip>): Promise<Clip[]>;
|
|
21
|
+
getManyAndCount(options?: FindManyOptions<Clip>): Promise<[Clip[], number]>;
|
|
23
22
|
getManyByAccount(account_id: number): Promise<Clip[]>;
|
|
23
|
+
getRandomClip(medium_id: number): Promise<Clip | null>;
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=clip.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../../src/services/clip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"clip.d.ts","sourceRoot":"","sources":["../../src/services/clip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAIrE,MAAM,MAAM,OAAO,GAAG;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,qBAAa,WAAY,SAAQ,eAAe,CAAC,IAAI,EAAE,SAAS,CAAC;IAC/D,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,WAAW,CAAc;gBAErB,0BAA0B,CAAC,EAAE,aAAa;IAMhD,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA6BvD,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAiC7E,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/D,WAAW,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAStF,OAAO,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAIzD,eAAe,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;IAI3E,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IASrD,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;CAa7D"}
|
package/dist/services/clip.js
CHANGED
|
@@ -40,7 +40,7 @@ class ClipService extends baseManyService_1.BaseManyService {
|
|
|
40
40
|
description: dto.description || null,
|
|
41
41
|
account,
|
|
42
42
|
item,
|
|
43
|
-
|
|
43
|
+
sharable_status_id: dto.sharable_status_id
|
|
44
44
|
};
|
|
45
45
|
const whereKeys = [];
|
|
46
46
|
return this._update(account, whereKeys, finalDto);
|
|
@@ -68,9 +68,8 @@ class ClipService extends baseManyService_1.BaseManyService {
|
|
|
68
68
|
end_time: dto.end_time || null,
|
|
69
69
|
title: dto.title || null,
|
|
70
70
|
description: dto.description || null,
|
|
71
|
-
account,
|
|
72
71
|
item,
|
|
73
|
-
|
|
72
|
+
sharable_status_id: dto.sharable_status_id
|
|
74
73
|
};
|
|
75
74
|
const whereKeys = ['id_text'];
|
|
76
75
|
return this._update(account, whereKeys, finalDto, undefined, clip);
|
|
@@ -96,6 +95,11 @@ class ClipService extends baseManyService_1.BaseManyService {
|
|
|
96
95
|
return this.repositoryRead.find(options);
|
|
97
96
|
});
|
|
98
97
|
}
|
|
98
|
+
getManyAndCount(options) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
return this.repositoryRead.findAndCount(options);
|
|
101
|
+
});
|
|
102
|
+
}
|
|
99
103
|
getManyByAccount(account_id) {
|
|
100
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
105
|
const account = yield this.accountService.get(account_id);
|
|
@@ -105,5 +109,18 @@ class ClipService extends baseManyService_1.BaseManyService {
|
|
|
105
109
|
return this._getAll(account);
|
|
106
110
|
});
|
|
107
111
|
}
|
|
112
|
+
getRandomClip(medium_id) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
+
let query = this.repositoryRead.createQueryBuilder('clip')
|
|
115
|
+
.innerJoin('clip.item', 'item')
|
|
116
|
+
.innerJoin('item.channel', 'channel');
|
|
117
|
+
const clips = yield query
|
|
118
|
+
.where('channel.medium_id = :medium_id', { medium_id })
|
|
119
|
+
.orderBy('RANDOM()')
|
|
120
|
+
.limit(1)
|
|
121
|
+
.getMany();
|
|
122
|
+
return clips[0] || null;
|
|
123
|
+
});
|
|
124
|
+
}
|
|
108
125
|
}
|
|
109
126
|
exports.ClipService = ClipService;
|
|
@@ -99,7 +99,7 @@ class FeedService {
|
|
|
99
99
|
feed.feed_flag_status = feed_flag_status;
|
|
100
100
|
}
|
|
101
101
|
feed.is_parsing = null;
|
|
102
|
-
feed.parsing_priority =
|
|
102
|
+
feed.parsing_priority = 0;
|
|
103
103
|
feed.container_id = '';
|
|
104
104
|
const newFeed = yield this.repositoryReadWrite.save(feed);
|
|
105
105
|
const channel = yield channelService.getOrCreateByPodcastIndexId({
|
|
@@ -12,8 +12,6 @@ type ItemGetByDto = {
|
|
|
12
12
|
guid: string | null;
|
|
13
13
|
guid_enclosure_url: string | null;
|
|
14
14
|
};
|
|
15
|
-
export declare const itemGetManyRelations: string[];
|
|
16
|
-
export declare const itemGetOneRelations: FindOptionsRelations<Item>;
|
|
17
15
|
export declare class ItemService {
|
|
18
16
|
protected repositoryRead: Repository<Item>;
|
|
19
17
|
protected repositoryReadWrite: Repository<Item>;
|
|
@@ -22,19 +20,31 @@ export declare class ItemService {
|
|
|
22
20
|
get(id: number, relations?: FindOptionsRelations<Item>): Promise<Item | null>;
|
|
23
21
|
getByIdText(id_text: string, relations?: FindOptionsRelations<Item>): Promise<Item | null>;
|
|
24
22
|
getByIdOrIdText(idOrIdText: string, relations?: FindOptionsRelations<Item>): Promise<Item | null>;
|
|
23
|
+
getRandomItem(medium_id: number): Promise<Item | null>;
|
|
25
24
|
getMany(config: FindManyOptions<Item>, itemType: 'normal' | 'live-item'): Promise<Item[]>;
|
|
25
|
+
getManyByPodcastGuidAndItemGuid(params: {
|
|
26
|
+
podcast_guid: string;
|
|
27
|
+
item_guid: string;
|
|
28
|
+
}[], options?: FindManyOptions<Item>): Promise<Item[]>;
|
|
26
29
|
getBy(channel: Channel, dto: ItemGetByDto): Promise<Item | null>;
|
|
27
30
|
getByGuid(channel: Channel, guid: string): Promise<Item | null>;
|
|
28
31
|
getByEnclosureUrl(channel: Channel, guid_enclosure_url: string): Promise<Item | null>;
|
|
29
32
|
getManyByGuid(channel: Channel, guids: string[], options?: FindManyOptions<Item>): Promise<Item[]>;
|
|
30
33
|
getManyByGuidEnclosureUrl(channel: Channel, guidEnclosureUrls: string[], options?: FindManyOptions<Item>): Promise<Item[]>;
|
|
31
34
|
getManyByChannel(channel: Channel, options?: FindManyOptions<Item>): Promise<Item[]>;
|
|
32
|
-
|
|
35
|
+
getManyForQueueByPubDate(item_id_text: string, order: 'forward' | 'backward'): Promise<Item[]>;
|
|
36
|
+
getManyByChannelWithLiveItem(channel: Channel, options?: FindManyOptions<Item>): Promise<Item[]>;
|
|
37
|
+
getManyByChannels(channels: Channel[], options?: FindManyOptions<Item>): Promise<Item[]>;
|
|
38
|
+
getManyByChannelsWithLiveItem(channels: Channel[], options?: FindManyOptions<Item>): Promise<Item[]>;
|
|
33
39
|
update(channel: Channel, item_flag_status_id: ItemFlagStatusStatusEnum, dto: ItemDto): Promise<Item>;
|
|
34
40
|
updateFlagStatus(item: Item, item_flag_status_id: ItemFlagStatusStatusEnum): Promise<Item>;
|
|
35
41
|
updateManyFlagStatus(items: Item[], item_flag_status_id: ItemFlagStatusStatusEnum): Promise<Item[]>;
|
|
36
42
|
delete(id: number): Promise<void>;
|
|
37
43
|
deleteMany(ids: number[]): Promise<void>;
|
|
38
44
|
}
|
|
45
|
+
export declare const itemGetManyRelations: string[];
|
|
46
|
+
export type SubItemGetManyRelations = 'item' | 'item.item_about' | 'item.item_chat' | 'item.item_description' | 'item.item_enclosures' | 'item.item_enclosures.item_enclosure_integrity' | 'item.item_enclosures.item_enclosure_sources' | 'item.item_images' | 'item.item_persons' | 'item.item_season' | 'item.item_season.channel_season' | 'item.live_item';
|
|
47
|
+
export declare const subItemGetManyRelations: SubItemGetManyRelations[];
|
|
48
|
+
export declare const itemGetOneRelations: FindOptionsRelations<Item>;
|
|
39
49
|
export {};
|
|
40
50
|
//# sourceMappingURL=item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/services/item/item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAC7C,UAAU,
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../src/services/item/item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,gBAAgB,EAC7C,UAAU,EAAsB,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAoB/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAE7E,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,IAAI,GAAG,IAAI,CAAA;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;CAClC,CAAA;AAED,KAAK,YAAY,GAAG;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,C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AAO,CAAC,IAAI,CAAC;IA4BpG,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,mBAAmB,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1F,oBAAoB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,mBAAmB,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAenG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAK/C;AAED,eAAO,MAAM,oBAAoB,UAchC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAC/B,MAAM,GACN,iBAAiB,GACjB,gBAAgB,GAChB,uBAAuB,GACvB,sBAAsB,GACtB,+CAA+C,GAC/C,6CAA6C,GAC7C,kBAAkB,GAClB,mBAAmB,GACnB,kBAAkB,GAClB,iCAAiC,GACjC,gBAAgB,CAAC;AAErB,eAAO,MAAM,uBAAuB,EAAE,uBAAuB,EAa5D,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,oBAAoB,CAAC,IAAI,CAmB1D,CAAC"}
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.itemGetOneRelations = exports.subItemGetManyRelations = exports.itemGetManyRelations = exports.ItemService = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const item_1 = require("@orm/entities/item/item");
|
|
15
15
|
const applyProperties_1 = require("@orm/lib/applyProperties");
|
|
@@ -31,44 +31,12 @@ const itemValueTimeSplitRecipient_1 = require("./itemValueTimeSplitRecipient");
|
|
|
31
31
|
const itemValueTimeSplitRemoteItem_1 = require("./itemValueTimeSplitRemoteItem");
|
|
32
32
|
const itemFlagStatus_1 = require("./itemFlagStatus");
|
|
33
33
|
const itemFlagStatus_2 = require("@orm/entities/item/itemFlagStatus");
|
|
34
|
-
|
|
34
|
+
const itemQueueListRelations = [
|
|
35
35
|
'item_about',
|
|
36
|
-
'
|
|
37
|
-
'item_chat',
|
|
38
|
-
'item_description',
|
|
39
|
-
'item_enclosures',
|
|
40
|
-
'item_enclosures.item_enclosure_integrity',
|
|
41
|
-
'item_enclosures.item_enclosure_sources',
|
|
36
|
+
'item_enclosures', 'item_enclosures.item_enclosure_sources',
|
|
42
37
|
'item_images',
|
|
43
|
-
'
|
|
44
|
-
'item_season',
|
|
45
|
-
'item_season.channel_season',
|
|
46
|
-
'live_item'
|
|
38
|
+
'channel', 'channel.channel_images'
|
|
47
39
|
];
|
|
48
|
-
exports.itemGetOneRelations = {
|
|
49
|
-
item_about: true,
|
|
50
|
-
item_chapters_feed: true,
|
|
51
|
-
item_chat: true,
|
|
52
|
-
item_content_links: true,
|
|
53
|
-
item_description: true,
|
|
54
|
-
item_enclosures: true,
|
|
55
|
-
item_fundings: true,
|
|
56
|
-
item_images: true,
|
|
57
|
-
item_license: true,
|
|
58
|
-
item_location: true,
|
|
59
|
-
item_persons: true,
|
|
60
|
-
item_season: true,
|
|
61
|
-
item_social_interacts: true,
|
|
62
|
-
item_soundbites: true,
|
|
63
|
-
item_transcripts: true,
|
|
64
|
-
item_txts: true,
|
|
65
|
-
item_values: true,
|
|
66
|
-
live_item: true
|
|
67
|
-
};
|
|
68
|
-
const getItemOneToOneRelations = (relations) => {
|
|
69
|
-
const oneToOneRelations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (relations.item_about ? { item_about: { item_itunes_episode_type: true } } : {})), (relations.item_chat ? { item_chat: true } : {})), (relations.item_description ? { item_description: true } : {})), (relations.item_license ? { item_license: true } : {})), (relations.item_location ? { item_location: true } : {})), (relations.item_season ? { item_season: { channel_season: true } } : {})), (relations.live_item ? { live_item: true } : {}));
|
|
70
|
-
return oneToOneRelations;
|
|
71
|
-
};
|
|
72
40
|
class ItemService {
|
|
73
41
|
constructor() {
|
|
74
42
|
this.repositoryRead = db_1.AppDataSourceRead.getRepository(item_1.Item);
|
|
@@ -87,7 +55,7 @@ class ItemService {
|
|
|
87
55
|
if (relations.item_chapters_feed) {
|
|
88
56
|
const itemChaptersFeedService = new itemChaptersFeed_1.ItemChaptersFeedService();
|
|
89
57
|
const item_chapters_feed = yield itemChaptersFeedService._get(item, {
|
|
90
|
-
relations: ['
|
|
58
|
+
relations: ['item_chapters_feed_log']
|
|
91
59
|
});
|
|
92
60
|
if (item_chapters_feed)
|
|
93
61
|
item.item_chapters_feed = item_chapters_feed;
|
|
@@ -212,6 +180,18 @@ class ItemService {
|
|
|
212
180
|
return item;
|
|
213
181
|
});
|
|
214
182
|
}
|
|
183
|
+
getRandomItem(medium_id) {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
185
|
+
let query = this.repositoryRead.createQueryBuilder('item')
|
|
186
|
+
.innerJoin('item.channel', 'channel');
|
|
187
|
+
const items = yield query
|
|
188
|
+
.where('channel.medium_id = :medium_id', { medium_id })
|
|
189
|
+
.orderBy('RANDOM()')
|
|
190
|
+
.limit(1)
|
|
191
|
+
.getMany();
|
|
192
|
+
return items[0] || null;
|
|
193
|
+
});
|
|
194
|
+
}
|
|
215
195
|
getMany(config, itemType) {
|
|
216
196
|
return __awaiter(this, void 0, void 0, function* () {
|
|
217
197
|
return this.repositoryRead.find(Object.assign(Object.assign({}, config), { where: {
|
|
@@ -226,6 +206,22 @@ class ItemService {
|
|
|
226
206
|
} }));
|
|
227
207
|
});
|
|
228
208
|
}
|
|
209
|
+
getManyByPodcastGuidAndItemGuid(params, options) {
|
|
210
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
211
|
+
if (!params.length)
|
|
212
|
+
return [];
|
|
213
|
+
const where = params.map(param => ({
|
|
214
|
+
guid: param.item_guid,
|
|
215
|
+
channel: {
|
|
216
|
+
podcast_guid: param.podcast_guid
|
|
217
|
+
},
|
|
218
|
+
item_flag_status: {
|
|
219
|
+
id: itemFlagStatus_2.ItemFlagStatusStatusEnum.Active
|
|
220
|
+
}
|
|
221
|
+
}));
|
|
222
|
+
return this.repositoryRead.find(Object.assign({ where }, options));
|
|
223
|
+
});
|
|
224
|
+
}
|
|
229
225
|
getBy(channel, dto) {
|
|
230
226
|
return __awaiter(this, void 0, void 0, function* () {
|
|
231
227
|
let item = null;
|
|
@@ -293,7 +289,41 @@ class ItemService {
|
|
|
293
289
|
} }, options));
|
|
294
290
|
});
|
|
295
291
|
}
|
|
296
|
-
|
|
292
|
+
getManyForQueueByPubDate(item_id_text, order) {
|
|
293
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
294
|
+
const item = yield this.repositoryRead.findOne({
|
|
295
|
+
where: { id_text: item_id_text },
|
|
296
|
+
relations: { channel: true }
|
|
297
|
+
});
|
|
298
|
+
if (!item || !item.channel || !item.pub_date) {
|
|
299
|
+
return [];
|
|
300
|
+
}
|
|
301
|
+
const pubDateOperator = order === 'forward'
|
|
302
|
+
? (0, typeorm_1.MoreThan)(item.pub_date)
|
|
303
|
+
: (0, typeorm_1.LessThan)(item.pub_date);
|
|
304
|
+
const pubDateSort = order === 'forward'
|
|
305
|
+
? 'ASC'
|
|
306
|
+
: 'DESC';
|
|
307
|
+
return this.repositoryRead.find({
|
|
308
|
+
where: {
|
|
309
|
+
channel: item.channel,
|
|
310
|
+
live_item: {
|
|
311
|
+
id: (0, typeorm_1.IsNull)()
|
|
312
|
+
},
|
|
313
|
+
item_flag_status: {
|
|
314
|
+
id: itemFlagStatus_2.ItemFlagStatusStatusEnum.Active
|
|
315
|
+
},
|
|
316
|
+
pub_date: pubDateOperator
|
|
317
|
+
},
|
|
318
|
+
order: {
|
|
319
|
+
pub_date: pubDateSort
|
|
320
|
+
},
|
|
321
|
+
take: 20,
|
|
322
|
+
relations: itemQueueListRelations
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
getManyByChannelWithLiveItem(channel, options) {
|
|
297
327
|
return __awaiter(this, void 0, void 0, function* () {
|
|
298
328
|
return this.repositoryRead.find(Object.assign({ where: {
|
|
299
329
|
channel,
|
|
@@ -306,6 +336,32 @@ class ItemService {
|
|
|
306
336
|
} }, options));
|
|
307
337
|
});
|
|
308
338
|
}
|
|
339
|
+
getManyByChannels(channels, options) {
|
|
340
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
341
|
+
return this.repositoryRead.find(Object.assign({ where: {
|
|
342
|
+
channel: (0, typeorm_1.In)(channels),
|
|
343
|
+
live_item: {
|
|
344
|
+
id: (0, typeorm_1.IsNull)()
|
|
345
|
+
},
|
|
346
|
+
item_flag_status: {
|
|
347
|
+
id: itemFlagStatus_2.ItemFlagStatusStatusEnum.Active
|
|
348
|
+
}
|
|
349
|
+
} }, options));
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
getManyByChannelsWithLiveItem(channels, options) {
|
|
353
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
354
|
+
return this.repositoryRead.find(Object.assign({ where: {
|
|
355
|
+
channel: (0, typeorm_1.In)(channels),
|
|
356
|
+
live_item: {
|
|
357
|
+
id: (0, typeorm_1.Not)((0, typeorm_1.IsNull)())
|
|
358
|
+
},
|
|
359
|
+
item_flag_status: {
|
|
360
|
+
id: itemFlagStatus_2.ItemFlagStatusStatusEnum.Active
|
|
361
|
+
}
|
|
362
|
+
} }, options));
|
|
363
|
+
});
|
|
364
|
+
}
|
|
309
365
|
update(channel, item_flag_status_id, dto) {
|
|
310
366
|
return __awaiter(this, void 0, void 0, function* () {
|
|
311
367
|
let item = yield this.getBy(channel, {
|
|
@@ -368,3 +424,56 @@ class ItemService {
|
|
|
368
424
|
}
|
|
369
425
|
}
|
|
370
426
|
exports.ItemService = ItemService;
|
|
427
|
+
exports.itemGetManyRelations = [
|
|
428
|
+
'item_about',
|
|
429
|
+
'item_about.item_itunes_episode_type',
|
|
430
|
+
'item_chat',
|
|
431
|
+
'item_description',
|
|
432
|
+
'item_enclosures',
|
|
433
|
+
'item_enclosures.item_enclosure_integrity',
|
|
434
|
+
'item_enclosures.item_enclosure_sources',
|
|
435
|
+
'item_images',
|
|
436
|
+
'item_persons',
|
|
437
|
+
'item_season',
|
|
438
|
+
'item_season.channel_season',
|
|
439
|
+
'live_item',
|
|
440
|
+
'live_item.live_item_status'
|
|
441
|
+
];
|
|
442
|
+
exports.subItemGetManyRelations = [
|
|
443
|
+
'item',
|
|
444
|
+
'item.item_about',
|
|
445
|
+
'item.item_chat',
|
|
446
|
+
'item.item_description',
|
|
447
|
+
'item.item_enclosures',
|
|
448
|
+
'item.item_enclosures.item_enclosure_integrity',
|
|
449
|
+
'item.item_enclosures.item_enclosure_sources',
|
|
450
|
+
'item.item_images',
|
|
451
|
+
'item.item_persons',
|
|
452
|
+
'item.item_season',
|
|
453
|
+
'item.item_season.channel_season',
|
|
454
|
+
'item.live_item'
|
|
455
|
+
];
|
|
456
|
+
exports.itemGetOneRelations = {
|
|
457
|
+
item_about: true,
|
|
458
|
+
item_chapters_feed: true,
|
|
459
|
+
item_chat: true,
|
|
460
|
+
item_content_links: true,
|
|
461
|
+
item_description: true,
|
|
462
|
+
item_enclosures: true,
|
|
463
|
+
item_fundings: true,
|
|
464
|
+
item_images: true,
|
|
465
|
+
item_license: true,
|
|
466
|
+
item_location: true,
|
|
467
|
+
item_persons: true,
|
|
468
|
+
item_season: true,
|
|
469
|
+
item_social_interacts: true,
|
|
470
|
+
item_soundbites: true,
|
|
471
|
+
item_transcripts: true,
|
|
472
|
+
item_txts: true,
|
|
473
|
+
item_values: true,
|
|
474
|
+
live_item: true
|
|
475
|
+
};
|
|
476
|
+
const getItemOneToOneRelations = (relations) => {
|
|
477
|
+
const oneToOneRelations = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (relations.item_about ? { item_about: { item_itunes_episode_type: true } } : {})), (relations.item_chat ? { item_chat: true } : {})), (relations.item_description ? { item_description: true } : {})), (relations.item_license ? { item_license: true } : {})), (relations.item_location ? { item_location: true } : {})), (relations.item_season ? { item_season: { channel_season: true } } : {})), (relations.live_item ? { live_item: true } : {}));
|
|
478
|
+
return oneToOneRelations;
|
|
479
|
+
};
|
|
@@ -8,13 +8,19 @@ export type ItemChapterDto = {
|
|
|
8
8
|
title: string | null;
|
|
9
9
|
web_url: string | null;
|
|
10
10
|
table_of_contents: boolean;
|
|
11
|
+
data_hash: string;
|
|
11
12
|
};
|
|
12
13
|
export declare class ItemChapterService extends BaseManyService<ItemChapter, 'item_chapters_feed'> {
|
|
13
14
|
constructor(transactionalEntityManager?: EntityManager);
|
|
14
15
|
getAll(item_chapters_feed: ItemChaptersFeed, config?: FindManyOptions<ItemChapter>): Promise<ItemChapter[]>;
|
|
16
|
+
getAllWithCount(item_chapters_feed: ItemChaptersFeed, config?: FindManyOptions<ItemChapter>): Promise<{
|
|
17
|
+
count: number;
|
|
18
|
+
results: ItemChapter[];
|
|
19
|
+
}>;
|
|
15
20
|
getByIdText(id_text: string, config?: FindOneOptions<ItemChapter>): Promise<ItemChapter | null>;
|
|
16
21
|
update(item_chapters_feed: ItemChaptersFeed, dto: ItemChapterDto): Promise<ItemChapter>;
|
|
17
22
|
updateMany(item_chapters_feed: ItemChaptersFeed, dtos: ItemChapterDto[]): Promise<ItemChapter[]>;
|
|
18
23
|
deleteMany(ids: number[]): Promise<void>;
|
|
24
|
+
deleteManyByDataHash(item_chapters_feed: ItemChaptersFeed, dataHashes: string[]): Promise<void>;
|
|
19
25
|
}
|
|
20
26
|
//# sourceMappingURL=itemChapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemChapter.d.ts","sourceRoot":"","sources":["../../../src/services/item/itemChapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"itemChapter.d.ts","sour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AAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAMhG,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAMxC,oBAAoB,CAAC,kBAAkB,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAQtG"}
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.ItemChapterService = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
13
14
|
const itemChapter_1 = require("@orm/entities/item/itemChapter");
|
|
14
15
|
const baseManyService_1 = require("@orm/services/base/baseManyService");
|
|
15
16
|
class ItemChapterService extends baseManyService_1.BaseManyService {
|
|
@@ -21,13 +22,43 @@ class ItemChapterService extends baseManyService_1.BaseManyService {
|
|
|
21
22
|
_getAll: { get: () => super._getAll }
|
|
22
23
|
});
|
|
23
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
|
|
25
|
+
const feed = Object.assign({}, item_chapters_feed);
|
|
26
|
+
delete feed.item_chapters;
|
|
27
|
+
delete feed.item_chapters_feed_log;
|
|
28
|
+
return _super._getAll.call(this, feed, config);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
getAllWithCount(item_chapters_feed, config) {
|
|
32
|
+
const _super = Object.create(null, {
|
|
33
|
+
_getAllWithCount: { get: () => super._getAllWithCount }
|
|
34
|
+
});
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
if (!item_chapters_feed) {
|
|
37
|
+
return { count: 0, results: [] };
|
|
38
|
+
}
|
|
39
|
+
const feed = Object.assign({}, item_chapters_feed);
|
|
40
|
+
delete feed.item_chapters;
|
|
41
|
+
delete feed.item_chapters_feed_log;
|
|
42
|
+
return _super._getAllWithCount.call(this, feed, config);
|
|
25
43
|
});
|
|
26
44
|
}
|
|
27
45
|
getByIdText(id_text, config) {
|
|
28
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const options = Object.assign({ where: { id_text } }, config);
|
|
30
|
-
|
|
47
|
+
const options = Object.assign({ where: { id_text }, relations: ['item_chapters_feed'] }, config);
|
|
48
|
+
const chapter = yield this.repositoryRead.findOne(options);
|
|
49
|
+
if (!chapter || !chapter.item_chapters_feed) {
|
|
50
|
+
return chapter;
|
|
51
|
+
}
|
|
52
|
+
const allChapters = yield this.getAll(chapter.item_chapters_feed, {
|
|
53
|
+
order: { start_time: 'ASC' }
|
|
54
|
+
});
|
|
55
|
+
const currentStart = parseFloat(chapter.start_time);
|
|
56
|
+
const nextChapter = allChapters.find(ch => parseFloat(ch.start_time) > currentStart);
|
|
57
|
+
if (nextChapter) {
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
+
return Object.assign(Object.assign({}, chapter), { end_time: nextChapter.start_time });
|
|
60
|
+
}
|
|
61
|
+
return chapter;
|
|
31
62
|
});
|
|
32
63
|
}
|
|
33
64
|
update(item_chapters_feed, dto) {
|
|
@@ -55,5 +86,15 @@ class ItemChapterService extends baseManyService_1.BaseManyService {
|
|
|
55
86
|
}
|
|
56
87
|
});
|
|
57
88
|
}
|
|
89
|
+
deleteManyByDataHash(item_chapters_feed, dataHashes) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
if (!dataHashes.length)
|
|
92
|
+
return;
|
|
93
|
+
yield this.repositoryReadWrite.delete({
|
|
94
|
+
item_chapters_feed,
|
|
95
|
+
data_hash: (0, typeorm_1.In)(dataHashes)
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}
|
|
58
99
|
}
|
|
59
100
|
exports.ItemChapterService = ItemChapterService;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EntityManager, FindOneOptions } from 'typeorm';
|
|
1
|
+
import { EntityManager, FindManyOptions, FindOneOptions } from 'typeorm';
|
|
2
2
|
import { Item } from '@orm/entities/item/item';
|
|
3
3
|
import { ItemSoundbite } from '@orm/entities/item/itemSoundbite';
|
|
4
4
|
import { BaseManyService } from '@orm/services/base/baseManyService';
|
|
@@ -9,7 +9,10 @@ type ItemSoundbiteDto = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare class ItemSoundbiteService extends BaseManyService<ItemSoundbite, 'item'> {
|
|
11
11
|
constructor(transactionalEntityManager?: EntityManager);
|
|
12
|
-
getByIdText(
|
|
12
|
+
getByIdText(item_soundbite_id_text: string, config?: FindOneOptions<ItemSoundbite>): Promise<ItemSoundbite | null>;
|
|
13
|
+
getRandomItemSoundbite(medium_id?: number): Promise<ItemSoundbite | null>;
|
|
14
|
+
getMany(options?: FindManyOptions<ItemSoundbite>): Promise<ItemSoundbite[]>;
|
|
15
|
+
getManyAndCount(options?: FindManyOptions<ItemSoundbite>): Promise<[ItemSoundbite[], number]>;
|
|
13
16
|
update(item: Item, dto: ItemSoundbiteDto): Promise<ItemSoundbite>;
|
|
14
17
|
updateMany(item: Item, dtos: ItemSoundbiteDto[]): Promise<ItemSoundbite[]>;
|
|
15
18
|
deleteAll(item: Item): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemSoundbite.d.ts","sourceRoot":"","sources":["../../../src/services/item/itemSoundbite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"itemSoundbite.d.ts","sourceRoot":"","sources":["../../../src/services/item/itemSoundbite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,KAAK,gBAAgB,GAAG;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAED,qBAAa,oBAAqB,SAAQ,eAAe,CAAC,aAAa,EAAE,MAAM,CAAC;gBAClE,0BAA0B,CAAC,EAAE,aAAa;IAIhD,WAAW,CAAC,sBAAsB,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IASlH,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAezE,OAAO,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAI3E,eAAe,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE,MAAM,CAAC,CAAC;IAI7F,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC;IAKjE,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAK1E,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3C"}
|
|
@@ -16,12 +16,36 @@ class ItemSoundbiteService extends baseManyService_1.BaseManyService {
|
|
|
16
16
|
constructor(transactionalEntityManager) {
|
|
17
17
|
super(itemSoundbite_1.ItemSoundbite, 'item', transactionalEntityManager);
|
|
18
18
|
}
|
|
19
|
-
getByIdText(
|
|
19
|
+
getByIdText(item_soundbite_id_text, config) {
|
|
20
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
-
const options = Object.assign({ where: { id_text } }, config);
|
|
21
|
+
const options = Object.assign({ where: { id_text: item_soundbite_id_text } }, config);
|
|
22
22
|
return this.repositoryRead.findOne(options);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
+
getRandomItemSoundbite(medium_id) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
let query = this.repositoryRead
|
|
28
|
+
.createQueryBuilder('itemSoundbite')
|
|
29
|
+
.innerJoin('itemSoundbite.item', 'item')
|
|
30
|
+
.innerJoin('item.channel', 'channel');
|
|
31
|
+
const soundbites = yield query
|
|
32
|
+
.where('channel.medium_id = :medium_id', { medium_id })
|
|
33
|
+
.orderBy('RANDOM()')
|
|
34
|
+
.limit(1)
|
|
35
|
+
.getMany();
|
|
36
|
+
return soundbites[0] || null;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
getMany(options) {
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
return this.repositoryRead.find(options);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
getManyAndCount(options) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return this.repositoryRead.findAndCount(options);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
25
49
|
update(item, dto) {
|
|
26
50
|
const _super = Object.create(null, {
|
|
27
51
|
_update: { get: () => super._update }
|