@@ -6,14 +6,14 @@ import {
66 createApiResponse ,
77} from "~/utils/supabase/apiUtils" ;
88import { asJsonLD , wrapJsonLd } from "~/utils/conversion/jsonld" ;
9- import { Tables } from "@repo/database/dbTypes" ;
9+ import type { Tables , Enums } from "@repo/database/dbTypes" ;
1010import { PostgrestMaybeSingleResponse } from "@supabase/supabase-js" ;
1111import { MIMETYPES , type DocType } from "~/utils/conversion/convert" ;
1212
1313type Concept = Tables < "Concept" > ;
1414type Content = Tables < "Content" > ;
15- type Space = Tables < "Space" > ;
1615type PlatformAccount = Tables < "PlatformAccount" > ;
16+ type Platform = Enums < "Platform" > ;
1717
1818export type SegmentDataType = { params : Promise < Record < string , string > > } ;
1919
@@ -53,15 +53,18 @@ export const GET = async (
5353 if ( spaceResponse . error ) {
5454 return createApiResponse ( request , spaceResponse ) ;
5555 }
56- if ( ! spaceResponse . data ) {
56+ let platform : Platform = "Obsidian" ;
57+ if ( spaceResponse . data ) {
58+ platform = spaceResponse . data . platform ;
59+ } else {
5760 // consideration: We may not see it because we don't have access,
58- // so it would be worth re-fetching as superuser to see if I should redirect to login.
59- return createApiResponse (
60- request ,
61- asPostgrestFailure ( "Space not found" , "401" , 401 ) ,
62- ) ;
61+ // We should find a way to check its platform otherwise.
62+ // Let's just keep the Obsidian guess for MIRA demo.
63+ // return createApiResponse(
64+ // request,
65+ // asPostgrestFailure("Space not found", "401", 401),
66+ // );
6367 }
64- const space : Space = spaceResponse . data ;
6568 const conceptResponse = await supabase
6669 . from ( "Concept" )
6770 . select ( )
@@ -161,7 +164,7 @@ export const GET = async (
161164 const relationsJLD = withContext
162165 ? relations . map ( ( c ) =>
163166 asJsonLD ( {
164- space ,
167+ platform ,
165168 concept : c ,
166169 baseUrl,
167170 schema : c . schema_id ? schemas [ c . schema_id ] : undefined ,
@@ -172,7 +175,7 @@ export const GET = async (
172175 const schemasJLD = withSchema
173176 ? Object . values ( schemas ) . map ( ( c ) =>
174177 asJsonLD ( {
175- space ,
178+ platform ,
176179 concept : c ,
177180 baseUrl,
178181 author : c . author_id ? authors [ c . author_id ] : undefined ,
@@ -181,7 +184,7 @@ export const GET = async (
181184 : [ ] ;
182185
183186 const baseJLDData = asJsonLD ( {
184- space ,
187+ platform ,
185188 concept,
186189 baseUrl,
187190 title,
0 commit comments