diff --git a/src/models/Photo.ts b/src/models/Photo.ts new file mode 100644 index 0000000..cbb4449 --- /dev/null +++ b/src/models/Photo.ts @@ -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, + }; +}