Office Hour block, codebase clean up for schemas and utils
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export interface EventPost {
|
||||
export type EventPost = {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
@@ -9,16 +9,7 @@ export interface EventPost {
|
||||
link: string;
|
||||
category: string;
|
||||
payment: string; // event payment link (e.g., Zeffy)
|
||||
}
|
||||
|
||||
export interface CouncilMember {
|
||||
role: string;
|
||||
name: string;
|
||||
email: string;
|
||||
image: string;
|
||||
major: string;
|
||||
year: string;
|
||||
}
|
||||
};
|
||||
|
||||
import type { InputValue } from '@portabletext/svelte';
|
||||
|
||||
@@ -35,8 +26,19 @@ export type OhCMSResponse = {
|
||||
day: string;
|
||||
startTime: string;
|
||||
endTime: string;
|
||||
host: {
|
||||
member: {
|
||||
name: string;
|
||||
position: string;
|
||||
};
|
||||
}[];
|
||||
|
||||
export type CouncilMember = {
|
||||
name: string;
|
||||
email: string;
|
||||
position: string;
|
||||
positionDescription: string;
|
||||
image: string; // URL
|
||||
yearProgram: string;
|
||||
};
|
||||
|
||||
export type Redirect = { shortname: string; url: string };
|
||||
|
||||
18
src/lib/utils.js
Normal file
18
src/lib/utils.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import { createClient } from '@sanity/client';
|
||||
import { SANITY_ID } from '$env/static/private';
|
||||
|
||||
const client = createClient({
|
||||
projectId: SANITY_ID,
|
||||
dataset: 'production',
|
||||
useCdn: true,
|
||||
apiVersion: '2025-02-06'
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {String} query the GROQ query from Sanity CMS
|
||||
*/
|
||||
export async function getFromCMS(query) {
|
||||
return await client.fetch(query);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user