|
| 1 | +#!/usr/bin/env tsx |
| 2 | + |
| 3 | +import dotenv from 'dotenv'; |
| 4 | +import path from 'path'; |
| 5 | +import { createClient } from '@sanity/client'; |
| 6 | + |
| 7 | +dotenv.config({ path: path.resolve(process.cwd(), '.env.local') }); |
| 8 | + |
| 9 | +async function main() { |
| 10 | + const client = createClient({ |
| 11 | + projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID!, |
| 12 | + dataset: process.env.NEXT_PUBLIC_SANITY_DATASET!, |
| 13 | + apiVersion: '2023-12-19', |
| 14 | + useCdn: false, |
| 15 | + token: process.env.SANITY_API_EDITOR_TOKEN!, |
| 16 | + }); |
| 17 | + |
| 18 | + // Check if Huck already exists |
| 19 | + const existing = await client.fetch( |
| 20 | + '*[_type == "person" && slug.current == "huck-rees"][0]' |
| 21 | + ); |
| 22 | + |
| 23 | + if (existing) { |
| 24 | + console.log('✅ Huck Rees already exists in Sanity!'); |
| 25 | + console.log('Person ID:', existing._id); |
| 26 | + return; |
| 27 | + } |
| 28 | + |
| 29 | + const bioShort = "PhD student in Geography studying river systems, floodplains, and wetland dynamics. Researches sediment transport, water availability, carbon sequestration, and river morphology across multiple scales."; |
| 30 | + |
| 31 | + const bioLong = `Huck is a PhD student in Geography at UC Santa Barbara studying the dynamics of rivers, floodplains, and wetlands and how they respond to change. His work spans questions of sediment transport and storage, water availability, carbon sequestration, and river morphology, connecting processes across a wide range of scales and environments. At the global scale, he develops globally applicable tools for mapping river systems and tracing how sediment is routed and stored across large drainage networks, drawing on remote sensing archives and numerical modeling to build a more complete picture of how the world's rivers function. At the regional scale, he investigates how shifting channel networks in the Okavango Delta redistribute water and reshape wetland ecosystems in response to flood pulses. Closer to home, he studies how beaver-based restoration alters channel morphology, stores sediment, and improves conditions for carbon storage and ecosystem recovery. Drawing on fieldwork, satellite observation, and computational modeling, his research seeks to understand how natural and managed changes to river systems ripple through watersheds, and how thoughtful, empirically driven monitoring and intervention can build resilience in a rapidly changing world.`; |
| 32 | + |
| 33 | + const personData = { |
| 34 | + _type: 'person', |
| 35 | + _id: 'person-huck-rees', |
| 36 | + name: 'Huck Rees', |
| 37 | + slug: { |
| 38 | + _type: 'slug', |
| 39 | + current: 'huck-rees' |
| 40 | + }, |
| 41 | + title: 'PhD Student', |
| 42 | + category: 'graduate-student', |
| 43 | + userGroup: 'current', |
| 44 | + email: 'jamesrees@ucsb.edu', |
| 45 | + bio: bioShort, |
| 46 | + bioLong: bioLong, |
| 47 | + socialMedia: { |
| 48 | + orcid: '0009-0004-4895-2243', |
| 49 | + googleScholar: 'https://scholar.google.com/citations?user=VdIf-LkAAAAJ&hl=en', |
| 50 | + linkedin: 'https://www.linkedin.com/in/james-rees-12b205157/', |
| 51 | + }, |
| 52 | + education: [ |
| 53 | + { |
| 54 | + _key: 'edu-1', |
| 55 | + degree: 'BA', |
| 56 | + field: 'Geology and History (Minor: GIS)', |
| 57 | + institution: 'UC Davis', |
| 58 | + year: 2019 |
| 59 | + }, |
| 60 | + { |
| 61 | + _key: 'edu-2', |
| 62 | + degree: 'MA', |
| 63 | + field: 'Geography (Fluvial Geomorphology, Hydrology Certificate)', |
| 64 | + institution: 'University of Colorado Boulder', |
| 65 | + year: 2021 |
| 66 | + } |
| 67 | + ], |
| 68 | + researchInterests: [ |
| 69 | + 'River Systems', |
| 70 | + 'Floodplain Dynamics', |
| 71 | + 'Wetland Ecosystems', |
| 72 | + 'Sediment Transport', |
| 73 | + 'Water Availability', |
| 74 | + 'Carbon Sequestration', |
| 75 | + 'River Morphology', |
| 76 | + 'Remote Sensing', |
| 77 | + 'Fluvial Geomorphology', |
| 78 | + 'Beaver-Based Restoration', |
| 79 | + 'Okavango Delta', |
| 80 | + 'Watershed Management' |
| 81 | + ], |
| 82 | + isActive: true, |
| 83 | + }; |
| 84 | + |
| 85 | + console.log('Creating person record in Sanity...'); |
| 86 | + const result = await client.create(personData); |
| 87 | + console.log('✅ Person created successfully!'); |
| 88 | + console.log('Person ID:', result._id); |
| 89 | + console.log('Slug:', result.slug.current); |
| 90 | +} |
| 91 | + |
| 92 | +main().catch((err) => { |
| 93 | + console.error('Error:', err?.message || err); |
| 94 | + process.exit(1); |
| 95 | +}); |
0 commit comments