Loading actions/geocode.ts 0 → 100644 +31 −0 Viewed Changes for actions/geocode.ts: 31 added lines, 0 removed lines. Original line number Diff line number Diff line 'use server'; import { geocode } from 'opencage-api-client'; export interface GeoCoordinates { lat: number; lng: number; } export async function geocodeAddress(address: string): Promise<GeoCoordinates> { const geocodeApiKey = process.env.GEOCODE_API_KEY; if (!geocodeApiKey) { throw new Error('GEOCODE_API_KEY is not set on the server'); } const geocodeResponse = await geocode({ key: geocodeApiKey, q: address, language: 'en', limit: 1, no_annotations: 1, }); if (!geocodeResponse || geocodeResponse.results.length === 0) { throw new Error('No geocoding results found for the provided address.'); } const { lat, lng } = geocodeResponse.results[0].geometry; return { lat, lng }; } actions/individuals.ts +1 −1 Viewed Changes for actions/individuals.ts: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ export async function createIndividualFromSignup( const api = new PartyManagement(session); const { data, error } = await api.createIndividual(individual, session); console.log('Sent new party individual'); return { data: data ? JSON.parse(JSON.stringify(data)) : undefined, error: error ? JSON.parse(JSON.stringify(error)) : undefined, Loading actions/services.ts +36 −0 Viewed Changes for actions/services.ts: 36 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ import { auth } from '@/auth'; import { Session } from 'next-auth'; import { ServiceInventoryManagement } from '@/services/tmf'; import { Api as ApiTmf638, Error as ErrorTmf638, Service, ServiceUpdate } from '@/services/tmf638'; export async function getListService({ fields, Loading Loading @@ -67,6 +68,41 @@ export async function getKubernetesServices() { return api.listService(query); } export async function getService(id: string): Promise<{ data?: Service; error?: ErrorTmf638 }> { const session: Session | null = await auth(); const api = new ServiceInventoryManagement(session); try { const response = await api.retrieveService(id); return { data: response.data, error: response.error }; } catch (error) { return { error: { code: 'UNKNOWN_ERROR', reason: error instanceof Error ? error.message : String(error), }, }; } } export async function serviceEdit( serviceId: string, service: Partial<ServiceUpdate>, ): Promise<{ data?: Service; error?: ErrorTmf638 }> { const session: Session | null = await auth(); const api = new ServiceInventoryManagement(session); try { const response = await api.patchService(serviceId, service); return { data: response.data, error: response.error }; } catch (error) { return { error: { code: 'UNKNOWN_ERROR', reason: error instanceof Error ? error.message : String(error), }, }; } } // export async function getListService({ orderDateFrom, orderDateTo, offset, limit }: { orderDateFrom: string | undefined; orderDateTo: string | undefined; offset: number; limit: number; }) { // const session: Session | null = await auth(); // const api = new ServiceOrderingManagement(session); Loading app/marketplace/page.tsx +6 −7 Viewed Changes for app/marketplace/page.tsx: 6 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -14,12 +14,12 @@ import { hasAccessToView } from '@/actions/roles-viewAccess'; export const dynamic = 'force-dynamic'; function getCurrentPath() { if (typeof window !== 'undefined') { return window.location.pathname; } return ''; } // function getCurrentPath() { // if (typeof window !== 'undefined') { // return window.location.pathname; // } // return ''; // } export default async function Marketplace({ searchParams, Loading Loading @@ -78,7 +78,6 @@ export default async function Marketplace({ {data.serviceSpecifications?.data?.map((serviceSpecification) => ( <ServiceSpecificationCard userId={data.session?.user?.name || ''} currentPath={getCurrentPath()} key={serviceSpecification.id} serviceSpecification={serviceSpecification} /> Loading app/layout.tsx +7 −1 Viewed Changes for app/layout.tsx: 7 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import React from 'react'; import { NextUIProvider } from '@nextui-org/react'; import type { Metadata } from 'next'; import { Roboto } from 'next/font/google'; import './globals.css'; export const metadata: Metadata = { Loading @@ -9,13 +10,18 @@ export const metadata: Metadata = { description: 'HypO Portal', }; const roboto = Roboto({ subsets: ['latin'], weight: ['100', '300', '400', '500', '700', '900'], }); export default function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { return ( <html lang="en"> <html lang="en" className={roboto.className}> <body> <NextUIProvider className="h-full">{children}</NextUIProvider> </body> Loading Loading
actions/geocode.ts 0 → 100644 +31 −0 Viewed Changes for actions/geocode.ts: 31 added lines, 0 removed lines. Original line number Diff line number Diff line 'use server'; import { geocode } from 'opencage-api-client'; export interface GeoCoordinates { lat: number; lng: number; } export async function geocodeAddress(address: string): Promise<GeoCoordinates> { const geocodeApiKey = process.env.GEOCODE_API_KEY; if (!geocodeApiKey) { throw new Error('GEOCODE_API_KEY is not set on the server'); } const geocodeResponse = await geocode({ key: geocodeApiKey, q: address, language: 'en', limit: 1, no_annotations: 1, }); if (!geocodeResponse || geocodeResponse.results.length === 0) { throw new Error('No geocoding results found for the provided address.'); } const { lat, lng } = geocodeResponse.results[0].geometry; return { lat, lng }; }
actions/individuals.ts +1 −1 Viewed Changes for actions/individuals.ts: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -92,7 +92,7 @@ export async function createIndividualFromSignup( const api = new PartyManagement(session); const { data, error } = await api.createIndividual(individual, session); console.log('Sent new party individual'); return { data: data ? JSON.parse(JSON.stringify(data)) : undefined, error: error ? JSON.parse(JSON.stringify(error)) : undefined, Loading
actions/services.ts +36 −0 Viewed Changes for actions/services.ts: 36 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ import { auth } from '@/auth'; import { Session } from 'next-auth'; import { ServiceInventoryManagement } from '@/services/tmf'; import { Api as ApiTmf638, Error as ErrorTmf638, Service, ServiceUpdate } from '@/services/tmf638'; export async function getListService({ fields, Loading Loading @@ -67,6 +68,41 @@ export async function getKubernetesServices() { return api.listService(query); } export async function getService(id: string): Promise<{ data?: Service; error?: ErrorTmf638 }> { const session: Session | null = await auth(); const api = new ServiceInventoryManagement(session); try { const response = await api.retrieveService(id); return { data: response.data, error: response.error }; } catch (error) { return { error: { code: 'UNKNOWN_ERROR', reason: error instanceof Error ? error.message : String(error), }, }; } } export async function serviceEdit( serviceId: string, service: Partial<ServiceUpdate>, ): Promise<{ data?: Service; error?: ErrorTmf638 }> { const session: Session | null = await auth(); const api = new ServiceInventoryManagement(session); try { const response = await api.patchService(serviceId, service); return { data: response.data, error: response.error }; } catch (error) { return { error: { code: 'UNKNOWN_ERROR', reason: error instanceof Error ? error.message : String(error), }, }; } } // export async function getListService({ orderDateFrom, orderDateTo, offset, limit }: { orderDateFrom: string | undefined; orderDateTo: string | undefined; offset: number; limit: number; }) { // const session: Session | null = await auth(); // const api = new ServiceOrderingManagement(session); Loading
app/marketplace/page.tsx +6 −7 Viewed Changes for app/marketplace/page.tsx: 6 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -14,12 +14,12 @@ import { hasAccessToView } from '@/actions/roles-viewAccess'; export const dynamic = 'force-dynamic'; function getCurrentPath() { if (typeof window !== 'undefined') { return window.location.pathname; } return ''; } // function getCurrentPath() { // if (typeof window !== 'undefined') { // return window.location.pathname; // } // return ''; // } export default async function Marketplace({ searchParams, Loading Loading @@ -78,7 +78,6 @@ export default async function Marketplace({ {data.serviceSpecifications?.data?.map((serviceSpecification) => ( <ServiceSpecificationCard userId={data.session?.user?.name || ''} currentPath={getCurrentPath()} key={serviceSpecification.id} serviceSpecification={serviceSpecification} /> Loading
app/layout.tsx +7 −1 Viewed Changes for app/layout.tsx: 7 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ import React from 'react'; import { NextUIProvider } from '@nextui-org/react'; import type { Metadata } from 'next'; import { Roboto } from 'next/font/google'; import './globals.css'; export const metadata: Metadata = { Loading @@ -9,13 +10,18 @@ export const metadata: Metadata = { description: 'HypO Portal', }; const roboto = Roboto({ subsets: ['latin'], weight: ['100', '300', '400', '500', '700', '900'], }); export default function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { return ( <html lang="en"> <html lang="en" className={roboto.className}> <body> <NextUIProvider className="h-full">{children}</NextUIProvider> </body> Loading