This commit is contained in:
Helena
2025-08-29 10:27:46 +03:00
14 changed files with 330 additions and 119 deletions

View File

@@ -1,13 +1,13 @@
import { sdk } from "@lib/config"
import { HttpTypes } from "@medusajs/types"
import { getCacheOptions } from "./cookies"
import { sdk } from "@lib/config";
import { HttpTypes } from "@medusajs/types";
import { getCacheOptions } from "./cookies";
export const listCategories = async (query?: Record<string, any>) => {
const next = {
...(await getCacheOptions("categories")),
}
};
const limit = query?.limit || 100
const limit = query?.limit || 100;
return sdk.client
.fetch<{ product_categories: HttpTypes.StoreProductCategory[] }>(
@@ -23,8 +23,8 @@ export const listCategories = async (query?: Record<string, any>) => {
cache: "force-cache",
}
)
.then(({ product_categories }) => product_categories)
}
.then(({ product_categories }) => product_categories);
};
export const getCategoryByHandle = async (categoryHandle: string[]) => {
const { product_categories } = await getProductCategories({
@@ -32,7 +32,7 @@ export const getCategoryByHandle = async (categoryHandle: string[]) => {
limit: 1,
});
return product_categories[0];
}
};
export const getProductCategories = async ({
handle,
@@ -45,19 +45,18 @@ export const getProductCategories = async ({
} = {}) => {
const next = {
...(await getCacheOptions("categories")),
}
};
return sdk.client
.fetch<HttpTypes.StoreProductCategoryListResponse>(
`/store/product-categories`,
{
query: {
fields,
handle,
limit,
},
next,
//cache: "force-cache",
}
);
}
return sdk.client.fetch<HttpTypes.StoreProductCategoryListResponse>(
`/store/product-categories`,
{
query: {
fields,
handle,
limit,
},
next,
//cache: "force-cache",
}
);
};

View File

@@ -16,6 +16,7 @@ const PathsSchema = z.object({
home: z.string().min(1),
selectPackage: z.string().min(1),
booking: z.string().min(1),
bookingHandle: z.string().min(1),
myOrders: z.string().min(1),
analysisResults: z.string().min(1),
orderAnalysisPackage: z.string().min(1),
@@ -64,6 +65,7 @@ const pathsConfig = PathsSchema.parse({
joinTeam: '/join',
selectPackage: '/select-package',
booking: '/home/booking',
bookingHandle: '/home/booking/[handle]',
orderAnalysisPackage: '/home/order-analysis-package',
myOrders: '/home/order',
analysisResults: '/home/analysis-results',

View File

@@ -1088,7 +1088,7 @@ export type Database = {
price: number
price_periods: string | null
requires_payment: boolean
sync_id: number
sync_id: string | null
updated_at: string | null
}
Insert: {
@@ -1107,7 +1107,7 @@ export type Database = {
price: number
price_periods?: string | null
requires_payment: boolean
sync_id: number
sync_id?: string | null
updated_at?: string | null
}
Update: {
@@ -1126,7 +1126,7 @@ export type Database = {
price?: number
price_periods?: string | null
requires_payment?: boolean
sync_id?: number
sync_id?: string | null
updated_at?: string | null
}
Relationships: [
@@ -1147,7 +1147,7 @@ export type Database = {
doctor_user_id: string | null
id: number
status: Database["medreport"]["Enums"]["analysis_feedback_status"]
updated_at: string
updated_at: string | null
updated_by: string | null
user_id: string
value: string | null
@@ -1159,7 +1159,7 @@ export type Database = {
doctor_user_id?: string | null
id?: number
status?: Database["medreport"]["Enums"]["analysis_feedback_status"]
updated_at?: string
updated_at?: string | null
updated_by?: string | null
user_id: string
value?: string | null
@@ -1171,7 +1171,7 @@ export type Database = {
doctor_user_id?: string | null
id?: number
status?: Database["medreport"]["Enums"]["analysis_feedback_status"]
updated_at?: string
updated_at?: string | null
updated_by?: string | null
user_id?: string
value?: string | null
@@ -1850,9 +1850,7 @@ export type Database = {
Returns: Json
}
create_team_account: {
Args:
| { account_name: string }
| { account_name: string; new_personal_code: string }
Args: { account_name: string; new_personal_code: string }
Returns: {
application_role: Database["medreport"]["Enums"]["application_role"]
city: string | null