@@ -25,7 +25,9 @@ import { singletonPlugin } from "./plugins/settings";
2525import { assistWithPresets } from "./plugins/assist" ;
2626import { editorialStructure } from "./structure" ;
2727import author from "./schemas/documents/author" ;
28+ import course from "./schemas/documents/course" ;
2829import guest from "./schemas/documents/guest" ;
30+ import lesson from "./schemas/documents/lesson" ;
2931import page from "./schemas/documents/page" ;
3032import podcast from "./schemas/documents/podcast" ;
3133import podcastType from "./schemas/documents/podcastType" ;
@@ -44,6 +46,36 @@ import trendSignal from "./schemas/documents/trendSignal";
4446// ── Shared constants ─────────────────────────────────────────────────
4547const projectId = process . env . SANITY_STUDIO_PROJECT_ID || "hfh83o0w" ;
4648const apiVersion = process . env . SANITY_STUDIO_API_VERSION || "2025-09-30" ;
49+ export const MEDIA_LIBRARY_ID =
50+ process . env . SANITY_STUDIO_MEDIA_LIBRARY_ID || "mlttp0BZbCpV" ;
51+
52+ export function buildMediaLibraryFilters ( dataset : "production" | "dev" ) {
53+ return [
54+ {
55+ name :
56+ dataset === "production"
57+ ? "Production Public Assets"
58+ : "Dev Sandbox Assets" ,
59+ query : `aspects.metadata.environment == "${ dataset } " && aspects.metadata.visibility != "private-vault"` ,
60+ } ,
61+ {
62+ name : "Editorial (Courses, Podcasts, Blog)" ,
63+ query : `aspects.metadata.environment == "${ dataset } " && aspects.metadata.category == "editorial"` ,
64+ } ,
65+ {
66+ name : "Guest Speaker Headshots" ,
67+ query : `aspects.metadata.environment == "${ dataset } " && aspects.metadata.category == "guest"` ,
68+ } ,
69+ {
70+ name : "Sponsor Logos & Creatives" ,
71+ query : `aspects.metadata.environment == "${ dataset } " && aspects.metadata.category == "sponsor"` ,
72+ } ,
73+ {
74+ name : "Studio Portal Vault (Private)" ,
75+ query : `aspects.metadata.environment == "${ dataset } " && (aspects.metadata.category == "portal-vault" || aspects.metadata.visibility == "private-vault")` ,
76+ } ,
77+ ] ;
78+ }
4779
4880// Set SANITY_STUDIO_DISABLE_PRESENTATION=true if you get network errors to api.sanity.io (e.g. firewall/VPN)
4981const presentationEnabled =
@@ -84,7 +116,9 @@ const schemaTypes = [
84116 sponsorConfig ,
85117 // Documents
86118 author ,
119+ course ,
87120 guest ,
121+ lesson ,
88122 page ,
89123 podcast ,
90124 podcastType ,
@@ -187,12 +221,23 @@ function buildPlugins(previewUrl: string): PluginOptions[] {
187221// ── Workspace definitions ────────────────────────────────────────────
188222const targetDataset = process . env . SANITY_STUDIO_DATASET ;
189223
224+ const sharedMediaLibraryConfig = {
225+ mediaLibrary : {
226+ enabled : true ,
227+ libraryId : MEDIA_LIBRARY_ID ,
228+ } ,
229+ auth : {
230+ loginMethod : "token" as const ,
231+ } ,
232+ } ;
233+
190234const devWorkspace = {
191235 name : "dev" ,
192236 title : "CodingCat.dev (Dev)" ,
193237 projectId,
194238 dataset : "dev" ,
195239 basePath : targetDataset === "dev" ? "/" : "/dev" ,
240+ ...sharedMediaLibraryConfig ,
196241 schema : { types : schemaTypes } ,
197242 plugins : buildPlugins (
198243 isLocal ? localPreviewOrigin : "https://dev.codingcat.dev" ,
@@ -205,6 +250,7 @@ const prodWorkspace = {
205250 projectId,
206251 dataset : "production" ,
207252 basePath : targetDataset === "production" ? "/" : "/production" ,
253+ ...sharedMediaLibraryConfig ,
208254 schema : { types : schemaTypes } ,
209255 plugins : buildPlugins (
210256 isLocal ? localPreviewOrigin : "https://codingcat.dev" ,
0 commit comments