···
39
39
40
40
export class AddUrlToLibraryUseCase extends BaseUseCase<
41
41
AddUrlToLibraryDTO,
42
42
-
Result<AddUrlToLibraryResponseDTO, ValidationError | AuthenticationError | AppError.UnexpectedError>
42
42
+
Result<
43
43
+
AddUrlToLibraryResponseDTO,
44
44
+
ValidationError | AuthenticationError | AppError.UnexpectedError
45
45
+
>
43
46
> {
44
47
constructor(
45
48
private cardRepository: ICardRepository,
···
216
219
await this.cardLibraryService.addCardToLibrary(noteCard, curatorId);
217
220
if (addNoteCardToLibraryResult.isErr()) {
218
221
// Propagate authentication errors
219
219
-
if (addNoteCardToLibraryResult.error instanceof AuthenticationError) {
222
222
+
if (
223
223
+
addNoteCardToLibraryResult.error instanceof AuthenticationError
224
224
+
) {
220
225
return err(addNoteCardToLibraryResult.error);
221
226
}
222
227
if (
···
192
192
await this.cardLibraryService.addCardToLibrary(noteCard, curatorId);
193
193
if (addNoteCardToLibraryResult.isErr()) {
194
194
// Propagate authentication errors
195
195
-
if (addNoteCardToLibraryResult.error instanceof AuthenticationError) {
195
195
+
if (
196
196
+
addNoteCardToLibraryResult.error instanceof AuthenticationError
197
197
+
) {
196
198
return err(addNoteCardToLibraryResult.error);
197
199
}
198
200
if (
···
292
294
);
293
295
if (removeFromCollectionsResult.isErr()) {
294
296
// Propagate authentication errors
295
295
-
if (removeFromCollectionsResult.error instanceof AuthenticationError) {
297
297
+
if (
298
298
+
removeFromCollectionsResult.error instanceof AuthenticationError
299
299
+
) {
296
300
return err(removeFromCollectionsResult.error);
297
301
}
298
302
if (
···
27
27
collectionId: CollectionId,
28
28
curatorId: CuratorId,
29
29
): Promise<
30
30
-
Result<Collection, CardCollectionValidationError | AuthenticationError | AppError.UnexpectedError>
30
30
+
Result<
31
31
+
Collection,
32
32
+
| CardCollectionValidationError
33
33
+
| AuthenticationError
34
34
+
| AppError.UnexpectedError
35
35
+
>
31
36
> {
32
37
try {
33
38
// Find the collection
···
98
103
): Promise<
99
104
Result<
100
105
Collection[],
101
101
-
CardCollectionValidationError | AuthenticationError | AppError.UnexpectedError
106
106
+
| CardCollectionValidationError
107
107
+
| AuthenticationError
108
108
+
| AppError.UnexpectedError
102
109
>
103
110
> {
104
111
const updatedCollections: Collection[] = [];
···
124
131
): Promise<
125
132
Result<
126
133
Collection | null,
127
127
-
CardCollectionValidationError | AuthenticationError | AppError.UnexpectedError
134
134
+
| CardCollectionValidationError
135
135
+
| AuthenticationError
136
136
+
| AppError.UnexpectedError
128
137
>
129
138
> {
130
139
try {
···
202
211
): Promise<
203
212
Result<
204
213
Collection[],
205
205
-
CardCollectionValidationError | AuthenticationError | AppError.UnexpectedError
214
214
+
| CardCollectionValidationError
215
215
+
| AuthenticationError
216
216
+
| AppError.UnexpectedError
206
217
>
207
218
> {
208
219
const updatedCollections: Collection[] = [];
···
29
29
card: Card,
30
30
curatorId: CuratorId,
31
31
): Promise<
32
32
-
Result<Card, CardLibraryValidationError | AuthenticationError | AppError.UnexpectedError>
32
32
+
Result<
33
33
+
Card,
34
34
+
| CardLibraryValidationError
35
35
+
| AuthenticationError
36
36
+
| AppError.UnexpectedError
37
37
+
>
33
38
> {
34
39
try {
35
40
// Check if card is already in curator's library
···
117
122
card: Card,
118
123
curatorId: CuratorId,
119
124
): Promise<
120
120
-
Result<Card, CardLibraryValidationError | AuthenticationError | AppError.UnexpectedError>
125
125
+
Result<
126
126
+
Card,
127
127
+
| CardLibraryValidationError
128
128
+
| AuthenticationError
129
129
+
| AppError.UnexpectedError
130
130
+
>
121
131
> {
122
132
try {
123
133
// Check if card is in curator's library