Also added photo types

This commit is contained in:
Anton Pogrebnjak
2026-04-06 22:56:43 +02:00
parent da9d256b71
commit c0a7f193db

32
src/models/Photo.ts Normal file
View 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,
};
}