diff --git a/src/modules/cards/application/useCases/commands/AddUrlToLibraryUseCase.ts b/src/modules/cards/application/useCases/commands/AddUrlToLibraryUseCase.ts index c223941f..54cab9e3 100644 --- a/src/modules/cards/application/useCases/commands/AddUrlToLibraryUseCase.ts +++ b/src/modules/cards/application/useCases/commands/AddUrlToLibraryUseCase.ts @@ -39,7 +39,10 @@ export class ValidationError extends UseCaseError { export class AddUrlToLibraryUseCase extends BaseUseCase< AddUrlToLibraryDTO, - Result + Result< + AddUrlToLibraryResponseDTO, + ValidationError | AuthenticationError | AppError.UnexpectedError + > > { constructor( private cardRepository: ICardRepository, @@ -216,7 +219,9 @@ export class AddUrlToLibraryUseCase extends BaseUseCase< await this.cardLibraryService.addCardToLibrary(noteCard, curatorId); if (addNoteCardToLibraryResult.isErr()) { // Propagate authentication errors - if (addNoteCardToLibraryResult.error instanceof AuthenticationError) { + if ( + addNoteCardToLibraryResult.error instanceof AuthenticationError + ) { return err(addNoteCardToLibraryResult.error); } if ( diff --git a/src/modules/cards/application/useCases/commands/UpdateUrlCardAssociationsUseCase.ts b/src/modules/cards/application/useCases/commands/UpdateUrlCardAssociationsUseCase.ts index 65c6955e..f098c06e 100644 --- a/src/modules/cards/application/useCases/commands/UpdateUrlCardAssociationsUseCase.ts +++ b/src/modules/cards/application/useCases/commands/UpdateUrlCardAssociationsUseCase.ts @@ -192,7 +192,9 @@ export class UpdateUrlCardAssociationsUseCase extends BaseUseCase< await this.cardLibraryService.addCardToLibrary(noteCard, curatorId); if (addNoteCardToLibraryResult.isErr()) { // Propagate authentication errors - if (addNoteCardToLibraryResult.error instanceof AuthenticationError) { + if ( + addNoteCardToLibraryResult.error instanceof AuthenticationError + ) { return err(addNoteCardToLibraryResult.error); } if ( @@ -292,7 +294,9 @@ export class UpdateUrlCardAssociationsUseCase extends BaseUseCase< ); if (removeFromCollectionsResult.isErr()) { // Propagate authentication errors - if (removeFromCollectionsResult.error instanceof AuthenticationError) { + if ( + removeFromCollectionsResult.error instanceof AuthenticationError + ) { return err(removeFromCollectionsResult.error); } if ( diff --git a/src/modules/cards/domain/services/CardCollectionService.ts b/src/modules/cards/domain/services/CardCollectionService.ts index 2398f4c8..cdd6af3b 100644 --- a/src/modules/cards/domain/services/CardCollectionService.ts +++ b/src/modules/cards/domain/services/CardCollectionService.ts @@ -27,7 +27,12 @@ export class CardCollectionService implements DomainService { collectionId: CollectionId, curatorId: CuratorId, ): Promise< - Result + Result< + Collection, + | CardCollectionValidationError + | AuthenticationError + | AppError.UnexpectedError + > > { try { // Find the collection @@ -98,7 +103,9 @@ export class CardCollectionService implements DomainService { ): Promise< Result< Collection[], - CardCollectionValidationError | AuthenticationError | AppError.UnexpectedError + | CardCollectionValidationError + | AuthenticationError + | AppError.UnexpectedError > > { const updatedCollections: Collection[] = []; @@ -124,7 +131,9 @@ export class CardCollectionService implements DomainService { ): Promise< Result< Collection | null, - CardCollectionValidationError | AuthenticationError | AppError.UnexpectedError + | CardCollectionValidationError + | AuthenticationError + | AppError.UnexpectedError > > { try { @@ -202,7 +211,9 @@ export class CardCollectionService implements DomainService { ): Promise< Result< Collection[], - CardCollectionValidationError | AuthenticationError | AppError.UnexpectedError + | CardCollectionValidationError + | AuthenticationError + | AppError.UnexpectedError > > { const updatedCollections: Collection[] = []; diff --git a/src/modules/cards/domain/services/CardLibraryService.ts b/src/modules/cards/domain/services/CardLibraryService.ts index 270897f5..c4d0701f 100644 --- a/src/modules/cards/domain/services/CardLibraryService.ts +++ b/src/modules/cards/domain/services/CardLibraryService.ts @@ -29,7 +29,12 @@ export class CardLibraryService implements DomainService { card: Card, curatorId: CuratorId, ): Promise< - Result + Result< + Card, + | CardLibraryValidationError + | AuthenticationError + | AppError.UnexpectedError + > > { try { // Check if card is already in curator's library @@ -117,7 +122,12 @@ export class CardLibraryService implements DomainService { card: Card, curatorId: CuratorId, ): Promise< - Result + Result< + Card, + | CardLibraryValidationError + | AuthenticationError + | AppError.UnexpectedError + > > { try { // Check if card is in curator's library