Skip to content

Commit 89c0477

Browse files
committed
refactor: rename contentful to cms
1 parent 5eaa480 commit 89c0477

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/lib/clients.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import "server-only";
33
import { createClient } from "contentful";
44
import { drizzle } from "drizzle-orm/neon-http";
55

6-
export const contentful = createClient({
6+
export const cms = createClient({
77
space: process.env.CONTENTFUL_SPACE_ID ?? "",
88
accessToken: process.env.CONTENTFUL_ACCESS_TOKEN ?? "",
99
environment: process.env.CONTENTFUL_ENVIRONMENT,

src/lib/queries.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { personalPortrait, resume } from "@/constants/contentful-ids";
22

3-
import { contentful, db } from "./clients";
3+
import { cms, db } from "./clients";
44
import {
55
type BlogPostSkeleton,
66
type CourseCategory,
@@ -15,23 +15,23 @@ import { blogPostMetadata } from "./schema";
1515
import { cache, generatePdfThumbnail } from "./utils";
1616

1717
export const getPersonalPortrait = cache(async () => {
18-
const asset = await contentful.getAsset(personalPortrait);
18+
const asset = await cms.getAsset(personalPortrait);
1919
return asset.fields.file && `https:${asset.fields.file.url}`;
2020
});
2121

2222
export const getResume = cache(async () => {
23-
const asset = await contentful.getAsset(resume);
23+
const asset = await cms.getAsset(resume);
2424
return asset.fields.file && `https:${asset.fields.file.url}`;
2525
});
2626

2727
export const getSkillSet = cache(async () => {
2828
const [{ items: skills }, { items: skillCategories }] = await Promise.all([
29-
contentful.getEntries<SkillSkeleton>({
29+
cms.getEntries<SkillSkeleton>({
3030
content_type: "skill",
3131
"fields.category[exists]": true,
3232
order: ["fields.name"],
3333
}),
34-
contentful.getEntries<SkillCategorySkeleton>({
34+
cms.getEntries<SkillCategorySkeleton>({
3535
content_type: "skillCategory",
3636
order: ["-fields.proficiency", "fields.name"],
3737
}),
@@ -58,7 +58,7 @@ export const getExperiences = cache(async () => {
5858
// Contentful always place undefined fields at the bottom,
5959
// so we first sort in ASC and then reverse it
6060
// such that it's in DESC order while undefined values are at the top
61-
const { items } = await contentful.getEntries<ExperienceSkeleton>({
61+
const { items } = await cms.getEntries<ExperienceSkeleton>({
6262
content_type: "experience",
6363
order: ["fields.to"],
6464
});
@@ -114,7 +114,7 @@ export const getEducations = cache(async () => {
114114
// Contentful always place undefined fields at the bottom,
115115
// so we first sort in ASC and then reverse it
116116
// such that it's in DESC order while undefined values are at the top
117-
const { items } = await contentful.getEntries<EducationSkeleton>({
117+
const { items } = await cms.getEntries<EducationSkeleton>({
118118
content_type: "education",
119119
order: ["fields.to"],
120120
});
@@ -145,7 +145,7 @@ export const getEducations = cache(async () => {
145145

146146
export const getBlogPosts = cache(async () => {
147147
const [{ items }, blogPostsMetadata] = await Promise.all([
148-
contentful.getEntries<BlogPostSkeleton>({
148+
cms.getEntries<BlogPostSkeleton>({
149149
content_type: "blogPost",
150150
order: ["-fields.publishedAt"],
151151
}),
@@ -167,7 +167,7 @@ export const getBlogPosts = cache(async () => {
167167
});
168168

169169
export const getBlogPostBySlug = cache(async (slug: string) => {
170-
const { items } = await contentful.getEntries<BlogPostSkeleton>({
170+
const { items } = await cms.getEntries<BlogPostSkeleton>({
171171
content_type: "blogPost",
172172
"fields.slug[in]": [slug],
173173
limit: 1,
@@ -191,7 +191,7 @@ export const getBlogPostBySlug = cache(async (slug: string) => {
191191
});
192192

193193
export const getContributedProjects = cache(async () => {
194-
const { items } = await contentful.getEntries<ProjectSkeleton>({
194+
const { items } = await cms.getEntries<ProjectSkeleton>({
195195
content_type: "project",
196196
"metadata.tags.sys.id[in]": ["contributed"],
197197
order: ["fields.name"],
@@ -208,15 +208,15 @@ export const getContributedProjects = cache(async () => {
208208
});
209209

210210
export const getCourseCategories = cache(async () => {
211-
const course = await contentful.getContentType("course");
211+
const course = await cms.getContentType("course");
212212

213213
return course.fields
214214
.find(({ id }) => id === "categories")
215215
?.items?.validations[0]?.in?.toSorted() as CourseCategory[] | undefined;
216216
});
217217

218218
export const getCourses = cache(async () => {
219-
const { items } = await contentful.getEntries<CourseSkeleton>({
219+
const { items } = await cms.getEntries<CourseSkeleton>({
220220
content_type: "course",
221221
order: ["fields.name"],
222222
});

0 commit comments

Comments
 (0)