1- import { OrbisDB } from "@useorbis/db-sdk" ;
1+ //import { OrbisDB } from "@useorbis/db-sdk";
2+ import axios from "axios" ;
23
3- const orbisdb = new OrbisDB ( {
4- ceramic : {
5- gateway : process . env . NEXT_PUBLIC_CERAMIC_URL || ''
6- } ,
7- nodes : [
8- {
9- gateway : process . env . NEXT_PUBLIC_ORBIS_NODE_URL || '' ,
10- env : process . env . NEXT_PUBLIC_ORBIS_ENV || ''
11- }
12- ]
13- } )
4+ // const orbisdb = new OrbisDB({
5+ // ceramic: {
6+ // gateway: process.env.NEXT_PUBLIC_CERAMIC_URL || ''
7+ // },
8+ // nodes: [
9+ // {
10+ // gateway: process.env.NEXT_PUBLIC_ORBIS_NODE_URL || '',
11+ // env: process.env.NEXT_PUBLIC_ORBIS_ENV || ''
12+ // }
13+ // ]
14+ // })
1415
15- const data = {
16- contexts : {
17- plurality : process . env . NEXT_PUBLIC_PLURALITY_CONTEXT ,
18- } ,
19- models : {
20- test_model : process . env . NEXT_PUBLIC_TEST_MODEL ,
21- profile_type_model : process . env . NEXT_PUBLIC_PROFILE_TYPE_MODEL
22- }
23- }
16+ // const data = {
17+ // contexts: {
18+ // plurality: process.env.NEXT_PUBLIC_PLURALITY_CONTEXT,
19+ // },
20+ // models: {
21+ // test_model: process.env.NEXT_PUBLIC_TEST_MODEL,
22+ // profile_type_model: process.env.NEXT_PUBLIC_PROFILE_TYPE_MODEL
23+ // }
24+ // }
2425
26+ // export async function selectProfileType1(stream_id: string) {
27+ // try {
28+ // let selectStatement = await orbisdb.select().from(data.models.profile_type_model || '')
29+ // .where({
30+ // stream_id: stream_id
31+ // })
32+ // .context(process.env.NEXT_PUBLIC_PLURALITY_CONTEXT || '');
33+ // // const query = selectStatement.build()
34+ // // console.log("Query that will be run", query)
35+ // const result= await selectStatement.run();
36+ // // console.log("Result", result)
37+ // // console.log(result);
38+ // // columns: Array<string>
39+ // // rows: Array<T | Record<string, any>>
40+ // const { columns, rows } = result
41+ // // console.log({ columns, rows });
42+ // return { columns, rows };
43+ // }
44+ // catch (error) {
45+ // console.log("Error", error)
46+ // }
47+ // }
48+
49+
2550 export async function selectProfileType ( stream_id : string ) {
26- try {
27- let selectStatement = await orbisdb . select ( ) . from ( data . models . profile_type_model || '' )
28- . where ( {
29- stream_id : stream_id
30- } )
31- . context ( process . env . NEXT_PUBLIC_PLURALITY_CONTEXT || '' ) ;
32- // const query = selectStatement.build()
33- // console.log("Query that will be run", query)
34- const result = await selectStatement . run ( ) ;
35- // console.log("Result", result)
36- // console.log(result);
37- // columns: Array<string>
38- // rows: Array<T | Record<string, any>>
39- const { columns, rows } = result
40- // console.log({ columns, rows });
41- return { columns, rows } ;
42- }
43- catch ( error ) {
44- console . log ( "Error" , error )
45- }
46- }
51+ const apiUrl = `${ process . env . NEXT_PUBLIC_DASHBOARD_API } /orbis-map/profile-types/${ stream_id } `
52+ const result = await axios . get ( apiUrl )
53+ // console.log("Data asd", result, result.data.data)
54+ return { profileTypeData : result . data . data }
55+ }
0 commit comments