mirror of
https://github.com/Pantonius/pantosite-astro.git
synced 2026-04-26 09:24:38 +00:00
Also added photo types
This commit is contained in:
32
src/models/Photo.ts
Normal file
32
src/models/Photo.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
export type CollectionPhoto = {
|
||||
id: string;
|
||||
collection: "photography";
|
||||
data: {
|
||||
title: string,
|
||||
src: string,
|
||||
pubDate: Date,
|
||||
description: string
|
||||
};
|
||||
filePath?: string;
|
||||
};
|
||||
|
||||
export type Photo = {
|
||||
id: string,
|
||||
title: string;
|
||||
src: string;
|
||||
pubDate: Date;
|
||||
description: string;
|
||||
|
||||
collection: "photography";
|
||||
};
|
||||
|
||||
export const convertPhoto = (collectionPhoto: CollectionPhoto): Photo => {
|
||||
return {
|
||||
id: collectionPhoto.id,
|
||||
title: collectionPhoto.data.title,
|
||||
src: "/images/photography/" + collectionPhoto.data.src,
|
||||
pubDate: collectionPhoto.data.pubDate,
|
||||
description: collectionPhoto.data.description,
|
||||
collection: collectionPhoto.collection,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user