@mediaryorg/contracts 1.0.10 → 2.0.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/proto/paths.d.ts +8 -0
- package/dist/proto/paths.js +8 -0
- package/generated/collection/v1/collection.ts +235 -0
- package/generated/favorite/v1/favorite.ts +146 -0
- package/generated/image/v1/image.ts +140 -0
- package/generated/library/v1/library.ts +216 -0
- package/generated/media/v1/media.ts +294 -0
- package/generated/media_request/v1/media_request.ts +223 -0
- package/generated/recommendation/v1/recommendation.ts +126 -0
- package/generated/search/v1/search.ts +103 -0
- package/package.json +3 -3
- package/proto/collection/v1/collection.proto +120 -0
- package/proto/favorite/v1/favorite.proto +79 -0
- package/proto/image/v1/image.proto +73 -0
- package/proto/library/v1/library.proto +144 -0
- package/proto/media/v1/media.proto +197 -0
- package/proto/media_request/v1/media_request.proto +142 -0
- package/proto/recommendation/v1/recommendation.proto +60 -0
- package/proto/search/v1/search.proto +62 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.6
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: library/v1/library.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
import { Media, MediaSource } from "../../media/v1/media";
|
|
11
|
+
|
|
12
|
+
export const protobufPackage = "library.v1";
|
|
13
|
+
|
|
14
|
+
/** Mirrors prisma enum Status (PLANNED/IN_PROGRESS/COMPLETED/DROPPED). */
|
|
15
|
+
export enum LibraryItemStatus {
|
|
16
|
+
LIBRARY_ITEM_STATUS_UNSPECIFIED = 0,
|
|
17
|
+
LIBRARY_ITEM_STATUS_PLANNED = 1,
|
|
18
|
+
LIBRARY_ITEM_STATUS_IN_PROGRESS = 2,
|
|
19
|
+
LIBRARY_ITEM_STATUS_COMPLETED = 3,
|
|
20
|
+
LIBRARY_ITEM_STATUS_DROPPED = 4,
|
|
21
|
+
UNRECOGNIZED = -1,
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface LibraryItem {
|
|
25
|
+
id: string;
|
|
26
|
+
userId: string;
|
|
27
|
+
mediaId: string;
|
|
28
|
+
status: LibraryItemStatus;
|
|
29
|
+
rating?: number | undefined;
|
|
30
|
+
notes?: string | undefined;
|
|
31
|
+
addedAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
/** Embedded media snapshot for the read paths (denormalized view). */
|
|
34
|
+
media:
|
|
35
|
+
| Media
|
|
36
|
+
| undefined;
|
|
37
|
+
/** Pre-aggregated counts to avoid extra round-trips on the gateway side. */
|
|
38
|
+
libraryCount: number;
|
|
39
|
+
reviewsCount: number;
|
|
40
|
+
isFavorite: boolean;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** Compact search hit accepted by AddFromSearch (mirrors AddFromSearchDto.searchResult). */
|
|
44
|
+
export interface LibrarySearchHit {
|
|
45
|
+
id: string;
|
|
46
|
+
title: string;
|
|
47
|
+
subtitle?: string | undefined;
|
|
48
|
+
imageUrl?: string | undefined;
|
|
49
|
+
year?: string | undefined;
|
|
50
|
+
type: string;
|
|
51
|
+
source: string;
|
|
52
|
+
externalId?: string | undefined;
|
|
53
|
+
rating?: number | undefined;
|
|
54
|
+
genres: string[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface AddFromSearchRequest {
|
|
58
|
+
userId: string;
|
|
59
|
+
searchResult: LibrarySearchHit | undefined;
|
|
60
|
+
status?: LibraryItemStatus | undefined;
|
|
61
|
+
rating?: number | undefined;
|
|
62
|
+
notes?: string | undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface AddFromSearchResponse {
|
|
66
|
+
item: LibraryItem | undefined;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface GetUserLibraryRequest {
|
|
70
|
+
userId: string;
|
|
71
|
+
statuses: LibraryItemStatus[];
|
|
72
|
+
collectionName?: string | undefined;
|
|
73
|
+
source?: MediaSource | undefined;
|
|
74
|
+
search?: string | undefined;
|
|
75
|
+
genres: string[];
|
|
76
|
+
minRating?: number | undefined;
|
|
77
|
+
maxRating?: number | undefined;
|
|
78
|
+
minYear?: number | undefined;
|
|
79
|
+
maxYear?: number | undefined;
|
|
80
|
+
page: number;
|
|
81
|
+
limit: number;
|
|
82
|
+
/** addedAt | rating | title | releaseYear | favorites */
|
|
83
|
+
sortBy: string;
|
|
84
|
+
sortOrder: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface LibraryPaginationMeta {
|
|
88
|
+
page: number;
|
|
89
|
+
limit: number;
|
|
90
|
+
total: number;
|
|
91
|
+
totalPages: number;
|
|
92
|
+
hasNextPage: boolean;
|
|
93
|
+
hasPrevPage: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface GetUserLibraryResponse {
|
|
97
|
+
data: LibraryItem[];
|
|
98
|
+
meta: LibraryPaginationMeta | undefined;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface GetLibraryItemRequest {
|
|
102
|
+
userId: string;
|
|
103
|
+
mediaId: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface GetLibraryItemResponse {
|
|
107
|
+
item: LibraryItem | undefined;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export interface UpdateLibraryItemRequest {
|
|
111
|
+
userId: string;
|
|
112
|
+
mediaId: string;
|
|
113
|
+
status?: LibraryItemStatus | undefined;
|
|
114
|
+
rating?: number | undefined;
|
|
115
|
+
notes?: string | undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface UpdateLibraryItemResponse {
|
|
119
|
+
item: LibraryItem | undefined;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface RemoveFromLibraryRequest {
|
|
123
|
+
userId: string;
|
|
124
|
+
mediaId: string;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface RemoveFromLibraryResponse {
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface IsInLibraryRequest {
|
|
131
|
+
userId: string;
|
|
132
|
+
mediaId: string;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface IsInLibraryResponse {
|
|
136
|
+
isInLibrary: boolean;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface GetGenresRequest {
|
|
140
|
+
userId: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface GetGenresResponse {
|
|
144
|
+
genres: string[];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export const LIBRARY_V1_PACKAGE_NAME = "library.v1";
|
|
148
|
+
|
|
149
|
+
export interface LibraryServiceClient {
|
|
150
|
+
addFromSearch(request: AddFromSearchRequest): Observable<AddFromSearchResponse>;
|
|
151
|
+
|
|
152
|
+
getUserLibrary(request: GetUserLibraryRequest): Observable<GetUserLibraryResponse>;
|
|
153
|
+
|
|
154
|
+
getLibraryItem(request: GetLibraryItemRequest): Observable<GetLibraryItemResponse>;
|
|
155
|
+
|
|
156
|
+
updateLibraryItem(request: UpdateLibraryItemRequest): Observable<UpdateLibraryItemResponse>;
|
|
157
|
+
|
|
158
|
+
removeFromLibrary(request: RemoveFromLibraryRequest): Observable<RemoveFromLibraryResponse>;
|
|
159
|
+
|
|
160
|
+
isInLibrary(request: IsInLibraryRequest): Observable<IsInLibraryResponse>;
|
|
161
|
+
|
|
162
|
+
getGenres(request: GetGenresRequest): Observable<GetGenresResponse>;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface LibraryServiceController {
|
|
166
|
+
addFromSearch(
|
|
167
|
+
request: AddFromSearchRequest,
|
|
168
|
+
): Promise<AddFromSearchResponse> | Observable<AddFromSearchResponse> | AddFromSearchResponse;
|
|
169
|
+
|
|
170
|
+
getUserLibrary(
|
|
171
|
+
request: GetUserLibraryRequest,
|
|
172
|
+
): Promise<GetUserLibraryResponse> | Observable<GetUserLibraryResponse> | GetUserLibraryResponse;
|
|
173
|
+
|
|
174
|
+
getLibraryItem(
|
|
175
|
+
request: GetLibraryItemRequest,
|
|
176
|
+
): Promise<GetLibraryItemResponse> | Observable<GetLibraryItemResponse> | GetLibraryItemResponse;
|
|
177
|
+
|
|
178
|
+
updateLibraryItem(
|
|
179
|
+
request: UpdateLibraryItemRequest,
|
|
180
|
+
): Promise<UpdateLibraryItemResponse> | Observable<UpdateLibraryItemResponse> | UpdateLibraryItemResponse;
|
|
181
|
+
|
|
182
|
+
removeFromLibrary(
|
|
183
|
+
request: RemoveFromLibraryRequest,
|
|
184
|
+
): Promise<RemoveFromLibraryResponse> | Observable<RemoveFromLibraryResponse> | RemoveFromLibraryResponse;
|
|
185
|
+
|
|
186
|
+
isInLibrary(
|
|
187
|
+
request: IsInLibraryRequest,
|
|
188
|
+
): Promise<IsInLibraryResponse> | Observable<IsInLibraryResponse> | IsInLibraryResponse;
|
|
189
|
+
|
|
190
|
+
getGenres(request: GetGenresRequest): Promise<GetGenresResponse> | Observable<GetGenresResponse> | GetGenresResponse;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export function LibraryServiceControllerMethods() {
|
|
194
|
+
return function (constructor: Function) {
|
|
195
|
+
const grpcMethods: string[] = [
|
|
196
|
+
"addFromSearch",
|
|
197
|
+
"getUserLibrary",
|
|
198
|
+
"getLibraryItem",
|
|
199
|
+
"updateLibraryItem",
|
|
200
|
+
"removeFromLibrary",
|
|
201
|
+
"isInLibrary",
|
|
202
|
+
"getGenres",
|
|
203
|
+
];
|
|
204
|
+
for (const method of grpcMethods) {
|
|
205
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
206
|
+
GrpcMethod("LibraryService", method)(constructor.prototype[method], method, descriptor);
|
|
207
|
+
}
|
|
208
|
+
const grpcStreamMethods: string[] = [];
|
|
209
|
+
for (const method of grpcStreamMethods) {
|
|
210
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
211
|
+
GrpcStreamMethod("LibraryService", method)(constructor.prototype[method], method, descriptor);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export const LIBRARY_SERVICE_NAME = "LibraryService";
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
|
+
// versions:
|
|
3
|
+
// protoc-gen-ts_proto v2.11.6
|
|
4
|
+
// protoc v3.21.12
|
|
5
|
+
// source: media/v1/media.proto
|
|
6
|
+
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices";
|
|
9
|
+
import { Observable } from "rxjs";
|
|
10
|
+
|
|
11
|
+
export const protobufPackage = "media.v1";
|
|
12
|
+
|
|
13
|
+
/** MediaSource mirrors prisma enum MediaSource. */
|
|
14
|
+
export enum MediaSource {
|
|
15
|
+
MEDIA_SOURCE_UNSPECIFIED = 0,
|
|
16
|
+
MEDIA_SOURCE_TMDB = 1,
|
|
17
|
+
MEDIA_SOURCE_GOOGLE_BOOKS = 2,
|
|
18
|
+
MEDIA_SOURCE_MAL = 3,
|
|
19
|
+
MEDIA_SOURCE_CUSTOM = 4,
|
|
20
|
+
UNRECOGNIZED = -1,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* MediaData is the structured payload kept as JSON in the legacy database.
|
|
25
|
+
* `custom_fields_json` contains the type-specific customFields object as a
|
|
26
|
+
* JSON-encoded string so callers can extend without breaking the schema.
|
|
27
|
+
*/
|
|
28
|
+
export interface MediaData {
|
|
29
|
+
title: string;
|
|
30
|
+
originalTitle: string;
|
|
31
|
+
description: string;
|
|
32
|
+
year: number;
|
|
33
|
+
posterUrl: string;
|
|
34
|
+
genres: string[];
|
|
35
|
+
rating: number;
|
|
36
|
+
releaseDate: string;
|
|
37
|
+
country: string;
|
|
38
|
+
originalLanguage: string;
|
|
39
|
+
customFieldsJson: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface Media {
|
|
43
|
+
id: string;
|
|
44
|
+
source: MediaSource;
|
|
45
|
+
externalId: string;
|
|
46
|
+
mediaData: MediaData | undefined;
|
|
47
|
+
searchableTitle: string;
|
|
48
|
+
externalIdsJson: string;
|
|
49
|
+
collectionId: string;
|
|
50
|
+
addedById: string;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface MediaCounts {
|
|
56
|
+
library: number;
|
|
57
|
+
reviews: number;
|
|
58
|
+
favorites: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface MediaWithCounts {
|
|
62
|
+
media: Media | undefined;
|
|
63
|
+
counts: MediaCounts | undefined;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface CreateMediaRequest {
|
|
67
|
+
source: MediaSource;
|
|
68
|
+
externalId: string;
|
|
69
|
+
mediaData: MediaData | undefined;
|
|
70
|
+
collectionId: string;
|
|
71
|
+
addedById: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface CreateMediaResponse {
|
|
75
|
+
media: Media | undefined;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface GetMediaByIdRequest {
|
|
79
|
+
mediaId: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface RatingDistributionEntry {
|
|
83
|
+
rating: number;
|
|
84
|
+
count: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface GetMediaByIdResponse {
|
|
88
|
+
media: Media | undefined;
|
|
89
|
+
counts: MediaCounts | undefined;
|
|
90
|
+
averageRating: number;
|
|
91
|
+
totalReviews: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface GetMediaByExternalIdRequest {
|
|
95
|
+
source: MediaSource;
|
|
96
|
+
externalId: string;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface GetMediaByExternalIdResponse {
|
|
100
|
+
media: Media | undefined;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface FindDuplicatesRequest {
|
|
104
|
+
title: string;
|
|
105
|
+
externalId: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface FindDuplicatesResponse {
|
|
109
|
+
items: Media[];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface GetMediaStatsRequest {
|
|
113
|
+
mediaId: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface MediaStats {
|
|
117
|
+
averageRating: number;
|
|
118
|
+
totalReviews: number;
|
|
119
|
+
ratingDistribution: RatingDistributionEntry[];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface GetMediaStatsResponse {
|
|
123
|
+
media: Media | undefined;
|
|
124
|
+
stats: MediaStats | undefined;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface UpdateMediaRequest {
|
|
128
|
+
mediaId: string;
|
|
129
|
+
source?: MediaSource | undefined;
|
|
130
|
+
externalId?: string | undefined;
|
|
131
|
+
mediaData?: MediaData | undefined;
|
|
132
|
+
collectionId?: string | undefined;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface UpdateMediaResponse {
|
|
136
|
+
media: Media | undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface DeleteMediaRequest {
|
|
140
|
+
mediaId: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export interface DeleteMediaResponse {
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface ListMediaRequest {
|
|
147
|
+
search?: string | undefined;
|
|
148
|
+
collectionId?: string | undefined;
|
|
149
|
+
source?: MediaSource | undefined;
|
|
150
|
+
year?: number | undefined;
|
|
151
|
+
page: number;
|
|
152
|
+
limit: number;
|
|
153
|
+
sortBy: string;
|
|
154
|
+
sortOrder: string;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface PaginationMeta {
|
|
158
|
+
page: number;
|
|
159
|
+
limit: number;
|
|
160
|
+
total: number;
|
|
161
|
+
totalPages: number;
|
|
162
|
+
hasNextPage: boolean;
|
|
163
|
+
hasPrevPage: boolean;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface ListMediaResponse {
|
|
167
|
+
data: MediaWithCounts[];
|
|
168
|
+
meta: PaginationMeta | undefined;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface EnsureMediaFromSearchRequest {
|
|
172
|
+
/**
|
|
173
|
+
* Source identifier coming from search-service results
|
|
174
|
+
* ("tmdb", "google_books", "mangadex", ..., or "local" for already-existing)
|
|
175
|
+
*/
|
|
176
|
+
source: string;
|
|
177
|
+
/** External id within that source (or media id when source == "local") */
|
|
178
|
+
externalId: string;
|
|
179
|
+
/** Search media type label ("movie"|"series"|"book"|"anime"|"manga"|"manhwa"|"game"|"kdrama") */
|
|
180
|
+
mediaType: string;
|
|
181
|
+
title: string;
|
|
182
|
+
subtitle: string;
|
|
183
|
+
imageUrl: string;
|
|
184
|
+
year: string;
|
|
185
|
+
rating?: number | undefined;
|
|
186
|
+
genres: string[];
|
|
187
|
+
/** User who initiated the action (becomes addedBy on creation). */
|
|
188
|
+
requestedByUserId: string;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface EnsureMediaFromSearchResponse {
|
|
192
|
+
media:
|
|
193
|
+
| Media
|
|
194
|
+
| undefined;
|
|
195
|
+
/** True when the media row was just created, false when reused. */
|
|
196
|
+
created: boolean;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export const MEDIA_V1_PACKAGE_NAME = "media.v1";
|
|
200
|
+
|
|
201
|
+
export interface MediaServiceClient {
|
|
202
|
+
createMedia(request: CreateMediaRequest): Observable<CreateMediaResponse>;
|
|
203
|
+
|
|
204
|
+
getMediaById(request: GetMediaByIdRequest): Observable<GetMediaByIdResponse>;
|
|
205
|
+
|
|
206
|
+
getMediaByExternalId(request: GetMediaByExternalIdRequest): Observable<GetMediaByExternalIdResponse>;
|
|
207
|
+
|
|
208
|
+
findDuplicates(request: FindDuplicatesRequest): Observable<FindDuplicatesResponse>;
|
|
209
|
+
|
|
210
|
+
getMediaStats(request: GetMediaStatsRequest): Observable<GetMediaStatsResponse>;
|
|
211
|
+
|
|
212
|
+
updateMedia(request: UpdateMediaRequest): Observable<UpdateMediaResponse>;
|
|
213
|
+
|
|
214
|
+
deleteMedia(request: DeleteMediaRequest): Observable<DeleteMediaResponse>;
|
|
215
|
+
|
|
216
|
+
listMedia(request: ListMediaRequest): Observable<ListMediaResponse>;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Cross-service: ensure media exists for a search hit.
|
|
220
|
+
* Used by library/favorites/recommendation flows so they don't need to write
|
|
221
|
+
* into the media database directly.
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
ensureMediaFromSearch(request: EnsureMediaFromSearchRequest): Observable<EnsureMediaFromSearchResponse>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface MediaServiceController {
|
|
228
|
+
createMedia(
|
|
229
|
+
request: CreateMediaRequest,
|
|
230
|
+
): Promise<CreateMediaResponse> | Observable<CreateMediaResponse> | CreateMediaResponse;
|
|
231
|
+
|
|
232
|
+
getMediaById(
|
|
233
|
+
request: GetMediaByIdRequest,
|
|
234
|
+
): Promise<GetMediaByIdResponse> | Observable<GetMediaByIdResponse> | GetMediaByIdResponse;
|
|
235
|
+
|
|
236
|
+
getMediaByExternalId(
|
|
237
|
+
request: GetMediaByExternalIdRequest,
|
|
238
|
+
): Promise<GetMediaByExternalIdResponse> | Observable<GetMediaByExternalIdResponse> | GetMediaByExternalIdResponse;
|
|
239
|
+
|
|
240
|
+
findDuplicates(
|
|
241
|
+
request: FindDuplicatesRequest,
|
|
242
|
+
): Promise<FindDuplicatesResponse> | Observable<FindDuplicatesResponse> | FindDuplicatesResponse;
|
|
243
|
+
|
|
244
|
+
getMediaStats(
|
|
245
|
+
request: GetMediaStatsRequest,
|
|
246
|
+
): Promise<GetMediaStatsResponse> | Observable<GetMediaStatsResponse> | GetMediaStatsResponse;
|
|
247
|
+
|
|
248
|
+
updateMedia(
|
|
249
|
+
request: UpdateMediaRequest,
|
|
250
|
+
): Promise<UpdateMediaResponse> | Observable<UpdateMediaResponse> | UpdateMediaResponse;
|
|
251
|
+
|
|
252
|
+
deleteMedia(
|
|
253
|
+
request: DeleteMediaRequest,
|
|
254
|
+
): Promise<DeleteMediaResponse> | Observable<DeleteMediaResponse> | DeleteMediaResponse;
|
|
255
|
+
|
|
256
|
+
listMedia(request: ListMediaRequest): Promise<ListMediaResponse> | Observable<ListMediaResponse> | ListMediaResponse;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Cross-service: ensure media exists for a search hit.
|
|
260
|
+
* Used by library/favorites/recommendation flows so they don't need to write
|
|
261
|
+
* into the media database directly.
|
|
262
|
+
*/
|
|
263
|
+
|
|
264
|
+
ensureMediaFromSearch(
|
|
265
|
+
request: EnsureMediaFromSearchRequest,
|
|
266
|
+
): Promise<EnsureMediaFromSearchResponse> | Observable<EnsureMediaFromSearchResponse> | EnsureMediaFromSearchResponse;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export function MediaServiceControllerMethods() {
|
|
270
|
+
return function (constructor: Function) {
|
|
271
|
+
const grpcMethods: string[] = [
|
|
272
|
+
"createMedia",
|
|
273
|
+
"getMediaById",
|
|
274
|
+
"getMediaByExternalId",
|
|
275
|
+
"findDuplicates",
|
|
276
|
+
"getMediaStats",
|
|
277
|
+
"updateMedia",
|
|
278
|
+
"deleteMedia",
|
|
279
|
+
"listMedia",
|
|
280
|
+
"ensureMediaFromSearch",
|
|
281
|
+
];
|
|
282
|
+
for (const method of grpcMethods) {
|
|
283
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
284
|
+
GrpcMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
285
|
+
}
|
|
286
|
+
const grpcStreamMethods: string[] = [];
|
|
287
|
+
for (const method of grpcStreamMethods) {
|
|
288
|
+
const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method);
|
|
289
|
+
GrpcStreamMethod("MediaService", method)(constructor.prototype[method], method, descriptor);
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export const MEDIA_SERVICE_NAME = "MediaService";
|