Merge Develop to Main

Merge request reports

Loading

actions/geocode.ts

0 → 100644
+31 −0
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 };
}
+1 −1
Changes for actions/individuals.ts: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -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,
+36 −0
Changes for actions/services.ts: 36 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -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,
@@ -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);
+6 −7
Changes for app/marketplace/page.tsx: 6 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -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,
@@ -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}
                  />
+7 −1
Changes for app/layout.tsx: 7 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -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 = {
@@ -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