-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a DB powered changelog (#456)
* Updated Prisma for new DB table * feat: Add changelog types + cached fetching * feat: added UX components to fetch changelogs * feat: wired into changelog index page * Yarned * Removed old styles * remove unused imports * Added placeholder default * Added multi-tenant * Scoped calls for tenants * Remove manual posts * removed bg white * added style feedback from review
- Loading branch information
Showing
11 changed files
with
233 additions
and
1,323 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 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,11 @@ | ||
import { DaoSlug } from "@prisma/client"; | ||
|
||
export type Changelog = { | ||
id: number; | ||
dao_slug: DaoSlug; | ||
title: string; | ||
body: string; | ||
author_address: string; | ||
created_at: Date; | ||
updated_at: Date; | ||
}; |
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,33 @@ | ||
import { cache } from "react"; | ||
import { | ||
PaginatedResult, | ||
paginateResult, | ||
PaginationParams, | ||
} from "@/app/lib/pagination"; | ||
import prisma from "@/app/lib/prisma"; | ||
import { DaoSlug } from "@prisma/client"; | ||
import { Changelog } from "./changelog"; | ||
|
||
async function getChangelogsForDAO({ | ||
daoSlug, | ||
pagination, | ||
}: { | ||
daoSlug: DaoSlug; | ||
pagination: PaginationParams; | ||
}): Promise<PaginatedResult<Changelog[]>> { | ||
const getChangelogsQuery = async (skip: number, take: number) => { | ||
return prisma.changelog.findMany({ | ||
where: { | ||
dao_slug: daoSlug, | ||
}, | ||
orderBy: { | ||
created_at: "desc", | ||
}, | ||
skip, | ||
take, | ||
}); | ||
}; | ||
|
||
return await paginateResult(getChangelogsQuery, pagination); | ||
} | ||
export const fetchChangelogForDAO = cache(getChangelogsForDAO); |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.