alpha
Login
or
Join now
nandi.uk
/
semble
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
index url from connections
author
Wesley Finck
date
3 months ago
(Apr 13, 2026, 5:48 PM -0700)
commit
8a9565a2
8a9565a285dab5cd46b301fd78ff5accee7a05ab
parent
9f9f6702
9f9f67023ad7f0f0e27467daafe8bdd16d56ca20
+81
-3
5 changed files
Expand all
Collapse all
Unified
Split
src
modules
search
application
eventHandlers
CardAddedToLibraryEventHandler.ts
ConnectionCreatedEventHandler.ts
useCases
commands
IndexUrlForSearchUseCase.ts
shared
infrastructure
events
BullMQEventPublisher.ts
processes
SearchWorkerProcess.ts
-1
src/modules/search/application/eventHandlers/CardAddedToLibraryEventHandler.ts
View file
Reviewed
···
40
40
// Index the URL for search
41
41
const indexResult = await this.indexUrlForSearchUseCase.execute({
42
42
url: card.url.value,
43
43
-
cardId: event.cardId.getStringValue(),
44
43
});
45
44
46
45
if (indexResult.isErr()) {
+69
src/modules/search/application/eventHandlers/ConnectionCreatedEventHandler.ts
View file
Reviewed
···
1
1
+
import { ConnectionCreatedEvent } from '../../../cards/domain/events/ConnectionCreatedEvent';
2
2
+
import { IEventHandler } from '../../../../shared/application/events/IEventSubscriber';
3
3
+
import { Result, ok } from '../../../../shared/core/Result';
4
4
+
import { IndexUrlForSearchUseCase } from '../useCases/commands/IndexUrlForSearchUseCase';
5
5
+
import { IConnectionRepository } from '../../../cards/domain/IConnectionRepository';
6
6
+
7
7
+
export class ConnectionCreatedEventHandler
8
8
+
implements IEventHandler<ConnectionCreatedEvent>
9
9
+
{
10
10
+
constructor(
11
11
+
private indexUrlForSearchUseCase: IndexUrlForSearchUseCase,
12
12
+
private connectionRepository: IConnectionRepository,
13
13
+
) {}
14
14
+
15
15
+
async handle(event: ConnectionCreatedEvent): Promise<Result<void>> {
16
16
+
// Get connection details
17
17
+
const connectionResult = await this.connectionRepository.findById(
18
18
+
event.connectionId,
19
19
+
);
20
20
+
if (connectionResult.isErr()) {
21
21
+
console.error(
22
22
+
'Failed to find connection for search indexing:',
23
23
+
connectionResult.error,
24
24
+
);
25
25
+
return ok(undefined); // Don't fail the event processing
26
26
+
}
27
27
+
28
28
+
const connection = connectionResult.value;
29
29
+
if (!connection) {
30
30
+
console.warn(
31
31
+
'Connection not found for search indexing:',
32
32
+
event.connectionId.getStringValue(),
33
33
+
);
34
34
+
return ok(undefined);
35
35
+
}
36
36
+
37
37
+
// Index source URL if it exists
38
38
+
if (connection.source.url) {
39
39
+
const sourceIndexResult = await this.indexUrlForSearchUseCase.execute({
40
40
+
url: connection.source.url.value,
41
41
+
});
42
42
+
43
43
+
if (sourceIndexResult.isErr()) {
44
44
+
console.error(
45
45
+
'Failed to index source URL for search:',
46
46
+
sourceIndexResult.error,
47
47
+
);
48
48
+
// Don't fail the event processing - search indexing is not critical
49
49
+
}
50
50
+
}
51
51
+
52
52
+
// Index target URL if it exists
53
53
+
if (connection.target.url) {
54
54
+
const targetIndexResult = await this.indexUrlForSearchUseCase.execute({
55
55
+
url: connection.target.url.value,
56
56
+
});
57
57
+
58
58
+
if (targetIndexResult.isErr()) {
59
59
+
console.error(
60
60
+
'Failed to index target URL for search:',
61
61
+
targetIndexResult.error,
62
62
+
);
63
63
+
// Don't fail the event processing - search indexing is not critical
64
64
+
}
65
65
+
}
66
66
+
67
67
+
return ok(undefined);
68
68
+
}
69
69
+
}
-1
src/modules/search/application/useCases/commands/IndexUrlForSearchUseCase.ts
View file
Reviewed
···
7
7
8
8
export interface IndexUrlForSearchDTO {
9
9
url: string;
10
10
-
cardId: string;
11
10
}
12
11
13
12
export interface IndexUrlForSearchResponseDTO {
+1
-1
src/shared/infrastructure/events/BullMQEventPublisher.ts
View file
Reviewed
···
94
94
case EventNames.USER_UNFOLLOWED_TARGET:
95
95
return [QueueNames.NOTIFICATIONS];
96
96
case EventNames.CONNECTION_CREATED:
97
97
-
return [QueueNames.FEEDS, QueueNames.NOTIFICATIONS];
97
97
+
return [QueueNames.FEEDS, QueueNames.NOTIFICATIONS, QueueNames.SEARCH];
98
98
case EventNames.CONNECTION_REMOVED:
99
99
return [QueueNames.NOTIFICATIONS];
100
100
default:
+11
src/shared/infrastructure/processes/SearchWorkerProcess.ts
View file
Reviewed
···
5
5
} from '../http/factories/ServiceFactory';
6
6
import { UseCaseFactory } from '../http/factories/UseCaseFactory';
7
7
import { CardAddedToLibraryEventHandler } from '../../../modules/search/application/eventHandlers/CardAddedToLibraryEventHandler';
8
8
+
import { ConnectionCreatedEventHandler } from '../../../modules/search/application/eventHandlers/ConnectionCreatedEventHandler';
8
9
import { QueueNames } from '../events/QueueConfig';
9
10
import { EventNames } from '../events/EventConfig';
10
11
import { BaseWorkerProcess } from './BaseWorkerProcess';
···
50
51
await subscriber.subscribe(
51
52
EventNames.CARD_ADDED_TO_LIBRARY,
52
53
cardAddedToLibraryHandler,
54
54
+
);
55
55
+
56
56
+
const connectionCreatedHandler = new ConnectionCreatedEventHandler(
57
57
+
useCases.indexUrlForSearchUseCase,
58
58
+
repositories.connectionRepository,
59
59
+
);
60
60
+
61
61
+
await subscriber.subscribe(
62
62
+
EventNames.CONNECTION_CREATED,
63
63
+
connectionCreatedHandler,
53
64
);
54
65
}
55
66
}