1
1
import { personalPortrait , resume } from "@/constants/contentful-ids" ;
2
2
3
- import { contentful , db } from "./clients" ;
3
+ import { cms , db } from "./clients" ;
4
4
import {
5
5
type BlogPostSkeleton ,
6
6
type CourseCategory ,
@@ -15,23 +15,23 @@ import { blogPostMetadata } from "./schema";
15
15
import { cache , generatePdfThumbnail } from "./utils" ;
16
16
17
17
export const getPersonalPortrait = cache ( async ( ) => {
18
- const asset = await contentful . getAsset ( personalPortrait ) ;
18
+ const asset = await cms . getAsset ( personalPortrait ) ;
19
19
return asset . fields . file && `https:${ asset . fields . file . url } ` ;
20
20
} ) ;
21
21
22
22
export const getResume = cache ( async ( ) => {
23
- const asset = await contentful . getAsset ( resume ) ;
23
+ const asset = await cms . getAsset ( resume ) ;
24
24
return asset . fields . file && `https:${ asset . fields . file . url } ` ;
25
25
} ) ;
26
26
27
27
export const getSkillSet = cache ( async ( ) => {
28
28
const [ { items : skills } , { items : skillCategories } ] = await Promise . all ( [
29
- contentful . getEntries < SkillSkeleton > ( {
29
+ cms . getEntries < SkillSkeleton > ( {
30
30
content_type : "skill" ,
31
31
"fields.category[exists]" : true ,
32
32
order : [ "fields.name" ] ,
33
33
} ) ,
34
- contentful . getEntries < SkillCategorySkeleton > ( {
34
+ cms . getEntries < SkillCategorySkeleton > ( {
35
35
content_type : "skillCategory" ,
36
36
order : [ "-fields.proficiency" , "fields.name" ] ,
37
37
} ) ,
@@ -58,7 +58,7 @@ export const getExperiences = cache(async () => {
58
58
// Contentful always place undefined fields at the bottom,
59
59
// so we first sort in ASC and then reverse it
60
60
// 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 > ( {
62
62
content_type : "experience" ,
63
63
order : [ "fields.to" ] ,
64
64
} ) ;
@@ -114,7 +114,7 @@ export const getEducations = cache(async () => {
114
114
// Contentful always place undefined fields at the bottom,
115
115
// so we first sort in ASC and then reverse it
116
116
// 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 > ( {
118
118
content_type : "education" ,
119
119
order : [ "fields.to" ] ,
120
120
} ) ;
@@ -145,7 +145,7 @@ export const getEducations = cache(async () => {
145
145
146
146
export const getBlogPosts = cache ( async ( ) => {
147
147
const [ { items } , blogPostsMetadata ] = await Promise . all ( [
148
- contentful . getEntries < BlogPostSkeleton > ( {
148
+ cms . getEntries < BlogPostSkeleton > ( {
149
149
content_type : "blogPost" ,
150
150
order : [ "-fields.publishedAt" ] ,
151
151
} ) ,
@@ -167,7 +167,7 @@ export const getBlogPosts = cache(async () => {
167
167
} ) ;
168
168
169
169
export const getBlogPostBySlug = cache ( async ( slug : string ) => {
170
- const { items } = await contentful . getEntries < BlogPostSkeleton > ( {
170
+ const { items } = await cms . getEntries < BlogPostSkeleton > ( {
171
171
content_type : "blogPost" ,
172
172
"fields.slug[in]" : [ slug ] ,
173
173
limit : 1 ,
@@ -191,7 +191,7 @@ export const getBlogPostBySlug = cache(async (slug: string) => {
191
191
} ) ;
192
192
193
193
export const getContributedProjects = cache ( async ( ) => {
194
- const { items } = await contentful . getEntries < ProjectSkeleton > ( {
194
+ const { items } = await cms . getEntries < ProjectSkeleton > ( {
195
195
content_type : "project" ,
196
196
"metadata.tags.sys.id[in]" : [ "contributed" ] ,
197
197
order : [ "fields.name" ] ,
@@ -208,15 +208,15 @@ export const getContributedProjects = cache(async () => {
208
208
} ) ;
209
209
210
210
export const getCourseCategories = cache ( async ( ) => {
211
- const course = await contentful . getContentType ( "course" ) ;
211
+ const course = await cms . getContentType ( "course" ) ;
212
212
213
213
return course . fields
214
214
. find ( ( { id } ) => id === "categories" )
215
215
?. items ?. validations [ 0 ] ?. in ?. toSorted ( ) as CourseCategory [ ] | undefined ;
216
216
} ) ;
217
217
218
218
export const getCourses = cache ( async ( ) => {
219
- const { items } = await contentful . getEntries < CourseSkeleton > ( {
219
+ const { items } = await cms . getEntries < CourseSkeleton > ( {
220
220
content_type : "course" ,
221
221
order : [ "fields.name" ] ,
222
222
} ) ;
0 commit comments