Skip to content

Commit

Permalink
W Persistence (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
typesafeui authored Aug 27, 2024
1 parent 8813b03 commit 103498d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/lib/persistence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getAllPostsVotesMoarBetter,
} from "./data";
import db from "../db";
import { hasAi } from "../utils/string";
import { hasAi, PRODUCT_HUNT_NAME } from "../utils/string";
import { Post as PostType } from "../types";
import { Prisma } from "@prisma/client";
import { getStartAndEndOfDayInUTC } from "../utils/date";
Expand Down Expand Up @@ -153,7 +153,7 @@ export async function fetchAndUpdateDatabase() {
await db.post.updateMany({
where: {
id: {
notIn: posts.map((post) => post.id),
notIn: posts.filter((product) => product.name !== PRODUCT_HUNT_NAME).map((post) => post.id),
},
deleted: false,
},
Expand Down
4 changes: 3 additions & 1 deletion src/app/utils/string.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { ProductPost } from "../types";

export const PRODUCT_HUNT_NAME = "OGHUNT";

export const hasAi = (
post: {
name: ProductPost["name"];
Expand All @@ -9,7 +11,7 @@ export const hasAi = (
},
showOnlyAi = false,
): boolean => {
if (post.name === "OGHUNT") {
if (post.name === PRODUCT_HUNT_NAME) {
return !showOnlyAi;
}

Expand Down

0 comments on commit 103498d

Please sign in to comment.