generated from nhcarrigan/template
feat: add activity view
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { getCodebergData } from "@/lib/codeberg";
|
||||
import { getGithubData } from "@/lib/github";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET() {
|
||||
const codeberg = await getCodebergData();
|
||||
const github = await getGithubData();
|
||||
|
||||
const normalised: {
|
||||
type: string;
|
||||
date: Date;
|
||||
repo: string;
|
||||
repoName: string;
|
||||
}[] = [...codeberg.map(i => ({ type: i.op_type, date: new Date(i.created), repo: i.repo.html_url, repoName: i.repo.full_name })), ...github.map(i => ({ type: i.type, date: new Date(i.created_at), repo: i.repo.url.replace("api.github.com/repos", "github.com"), repoName: i.repo.name }))]
|
||||
|
||||
return NextResponse.json(normalised.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()).slice(0, 100))
|
||||
}
|
||||
Reference in New Issue
Block a user