Skip to content

Commit

Permalink
fix: reenable authup robot aggregator
Browse files Browse the repository at this point in the history
  • Loading branch information
tada5hi committed Jun 24, 2024
1 parent 06928f6 commit a684e57
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
41 changes: 22 additions & 19 deletions packages/server-core/src/aggregators/authup/entities/robot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,31 @@ import { RegistryProjectEntity } from '../../../domains';

export async function handleAuthupRobotEvent(context: RobotEventContext) {
if (
context.event === 'created' ||
context.event === 'updated'
context.event !== 'created' &&
context.event !== 'updated'
) {
if (context.data.name === ServiceID.REGISTRY) {
const dataSource = await useDataSource();
return;
}
if (context.data.name !== ServiceID.REGISTRY) {
return;
}

const dataSource = await useDataSource();

const projectRepository = dataSource.getRepository(RegistryProjectEntity);
const projects = await projectRepository.find({
select: ['id'],
});
const projectRepository = dataSource.getRepository(RegistryProjectEntity);
const projects = await projectRepository.find({
select: ['id'],
});

for (let i = 0; i < projects.length; i++) {
const queueMessage = buildRegistryTaskQueueRouterPayload({
command: RegistryCommand.PROJECT_LINK,
data: {
id: projects[i].id,
},
});
for (let i = 0; i < projects.length; i++) {
const queueMessage = buildRegistryTaskQueueRouterPayload({
command: RegistryCommand.PROJECT_LINK,
data: {
id: projects[i].id,
},
});

const queueRouter = useQueueRouter();
await queueRouter.publish(queueMessage);
}
}
const queueRouter = useQueueRouter();
await queueRouter.publish(queueMessage);
}
}
4 changes: 2 additions & 2 deletions packages/server-core/src/aggregators/authup/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { isRedisClientUsable, useLogger, useRedisSubscribeClient } from '@privat
import type { Aggregator } from '@privateaim/server-kit';
import { EnvironmentName, useEnv } from '../../config';
import {
handleAuthupRealmEvent,
handleAuthupRealmEvent, handleAuthupRobotEvent,
handleAuthupUserEvent,
} from './entities';

Expand Down Expand Up @@ -38,7 +38,7 @@ export function createAuthupAggregator() : Aggregator {
break;
}
case DomainType.ROBOT: {
// await handleAuthupRobotEvent(event);
await handleAuthupRobotEvent(event);
break;
}
case DomainType.USER: {
Expand Down

0 comments on commit a684e57

Please sign in to comment.