A social knowledge tool for researchers built on ATProto

Merge pull request #179 from cosmik-network/feature/add-trailing-slash-url-normalization

update use cases to use url value object value

authored by

Wesley Finck and committed by
GitHub
4c2317b3 b477b15b

+22 -16
+2 -2
src/modules/cards/application/useCases/commands/AddUrlToLibraryUseCase.ts
··· 107 107 // Create URL card 108 108 const urlCardInput: IUrlCardInput = { 109 109 type: CardTypeEnum.URL, 110 - url: request.url, 110 + url: url.value, 111 111 metadata: metadataResult.value, 112 112 }; 113 113 ··· 192 192 type: CardTypeEnum.NOTE, 193 193 text: request.note, 194 194 parentCardId: urlCard.cardId.getStringValue(), 195 - url: request.url, 195 + url: url.value, 196 196 }; 197 197 198 198 const noteCardResult = CardFactory.create({
+1 -1
src/modules/cards/application/useCases/queries/GetCollectionsForUrlUseCase.ts
··· 60 60 try { 61 61 // Execute query to get collections containing cards with this URL (raw data with authorId) 62 62 const result = await this.collectionQueryRepo.getCollectionsWithUrl( 63 - query.url, 63 + urlResult.value.value, 64 64 { 65 65 page, 66 66 limit,
+9 -6
src/modules/cards/application/useCases/queries/GetLibrariesForUrlUseCase.ts
··· 68 68 69 69 try { 70 70 // Execute query to get libraries with full card data 71 - const result = await this.cardQueryRepo.getLibrariesForUrl(query.url, { 72 - page, 73 - limit, 74 - sortBy, 75 - sortOrder, 76 - }); 71 + const result = await this.cardQueryRepo.getLibrariesForUrl( 72 + urlResult.value.value, 73 + { 74 + page, 75 + limit, 76 + sortBy, 77 + sortOrder, 78 + }, 79 + ); 77 80 78 81 // Enrich with user profiles 79 82 const uniqueUserIds = Array.from(
+9 -6
src/modules/cards/application/useCases/queries/GetNoteCardsForUrlUseCase.ts
··· 58 58 59 59 try { 60 60 // Execute query to get note cards for the URL (raw data with authorId) 61 - const result = await this.cardQueryRepo.getNoteCardsForUrl(query.url, { 62 - page, 63 - limit, 64 - sortBy, 65 - sortOrder, 66 - }); 61 + const result = await this.cardQueryRepo.getNoteCardsForUrl( 62 + urlResult.value.value, 63 + { 64 + page, 65 + limit, 66 + sortBy, 67 + sortOrder, 68 + }, 69 + ); 67 70 68 71 // Enrich with author profiles 69 72 const uniqueAuthorIds = Array.from(
+1 -1
src/modules/cards/application/useCases/queries/GetUrlMetadataUseCase.ts
··· 62 62 63 63 return ok({ 64 64 metadata: { 65 - url: metadata.url, 65 + url: url.value, 66 66 title: metadata.title, 67 67 description: metadata.description, 68 68 author: metadata.author,