-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
126 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { NextResponse } from "next/server"; | ||
import Analytics from "~~/model/analytics"; | ||
import Journey from "~~/model/journey"; | ||
import connectDB from "~~/services/connectDB"; | ||
|
||
export async function GET() { | ||
await connectDB(); | ||
const topJourneys = await Analytics.aggregate([ | ||
{ $group: { _id: "$journeyId", count: { $sum: 1 } } }, | ||
{ $sort: { count: -1 } }, | ||
{ $limit: 5 }, | ||
]).exec(); | ||
|
||
for (const journey of topJourneys) { | ||
const journeyBody = await Journey.findById(journey._id); | ||
journey.journeyName = journeyBody?.name; | ||
} | ||
return new NextResponse(JSON.stringify(topJourneys), { | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { FrameMetadataType } from "@coinbase/onchainkit"; | ||
import { DEFAULT_FRAME } from "~~/constants"; | ||
|
||
export const GetDefaultFrame = async (journey_id: string) => { | ||
let frame: FrameMetadataType = DEFAULT_FRAME; | ||
frame.state.journey_id = journey_id; | ||
return frame; | ||
}; |