diff --git a/server/api/review-tags/index.get.ts b/server/api/review-tags/index.get.ts new file mode 100644 index 00000000..a4c58f71 --- /dev/null +++ b/server/api/review-tags/index.get.ts @@ -0,0 +1,10 @@ +import { type ReviewTag } from '../../db/schema'; +import authenticateAdminRequest from '../../utils/admin'; + +export default defineEventHandler(async (event) => { + await authenticateAdminRequest(event); + + const reviewTags = (await general_memoryStorage.getItem('reviewTags')) || []; + + return reviewTags; +}); diff --git a/server/utils/tasks/seed-cache.ts b/server/utils/tasks/seed-cache.ts index 9ef9ccb5..f397617f 100644 --- a/server/utils/tasks/seed-cache.ts +++ b/server/utils/tasks/seed-cache.ts @@ -1,5 +1,5 @@ import { desc, inArray } from 'drizzle-orm'; -import { jobPostingsTable, metaDataTable } from '~~/server/db/schema'; +import { jobPostingsTable, reviewTagsTable, metaDataTable } from '~~/server/db/schema'; import type { CareerSiteConfig, SEOConfig } from '~~/shared/schemas/setting'; export async function seedCache() { @@ -12,6 +12,8 @@ export async function seedCache() { .from(metaDataTable) .where(inArray(metaDataTable.key, ['seoConfig', 'careerSiteConfig', 'firstSetupAccessKey'])); + const reviewTags = await db.select().from(reviewTagsTable); + // Do not save totalApplicants in cache const jobPostings = (await db.select().from(jobPostingsTable).orderBy(desc(jobPostingsTable.createdAt))).map((p) => ({ ...p, @@ -41,6 +43,7 @@ export async function seedCache() { general_memoryStorage.setItem('firstSetupAccessKey', firstSetupAccessKey), general_memoryStorage.setItem('remoteAssetBase', remoteAssetBase), general_memoryStorage.setItem('postings', jobPostings), + general_memoryStorage.setItem('reviewTags', reviewTags), ]); return { result: true };