Merge branch 'main' into feature/MED-100

This commit is contained in:
2025-07-21 11:38:47 +03:00
46 changed files with 6714 additions and 501 deletions

5
.env
View File

@@ -51,7 +51,4 @@ LOGGER=pino
NEXT_PUBLIC_DEFAULT_LOCALE=et
NEXT_PUBLIC_TEAM_NAVIGATION_STYLE=custom
NEXT_PUBLIC_USER_NAVIGATION_STYLE=custom
# MEDUSA
NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=
NEXT_PUBLIC_USER_NAVIGATION_STYLE=custom

View File

@@ -1,10 +1,9 @@
# This file is used to define environment variables for the development environment.
# These values are only used when running the app in development mode.
# SUPABASE
NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
# SUPABASE DEVELOPMENT
NEXT_PUBLIC_SUPABASE_URL=https://oqsdacktkhmbylmzstjq.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9xc2RhY2t0a2htYnlsbXpzdGpxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDY1MjgxMjMsImV4cCI6MjA2MjEwNDEyM30.LdHCTWxijFmhXdnT9KVuLRAVbtSwY7OO-oLtpd8GmO0
## THIS IS FOR DEVELOPMENT ONLY - DO NOT USE IN PRODUCTION
SUPABASE_DB_WEBHOOK_SECRET=WEBHOOKSECRET
@@ -14,8 +13,6 @@ SUPABASE_DB_WEBHOOK_SECRET=WEBHOOKSECRET
# CONTACT FORM
CONTACT_EMAIL=test@makerkit.dev
# STRIPE
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=
# MAILER
MAILER_PROVIDER=nodemailer

View File

@@ -6,7 +6,7 @@
## PUBLIC KEYS OR CONFIGURATION ARE OKAY TO BE PLACED HERE.
# SUPABASE
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_URL=https://oqsdacktkhmbylmzstjq.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im9xc2RhY2t0a2htYnlsbXpzdGpxIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDY1MjgxMjMsImV4cCI6MjA2MjEwNDEyM30.LdHCTWxijFmhXdnT9KVuLRAVbtSwY7OO-oLtpd8GmO0
# STRIPE
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=

View File

@@ -1,17 +1,50 @@
# --- Stage 1: Build ---
FROM node:20-alpine as builder
WORKDIR /app
RUN npm install -g pnpm@9
RUN npm install -g dotenv-cli
# Copy necessary files for workspace resolution
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
COPY packages packages
COPY tooling tooling
COPY .env .env
COPY .env.production .env.production
# Install all dependencies
# Load env file and echo a specific variable
# RUN dotenv -e .env -- printenv | grep 'SUPABASE' || true
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
ENV NODE_ENV=production
# 🔍 Optional: Log key envs for debug
RUN echo "📄 .env.production contents:" && cat .env.production \
&& echo "🔧 Current ENV available to Next.js build:" && printenv | grep -E 'SUPABASE|STRIPE|NEXT|NODE_ENV' || true
RUN node check-env.js
RUN pnpm build
# --- Stage 2: Runtime ---
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app ./
RUN npm install -g pnpm@9 \
&& pnpm install --prod --frozen-lockfile
ENV NODE_ENV=production
# 🔍 Optional: Log key envs for debug
RUN echo "📄 .env.production contents:" && cat .env.production \
&& echo "🔧 Current ENV available to Next.js build:" && printenv | grep -E 'SUPABASE|STRIPE|NEXT|NODE_ENV' || true
EXPOSE 3000
CMD ["pnpm", "start"]

View File

@@ -10,7 +10,7 @@ import CompanyOfferForm from './_components/company-offer-form';
function CompanyOffer() {
return (
<div className="border-border flex max-w-5xl flex-row overflow-hidden rounded-3xl border">
<div className="flex w-1/2 flex-col px-12 py-14 text-center">
<div className="flex flex-col px-12 py-14 text-center md:w-1/2">
<MedReportLogo />
<h1 className="pt-8">
<Trans i18nKey={'account:requestCompanyAccount:title'} />
@@ -20,7 +20,7 @@ function CompanyOffer() {
</p>
<CompanyOfferForm />
</div>
<div className="w-1/2 min-w-[460px] bg-[url(/assets/med-report-logo-big.png)] bg-cover bg-center bg-no-repeat"></div>
<div className="hidden w-1/2 min-w-[460px] bg-[url(/assets/med-report-logo-big.png)] bg-cover bg-center bg-no-repeat md:block"></div>
</div>
);
}

View File

@@ -21,8 +21,8 @@ import {
import { Input } from '@kit/ui/input';
import { Trans } from '@kit/ui/trans';
import { UpdateAccountSchema } from '../schemas/update-account.schema';
import { onUpdateAccount } from '../server/actions/update-account-actions';
import { UpdateAccountSchema } from '../_lib/schemas/update-account.schema';
import { onUpdateAccount } from '../_lib/server/update-account';
export function UpdateAccountForm({ user }: { user: User }) {
const form = useForm({

View File

@@ -2,14 +2,14 @@
import { redirect } from 'next/navigation';
import { createAuthApi } from '@kit/auth/api';
import { enhanceAction } from '@kit/next/actions';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import pathsConfig from '~/config/paths.config';
import { updateCustomer } from '@lib/data/customer';
import { UpdateAccountSchema } from '../../schemas/update-account.schema';
import { createAuthApi } from '../api';
import { UpdateAccountSchema } from '../schemas/update-account.schema';
export interface AccountSubmitData {
firstName: string;

View File

@@ -4,13 +4,14 @@ import { BackButton } from '@/components/back-button';
import { MedReportLogo } from '@/components/med-report-logo';
import pathsConfig from '@/config/paths.config';
import { signOutAction } from '@/lib/actions/sign-out';
import { UpdateAccountForm } from '@/packages/features/auth/src/components/update-account-form';
import { getSupabaseServerClient } from '@/packages/supabase/src/clients/server-client';
import { Trans } from '@kit/ui/trans';
import { withI18n } from '~/lib/i18n/with-i18n';
import { UpdateAccountForm } from './_components/update-account-form';
async function UpdateAccount() {
const client = getSupabaseServerClient();
@@ -24,7 +25,7 @@ async function UpdateAccount() {
return (
<div className="border-border flex max-w-5xl flex-row overflow-hidden rounded-3xl border">
<div className="relative flex w-1/2 min-w-md flex-col px-12 pt-7 pb-22 text-center">
<div className="relative flex min-w-md flex-col px-12 pt-7 pb-22 text-center md:w-1/2">
<BackButton onBack={signOutAction} />
<MedReportLogo />
<h1 className="pt-8">
@@ -35,7 +36,7 @@ async function UpdateAccount() {
</p>
<UpdateAccountForm user={user} />
</div>
<div className="w-1/2 min-w-[460px] bg-[url(/assets/med-report-logo-big.png)] bg-cover bg-center bg-no-repeat"></div>
<div className="hidden w-1/2 min-w-[460px] bg-[url(/assets/med-report-logo-big.png)] bg-cover bg-center bg-no-repeat md:block"></div>
</div>
);
}

View File

@@ -0,0 +1,89 @@
import React from 'react';
import { ArrowDown } from 'lucide-react';
import { cn } from '@kit/ui/utils';
export enum AnalysisResultLevel {
VERY_LOW = 0,
LOW = 1,
NORMAL = 2,
HIGH = 3,
VERY_HIGH = 4,
}
const Level = ({
isActive = false,
color,
isFirst = false,
isLast = false,
}: {
isActive?: boolean;
color: 'destructive' | 'success' | 'warning';
isFirst?: boolean;
isLast?: boolean;
}) => {
return (
<div
className={cn(`bg-${color} relative h-3 flex-1`, {
'opacity-20': !isActive,
'rounded-l-lg': isFirst,
'rounded-r-lg': isLast,
})}
>
{isActive && (
<div className="absolute top-[-14px] left-1/2 -translate-x-1/2 rounded-[10px] bg-white p-[2px]">
<ArrowDown strokeWidth={2} />
</div>
)}
</div>
);
};
const AnalysisLevelBar = ({
normLowerIncluded = true,
normUpperIncluded = true,
level,
}: {
normLowerIncluded?: boolean;
normUpperIncluded?: boolean;
level: AnalysisResultLevel;
}) => {
return (
<div className="mt-4 flex h-3 w-full max-w-[360px] gap-1 sm:mt-0">
{normLowerIncluded && (
<>
<Level
isActive={level === AnalysisResultLevel.VERY_LOW}
color="destructive"
isFirst
/>
<Level isActive={level === AnalysisResultLevel.LOW} color="warning" />
</>
)}
<Level
isFirst={!normLowerIncluded}
isLast={!normUpperIncluded}
isActive={level === AnalysisResultLevel.NORMAL}
color="success"
/>
{normUpperIncluded && (
<>
<Level
isActive={level === AnalysisResultLevel.HIGH}
color="warning"
/>
<Level
isActive={level === AnalysisResultLevel.VERY_HIGH}
color="destructive"
isLast
/>
</>
)}
</div>
);
};
export default AnalysisLevelBar;

View File

@@ -0,0 +1,98 @@
'use client';
import React, { useState } from 'react';
import { Info } from 'lucide-react';
import { cn } from '@kit/ui/utils';
import AnalysisLevelBar, { AnalysisResultLevel } from './analysis-level-bar';
export enum AnalysisStatus {
NORMAL = 0,
MEDIUM = 1,
HIGH = 2,
}
const Analysis = ({
analysis: {
name,
status,
unit,
value,
normLowerIncluded,
normUpperIncluded,
normLower,
normUpper,
},
}: {
analysis: {
name: string;
status: AnalysisStatus;
unit: string;
value: number;
normLowerIncluded: boolean;
normUpperIncluded: boolean;
normLower: number;
normUpper: number;
};
}) => {
const [showTooltip, setShowTooltip] = useState(false);
const isUnderNorm = value < normLower;
const getAnalysisResultLevel = () => {
if (isUnderNorm) {
switch (status) {
case AnalysisStatus.MEDIUM:
return AnalysisResultLevel.LOW;
default:
return AnalysisResultLevel.VERY_LOW;
}
}
switch (status) {
case AnalysisStatus.MEDIUM:
return AnalysisResultLevel.HIGH;
case AnalysisStatus.HIGH:
return AnalysisResultLevel.VERY_HIGH;
default:
return AnalysisResultLevel.NORMAL;
}
};
return (
<div className="border-border grid grid-cols-2 items-center justify-between rounded-lg border px-5 py-3 sm:flex">
<div className="flex items-center gap-2 font-semibold">
{name}
<div
className="group/tooltip relative"
onClick={() => setShowTooltip(!showTooltip)}
onMouseLeave={() => setShowTooltip(false)}
>
<Info className="hover" />{' '}
<div
className={cn(
'absolute bottom-full left-1/2 z-10 mb-2 hidden -translate-x-1/2 rounded border bg-white p-4 text-sm whitespace-nowrap group-hover/tooltip:block',
{ block: showTooltip },
)}
>
This text changes when you hover the box above.
</div>
</div>
</div>
<div className="flex items-center gap-3">
<div className="font-semibold">{value}</div>
<div className="text-muted-foreground text-sm">{unit}</div>
</div>
<div className="text-muted-foreground mt-4 flex gap-2 text-center text-sm sm:mt-0 sm:block sm:gap-0">
{normLower} - {normUpper}
<div>Normaalne vahemik</div>
</div>
<AnalysisLevelBar
normLowerIncluded={normLowerIncluded}
normUpperIncluded={normUpperIncluded}
level={getAnalysisResultLevel()}
/>
</div>
);
};
export default Analysis;

View File

@@ -0,0 +1,59 @@
import { createI18nServerInstance } from '@/lib/i18n/i18n.server';
import { withI18n } from '@/lib/i18n/with-i18n';
import { Trans } from '@kit/ui/makerkit/trans';
import { PageBody } from '@kit/ui/page';
import { Button } from '@kit/ui/shadcn/button';
import { loadUserAnalysis } from '../../_lib/server/load-user-analysis';
import Analysis, { AnalysisStatus } from './_components/analysis';
export const generateMetadata = async () => {
const i18n = await createI18nServerInstance();
const title = i18n.t('account:analysisResults.pageTitle');
return {
title,
};
};
async function AnalysisResultsPage() {
const analysisList = await loadUserAnalysis();
return (
<PageBody>
<div className="mt-8 flex items-center justify-between">
<div>
<h4>
<Trans i18nKey="account:analysisResults.pageTitle" />
</h4>
<p className="text-muted-foreground text-sm">
<Trans i18nKey="account:analysisResults.description" />
</p>
</div>
<Button>
<Trans i18nKey="account:analysisResults.orderNewAnalysis" />
</Button>
</div>
<div className="flex flex-col gap-2">
{analysisList?.map((analysis, index) => (
<Analysis
key={index}
analysis={{
name: analysis.element.analysis_name || '',
status: analysis.element.norm_status as AnalysisStatus,
unit: analysis.element.unit || '',
value: analysis.element.response_value,
normLowerIncluded: !!analysis.element.norm_lower_included,
normUpperIncluded: !!analysis.element.norm_upper_included,
normLower: analysis.element.norm_lower || 0,
normUpper: analysis.element.norm_upper || 0,
}}
/>
))}
</div>
</PageBody>
);
}
export default withI18n(AnalysisResultsPage);

View File

@@ -1,6 +1,7 @@
'use client';
import Link from 'next/link';
import { InfoTooltip } from '@/components/ui/info-tooltip';
import { BlendingModeIcon, RulerHorizontalIcon } from '@radix-ui/react-icons';
import {
@@ -130,7 +131,7 @@ const dummyRecommendations = [
export default function Dashboard() {
return (
<>
<div className="grid auto-rows-fr grid-cols-5 gap-3">
<div className="grid auto-rows-fr grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-5">
{dummyCards.map(
({
title,
@@ -190,7 +191,7 @@ export default function Dashboard() {
) => {
return (
<div className="flex justify-between" key={index}>
<div className="flex flex-row items-center gap-4">
<div className="mr-4 flex flex-row items-center gap-4">
<div
className={cn(
'flex size-8 items-center-safe justify-center-safe rounded-full text-white',

View File

@@ -0,0 +1,22 @@
import { cache } from 'react';
import { createAccountsApi } from '@kit/accounts/api';
import { UserAnalysis } from '@kit/accounts/types/accounts';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
export type UserAccount = Awaited<ReturnType<typeof loadUserAnalysis>>;
/**
* @name loadUserAccount
* @description
* Load the user account. It's a cached per-request function that fetches the user workspace data.
* It can be used across the server components to load the user workspace data.
*/
export const loadUserAnalysis = cache(analysisLoader);
async function analysisLoader(): Promise<UserAnalysis | null> {
const client = getSupabaseServerClient();
const api = createAccountsApi(client);
return api.getUserAnalysis();
}

View File

@@ -1,14 +1,14 @@
import Link from 'next/link';
import SelectAnalysisPackages from '@/components/select-analysis-packages';
import { CaretRightIcon } from '@radix-ui/react-icons';
import { Scale } from 'lucide-react';
import { Trans } from '@kit/ui/trans';
import { Button } from '@kit/ui/button';
import { Trans } from '@kit/ui/trans';
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
import { withI18n } from '~/lib/i18n/with-i18n';
import SelectAnalysisPackages from '@/components/select-analysis-packages';
import { MedReportLogo } from '../../components/med-report-logo';
import pathsConfig from '../../config/paths.config';
@@ -44,12 +44,14 @@ async function SelectPackagePage() {
/>
</div>
<SelectAnalysisPackages analysisPackages={analysisPackages} countryCode={countryCode} />
<Link href={pathsConfig.app.home}>
<Button variant="secondary" className="align-center">
<Trans i18nKey={'marketing:notInterestedInAudit'} />{' '}
<CaretRightIcon className="size-4" />
</Button>
</Link>
<div className="flex justify-center">
<Link href={pathsConfig.app.home}>
<Button variant="secondary" className="align-center">
<Trans i18nKey="marketing:notInterestedInAudit" />{' '}
<CaretRightIcon className="size-4" />
</Button>
</Link>
</div>
</div>
);
}

1
check-env.js Normal file
View File

@@ -0,0 +1 @@
console.log('ENV =', process.env.MEDUSA_BACKEND_URL);

View File

@@ -17,8 +17,8 @@ export const PackageHeader = ({
}) => {
return (
<div className="space-y-1 text-center">
<p className="font-medium">{title}</p>
<h2>
<p className="text-sm sm:text-lg sm:font-medium">{title}</p>
<h2 className="text-xl sm:text-4xl">
{formatCurrency({
currencyCode: 'eur',
locale: language,

View File

@@ -11,7 +11,7 @@ export default function SelectAnalysisPackages({ analysisPackages, countryCode }
<SelectAnalysisPackage key={product.title} analysisPackage={product} countryCode={countryCode} />
)) : (
<h4>
<Trans i18nKey='order-analysis-package:noPackagesAvailable' />
<Trans i18nKey="order-analysis-package:noPackagesAvailable" />
</h4>
)}
</div>

View File

@@ -61,7 +61,7 @@ const pathsConfig = PathsSchema.parse({
orderAnalysisPackage: '/home/order-analysis-package',
// these routes are added as placeholders and can be changed when the pages are added
myOrders: '/my-orders',
analysisResults: '/analysis-results',
analysisResults: '/home/analysis-results',
orderAnalysis: '/order-analysis',
orderHealthAnalysis: '/order-health-analysis',
},

View File

@@ -617,6 +617,7 @@ export async function syncPrivateMessage(
response_value: response.VastuseVaartus,
unit: element.Mootyhik ?? null,
original_response_element: element,
analysis_name: element.UuringNimi || element.KNimetus,
})),
);
}

View File

@@ -1,4 +1,7 @@
import withBundleAnalyzer from '@next/bundle-analyzer';
import transpileModules from 'next-transpile-modules';
const withTM = transpileModules(['lucide-react']);
const IS_PRODUCTION = process.env.NODE_ENV === 'production';
const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL;
@@ -24,7 +27,7 @@ const INTERNAL_PACKAGES = [
];
/** @type {import('next').NextConfig} */
const config = {
const config = withTM({
reactStrictMode: true,
/** Enables hot reloading for local packages without a build step */
transpilePackages: INTERNAL_PACKAGES,
@@ -67,7 +70,7 @@ const config = {
/** We already do linting and typechecking as separate tasks in CI */
eslint: { ignoreDuringBuilds: true },
typescript: { ignoreBuildErrors: true },
};
});
export default withBundleAnalyzer({
enabled: process.env.ANALYZE === 'true',

View File

@@ -23,7 +23,7 @@
"supabase:test": "supabase db test",
"supabase:db:reset": "supabase db reset",
"supabase:db:lint": "supabase db lint",
"supabase:db:diff": "supabase db diff",
"supabase:db:diff": "supabase db diff --schema auth --schema audit --schema medreport",
"supabase:deploy": "supabase link --project-ref $SUPABASE_PROJECT_REF && supabase db push",
"supabase:typegen": "supabase gen types typescript --local > ./packages/supabase/src/database.types.ts",
"supabase:db:dump:local": "supabase db dump --local --data-only",
@@ -101,9 +101,9 @@
"babel-plugin-react-compiler": "19.1.0-rc.2",
"cssnano": "^7.0.7",
"dotenv": "^16.5.0",
"next-transpile-modules": "^10.0.1",
"pino-pretty": "^13.0.0",
"prettier": "^3.5.3",
"react-hook-form": "^7.57.0",
"supabase": "^2.30.4",
"tailwindcss": "4.1.7",
"tailwindcss-animate": "^1.0.7",

View File

@@ -32,8 +32,7 @@
"date-fns": "^4.1.0",
"lucide-react": "^0.510.0",
"next": "15.3.2",
"react": "19.1.0",
"react-hook-form": "^7.56.3"
"react": "19.1.0"
},
"typesVersions": {
"*": {

View File

@@ -14,7 +14,8 @@
"./personal-account-settings": "./src/components/personal-account-settings/index.ts",
"./components": "./src/components/index.ts",
"./hooks/*": "./src/hooks/*.ts",
"./api": "./src/server/api.ts"
"./api": "./src/server/api.ts",
"./types/*": "./src/types/*.ts"
},
"dependencies": {
"nanoid": "^5.1.5"
@@ -43,7 +44,6 @@
"next-themes": "0.4.6",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-hook-form": "^7.56.3",
"sonner": "^2.0.3"
},
"prettier": "@kit/prettier-config",

View File

@@ -2,6 +2,8 @@ import { SupabaseClient } from '@supabase/supabase-js';
import { Database } from '@kit/supabase/database';
import { UserAnalysis } from '../types/accounts';
/**
* Class representing an API for interacting with user accounts.
* @constructor
@@ -169,6 +171,51 @@ class AccountsApi {
return response.data?.customer_id;
}
async getUserAnalysis(): Promise<UserAnalysis | null> {
const authUser = await this.client.auth.getUser();
const { data, error: userError } = authUser;
if (userError) {
console.error('Failed to get user', userError);
throw userError;
}
const { user } = data;
const { data: analysisResponses } = await this.client
.schema('medreport')
.from('analysis_responses')
.select('*')
.eq('user_id', user.id);
if (!analysisResponses) {
return null;
}
const analysisResponseIds = analysisResponses.map((r) => r.id);
const { data: analysisResponseElements } = await this.client
.schema('medreport')
.from('analysis_response_elements')
.select('*')
.in('analysis_response_id', analysisResponseIds);
if (!analysisResponseElements) {
return null;
}
const elementMap = new Map(
analysisResponseElements.map((e) => [e.analysis_response_id, e]),
);
return analysisResponses
.filter((r) => elementMap.has(r.id))
.map((r) => ({
...r,
element: elementMap.get(r.id)!,
}));
}
}
export function createAccountsApi(client: SupabaseClient<Database>) {

View File

@@ -0,0 +1,6 @@
import { Database } from '@kit/supabase/database';
export type UserAnalysis =
(Database['medreport']['Tables']['analysis_responses']['Row'] & {
element: Database['medreport']['Tables']['analysis_response_elements']['Row'];
})[];

View File

@@ -27,8 +27,7 @@
"lucide-react": "^0.510.0",
"next": "15.3.2",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-hook-form": "^7.56.3"
"react-dom": "19.1.0"
},
"exports": {
".": "./src/index.ts",

View File

@@ -17,7 +17,8 @@
"./captcha/client": "./src/captcha/client/index.ts",
"./captcha/server": "./src/captcha/server/index.ts",
"./resend-email-link": "./src/components/resend-auth-link-form.tsx",
"./lib/utils/*": "./src/lib/utils/*.ts"
"./lib/utils/*": "./src/lib/utils/*.ts",
"./api": "./src/server/api.ts"
},
"devDependencies": {
"@hookform/resolvers": "^5.0.1",
@@ -34,7 +35,6 @@
"@types/react": "19.1.4",
"lucide-react": "^0.510.0",
"next": "15.3.2",
"react-hook-form": "^7.56.3",
"sonner": "^2.0.3"
},
"prettier": "@kit/prettier-config",

View File

@@ -1,14 +1,16 @@
import Medusa from "@medusajs/js-sdk"
import Medusa from "@medusajs/js-sdk";
// Defaults to standard port for Medusa server
let MEDUSA_BACKEND_URL = "http://localhost:9000"
let MEDUSA_BACKEND_URL = "http://localhost:9000";
if (process.env.MEDUSA_BACKEND_URL) {
MEDUSA_BACKEND_URL = process.env.MEDUSA_BACKEND_URL
MEDUSA_BACKEND_URL = process.env.MEDUSA_BACKEND_URL;
}
export const sdk = new Medusa({
export const SDK_CONFIG = {
baseUrl: MEDUSA_BACKEND_URL,
debug: process.env.NODE_ENV === "development",
publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,
})
};
export const sdk = new Medusa(SDK_CONFIG);

View File

@@ -1,13 +1,13 @@
"use server"
"use server";
import { sdk } from "@lib/config"
import { HttpTypes } from "@medusajs/types"
import { getCacheOptions } from "./cookies"
import { sdk, SDK_CONFIG } from "@lib/config";
import { HttpTypes } from "@medusajs/types";
import { getCacheOptions } from "./cookies";
export const retrieveCollection = async (id: string) => {
const next = {
...(await getCacheOptions("collections")),
}
};
return sdk.client
.fetch<{ collection: HttpTypes.StoreCollection }>(
@@ -17,19 +17,19 @@ export const retrieveCollection = async (id: string) => {
cache: "force-cache",
}
)
.then(({ collection }) => collection)
}
.then(({ collection }) => collection);
};
export const listCollections = async (
queryParams: Record<string, string> = {}
): Promise<{ collections: HttpTypes.StoreCollection[]; count: number }> => {
const next = {
...(await getCacheOptions("collections")),
}
queryParams.limit = queryParams.limit || "100"
queryParams.offset = queryParams.offset || "0"
};
queryParams.limit = queryParams.limit || "100";
queryParams.offset = queryParams.offset || "0";
console.log("SDK_CONFIG: ", SDK_CONFIG.baseUrl);
return sdk.client
.fetch<{ collections: HttpTypes.StoreCollection[]; count: number }>(
"/store/collections",
@@ -39,15 +39,15 @@ export const listCollections = async (
cache: "force-cache",
}
)
.then(({ collections }) => ({ collections, count: collections.length }))
}
.then(({ collections }) => ({ collections, count: collections.length }));
};
export const getCollectionByHandle = async (
handle: string
): Promise<HttpTypes.StoreCollection> => {
const next = {
...(await getCacheOptions("collections")),
}
};
return sdk.client
.fetch<HttpTypes.StoreCollectionListResponse>(`/store/collections`, {
@@ -55,5 +55,5 @@ export const getCollectionByHandle = async (
next,
cache: "force-cache",
})
.then(({ collections }) => collections[0])
}
.then(({ collections }) => collections[0]);
};

View File

@@ -38,7 +38,9 @@ export const SuccessNotification = ({
width={326}
height={195}
/>
<h1 className="pb-2">{title || <Trans i18nKey={titleKey} />}</h1>
<h1 className="pb-2 text-center">
{title || <Trans i18nKey={titleKey} />}
</h1>
<p className="text-muted-foreground text-sm">
<Trans i18nKey={descriptionKey} />
</p>

View File

@@ -44,7 +44,6 @@
"next": "15.3.2",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-hook-form": "^7.56.3",
"sonner": "^2.0.3"
},
"prettier": "@kit/prettier-config",

View File

@@ -29,8 +29,7 @@
"@types/react": "19.1.4",
"@types/react-dom": "19.1.5",
"react": "19.1.0",
"react-dom": "19.1.0",
"react-hook-form": "^7.56.3"
"react-dom": "19.1.0"
},
"typesVersions": {
"*": {

File diff suppressed because it is too large Load Diff

View File

@@ -54,7 +54,6 @@
"next-themes": "0.4.6",
"prettier": "^3.5.3",
"react-day-picker": "^8.10.1",
"react-hook-form": "^7.56.3",
"sonner": "^2.0.3",
"tailwindcss": "4.1.7",
"tailwindcss-animate": "^1.0.7",

View File

@@ -37,16 +37,12 @@ function PageWithSidebar(props: PageProps) {
<div
className={
props.contentContainerClassName ??
'mx-auto flex h-screen w-full flex-col overflow-y-auto bg-inherit'
'mx-auto flex h-screen w-full flex-col bg-inherit'
}
>
{MobileNavigation}
<div
className={
'bg-background flex flex-1 flex-col overflow-y-auto px-4 lg:px-0'
}
>
<div className={'bg-background flex flex-1 flex-col px-4 lg:px-0'}>
{Children}
</div>
</div>
@@ -75,7 +71,7 @@ function PageWithHeader(props: PageProps) {
const { Navigation, Children, MobileNavigation } = getSlotsFromPage(props);
return (
<div className={cn('flex h-screen flex-1 flex-col z-900', props.className)}>
<div className={cn('z-900 flex h-screen flex-1 flex-col', props.className)}>
<div
className={
props.contentContainerClassName ?? 'flex flex-1 flex-col space-y-4'
@@ -83,7 +79,7 @@ function PageWithHeader(props: PageProps) {
>
<div
className={cn(
'bg-bg-background border-1 light:border-border dark:border-border dark:shadow-primary/10 flex h-15 items-center justify-between px-4 py-1 lg:justify-start lg:shadow-xs border-b',
'bg-bg-background light:border-border dark:border-border dark:shadow-primary/10 flex h-15 items-center justify-between border-1 border-b px-4 py-1 lg:justify-start lg:shadow-xs',
{
'sticky top-0 z-1000 backdrop-blur-md': props.sticky ?? true,
},

125
pnpm-lock.yaml generated
View File

@@ -210,6 +210,9 @@ importers:
dotenv:
specifier: ^16.5.0
version: 16.5.0
next-transpile-modules:
specifier: ^10.0.1
version: 10.0.1
pino-pretty:
specifier: ^13.0.0
version: 13.0.0
@@ -269,7 +272,7 @@ importers:
devDependencies:
'@hookform/resolvers':
specifier: ^5.0.1
version: 5.0.1(react-hook-form@7.57.0(react@19.1.0))
version: 5.0.1(react-hook-form@7.58.0(react@19.1.0))
'@kit/billing':
specifier: workspace:*
version: link:../core
@@ -318,9 +321,6 @@ importers:
react:
specifier: 19.1.0
version: 19.1.0
react-hook-form:
specifier: ^7.56.3
version: 7.57.0(react@19.1.0)
packages/billing/lemon-squeezy:
dependencies:
@@ -607,7 +607,7 @@ importers:
devDependencies:
'@hookform/resolvers':
specifier: ^5.0.1
version: 5.0.1(react-hook-form@7.57.0(react@19.1.0))
version: 5.0.1(react-hook-form@7.58.0(react@19.1.0))
'@kit/billing-gateway':
specifier: workspace:*
version: link:../../billing/gateway
@@ -674,9 +674,6 @@ importers:
react-dom:
specifier: 19.1.0
version: 19.1.0(react@19.1.0)
react-hook-form:
specifier: ^7.56.3
version: 7.57.0(react@19.1.0)
sonner:
specifier: ^2.0.3
version: 2.0.5(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
@@ -685,7 +682,7 @@ importers:
devDependencies:
'@hookform/resolvers':
specifier: ^5.0.1
version: 5.0.1(react-hook-form@7.57.0(react@19.1.0))
version: 5.0.1(react-hook-form@7.58.0(react@19.1.0))
'@kit/eslint-config':
specifier: workspace:*
version: link:../../../tooling/eslint
@@ -737,15 +734,12 @@ importers:
react-dom:
specifier: 19.1.0
version: 19.1.0(react@19.1.0)
react-hook-form:
specifier: ^7.56.3
version: 7.57.0(react@19.1.0)
packages/features/auth:
devDependencies:
'@hookform/resolvers':
specifier: ^5.0.1
version: 5.0.1(react-hook-form@7.57.0(react@19.1.0))
version: 5.0.1(react-hook-form@7.58.0(react@19.1.0))
'@kit/eslint-config':
specifier: workspace:*
version: link:../../../tooling/eslint
@@ -785,9 +779,6 @@ importers:
next:
specifier: 15.3.2
version: 15.3.2(@opentelemetry/api@1.9.0)(babel-plugin-react-compiler@19.1.0-rc.2)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
react-hook-form:
specifier: ^7.56.3
version: 7.57.0(react@19.1.0)
sonner:
specifier: ^2.0.3
version: 2.0.5(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
@@ -942,7 +933,7 @@ importers:
devDependencies:
'@hookform/resolvers':
specifier: ^5.0.1
version: 5.0.1(react-hook-form@7.57.0(react@19.1.0))
version: 5.0.1(react-hook-form@7.58.0(react@19.1.0))
'@kit/accounts':
specifier: workspace:*
version: link:../accounts
@@ -1015,9 +1006,6 @@ importers:
react-dom:
specifier: 19.1.0
version: 19.1.0(react@19.1.0)
react-hook-form:
specifier: ^7.56.3
version: 7.57.0(react@19.1.0)
sonner:
specifier: ^2.0.3
version: 2.0.5(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
@@ -1276,7 +1264,7 @@ importers:
devDependencies:
'@hookform/resolvers':
specifier: ^5.0.1
version: 5.0.1(react-hook-form@7.57.0(react@19.1.0))
version: 5.0.1(react-hook-form@7.58.0(react@19.1.0))
'@kit/email-templates':
specifier: workspace:*
version: link:../email-templates
@@ -1322,9 +1310,6 @@ importers:
react-dom:
specifier: 19.1.0
version: 19.1.0(react@19.1.0)
react-hook-form:
specifier: ^7.56.3
version: 7.57.0(react@19.1.0)
packages/shared:
dependencies:
@@ -1384,7 +1369,7 @@ importers:
dependencies:
'@hookform/resolvers':
specifier: ^5.0.1
version: 5.0.1(react-hook-form@7.57.0(react@19.1.0))
version: 5.0.1(react-hook-form@7.58.0(react@19.1.0))
'@radix-ui/react-accordion':
specifier: 1.2.10
version: 1.2.10(@types/react-dom@19.1.5(@types/react@19.1.4))(@types/react@19.1.4)(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
@@ -1512,9 +1497,6 @@ importers:
react-day-picker:
specifier: ^8.10.1
version: 8.10.1(date-fns@4.1.0)(react@19.1.0)
react-hook-form:
specifier: ^7.56.3
version: 7.57.0(react@19.1.0)
sonner:
specifier: ^2.0.3
version: 2.0.5(react-dom@19.1.0(react@19.1.0))(react@19.1.0)
@@ -7801,6 +7783,9 @@ packages:
react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc
react-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc
next-transpile-modules@10.0.1:
resolution: {integrity: sha512-4VX/LCMofxIYAVV58UmD+kr8jQflpLWvas/BQ4Co0qWLWzVh06FoZkECkrX5eEZT6oJFqie6+kfbTA3EZCVtdQ==}
next@15.3.2:
resolution: {integrity: sha512-CA3BatMyHkxZ48sgOCLdVHjFU36N7TF1HhqAHLFOkV6buwZnvMI84Cug8xD56B9mCuKrqXnLn94417GrZ/jjCQ==}
engines: {node: ^18.18.0 || ^19.8.0 || >= 20.0.0}
@@ -8519,12 +8504,6 @@ packages:
peerDependencies:
react: '>=16.13.1'
react-hook-form@7.57.0:
resolution: {integrity: sha512-RbEks3+cbvTP84l/VXGUZ+JMrKOS8ykQCRYdm5aYsxnDquL0vspsyNhGRO7pcH6hsZqWlPOjLye7rJqdtdAmlg==}
engines: {node: '>=18.0.0'}
peerDependencies:
react: ^16.8.0 || ^17 || ^18 || ^19
react-hook-form@7.58.0:
resolution: {integrity: sha512-zGijmEed35oNfOfy7ub99jfjkiLhHwA3dl5AgyKdWC6QQzhnc7tkWewSa+T+A2EpLrc6wo5DUoZctS9kufWJjA==}
engines: {node: '>=18.0.0'}
@@ -9960,10 +9939,10 @@ snapshots:
react-dom: 19.0.0-rc-66855b96-20241106(react@19.0.0-rc-66855b96-20241106)
use-sync-external-store: 1.5.0(react@19.0.0-rc-66855b96-20241106)
'@hookform/resolvers@5.0.1(react-hook-form@7.57.0(react@19.1.0))':
'@hookform/resolvers@5.0.1(react-hook-form@7.58.0(react@19.1.0))':
dependencies:
'@standard-schema/utils': 0.3.0
react-hook-form: 7.57.0(react@19.1.0)
react-hook-form: 7.58.0(react@19.1.0)
'@hookform/resolvers@5.1.1(react-hook-form@7.58.0(react@19.1.0))':
dependencies:
@@ -17650,8 +17629,8 @@ snapshots:
'@typescript-eslint/parser': 8.33.1(eslint@8.10.0)(typescript@5.8.3)
eslint: 8.10.0
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint@8.10.0))(eslint@8.10.0)
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint@8.10.0))(eslint@8.10.0))(eslint@8.10.0)
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0)(eslint@8.10.0)
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint@8.10.0)
eslint-plugin-jsx-a11y: 6.10.2(eslint@8.10.0)
eslint-plugin-react: 7.37.5(eslint@8.10.0)
eslint-plugin-react-hooks: 5.2.0(eslint@8.10.0)
@@ -17670,8 +17649,8 @@ snapshots:
'@typescript-eslint/parser': 8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
eslint: 9.28.0(jiti@2.4.2)
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2))
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2))
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0)(eslint@9.28.0(jiti@2.4.2))
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2))
eslint-plugin-jsx-a11y: 6.10.2(eslint@9.28.0(jiti@2.4.2))
eslint-plugin-react: 7.37.5(eslint@9.28.0(jiti@2.4.2))
eslint-plugin-react-hooks: 5.2.0(eslint@9.28.0(jiti@2.4.2))
@@ -17696,22 +17675,7 @@ snapshots:
transitivePeerDependencies:
- supports-color
eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2)):
dependencies:
'@nolyfill/is-core-module': 1.0.39
debug: 4.4.1
eslint: 9.28.0(jiti@2.4.2)
get-tsconfig: 4.10.1
is-bun-module: 2.0.0
stable-hash: 0.0.5
tinyglobby: 0.2.14
unrs-resolver: 1.7.11
optionalDependencies:
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2))
transitivePeerDependencies:
- supports-color
eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint@8.10.0))(eslint@8.10.0):
eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0)(eslint@8.10.0):
dependencies:
'@nolyfill/is-core-module': 1.0.39
debug: 4.4.1
@@ -17722,33 +17686,48 @@ snapshots:
tinyglobby: 0.2.14
unrs-resolver: 1.7.11
optionalDependencies:
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint@8.10.0))(eslint@8.10.0))(eslint@8.10.0)
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint@8.10.0)
transitivePeerDependencies:
- supports-color
eslint-module-utils@2.12.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint@8.10.0))(eslint@8.10.0))(eslint@8.10.0):
eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0)(eslint@9.28.0(jiti@2.4.2)):
dependencies:
'@nolyfill/is-core-module': 1.0.39
debug: 4.4.1
eslint: 9.28.0(jiti@2.4.2)
get-tsconfig: 4.10.1
is-bun-module: 2.0.0
stable-hash: 0.0.5
tinyglobby: 0.2.14
unrs-resolver: 1.7.11
optionalDependencies:
eslint-plugin-import: 2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2))
transitivePeerDependencies:
- supports-color
eslint-module-utils@2.12.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@8.10.0):
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 8.33.1(eslint@8.10.0)(typescript@5.8.3)
eslint: 8.10.0
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint@8.10.0))(eslint@8.10.0)
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0)(eslint@8.10.0)
transitivePeerDependencies:
- supports-color
eslint-module-utils@2.12.0(@typescript-eslint/parser@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2)):
eslint-module-utils@2.12.0(@typescript-eslint/parser@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.28.0(jiti@2.4.2)):
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
eslint: 9.28.0(jiti@2.4.2)
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2))
eslint-import-resolver-typescript: 3.10.1(eslint-plugin-import@2.31.0)(eslint@9.28.0(jiti@2.4.2))
transitivePeerDependencies:
- supports-color
eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint@8.10.0))(eslint@8.10.0))(eslint@8.10.0):
eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2)):
dependencies:
'@rtsao/scc': 1.1.0
array-includes: 3.1.9
@@ -17757,9 +17736,9 @@ snapshots:
array.prototype.flatmap: 1.3.3
debug: 3.2.7
doctrine: 2.1.0
eslint: 8.10.0
eslint: 9.28.0(jiti@2.4.2)
eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint@8.10.0))(eslint@8.10.0))(eslint@8.10.0)
eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@9.28.0(jiti@2.4.2))
hasown: 2.0.2
is-core-module: 2.16.1
is-glob: 4.0.3
@@ -17771,13 +17750,13 @@ snapshots:
string.prototype.trimend: 1.0.9
tsconfig-paths: 3.15.0
optionalDependencies:
'@typescript-eslint/parser': 8.33.1(eslint@8.10.0)(typescript@5.8.3)
'@typescript-eslint/parser': 8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
transitivePeerDependencies:
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
- supports-color
eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2)):
eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint@8.10.0):
dependencies:
'@rtsao/scc': 1.1.0
array-includes: 3.1.9
@@ -17786,9 +17765,9 @@ snapshots:
array.prototype.flatmap: 1.3.3
debug: 3.2.7
doctrine: 2.1.0
eslint: 9.28.0(jiti@2.4.2)
eslint: 8.10.0
eslint-import-resolver-node: 0.3.9
eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1(eslint-plugin-import@2.31.0(@typescript-eslint/parser@8.32.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2)))(eslint@9.28.0(jiti@2.4.2))
eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.33.1(eslint@8.10.0)(typescript@5.8.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.10.1)(eslint@8.10.0)
hasown: 2.0.2
is-core-module: 2.16.1
is-glob: 4.0.3
@@ -17800,7 +17779,7 @@ snapshots:
string.prototype.trimend: 1.0.9
tsconfig-paths: 3.15.0
optionalDependencies:
'@typescript-eslint/parser': 8.33.1(eslint@9.28.0(jiti@2.4.2))(typescript@5.8.3)
'@typescript-eslint/parser': 8.33.1(eslint@8.10.0)(typescript@5.8.3)
transitivePeerDependencies:
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
@@ -19261,6 +19240,10 @@ snapshots:
react: 19.1.0
react-dom: 19.1.0(react@19.1.0)
next-transpile-modules@10.0.1:
dependencies:
enhanced-resolve: 5.18.1
next@15.3.2(@babel/core@7.27.4)(@opentelemetry/api@1.9.0)(babel-plugin-react-compiler@19.1.0-rc.2)(react-dom@19.0.0-rc-66855b96-20241106(react@19.0.0-rc-66855b96-20241106))(react@19.0.0-rc-66855b96-20241106):
dependencies:
'@next/env': 15.3.2
@@ -20175,10 +20158,6 @@ snapshots:
'@babel/runtime': 7.27.6
react: 19.1.0
react-hook-form@7.57.0(react@19.1.0):
dependencies:
react: 19.1.0
react-hook-form@7.58.0(react@19.1.0):
dependencies:
react: 19.1.0

View File

@@ -122,5 +122,10 @@
"consentToAnonymizedCompanyData": {
"label": "Consent to be included in employer statistics",
"description": "Consent to be included in anonymized company statistics"
},
"analysisResults": {
"pageTitle": "My analysis results",
"description": "Super, oled käinud tervist kontrollimas. Siin on sinule olulised näitajad:",
"orderNewAnalysis": "Telli uued analüüsid"
}
}
}

View File

@@ -145,5 +145,10 @@
"successTitle": "Tere, {{firstName}} {{lastName}}",
"successDescription": "Teie tervisekonto on aktiveeritud ja kasutamiseks valmis!",
"successButton": "Jätka"
},
"analysisResults": {
"pageTitle": "Minu analüüside vastused",
"description": "Super, oled käinud tervist kontrollimas. Siin on sinule olulised näitajad:",
"orderNewAnalysis": "Telli uued analüüsid"
}
}

View File

@@ -119,5 +119,8 @@
"consentToAnonymizedCompanyData": {
"label": "Consent to be included in employer statistics",
"description": "Consent to be included in anonymized company statistics"
},
"analysisResults": {
"pageTitle": "My analysis results"
}
}
}

View File

@@ -1,227 +1,227 @@
create table "public"."connected_online_providers" (
"id" bigint not null,
"name" text not null,
"email" text,
"phone_number" text,
"can_select_worker" boolean not null,
"personal_code_required" boolean not null,
"created_at" timestamp with time zone not null default now(),
"updated_at" timestamp without time zone default now()
);
-- create table "public"."connected_online_providers" (
-- "id" bigint not null,
-- "name" text not null,
-- "email" text,
-- "phone_number" text,
-- "can_select_worker" boolean not null,
-- "personal_code_required" boolean not null,
-- "created_at" timestamp with time zone not null default now(),
-- "updated_at" timestamp without time zone default now()
-- );
alter table "public"."connected_online_providers" enable row level security;
-- alter table "public"."connected_online_providers" enable row level security;
create table "public"."connected_online_services" (
"id" bigint not null,
"clinic_id" bigint not null,
"sync_id" bigint not null,
"name" text not null,
"description" text,
"price" double precision not null,
"requires_payment" boolean not null,
"duration" bigint not null,
"neto_duration" bigint,
"display" text,
"price_periods" text,
"online_hide_duration" bigint,
"online_hide_price" bigint,
"code" text not null,
"has_free_codes" boolean not null,
"created_at" timestamp with time zone not null default now(),
"updated_at" timestamp with time zone default now()
);
-- create table "public"."connected_online_services" (
-- "id" bigint not null,
-- "clinic_id" bigint not null,
-- "sync_id" bigint not null,
-- "name" text not null,
-- "description" text,
-- "price" double precision not null,
-- "requires_payment" boolean not null,
-- "duration" bigint not null,
-- "neto_duration" bigint,
-- "display" text,
-- "price_periods" text,
-- "online_hide_duration" bigint,
-- "online_hide_price" bigint,
-- "code" text not null,
-- "has_free_codes" boolean not null,
-- "created_at" timestamp with time zone not null default now(),
-- "updated_at" timestamp with time zone default now()
-- );
alter table "public"."connected_online_services" enable row level security;
-- alter table "public"."connected_online_services" enable row level security;
CREATE UNIQUE INDEX connected_online_providers_id_key ON public.connected_online_providers USING btree (id);
-- CREATE UNIQUE INDEX connected_online_providers_id_key ON public.connected_online_providers USING btree (id);
CREATE UNIQUE INDEX connected_online_providers_pkey ON public.connected_online_providers USING btree (id);
-- CREATE UNIQUE INDEX connected_online_providers_pkey ON public.connected_online_providers USING btree (id);
CREATE UNIQUE INDEX connected_online_services_id_key ON public.connected_online_services USING btree (id);
-- CREATE UNIQUE INDEX connected_online_services_id_key ON public.connected_online_services USING btree (id);
CREATE UNIQUE INDEX connected_online_services_pkey ON public.connected_online_services USING btree (id);
-- CREATE UNIQUE INDEX connected_online_services_pkey ON public.connected_online_services USING btree (id);
alter table "public"."connected_online_providers" add constraint "connected_online_providers_pkey" PRIMARY KEY using index "connected_online_providers_pkey";
-- alter table "public"."connected_online_providers" add constraint "connected_online_providers_pkey" PRIMARY KEY using index "connected_online_providers_pkey";
alter table "public"."connected_online_services" add constraint "connected_online_services_pkey" PRIMARY KEY using index "connected_online_services_pkey";
-- alter table "public"."connected_online_services" add constraint "connected_online_services_pkey" PRIMARY KEY using index "connected_online_services_pkey";
alter table "public"."connected_online_providers" add constraint "connected_online_providers_id_key" UNIQUE using index "connected_online_providers_id_key";
-- alter table "public"."connected_online_providers" add constraint "connected_online_providers_id_key" UNIQUE using index "connected_online_providers_id_key";
alter table "public"."connected_online_services" add constraint "connected_online_services_clinic_id_fkey" FOREIGN KEY (clinic_id) REFERENCES connected_online_providers(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
-- alter table "public"."connected_online_services" add constraint "connected_online_services_clinic_id_fkey" FOREIGN KEY (clinic_id) REFERENCES connected_online_providers(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."connected_online_services" validate constraint "connected_online_services_clinic_id_fkey";
-- alter table "public"."connected_online_services" validate constraint "connected_online_services_clinic_id_fkey";
alter table "public"."connected_online_services" add constraint "connected_online_services_id_key" UNIQUE using index "connected_online_services_id_key";
-- alter table "public"."connected_online_services" add constraint "connected_online_services_id_key" UNIQUE using index "connected_online_services_id_key";
grant delete on table "public"."connected_online_providers" to "service_role";
-- grant delete on table "public"."connected_online_providers" to "service_role";
grant insert on table "public"."connected_online_providers" to "service_role";
-- grant insert on table "public"."connected_online_providers" to "service_role";
grant references on table "public"."connected_online_providers" to "service_role";
-- grant references on table "public"."connected_online_providers" to "service_role";
grant select on table "public"."connected_online_providers" to "service_role";
-- grant select on table "public"."connected_online_providers" to "service_role";
grant trigger on table "public"."connected_online_providers" to "service_role";
-- grant trigger on table "public"."connected_online_providers" to "service_role";
grant truncate on table "public"."connected_online_providers" to "service_role";
-- grant truncate on table "public"."connected_online_providers" to "service_role";
grant update on table "public"."connected_online_providers" to "service_role";
-- grant update on table "public"."connected_online_providers" to "service_role";
grant select on table "public"."connected_online_providers" to "authenticated";
-- grant select on table "public"."connected_online_providers" to "authenticated";
grant delete on table "public"."connected_online_services" to "service_role";
-- grant delete on table "public"."connected_online_services" to "service_role";
grant insert on table "public"."connected_online_services" to "service_role";
-- grant insert on table "public"."connected_online_services" to "service_role";
grant references on table "public"."connected_online_services" to "service_role";
-- grant references on table "public"."connected_online_services" to "service_role";
grant select on table "public"."connected_online_services" to "service_role";
-- grant select on table "public"."connected_online_services" to "service_role";
grant trigger on table "public"."connected_online_services" to "service_role";
-- grant trigger on table "public"."connected_online_services" to "service_role";
grant truncate on table "public"."connected_online_services" to "service_role";
-- grant truncate on table "public"."connected_online_services" to "service_role";
grant update on table "public"."connected_online_services" to "service_role";
-- grant update on table "public"."connected_online_services" to "service_role";
grant select on table "public"."connected_online_services" to "authenticated";
-- grant select on table "public"."connected_online_services" to "authenticated";
create type "audit"."request_status" as enum ('SUCCESS', 'FAIL');
-- create type "audit"."request_status" as enum ('SUCCESS', 'FAIL');
create table "audit"."request_entries" (
"id" bigint generated by default as identity not null,
"personal_code" bigint,
"request_api" text not null,
"request_api_method" text not null,
"status" audit.request_status not null,
"comment" text,
"service_provider_id" bigint,
"service_id" bigint,
"requested_start_date" timestamp with time zone,
"requested_end_date" timestamp with time zone,
"created_at" timestamp with time zone not null default now()
);
-- create table "audit"."request_entries" (
-- "id" bigint generated by default as identity not null,
-- "personal_code" bigint,
-- "request_api" text not null,
-- "request_api_method" text not null,
-- "status" audit.request_status not null,
-- "comment" text,
-- "service_provider_id" bigint,
-- "service_id" bigint,
-- "requested_start_date" timestamp with time zone,
-- "requested_end_date" timestamp with time zone,
-- "created_at" timestamp with time zone not null default now()
-- );
alter table "audit"."request_entries" enable row level security;
-- alter table "audit"."request_entries" enable row level security;
CREATE UNIQUE INDEX request_entries_pkey ON audit.request_entries USING btree (id);
-- CREATE UNIQUE INDEX request_entries_pkey ON audit.request_entries USING btree (id);
alter table "audit"."request_entries" add constraint "request_entries_pkey" PRIMARY KEY using index "request_entries_pkey";
-- alter table "audit"."request_entries" add constraint "request_entries_pkey" PRIMARY KEY using index "request_entries_pkey";
grant delete on table "audit"."request_entries" to "service_role";
-- grant delete on table "audit"."request_entries" to "service_role";
grant insert on table "audit"."request_entries" to "service_role";
-- grant insert on table "audit"."request_entries" to "service_role";
grant references on table "audit"."request_entries" to "service_role";
-- grant references on table "audit"."request_entries" to "service_role";
grant select on table "audit"."request_entries" to "service_role";
-- grant select on table "audit"."request_entries" to "service_role";
grant trigger on table "audit"."request_entries" to "service_role";
-- grant trigger on table "audit"."request_entries" to "service_role";
grant truncate on table "audit"."request_entries" to "service_role";
-- grant truncate on table "audit"."request_entries" to "service_role";
grant update on table "audit"."request_entries" to "service_role";
-- grant update on table "audit"."request_entries" to "service_role";
create policy "service_role_all"
on "audit"."request_entries"
as permissive
for all
to service_role
using (true);
-- create policy "service_role_all"
-- on "audit"."request_entries"
-- as permissive
-- for all
-- to service_role
-- using (true);
create table "public"."connected_online_reservation" (
"id" bigint generated by default as identity not null,
"user_id" uuid not null,
"booking_code" text not null,
"service_id" bigint not null,
"clinic_id" bigint not null,
"service_user_id" bigint,
"sync_user_id" bigint not null,
"requires_payment" boolean not null,
"comments" text,
"start_time" timestamp with time zone not null,
"lang" text not null,
"discount_code" text,
"created_at" timestamp with time zone not null default now(),
"updated_at" timestamp with time zone default now()
);
-- create table "public"."connected_online_reservation" (
-- "id" bigint generated by default as identity not null,
-- "user_id" uuid not null,
-- "booking_code" text not null,
-- "service_id" bigint not null,
-- "clinic_id" bigint not null,
-- "service_user_id" bigint,
-- "sync_user_id" bigint not null,
-- "requires_payment" boolean not null,
-- "comments" text,
-- "start_time" timestamp with time zone not null,
-- "lang" text not null,
-- "discount_code" text,
-- "created_at" timestamp with time zone not null default now(),
-- "updated_at" timestamp with time zone default now()
-- );
alter table "public"."connected_online_reservation" enable row level security;
-- alter table "public"."connected_online_reservation" enable row level security;
CREATE UNIQUE INDEX connected_online_reservation_booking_code_key ON public.connected_online_reservation USING btree (booking_code);
-- CREATE UNIQUE INDEX connected_online_reservation_booking_code_key ON public.connected_online_reservation USING btree (booking_code);
CREATE UNIQUE INDEX connected_online_reservation_pkey ON public.connected_online_reservation USING btree (id);
-- CREATE UNIQUE INDEX connected_online_reservation_pkey ON public.connected_online_reservation USING btree (id);
alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_pkey" PRIMARY KEY using index "connected_online_reservation_pkey";
-- alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_pkey" PRIMARY KEY using index "connected_online_reservation_pkey";
alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_booking_code_key" UNIQUE using index "connected_online_reservation_booking_code_key";
-- alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_booking_code_key" UNIQUE using index "connected_online_reservation_booking_code_key";
alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_user_id_fkey" FOREIGN KEY (user_id) REFERENCES auth.users(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
-- alter table "public"."connected_online_reservation" add constraint "connected_online_reservation_user_id_fkey" FOREIGN KEY (user_id) REFERENCES auth.users(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."connected_online_reservation" validate constraint "connected_online_reservation_user_id_fkey";
-- alter table "public"."connected_online_reservation" validate constraint "connected_online_reservation_user_id_fkey";
grant delete on table "public"."connected_online_reservation" to "service_role";
-- grant delete on table "public"."connected_online_reservation" to "service_role";
grant insert on table "public"."connected_online_reservation" to "service_role";
-- grant insert on table "public"."connected_online_reservation" to "service_role";
grant references on table "public"."connected_online_reservation" to "service_role";
-- grant references on table "public"."connected_online_reservation" to "service_role";
grant select on table "public"."connected_online_reservation" to "service_role";
-- grant select on table "public"."connected_online_reservation" to "service_role";
grant trigger on table "public"."connected_online_reservation" to "service_role";
-- grant trigger on table "public"."connected_online_reservation" to "service_role";
grant truncate on table "public"."connected_online_reservation" to "service_role";
-- grant truncate on table "public"."connected_online_reservation" to "service_role";
grant update on table "public"."connected_online_reservation" to "service_role";
-- grant update on table "public"."connected_online_reservation" to "service_role";
create policy "service_role_all"
on "public"."connected_online_reservation"
as permissive
for all
to service_role
using (true);
-- create policy "service_role_all"
-- on "public"."connected_online_reservation"
-- as permissive
-- for all
-- to service_role
-- using (true);
CREATE TRIGGER connected_online_providers_change_record_timestamps AFTER INSERT OR UPDATE ON public.connected_online_providers FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamps();
-- CREATE TRIGGER connected_online_providers_change_record_timestamps AFTER INSERT OR UPDATE ON public.connected_online_providers FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamps();
CREATE TRIGGER connected_online_services_change_record_timestamps AFTER INSERT OR UPDATE ON public.connected_online_services FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamps();
-- CREATE TRIGGER connected_online_services_change_record_timestamps AFTER INSERT OR UPDATE ON public.connected_online_services FOR EACH ROW EXECUTE FUNCTION trigger_set_timestamps();
create policy "service_role_all"
on "public"."connected_online_providers"
as permissive
for all
to service_role
using (true);
-- create policy "service_role_all"
-- on "public"."connected_online_providers"
-- as permissive
-- for all
-- to service_role
-- using (true);
create policy "service_role_all"
on "public"."connected_online_services"
as permissive
for all
to service_role
using (true);
-- create policy "service_role_all"
-- on "public"."connected_online_services"
-- as permissive
-- for all
-- to service_role
-- using (true);
create policy "authenticated_select"
on "public"."connected_online_providers"
as permissive
for select
to authenticated
using (true);
-- create policy "authenticated_select"
-- on "public"."connected_online_providers"
-- as permissive
-- for select
-- to authenticated
-- using (true);
create policy "authenticated_select"
on "public"."connected_online_services"
as permissive
for select
to authenticated
using (true);
-- create policy "authenticated_select"
-- on "public"."connected_online_services"
-- as permissive
-- for select
-- to authenticated
-- using (true);
create policy "own_all"
on "public"."connected_online_reservation"
as permissive
for all
to authenticated
using ((( SELECT auth.uid() AS uid) = user_id));
-- create policy "own_all"
-- on "public"."connected_online_reservation"
-- as permissive
-- for all
-- to authenticated
-- using ((( SELECT auth.uid() AS uid) = user_id));

View File

@@ -1,225 +1,225 @@
create table "public"."medreport_product_groups" (
"id" bigint generated by default as identity not null,
"name" text not null,
"created_at" timestamp with time zone not null default now(),
"updated_at" timestamp with time zone
);
-- create table "public"."medreport_product_groups" (
-- "id" bigint generated by default as identity not null,
-- "name" text not null,
-- "created_at" timestamp with time zone not null default now(),
-- "updated_at" timestamp with time zone
-- );
create table "public"."medreport_products" (
"id" bigint generated by default as identity not null,
"name" text not null,
"product_group_id" bigint,
"created_at" timestamp with time zone not null default now(),
"updated_at" timestamp with time zone default now()
);
-- create table "public"."medreport_products" (
-- "id" bigint generated by default as identity not null,
-- "name" text not null,
-- "product_group_id" bigint,
-- "created_at" timestamp with time zone not null default now(),
-- "updated_at" timestamp with time zone default now()
-- );
alter table "public"."medreport_products" enable row level security;
-- alter table "public"."medreport_products" enable row level security;
create table "public"."medreport_products_analyses_relations" (
"product_id" bigint not null,
"analysis_element_id" bigint,
"analysis_id" bigint
);
-- create table "public"."medreport_products_analyses_relations" (
-- "product_id" bigint not null,
-- "analysis_element_id" bigint,
-- "analysis_id" bigint
-- );
alter table "public"."medreport_product_groups" enable row level security;
-- alter table "public"."medreport_product_groups" enable row level security;
alter table "public"."medreport_products_analyses_relations" enable row level security;
-- alter table "public"."medreport_products_analyses_relations" enable row level security;
CREATE UNIQUE INDEX medreport_product_groups_name_key ON public.medreport_product_groups USING btree (name);
-- CREATE UNIQUE INDEX medreport_product_groups_name_key ON public.medreport_product_groups USING btree (name);
CREATE UNIQUE INDEX medreport_product_groups_pkey ON public.medreport_product_groups USING btree (id);
-- CREATE UNIQUE INDEX medreport_product_groups_pkey ON public.medreport_product_groups USING btree (id);
alter table "public"."medreport_product_groups" add constraint "medreport_product_groups_pkey" PRIMARY KEY using index "medreport_product_groups_pkey";
-- alter table "public"."medreport_product_groups" add constraint "medreport_product_groups_pkey" PRIMARY KEY using index "medreport_product_groups_pkey";
alter table "public"."medreport_product_groups" add constraint "medreport_product_groups_name_key" UNIQUE using index "medreport_product_groups_name_key";
-- alter table "public"."medreport_product_groups" add constraint "medreport_product_groups_name_key" UNIQUE using index "medreport_product_groups_name_key";
alter table "public"."medreport_products" add constraint "medreport_products_product_groups_id_fkey" FOREIGN KEY (product_group_id) REFERENCES medreport_product_groups(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
-- alter table "public"."medreport_products" add constraint "medreport_products_product_groups_id_fkey" FOREIGN KEY (product_group_id) REFERENCES medreport_product_groups(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products" validate constraint "medreport_products_product_groups_id_fkey";
-- alter table "public"."medreport_products" validate constraint "medreport_products_product_groups_id_fkey";
grant select on table "public"."medreport_product_groups" to "anon";
-- grant select on table "public"."medreport_product_groups" to "anon";
grant select on table "public"."medreport_product_groups" to "authenticated";
-- grant select on table "public"."medreport_product_groups" to "authenticated";
grant delete on table "public"."medreport_product_groups" to "service_role";
-- grant delete on table "public"."medreport_product_groups" to "service_role";
grant insert on table "public"."medreport_product_groups" to "service_role";
-- grant insert on table "public"."medreport_product_groups" to "service_role";
grant references on table "public"."medreport_product_groups" to "service_role";
-- grant references on table "public"."medreport_product_groups" to "service_role";
grant select on table "public"."medreport_product_groups" to "service_role";
-- grant select on table "public"."medreport_product_groups" to "service_role";
grant trigger on table "public"."medreport_product_groups" to "service_role";
-- grant trigger on table "public"."medreport_product_groups" to "service_role";
grant truncate on table "public"."medreport_product_groups" to "service_role";
-- grant truncate on table "public"."medreport_product_groups" to "service_role";
grant update on table "public"."medreport_product_groups" to "service_role";
-- grant update on table "public"."medreport_product_groups" to "service_role";
CREATE UNIQUE INDEX medreport_products_analyses_analysis_element_id_key ON public.medreport_products_analyses_relations USING btree (analysis_element_id);
-- CREATE UNIQUE INDEX medreport_products_analyses_analysis_element_id_key ON public.medreport_products_analyses_relations USING btree (analysis_element_id);
CREATE UNIQUE INDEX medreport_products_analyses_analysis_id_key ON public.medreport_products_analyses_relations USING btree (analysis_id);
-- CREATE UNIQUE INDEX medreport_products_analyses_analysis_id_key ON public.medreport_products_analyses_relations USING btree (analysis_id);
CREATE UNIQUE INDEX medreport_products_analyses_pkey ON public.medreport_products_analyses_relations USING btree (product_id);
-- CREATE UNIQUE INDEX medreport_products_analyses_pkey ON public.medreport_products_analyses_relations USING btree (product_id);
CREATE UNIQUE INDEX medreport_products_name_key ON public.medreport_products USING btree (name);
-- CREATE UNIQUE INDEX medreport_products_name_key ON public.medreport_products USING btree (name);
CREATE UNIQUE INDEX medreport_products_pkey ON public.medreport_products USING btree (id);
-- CREATE UNIQUE INDEX medreport_products_pkey ON public.medreport_products USING btree (id);
alter table "public"."medreport_products" add constraint "medreport_products_pkey" PRIMARY KEY using index "medreport_products_pkey";
-- alter table "public"."medreport_products" add constraint "medreport_products_pkey" PRIMARY KEY using index "medreport_products_pkey";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_pkey" PRIMARY KEY using index "medreport_products_analyses_pkey";
-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_pkey" PRIMARY KEY using index "medreport_products_analyses_pkey";
alter table "public"."medreport_products" add constraint "medreport_products_name_key" UNIQUE using index "medreport_products_name_key";
-- alter table "public"."medreport_products" add constraint "medreport_products_name_key" UNIQUE using index "medreport_products_name_key";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_element_id_fkey" FOREIGN KEY (analysis_element_id) REFERENCES analysis_elements(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_element_id_fkey" FOREIGN KEY (analysis_element_id) REFERENCES analysis_elements(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_element_id_fkey";
-- alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_element_id_fkey";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_element_id_key" UNIQUE using index "medreport_products_analyses_analysis_element_id_key";
-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_element_id_key" UNIQUE using index "medreport_products_analyses_analysis_element_id_key";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_id_fkey" FOREIGN KEY (analysis_id) REFERENCES analyses(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_id_fkey" FOREIGN KEY (analysis_id) REFERENCES analyses(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_id_fkey";
-- alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_analysis_id_fkey";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_id_key" UNIQUE using index "medreport_products_analyses_analysis_id_key";
-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_analysis_id_key" UNIQUE using index "medreport_products_analyses_analysis_id_key";
alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_product_id_fkey" FOREIGN KEY (product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
-- alter table "public"."medreport_products_analyses_relations" add constraint "medreport_products_analyses_product_id_fkey" FOREIGN KEY (product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_product_id_fkey";
-- alter table "public"."medreport_products_analyses_relations" validate constraint "medreport_products_analyses_product_id_fkey";
alter table "public"."medreport_products_analyses_relations" add constraint "product_can_be_tied_to_only_one_external_item" CHECK (((analysis_id IS NULL) OR (analysis_element_id IS NULL))) not valid;
-- alter table "public"."medreport_products_analyses_relations" add constraint "product_can_be_tied_to_only_one_external_item" CHECK (((analysis_id IS NULL) OR (analysis_element_id IS NULL))) not valid;
alter table "public"."medreport_products_analyses_relations" validate constraint "product_can_be_tied_to_only_one_external_item";
-- alter table "public"."medreport_products_analyses_relations" validate constraint "product_can_be_tied_to_only_one_external_item";
grant select on table "public"."medreport_products" to "anon";
-- grant select on table "public"."medreport_products" to "anon";
grant select on table "public"."medreport_products" to "authenticated";
-- grant select on table "public"."medreport_products" to "authenticated";
grant delete on table "public"."medreport_products" to "service_role";
-- grant delete on table "public"."medreport_products" to "service_role";
grant insert on table "public"."medreport_products" to "service_role";
-- grant insert on table "public"."medreport_products" to "service_role";
grant references on table "public"."medreport_products" to "service_role";
-- grant references on table "public"."medreport_products" to "service_role";
grant select on table "public"."medreport_products" to "service_role";
-- grant select on table "public"."medreport_products" to "service_role";
grant trigger on table "public"."medreport_products" to "service_role";
-- grant trigger on table "public"."medreport_products" to "service_role";
grant truncate on table "public"."medreport_products" to "service_role";
-- grant truncate on table "public"."medreport_products" to "service_role";
grant update on table "public"."medreport_products" to "service_role";
-- grant update on table "public"."medreport_products" to "service_role";
grant select on table "public"."medreport_products_analyses_relations" to "anon";
-- grant select on table "public"."medreport_products_analyses_relations" to "anon";
grant select on table "public"."medreport_products_analyses_relations" to "authenticated";
-- grant select on table "public"."medreport_products_analyses_relations" to "authenticated";
grant delete on table "public"."medreport_products_analyses_relations" to "service_role";
-- grant delete on table "public"."medreport_products_analyses_relations" to "service_role";
grant insert on table "public"."medreport_products_analyses_relations" to "service_role";
-- grant insert on table "public"."medreport_products_analyses_relations" to "service_role";
grant references on table "public"."medreport_products_analyses_relations" to "service_role";
-- grant references on table "public"."medreport_products_analyses_relations" to "service_role";
grant select on table "public"."medreport_products_analyses_relations" to "service_role";
-- grant select on table "public"."medreport_products_analyses_relations" to "service_role";
grant trigger on table "public"."medreport_products_analyses_relations" to "service_role";
-- grant trigger on table "public"."medreport_products_analyses_relations" to "service_role";
grant truncate on table "public"."medreport_products_analyses_relations" to "service_role";
-- grant truncate on table "public"."medreport_products_analyses_relations" to "service_role";
grant update on table "public"."medreport_products_analyses_relations" to "service_role";
-- grant update on table "public"."medreport_products_analyses_relations" to "service_role";
create policy "Enable read access for all users"
on "public"."medreport_products_analyses_relations"
as permissive
for select
to public
using (true);
-- create policy "Enable read access for all users"
-- on "public"."medreport_products_analyses_relations"
-- as permissive
-- for select
-- to public
-- using (true);
ALTER TABLE medreport_products_analyses_relations
ADD CONSTRAINT product_can_be_tied_to_only_one_analysis_item
CHECK (analysis_id IS NULL OR analysis_element_id IS NULL);
-- ALTER TABLE medreport_products_analyses_relations
-- ADD CONSTRAINT product_can_be_tied_to_only_one_analysis_item
-- CHECK (analysis_id IS NULL OR analysis_element_id IS NULL);
create table "public"."medreport_products_external_services_relations" (
"product_id" bigint not null,
"connected_online_service_id" bigint not null
);
-- create table "public"."medreport_products_external_services_relations" (
-- "product_id" bigint not null,
-- "connected_online_service_id" bigint not null
-- );
alter table "public"."medreport_products_external_services_relations" enable row level security;
-- alter table "public"."medreport_products_external_services_relations" enable row level security;
CREATE UNIQUE INDEX medreport_products_connected_online_services_id_key ON public.medreport_products_external_services_relations USING btree (connected_online_service_id);
-- CREATE UNIQUE INDEX medreport_products_connected_online_services_id_key ON public.medreport_products_external_services_relations USING btree (connected_online_service_id);
CREATE UNIQUE INDEX medreport_products_connected_online_services_pkey ON public.medreport_products_external_services_relations USING btree (connected_online_service_id);
-- CREATE UNIQUE INDEX medreport_products_connected_online_services_pkey ON public.medreport_products_external_services_relations USING btree (connected_online_service_id);
alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_pkey" PRIMARY KEY using index "medreport_products_connected_online_services_pkey";
-- alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_pkey" PRIMARY KEY using index "medreport_products_connected_online_services_pkey";
alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_id_fkey" FOREIGN KEY (connected_online_service_id) REFERENCES connected_online_services(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
-- alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_id_fkey" FOREIGN KEY (connected_online_service_id) REFERENCES connected_online_services(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products_external_services_relations" validate constraint "medreport_products_connected_online_services_id_fkey";
-- alter table "public"."medreport_products_external_services_relations" validate constraint "medreport_products_connected_online_services_id_fkey";
alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_id_key" UNIQUE using index "medreport_products_connected_online_services_id_key";
-- alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_id_key" UNIQUE using index "medreport_products_connected_online_services_id_key";
alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_product_id_fkey" FOREIGN KEY (product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
-- alter table "public"."medreport_products_external_services_relations" add constraint "medreport_products_connected_online_services_product_id_fkey" FOREIGN KEY (product_id) REFERENCES medreport_products(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."medreport_products_external_services_relations" validate constraint "medreport_products_connected_online_services_product_id_fkey";
-- alter table "public"."medreport_products_external_services_relations" validate constraint "medreport_products_connected_online_services_product_id_fkey";
grant select on table "public"."medreport_products_external_services_relations" to "anon";
-- grant select on table "public"."medreport_products_external_services_relations" to "anon";
grant select on table "public"."medreport_products_external_services_relations" to "authenticated";
-- grant select on table "public"."medreport_products_external_services_relations" to "authenticated";
grant delete on table "public"."medreport_products_external_services_relations" to "service_role";
-- grant delete on table "public"."medreport_products_external_services_relations" to "service_role";
grant insert on table "public"."medreport_products_external_services_relations" to "service_role";
-- grant insert on table "public"."medreport_products_external_services_relations" to "service_role";
grant references on table "public"."medreport_products_external_services_relations" to "service_role";
-- grant references on table "public"."medreport_products_external_services_relations" to "service_role";
grant select on table "public"."medreport_products_external_services_relations" to "service_role";
-- grant select on table "public"."medreport_products_external_services_relations" to "service_role";
grant trigger on table "public"."medreport_products_external_services_relations" to "service_role";
-- grant trigger on table "public"."medreport_products_external_services_relations" to "service_role";
grant truncate on table "public"."medreport_products_external_services_relations" to "service_role";
-- grant truncate on table "public"."medreport_products_external_services_relations" to "service_role";
grant update on table "public"."medreport_products_external_services_relations" to "service_role";
-- grant update on table "public"."medreport_products_external_services_relations" to "service_role";
CREATE OR REPLACE FUNCTION check_tied_to_connected_online()
RETURNS TRIGGER AS $$
BEGIN
IF EXISTS (
SELECT 1
FROM medreport_products_external_services_relations
WHERE product_id = NEW.product_id
) THEN
RAISE EXCEPTION 'Value "%" already exists in medreport_products_external_services_relations', NEW.product_id;
END IF;
-- CREATE OR REPLACE FUNCTION check_tied_to_connected_online()
-- RETURNS TRIGGER AS $$
-- BEGIN
-- IF EXISTS (
-- SELECT 1
-- FROM medreport_products_external_services_relations
-- WHERE product_id = NEW.product_id
-- ) THEN
-- RAISE EXCEPTION 'Value "%" already exists in medreport_products_external_services_relations', NEW.product_id;
-- END IF;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
-- RETURN NEW;
-- END;
-- $$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION check_tied_to_analysis_item()
RETURNS TRIGGER AS $$
BEGIN
IF EXISTS (
SELECT 1
FROM medreport_products_analyses_relations
WHERE product_id = NEW.product_id
) THEN
RAISE EXCEPTION 'Value "%" already exists in medreport_products_analyses_relations', NEW.product_id;
END IF;
-- CREATE OR REPLACE FUNCTION check_tied_to_analysis_item()
-- RETURNS TRIGGER AS $$
-- BEGIN
-- IF EXISTS (
-- SELECT 1
-- FROM medreport_products_analyses_relations
-- WHERE product_id = NEW.product_id
-- ) THEN
-- RAISE EXCEPTION 'Value "%" already exists in medreport_products_analyses_relations', NEW.product_id;
-- END IF;
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
-- RETURN NEW;
-- END;
-- $$ LANGUAGE plpgsql;
CREATE TRIGGER check_not_already_tied_to_connected_online BEFORE INSERT OR UPDATE ON public.medreport_products_analyses_relations FOR EACH ROW EXECUTE FUNCTION check_tied_to_connected_online();
-- CREATE TRIGGER check_not_already_tied_to_connected_online BEFORE INSERT OR UPDATE ON public.medreport_products_analyses_relations FOR EACH ROW EXECUTE FUNCTION check_tied_to_connected_online();
CREATE TRIGGER check_not_already_tied_to_analysis BEFORE INSERT OR UPDATE ON public.medreport_products_external_services_relations FOR EACH ROW EXECUTE FUNCTION check_tied_to_analysis_item();
-- CREATE TRIGGER check_not_already_tied_to_analysis BEFORE INSERT OR UPDATE ON public.medreport_products_external_services_relations FOR EACH ROW EXECUTE FUNCTION check_tied_to_analysis_item();
create policy "read_all"
on "public"."medreport_product_groups"
as permissive
for select
to public
using (true);
-- create policy "read_all"
-- on "public"."medreport_product_groups"
-- as permissive
-- for select
-- to public
-- using (true);

View File

@@ -680,17 +680,17 @@ drop policy "accounts_self_update" on "public"."accounts";
drop policy "create_org_account" on "public"."accounts";
drop policy "restrict_mfa_accounts" on "public"."accounts";
-- drop policy "restrict_mfa_accounts" on "public"."accounts";
drop policy "super_admins_access_accounts" on "public"."accounts";
-- drop policy "super_admins_access_accounts" on "public"."accounts";
drop policy "accounts_memberships_delete" on "public"."accounts_memberships";
drop policy "accounts_memberships_read" on "public"."accounts_memberships";
drop policy "restrict_mfa_accounts_memberships" on "public"."accounts_memberships";
-- drop policy "restrict_mfa_accounts_memberships" on "public"."accounts_memberships";
drop policy "super_admins_access_accounts_memberships" on "public"."accounts_memberships";
-- drop policy "super_admins_access_accounts_memberships" on "public"."accounts_memberships";
drop policy "analysis_all" on "public"."analyses";
@@ -742,53 +742,53 @@ drop policy "invitations_read_self" on "public"."invitations";
drop policy "invitations_update" on "public"."invitations";
drop policy "restrict_mfa_invitations" on "public"."invitations";
-- drop policy "restrict_mfa_invitations" on "public"."invitations";
drop policy "super_admins_access_invitations" on "public"."invitations";
-- drop policy "super_admins_access_invitations" on "public"."invitations";
drop policy "read_all" on "public"."medreport_product_groups";
drop policy "Enable read access for all users" on "public"."medreport_products_analyses_relations";
drop policy "Users can read their own nonces" on "public"."nonces";
-- drop policy "Users can read their own nonces" on "public"."nonces";
drop policy "notifications_read_self" on "public"."notifications";
drop policy "notifications_update_self" on "public"."notifications";
drop policy "restrict_mfa_notifications" on "public"."notifications";
-- drop policy "restrict_mfa_notifications" on "public"."notifications";
drop policy "order_items_read_self" on "public"."order_items";
drop policy "restrict_mfa_order_items" on "public"."order_items";
-- drop policy "restrict_mfa_order_items" on "public"."order_items";
drop policy "super_admins_access_order_items" on "public"."order_items";
-- drop policy "super_admins_access_order_items" on "public"."order_items";
drop policy "orders_read_self" on "public"."orders";
drop policy "restrict_mfa_orders" on "public"."orders";
-- drop policy "restrict_mfa_orders" on "public"."orders";
drop policy "super_admins_access_orders" on "public"."orders";
-- drop policy "super_admins_access_orders" on "public"."orders";
drop policy "restrict_mfa_role_permissions" on "public"."role_permissions";
-- drop policy "restrict_mfa_role_permissions" on "public"."role_permissions";
drop policy "role_permissions_read" on "public"."role_permissions";
drop policy "super_admins_access_role_permissions" on "public"."role_permissions";
-- drop policy "super_admins_access_role_permissions" on "public"."role_permissions";
drop policy "roles_read" on "public"."roles";
drop policy "restrict_mfa_subscription_items" on "public"."subscription_items";
-- drop policy "restrict_mfa_subscription_items" on "public"."subscription_items";
drop policy "subscription_items_read_self" on "public"."subscription_items";
drop policy "super_admins_access_subscription_items" on "public"."subscription_items";
-- drop policy "super_admins_access_subscription_items" on "public"."subscription_items";
drop policy "restrict_mfa_subscriptions" on "public"."subscriptions";
-- drop policy "restrict_mfa_subscriptions" on "public"."subscriptions";
drop policy "subscriptions_read_self" on "public"."subscriptions";
drop policy "super_admins_access_subscriptions" on "public"."subscriptions";
-- drop policy "super_admins_access_subscriptions" on "public"."subscriptions";
alter table "public"."accounts" drop constraint "accounts_created_by_fkey";
@@ -888,7 +888,7 @@ alter table "public"."medreport_products_analyses_relations" drop constraint "pr
alter table "public"."medreport_products_analyses_relations" drop constraint "product_can_be_tied_to_only_one_external_item";
alter table "public"."nonces" drop constraint "nonces_user_id_fkey";
-- alter table "public"."nonces" drop constraint "nonces_user_id_fkey";
alter table "public"."notifications" drop constraint "notifications_account_id_fkey";
@@ -956,7 +956,7 @@ alter table "public"."medreport_products_analyses_relations" drop constraint "me
alter table "public"."medreport_products_external_services_relations" drop constraint "medreport_products_connected_online_services_pkey";
alter table "public"."nonces" drop constraint "nonces_pkey";
-- alter table "public"."nonces" drop constraint "nonces_pkey";
alter table "public"."notifications" drop constraint "notifications_pkey";
@@ -5160,47 +5160,47 @@ revoke truncate on table "public"."medreport_products_external_services_relation
revoke update on table "public"."medreport_products_external_services_relations" from "service_role";
revoke delete on table "public"."nonces" from "anon";
-- revoke delete on table "public"."nonces" from "anon";
revoke insert on table "public"."nonces" from "anon";
-- revoke insert on table "public"."nonces" from "anon";
revoke references on table "public"."nonces" from "anon";
-- revoke references on table "public"."nonces" from "anon";
revoke select on table "public"."nonces" from "anon";
-- revoke select on table "public"."nonces" from "anon";
revoke trigger on table "public"."nonces" from "anon";
-- revoke trigger on table "public"."nonces" from "anon";
revoke truncate on table "public"."nonces" from "anon";
-- revoke truncate on table "public"."nonces" from "anon";
revoke update on table "public"."nonces" from "anon";
-- revoke update on table "public"."nonces" from "anon";
revoke delete on table "public"."nonces" from "authenticated";
-- revoke delete on table "public"."nonces" from "authenticated";
revoke insert on table "public"."nonces" from "authenticated";
-- revoke insert on table "public"."nonces" from "authenticated";
revoke references on table "public"."nonces" from "authenticated";
-- revoke references on table "public"."nonces" from "authenticated";
revoke select on table "public"."nonces" from "authenticated";
-- revoke select on table "public"."nonces" from "authenticated";
revoke trigger on table "public"."nonces" from "authenticated";
-- revoke trigger on table "public"."nonces" from "authenticated";
revoke truncate on table "public"."nonces" from "authenticated";
-- revoke truncate on table "public"."nonces" from "authenticated";
revoke update on table "public"."nonces" from "authenticated";
-- revoke update on table "public"."nonces" from "authenticated";
revoke delete on table "public"."nonces" from "service_role";
-- revoke delete on table "public"."nonces" from "service_role";
revoke insert on table "public"."nonces" from "service_role";
-- revoke insert on table "public"."nonces" from "service_role";
revoke references on table "public"."nonces" from "service_role";
-- revoke references on table "public"."nonces" from "service_role";
revoke select on table "public"."nonces" from "service_role";
-- revoke select on table "public"."nonces" from "service_role";
revoke trigger on table "public"."nonces" from "service_role";
-- revoke trigger on table "public"."nonces" from "service_role";
revoke truncate on table "public"."nonces" from "service_role";
-- revoke truncate on table "public"."nonces" from "service_role";
revoke update on table "public"."nonces" from "service_role";
-- revoke update on table "public"."nonces" from "service_role";
revoke delete on table "public"."notifications" from "anon";
@@ -5410,7 +5410,7 @@ drop table "public"."medreport_products_analyses_relations";
drop table "public"."medreport_products_external_services_relations";
drop table "public"."nonces";
-- drop table "public"."nonces";
drop table "public"."notifications";

View File

@@ -0,0 +1,3 @@
alter table "medreport"."analysis_response_elements" add column "analysis_name" text;
alter table "medreport"."analysis_response_elements" alter column "response_value" set data type double precision using "response_value"::double precision;

146
supabase/sql/analysis.sql Normal file
View File

@@ -0,0 +1,146 @@
-- Create analysis for /home/analysis-results
INSERT INTO medreport.analysis_groups (
id,
original_id,
name,
"order",
created_at,
updated_at
)
VALUES (
1, -- id
'GROUP_ORIG_001', -- original_id
'Blood Tests', -- name
1, -- order
NOW(), -- created_at
NOW() -- updated_at
);
INSERT INTO medreport.analysis_elements (
id,
analysis_id_oid,
analysis_id_original,
tehik_short_loinc,
tehik_loinc_name,
analysis_name_lab,
"order",
created_at,
updated_at,
parent_analysis_group_id,
material_groups
)
VALUES (
1, -- id (must match the one used in analyses)
'OID12345', -- analysis_id_oid
'ORIG123', -- analysis_id_original
'LNC123-4', -- tehik_short_loinc
'Hemoglobiin', -- tehik_loinc_name
'Hemoglobiin (Lab)', -- analysis_name_lab
1, -- order
NOW(), -- created_at
NOW(), -- updated_at
1, -- parent_analysis_group_id
'{}'::jsonb[] -- material_groups (empty array for now)
);
INSERT INTO medreport.analyses (
id,
analysis_id_oid,
analysis_id_original,
tehik_short_loinc,
tehik_loinc_name,
analysis_name_lab,
"order",
created_at,
updated_at,
parent_analysis_element_id
)
VALUES (
101, -- id
'OID12345', -- analysis_id_oid
'ORIG123', -- analysis_id_original
'LNC123-4', -- tehik_short_loinc
'Hemoglobiin', -- tehik_loinc_name
'Hemoglobiin (Lab)', -- analysis_name_lab
1, -- order
NOW(), -- created_at
NOW(), -- updated_at
1 -- parent_analysis_element_id
);
INSERT INTO medreport.analysis_orders (
analysis_element_ids,
analysis_ids,
user_id,
status,
id
) VALUES (
ARRAY[1, 2, 3],
ARRAY[101, 102],
'8dcb4354-77be-4915-a2cd-8fc573e675d6',
'COMPLETED',
'10' -- unique id
);
INSERT INTO medreport.analysis_responses (
id,
analysis_order_id,
order_number,
order_status,
user_id
)
VALUES (
'1', -- unique id
'10', -- ID of medreport.analysis_orders
'123',
'COMPLETED',
'8dcb4354-77be-4915-a2cd-8fc573e675d6'
)
ON CONFLICT (order_number)
DO UPDATE SET
analysis_order_id = EXCLUDED.analysis_order_id,
order_status = EXCLUDED.order_status,
user_id = EXCLUDED.user_id
RETURNING id;
INSERT INTO medreport.analysis_response_elements (
id,
analysis_response_id,
analysis_element_original_id,
unit,
response_value,
response_time,
norm_upper,
norm_upper_included,
norm_lower,
norm_lower_included,
norm_status,
original_response_element,
created_at,
updated_at,
analysis_name
)
VALUES
-- Repeat this row for each element
(
'1000', -- unique id
'1', -- ID of medreport.analysis_responses
'2',
'g/L',
146,
NOW()::timestamptz,
5,
true,
1,
false,
3,
'{"original_name": "Hgb", "value": 13.5}'::jsonb,
NOW(),
NOW(),
'Hematokrit'
);

View File

@@ -3,16 +3,18 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@kit/ui/*": ["packages/ui/src/*"],
"@kit/ui": ["packages/ui/src/index.ts"],
"@lib/*": ["packages/features/medusa-storefront/src/lib/*"],
"@modules/*": ["packages/features/medusa-storefront/src/modules/*"],
"@styles/*": ["packages/features/medusa-storefront/src/styles/*"],
"types/*": ["packages/features/medusa-storefront/src/types/*"],
"@/*": ["./*"],
"~/*": ["./app/*"],
"~/config/*": ["./config/*"],
"~/components/*": ["./components/*"],
"~/lib/*": ["./lib/*"],
"~/medusa/*": ["./packages/features/medusa-storefront/src/*"]
"~/medusa/*": ["./packages/features/medusa-storefront/src/*"],
"@/*": ["./*"],
"~/*": ["./app/*"]
},
"plugins": [
{