- {dummyCards.map(({
- title,
- description,
- icon,
- cardVariant,
- descriptionColor,
- iconBg,
- }) => (
+
+ {heroCategories.map(({ name, description, color, handle }) => (
-
+
- {icon}
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+ {name}
+ {description}
))}
diff --git a/app/home/(user)/_components/service-categories.tsx b/app/home/(user)/_components/service-categories.tsx
new file mode 100644
index 0000000..148f109
--- /dev/null
+++ b/app/home/(user)/_components/service-categories.tsx
@@ -0,0 +1,61 @@
+'use client';
+
+import React from 'react';
+
+import { redirect } from 'next/navigation';
+
+import { createPath, pathsConfig } from '@/packages/shared/src/config';
+import { ComponentInstanceIcon } from '@radix-ui/react-icons';
+
+import { cn } from '@kit/ui/shadcn';
+import { Card, CardDescription, CardTitle } from '@kit/ui/shadcn/card';
+
+export interface ServiceCategory {
+ name: string;
+ handle: string;
+ color: string;
+ description: string;
+}
+
+const ServiceCategories = ({
+ categories,
+}: {
+ categories: ServiceCategory[];
+}) => {
+ return (
+
+ {categories.map((category, index) => (
+
{
+ redirect(
+ pathsConfig.app.bookingHandle.replace(
+ '[handle]',
+ category.handle,
+ ),
+ );
+ }}
+ >
+
+
+
+
+
{category.name}
+
+ {category.description}
+
+
+
+ ))}
+
+ );
+};
+
+export default ServiceCategories;
diff --git a/app/home/(user)/_lib/server/load-analyses.ts b/app/home/(user)/_lib/server/load-analyses.ts
index 424ff25..db22011 100644
--- a/app/home/(user)/_lib/server/load-analyses.ts
+++ b/app/home/(user)/_lib/server/load-analyses.ts
@@ -1,9 +1,11 @@
import { cache } from 'react';
-import { listProductTypes } from "@lib/data/products";
-import { listRegions } from '@lib/data/regions';
import { getProductCategories } from '@lib/data/categories';
+import { listProductTypes } from '@lib/data/products';
+import { listRegions } from '@lib/data/regions';
+
import { OrderAnalysisCard } from '../../_components/order-analyses-cards';
+import { ServiceCategory } from '../../_components/service-categories';
async function countryCodesLoader() {
const countryCodes = await listRegions().then((regions) =>
@@ -14,7 +16,9 @@ async function countryCodesLoader() {
export const loadCountryCodes = cache(countryCodesLoader);
async function productCategoriesLoader() {
- const productCategories = await getProductCategories({ fields: "*products, *products.variants" });
+ const productCategories = await getProductCategories({
+ fields: '*products, *products.variants, is_active',
+ });
return productCategories.product_categories ?? [];
}
export const loadProductCategories = cache(productCategoriesLoader);
@@ -29,25 +33,34 @@ async function analysesLoader() {
const [countryCodes, productCategories] = await Promise.all([
loadCountryCodes(),
loadProductCategories(),
- ]);
+ ]);
const countryCode = countryCodes[0]!;
- const category = productCategories.find(({ metadata }) => metadata?.page === 'order-analysis');
-
+ const category = productCategories.find(
+ ({ metadata }) => metadata?.page === 'order-analysis',
+ );
+ const serviceCategories = productCategories.filter(
+ ({ parent_category }) => parent_category?.handle === 'tto-categories',
+ );
+ console.log('serviceCategories', serviceCategories);
return {
- analyses: category?.products?.map
(({ title, description, subtitle, variants, status, metadata }) => {
- const variant = variants![0]!;
- return {
- title,
- description,
- subtitle,
- variant: {
- id: variant.id,
+ analyses:
+ category?.products?.map(
+ ({ title, description, subtitle, variants, status, metadata }) => {
+ const variant = variants![0]!;
+ return {
+ title,
+ description,
+ subtitle,
+ variant: {
+ id: variant.id,
+ },
+ isAvailable:
+ status === 'published' && !!metadata?.analysisIdOriginal,
+ };
},
- isAvailable: status === 'published' && !!metadata?.analysisIdOriginal,
- };
- }) ?? [],
+ ) ?? [],
countryCode,
- }
+ };
}
export const loadAnalyses = cache(analysesLoader);
diff --git a/app/home/(user)/_lib/server/load-tto-services.ts b/app/home/(user)/_lib/server/load-tto-services.ts
new file mode 100644
index 0000000..a8b4e1b
--- /dev/null
+++ b/app/home/(user)/_lib/server/load-tto-services.ts
@@ -0,0 +1,49 @@
+import { cache } from 'react';
+
+import { getProductCategories } from '@lib/data';
+
+import { ServiceCategory } from '../../_components/service-categories';
+
+async function ttoServicesLoader() {
+ const response = await getProductCategories({
+ fields: '*products, is_active, metadata',
+ });
+ console.log('response.product_categories', response.product_categories);
+ const heroCategories = response.product_categories?.filter(
+ ({ parent_category, is_active, metadata }) =>
+ parent_category?.handle === 'tto-categories' &&
+ is_active &&
+ metadata?.isHero,
+ );
+
+ const ttoCategories = response.product_categories?.filter(
+ ({ parent_category, is_active, metadata }) =>
+ parent_category?.handle === 'tto-categories' &&
+ is_active &&
+ !metadata?.isHero,
+ );
+
+ return {
+ heroCategories:
+ heroCategories.map(
+ ({ name, handle, metadata, description }) => ({
+ name,
+ handle,
+ color:
+ typeof metadata?.color === 'string' ? metadata.color : 'primary',
+ description,
+ }),
+ ) ?? [],
+ ttoCategories:
+ ttoCategories.map(
+ ({ name, handle, metadata, description }) => ({
+ name,
+ handle,
+ color:
+ typeof metadata?.color === 'string' ? metadata.color : 'primary',
+ description,
+ }),
+ ) ?? [],
+ };
+}
+export const loadTtoServices = cache(ttoServicesLoader);
diff --git a/packages/features/medusa-storefront/src/lib/data/categories.ts b/packages/features/medusa-storefront/src/lib/data/categories.ts
index 7b3987d..b4db69d 100644
--- a/packages/features/medusa-storefront/src/lib/data/categories.ts
+++ b/packages/features/medusa-storefront/src/lib/data/categories.ts
@@ -1,13 +1,13 @@
-import { sdk } from "@lib/config"
-import { HttpTypes } from "@medusajs/types"
-import { getCacheOptions } from "./cookies"
+import { sdk } from "@lib/config";
+import { HttpTypes } from "@medusajs/types";
+import { getCacheOptions } from "./cookies";
export const listCategories = async (query?: Record) => {
const next = {
...(await getCacheOptions("categories")),
- }
+ };
- const limit = query?.limit || 100
+ const limit = query?.limit || 100;
return sdk.client
.fetch<{ product_categories: HttpTypes.StoreProductCategory[] }>(
@@ -23,8 +23,8 @@ export const listCategories = async (query?: Record) => {
cache: "force-cache",
}
)
- .then(({ product_categories }) => product_categories)
-}
+ .then(({ product_categories }) => product_categories);
+};
export const getCategoryByHandle = async (categoryHandle: string[]) => {
const { product_categories } = await getProductCategories({
@@ -32,7 +32,7 @@ export const getCategoryByHandle = async (categoryHandle: string[]) => {
limit: 1,
});
return product_categories[0];
-}
+};
export const getProductCategories = async ({
handle,
@@ -45,19 +45,18 @@ export const getProductCategories = async ({
} = {}) => {
const next = {
...(await getCacheOptions("categories")),
- }
+ };
- return sdk.client
- .fetch(
- `/store/product-categories`,
- {
- query: {
- fields,
- handle,
- limit,
- },
- next,
- //cache: "force-cache",
- }
- );
-}
+ return sdk.client.fetch(
+ `/store/product-categories`,
+ {
+ query: {
+ fields,
+ handle,
+ limit,
+ },
+ next,
+ //cache: "force-cache",
+ }
+ );
+};
diff --git a/packages/shared/src/config/paths.config.ts b/packages/shared/src/config/paths.config.ts
index d21c445..4e400e4 100644
--- a/packages/shared/src/config/paths.config.ts
+++ b/packages/shared/src/config/paths.config.ts
@@ -16,6 +16,7 @@ const PathsSchema = z.object({
home: z.string().min(1),
selectPackage: z.string().min(1),
booking: z.string().min(1),
+ bookingHandle: z.string().min(1),
myOrders: z.string().min(1),
analysisResults: z.string().min(1),
orderAnalysisPackage: z.string().min(1),
@@ -64,6 +65,7 @@ const pathsConfig = PathsSchema.parse({
joinTeam: '/join',
selectPackage: '/select-package',
booking: '/home/booking',
+ bookingHandle: '/home/booking/[handle]',
orderAnalysisPackage: '/home/order-analysis-package',
myOrders: '/home/order',
analysisResults: '/home/analysis-results',
diff --git a/packages/supabase/src/database.types.ts b/packages/supabase/src/database.types.ts
index 4137545..a070462 100644
--- a/packages/supabase/src/database.types.ts
+++ b/packages/supabase/src/database.types.ts
@@ -108,6 +108,63 @@ export type Database = {
}
Relationships: []
}
+ medipost_dispatch: {
+ Row: {
+ changed_by: string | null
+ created_at: string
+ error_message: string | null
+ id: number
+ is_medipost_error: boolean
+ is_success: boolean
+ medusa_order_id: string
+ }
+ Insert: {
+ changed_by?: string | null
+ created_at?: string
+ error_message?: string | null
+ id?: number
+ is_medipost_error: boolean
+ is_success: boolean
+ medusa_order_id: string
+ }
+ Update: {
+ changed_by?: string | null
+ created_at?: string
+ error_message?: string | null
+ id?: number
+ is_medipost_error?: boolean
+ is_success?: boolean
+ medusa_order_id?: string
+ }
+ Relationships: []
+ }
+ medusa_action: {
+ Row: {
+ action: string
+ created_at: string
+ id: number
+ medusa_user_id: string
+ page: string | null
+ user_email: string
+ }
+ Insert: {
+ action: string
+ created_at?: string
+ id?: number
+ medusa_user_id: string
+ page?: string | null
+ user_email: string
+ }
+ Update: {
+ action?: string
+ created_at?: string
+ id?: number
+ medusa_user_id?: string
+ page?: string | null
+ user_email?: string
+ }
+ Relationships: []
+ }
page_views: {
Row: {
account_id: string
@@ -201,28 +258,6 @@ export type Database = {
}
Relationships: []
}
- medusa_action: {
- Row: {
- id: number
- medusa_user_id: string
- user_email: string
- action: string
- page: string
- created_at: string
- }
- Insert: {
- medusa_user_id: string
- user_email: string
- action: string
- page: string
- }
- Update: {
- medusa_user_id?: string
- user_email?: string
- action?: string
- page?: string
- }
- }
}
Views: {
[_ in never]: never
@@ -329,6 +364,7 @@ export type Database = {
id: string
is_personal_account: boolean
last_name: string | null
+ medusa_account_id: string | null
name: string
personal_code: string | null
phone: string | null
@@ -336,7 +372,6 @@ export type Database = {
primary_owner_user_id: string
public_data: Json
slug: string | null
- medusa_account_id: string | null
updated_at: string | null
updated_by: string | null
}
@@ -351,6 +386,7 @@ export type Database = {
id?: string
is_personal_account?: boolean
last_name?: string | null
+ medusa_account_id?: string | null
name: string
personal_code?: string | null
phone?: string | null
@@ -358,7 +394,6 @@ export type Database = {
primary_owner_user_id?: string
public_data?: Json
slug?: string | null
- medusa_account_id?: string | null
updated_at?: string | null
updated_by?: string | null
}
@@ -373,6 +408,7 @@ export type Database = {
id?: string
is_personal_account?: boolean
last_name?: string | null
+ medusa_account_id?: string | null
name?: string
personal_code?: string | null
phone?: string | null
@@ -380,7 +416,6 @@ export type Database = {
primary_owner_user_id?: string
public_data?: Json
slug?: string | null
- medusa_account_id?: string | null
updated_at?: string | null
updated_by?: string | null
}
@@ -393,6 +428,7 @@ export type Database = {
created_at: string
created_by: string | null
has_seen_confirmation: boolean
+ id: string
updated_at: string
updated_by: string | null
user_id: string
@@ -403,6 +439,7 @@ export type Database = {
created_at?: string
created_by?: string | null
has_seen_confirmation?: boolean
+ id?: string
updated_at?: string
updated_by?: string | null
user_id: string
@@ -413,6 +450,7 @@ export type Database = {
created_at?: string
created_by?: string | null
has_seen_confirmation?: boolean
+ id?: string
updated_at?: string
updated_by?: string | null
user_id?: string
@@ -1022,7 +1060,7 @@ export type Database = {
price: number
price_periods: string | null
requires_payment: boolean
- sync_id: number
+ sync_id: string | null
updated_at: string | null
}
Insert: {
@@ -1041,7 +1079,7 @@ export type Database = {
price: number
price_periods?: string | null
requires_payment: boolean
- sync_id: number
+ sync_id?: string | null
updated_at?: string | null
}
Update: {
@@ -1060,7 +1098,7 @@ export type Database = {
price?: number
price_periods?: string | null
requires_payment?: boolean
- sync_id?: number
+ sync_id?: string | null
updated_at?: string | null
}
Relationships: [
@@ -1081,7 +1119,7 @@ export type Database = {
doctor_user_id: string | null
id: number
status: Database["medreport"]["Enums"]["analysis_feedback_status"]
- updated_at: string
+ updated_at: string | null
updated_by: string | null
user_id: string
value: string | null
@@ -1093,7 +1131,7 @@ export type Database = {
doctor_user_id?: string | null
id?: number
status?: Database["medreport"]["Enums"]["analysis_feedback_status"]
- updated_at?: string
+ updated_at?: string | null
updated_by?: string | null
user_id: string
value?: string | null
@@ -1105,7 +1143,7 @@ export type Database = {
doctor_user_id?: string | null
id?: number
status?: Database["medreport"]["Enums"]["analysis_feedback_status"]
- updated_at?: string
+ updated_at?: string | null
updated_by?: string | null
user_id?: string
value?: string | null
@@ -1784,9 +1822,7 @@ export type Database = {
Returns: Json
}
create_team_account: {
- Args:
- | { account_name: string }
- | { account_name: string; new_personal_code: string }
+ Args: { account_name: string; new_personal_code: string }
Returns: {
application_role: Database["medreport"]["Enums"]["application_role"]
city: string | null
@@ -1798,6 +1834,7 @@ export type Database = {
id: string
is_personal_account: boolean
last_name: string | null
+ medusa_account_id: string | null
name: string
personal_code: string | null
phone: string | null
@@ -1836,6 +1873,7 @@ export type Database = {
primary_owner_user_id: string
name: string
email: string
+ personal_code: string
picture_url: string
created_at: string
updated_at: string
@@ -1853,10 +1891,18 @@ export type Database = {
account_id: string
}[]
}
+ get_medipost_dispatch_tries: {
+ Args: { p_medusa_order_id: string }
+ Returns: number
+ }
get_nonce_status: {
Args: { p_id: string }
Returns: Json
}
+ get_order_possible_actions: {
+ Args: { p_medusa_order_id: string }
+ Returns: Json
+ }
get_upper_system_role: {
Args: Record
Returns: string
@@ -1937,6 +1983,10 @@ export type Database = {
Args: { account_id: string; user_id: string }
Returns: boolean
}
+ medipost_retry_dispatch: {
+ Args: { order_id: string }
+ Returns: Json
+ }
revoke_nonce: {
Args: { p_id: string; p_reason?: string }
Returns: boolean
@@ -2057,21 +2107,6 @@ export type Database = {
}
Returns: Json
}
- medipost_retry_dispatch: {
- Args: {
- order_id: string
- }
- Returns: {
- success: boolean
- error: string | null
- }
- }
- get_medipost_dispatch_tries: {
- Args: {
- p_medusa_order_id: string
- }
- Returns: number
- }
}
Enums: {
analysis_feedback_status: "STARTED" | "DRAFT" | "COMPLETED"
diff --git a/supabase/migrations/20250827134000_bookings.sql b/supabase/migrations/20250827134000_bookings.sql
new file mode 100644
index 0000000..9d77627
--- /dev/null
+++ b/supabase/migrations/20250827134000_bookings.sql
@@ -0,0 +1,2 @@
+ALTER TABLE medreport.connected_online_services
+ALTER COLUMN sync_id TYPE text USING sync_id::text;
\ No newline at end of file
From ad28352fc8780048617c1aa94b92d3544b8f2dd9 Mon Sep 17 00:00:00 2001
From: Danel Kungla
Date: Thu, 28 Aug 2025 14:11:54 +0300
Subject: [PATCH 3/8] MED-104: create booking view with categories
---
.../(dashboard)/booking/[handle]/page.tsx | 16 +++++++---
app/home/(user)/(dashboard)/booking/page.tsx | 17 ++++++++--
app/home/(user)/_components/order-cards.tsx | 2 +-
.../(user)/_components/service-categories.tsx | 2 +-
app/home/(user)/_lib/server/load-analyses.ts | 2 +-
app/home/(user)/_lib/server/load-category.ts | 31 +++++++++++++++++++
.../(user)/_lib/server/load-tto-services.ts | 2 +-
public/locales/et/booking.json | 15 ++++-----
public/locales/et/common.json | 3 +-
9 files changed, 72 insertions(+), 18 deletions(-)
create mode 100644 app/home/(user)/_lib/server/load-category.ts
diff --git a/app/home/(user)/(dashboard)/booking/[handle]/page.tsx b/app/home/(user)/(dashboard)/booking/[handle]/page.tsx
index 9036447..ebce187 100644
--- a/app/home/(user)/(dashboard)/booking/[handle]/page.tsx
+++ b/app/home/(user)/(dashboard)/booking/[handle]/page.tsx
@@ -1,13 +1,13 @@
-import { use } from 'react';
+import { HomeLayoutPageHeader } from '@/app/home/(user)/_components/home-page-header';
+import { loadCategory } from '@/app/home/(user)/_lib/server/load-category';
+import { AppBreadcrumbs } from '@kit/ui/makerkit/app-breadcrumbs';
import { PageBody } from '@kit/ui/page';
import { Trans } from '@kit/ui/trans';
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
import { withI18n } from '~/lib/i18n/with-i18n';
-import { HomeLayoutPageHeader } from '../../../_components/home-page-header';
-
export const generateMetadata = async () => {
const i18n = await createI18nServerInstance();
const title = i18n.t('booking:title');
@@ -17,9 +17,17 @@ export const generateMetadata = async () => {
};
};
-function BookingHandlePage() {
+async function BookingHandlePage({ params }: { params: { handle: string } }) {
+ const handle = await params.handle;
+ const { category } = await loadCategory({ handle });
+
return (
<>
+
}
description={}
diff --git a/app/home/(user)/(dashboard)/booking/page.tsx b/app/home/(user)/(dashboard)/booking/page.tsx
index 14b1c1a..680edfb 100644
--- a/app/home/(user)/(dashboard)/booking/page.tsx
+++ b/app/home/(user)/(dashboard)/booking/page.tsx
@@ -1,5 +1,6 @@
import { use } from 'react';
+import { AppBreadcrumbs } from '@kit/ui/makerkit/app-breadcrumbs';
import { PageBody } from '@kit/ui/page';
import { Trans } from '@kit/ui/trans';
@@ -22,15 +23,27 @@ export const generateMetadata = async () => {
function BookingPage() {
const { heroCategories, ttoCategories } = use(loadTtoServices());
- console.log('ttoCategories', heroCategories, ttoCategories);
+
+ if (!heroCategories.length && !ttoCategories.length) {
+ return (
+ <>
+
+
+
+
+ >
+ );
+ }
+
return (
<>
+
}
description={}
/>
-
+
diff --git a/app/home/(user)/_components/order-cards.tsx b/app/home/(user)/_components/order-cards.tsx
index b179d18..0c936ce 100644
--- a/app/home/(user)/_components/order-cards.tsx
+++ b/app/home/(user)/_components/order-cards.tsx
@@ -24,7 +24,7 @@ export default function OrderCards({
heroCategories: ServiceCategory[];
}) {
return (
-
+
{heroCategories.map(({ name, description, color, handle }) => (
{
return (
-
+
{categories.map((category, index) => (
parent_category?.handle === 'tto-categories',
);
- console.log('serviceCategories', serviceCategories);
+
return {
analyses:
category?.products?.map(
diff --git a/app/home/(user)/_lib/server/load-category.ts b/app/home/(user)/_lib/server/load-category.ts
new file mode 100644
index 0000000..2c0479c
--- /dev/null
+++ b/app/home/(user)/_lib/server/load-category.ts
@@ -0,0 +1,31 @@
+import { cache } from 'react';
+
+import { getProductCategories } from '@lib/data';
+
+import { ServiceCategory } from '../../_components/service-categories';
+
+async function categoryLoader({
+ handle,
+}: {
+ handle: string;
+}): Promise<{ category: ServiceCategory | null }> {
+ const response = await getProductCategories({
+ handle,
+ fields: '*products, is_active, metadata',
+ });
+
+ const category = response.product_categories[0];
+
+ return {
+ category: {
+ color:
+ typeof category?.metadata?.color === 'string'
+ ? category?.metadata?.color
+ : 'primary',
+ description: category?.description || '',
+ handle: category?.handle || '',
+ name: category?.name || '',
+ },
+ };
+}
+export const loadCategory = cache(categoryLoader);
diff --git a/app/home/(user)/_lib/server/load-tto-services.ts b/app/home/(user)/_lib/server/load-tto-services.ts
index a8b4e1b..3bbc4e5 100644
--- a/app/home/(user)/_lib/server/load-tto-services.ts
+++ b/app/home/(user)/_lib/server/load-tto-services.ts
@@ -8,7 +8,7 @@ async function ttoServicesLoader() {
const response = await getProductCategories({
fields: '*products, is_active, metadata',
});
- console.log('response.product_categories', response.product_categories);
+
const heroCategories = response.product_categories?.filter(
({ parent_category, is_active, metadata }) =>
parent_category?.handle === 'tto-categories' &&
diff --git a/public/locales/et/booking.json b/public/locales/et/booking.json
index 17554de..3410d59 100644
--- a/public/locales/et/booking.json
+++ b/public/locales/et/booking.json
@@ -1,8 +1,9 @@
{
- "title": "Vali teenus",
- "description": "Vali sobiv teenus või pakett vastavalt oma tervisemurele või -eesmärgile.",
- "analysisPackages": {
- "title": "Analüüside paketid",
- "description": "Tutvu personaalsete analüüsi pakettidega ja telli"
- }
-}
\ No newline at end of file
+ "title": "Vali teenus",
+ "description": "Vali sobiv teenus või pakett vastavalt oma tervisemurele või -eesmärgile.",
+ "analysisPackages": {
+ "title": "Analüüside paketid",
+ "description": "Tutvu personaalsete analüüsi pakettidega ja telli"
+ },
+ "noCategories": "Teenuste loetelu ei leitud, proovi hiljem uuesti"
+}
diff --git a/public/locales/et/common.json b/public/locales/et/common.json
index 8239aaf..70e6ec6 100644
--- a/public/locales/et/common.json
+++ b/public/locales/et/common.json
@@ -80,7 +80,8 @@
"dashboard": "Ülevaade",
"settings": "Settings",
"profile": "Profile",
- "application": "Application"
+ "application": "Application",
+ "pickTime": "Vali aeg"
},
"roles": {
"owner": {
From e0688eb539d4bf5f19daf86b06adae4e83d25dce Mon Sep 17 00:00:00 2001
From: Karli
Date: Thu, 28 Aug 2025 15:49:03 +0300
Subject: [PATCH 4/8] feat(MED-86): fix status check for fake responses
---
app/api/job/test-medipost-responses/route.ts | 2 +-
public/locales/en/orders.json | 3 +--
public/locales/et/orders.json | 1 -
3 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/app/api/job/test-medipost-responses/route.ts b/app/api/job/test-medipost-responses/route.ts
index 2cf8fa7..4ca8be0 100644
--- a/app/api/job/test-medipost-responses/route.ts
+++ b/app/api/job/test-medipost-responses/route.ts
@@ -16,7 +16,7 @@ export async function POST(request: NextRequest) {
return NextResponse.json({}, { status: 401, statusText: 'Unauthorized' });
}
- const analysisOrders = await getAnalysisOrdersAdmin({ orderStatus: 'QUEUED' });
+ const analysisOrders = await getAnalysisOrdersAdmin({ orderStatus: 'PROCESSING' });
console.error(`Sending test responses for ${analysisOrders.length} analysis orders`);
for (const medreportOrder of analysisOrders) {
diff --git a/public/locales/en/orders.json b/public/locales/en/orders.json
index 7c16fc9..f846b0a 100644
--- a/public/locales/en/orders.json
+++ b/public/locales/en/orders.json
@@ -9,8 +9,7 @@
},
"status": {
"QUEUED": "Waiting to send to lab",
- "ON_HOLD": "Waiting for analysis results",
- "PROCESSING": "In progress",
+ "PROCESSING": "Waiting for results",
"PARTIAL_ANALYSIS_RESPONSE": "Partial analysis response",
"FULL_ANALYSIS_RESPONSE": "All analysis responses received, waiting for doctor response",
"COMPLETED": "Completed",
diff --git a/public/locales/et/orders.json b/public/locales/et/orders.json
index ef0a203..4811a2e 100644
--- a/public/locales/et/orders.json
+++ b/public/locales/et/orders.json
@@ -9,7 +9,6 @@
},
"status": {
"QUEUED": "Esitatud",
- "ON_HOLD": "Makstud",
"PROCESSING": "Synlabile edastatud",
"PARTIAL_ANALYSIS_RESPONSE": "Osalised tulemused",
"FULL_ANALYSIS_RESPONSE": "Kõik tulemused käes, ootab arsti kokkuvõtet",
From 4588d11d5a554e9cb28a4a1e8028166b54b67d2f Mon Sep 17 00:00:00 2001
From: Karli
Date: Thu, 28 Aug 2025 15:37:29 +0300
Subject: [PATCH 5/8] feat(MED-86): don't prettify results sync log since aws
will split it up
---
app/api/job/handler/sync-analysis-results.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/api/job/handler/sync-analysis-results.ts b/app/api/job/handler/sync-analysis-results.ts
index c7fd529..c5a2323 100644
--- a/app/api/job/handler/sync-analysis-results.ts
+++ b/app/api/job/handler/sync-analysis-results.ts
@@ -58,5 +58,5 @@ export default async function syncAnalysisResults() {
}
return acc;
}, {} as GroupedResults);
- console.info(`Processed ${processedMessages.length} messages, results: ${JSON.stringify(groupedResults, undefined, 2)}`);
+ console.info(`Processed ${processedMessages.length} messages, results: ${JSON.stringify(groupedResults)}`);
}
From 5ee161f482c7d5a039eadd09a0f15dc5fba156c1 Mon Sep 17 00:00:00 2001
From: Helena
Date: Thu, 28 Aug 2025 16:47:27 +0300
Subject: [PATCH 6/8] remove html length limit from emails
---
lib/validations/email.schema.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/validations/email.schema.ts b/lib/validations/email.schema.ts
index 58cc00d..b06524d 100644
--- a/lib/validations/email.schema.ts
+++ b/lib/validations/email.schema.ts
@@ -3,5 +3,5 @@ import { z } from 'zod';
export const emailSchema = z.object({
to: z.string().email(),
subject: z.string().min(1).max(200),
- html: z.string().min(1).max(5000),
+ html: z.string().min(1),
});
From 7d1400fba6ffd40342d757029c9f2ca5978088da Mon Sep 17 00:00:00 2001
From: Helena
Date: Thu, 28 Aug 2025 17:30:32 +0300
Subject: [PATCH 7/8] log email result and subject
---
lib/services/mailer.service.ts | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/services/mailer.service.ts b/lib/services/mailer.service.ts
index 07ccc37..74bc165 100644
--- a/lib/services/mailer.service.ts
+++ b/lib/services/mailer.service.ts
@@ -6,6 +6,7 @@ import { emailSchema } from '@/lib/validations/email.schema';
import { renderDoctorSummaryReceivedEmail } from '@kit/email-templates';
import { getMailer } from '@kit/mailers';
import { enhanceAction } from '@kit/next/actions';
+import { getLogger } from '@kit/shared/logger';
export const sendDoctorSummaryCompletedEmail = async (
language: string,
@@ -49,12 +50,18 @@ export const sendCompanyOfferEmail = async (
export const sendEmail = enhanceAction(
async ({ subject, html, to }) => {
const mailer = await getMailer();
- await mailer.sendEmail({
+ const log = await getLogger();
+
+ const result = await mailer.sendEmail({
to,
subject,
html,
});
+ log.info(
+ `Sent email with subject "${subject}", result: ${JSON.stringify(result)}`,
+ );
+
return {};
},
{
From 5cf29447b302900fe82cfb2da7ef4e672f18d479 Mon Sep 17 00:00:00 2001
From: Helena
Date: Thu, 28 Aug 2025 18:03:28 +0300
Subject: [PATCH 8/8] add email sender
---
lib/services/mailer.service.ts | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/services/mailer.service.ts b/lib/services/mailer.service.ts
index 74bc165..c902bad 100644
--- a/lib/services/mailer.service.ts
+++ b/lib/services/mailer.service.ts
@@ -52,7 +52,13 @@ export const sendEmail = enhanceAction(
const mailer = await getMailer();
const log = await getLogger();
+ if (!process.env.EMAIL_USER) {
+ log.error('Sending email failed, as no sender found in env.')
+ throw new Error('No email user configured');
+ }
+
const result = await mailer.sendEmail({
+ from: process.env.EMAIL_USER,
to,
subject,
html,