Skip to content

Commit

Permalink
add mirrors api
Browse files Browse the repository at this point in the history
  • Loading branch information
pankaj-peerdb committed Dec 18, 2023
1 parent b68f04a commit fd37ff7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ui/app/api/mirrors/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { getTruePeer } from '@/app/api/peers/route';
import prisma from '@/app/utils/prisma';
export async function GET(request: Request) {
const mirrors = await prisma.flows.findMany({
distinct: 'name',
include: {
sourcePeer: true,
destinationPeer: true,
},
});

const flows = mirrors?.map((mirror) => {
let newMirror: any = {
...mirror,
sourcePeer: getTruePeer(mirror.sourcePeer),
destinationPeer: getTruePeer(mirror.destinationPeer),
};
return newMirror;
});
return new Response(JSON.stringify(flows));
}

0 comments on commit fd37ff7

Please sign in to comment.