Update some metadata for the photo category page
This commit is contained in:
@@ -239,7 +239,7 @@ export async function getCategoryAlbums(settings: GlobalSettings, route: string)
|
||||
const client = await createDirectusConnection();
|
||||
const result = await client.query(print(getCategoryAlbumQuery), {
|
||||
date: formatDate(new Date(), "%Y-%M-%D"),
|
||||
categoryUrl: `/${route}`
|
||||
categoryUrl: route
|
||||
});
|
||||
|
||||
let albums: PhotoAlbum[] = [];
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createDirectusConnection } from "@/lib/directus";
|
||||
import { print } from "graphql";
|
||||
import getCategories from '@/graphql/photos/getCategories.graphql';
|
||||
import getCategory from '@/graphql/photos/getCategory.graphql';
|
||||
|
||||
export async function getAllCategories(settings: GlobalSettings): Promise<PhotoAlbumCategory[]> {
|
||||
const client = await createDirectusConnection();
|
||||
@@ -23,3 +24,26 @@ export async function getAllCategories(settings: GlobalSettings): Promise<PhotoA
|
||||
|
||||
return categories;
|
||||
}
|
||||
|
||||
export async function getPhotoCategory(url: string): Promise<PhotoAlbumCategory> {
|
||||
const client = await createDirectusConnection();
|
||||
const result = await client.query(print(getCategory), {
|
||||
url: url
|
||||
});
|
||||
|
||||
const item = result["Photo_Categories"][0];
|
||||
|
||||
let categories: PhotoAlbumCategory = {
|
||||
id: item["id"],
|
||||
title: item["title"],
|
||||
url: item["url"],
|
||||
thumbnail: {
|
||||
url: item["thumbnail"]["filename_disk"],
|
||||
width: item["thumbnail"]["width"],
|
||||
height: item["thumbnail"]["height"]
|
||||
}
|
||||
};
|
||||
|
||||
return categories;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user