initial commit

This commit is contained in:
Danel Kungla
2025-08-28 13:15:39 +03:00
parent 5159325e6d
commit 31bc4b6cff
11 changed files with 345 additions and 151 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

@@ -108,6 +108,63 @@ export type Database = {
}
Relationships: []
}
medipost_dispatch: {
Row: {
changed_by: string | null
created_at: string
error_message: string | null
id: number
is_medipost_error: boolean
is_success: boolean
medusa_order_id: string
}
Insert: {
changed_by?: string | null
created_at?: string
error_message?: string | null
id?: number
is_medipost_error: boolean
is_success: boolean
medusa_order_id: string
}
Update: {
changed_by?: string | null
created_at?: string
error_message?: string | null
id?: number
is_medipost_error?: boolean
is_success?: boolean
medusa_order_id?: string
}
Relationships: []
}
medusa_action: {
Row: {
action: string
created_at: string
id: number
medusa_user_id: string
page: string | null
user_email: string
}
Insert: {
action: string
created_at?: string
id?: number
medusa_user_id: string
page?: string | null
user_email: string
}
Update: {
action?: string
created_at?: string
id?: number
medusa_user_id?: string
page?: string | null
user_email?: string
}
Relationships: []
}
page_views: {
Row: {
account_id: string
@@ -201,28 +258,6 @@ export type Database = {
}
Relationships: []
}
medusa_action: {
Row: {
id: number
medusa_user_id: string
user_email: string
action: string
page: string
created_at: string
}
Insert: {
medusa_user_id: string
user_email: string
action: string
page: string
}
Update: {
medusa_user_id?: string
user_email?: string
action?: string
page?: string
}
}
}
Views: {
[_ in never]: never
@@ -329,6 +364,7 @@ export type Database = {
id: string
is_personal_account: boolean
last_name: string | null
medusa_account_id: string | null
name: string
personal_code: string | null
phone: string | null
@@ -336,7 +372,6 @@ export type Database = {
primary_owner_user_id: string
public_data: Json
slug: string | null
medusa_account_id: string | null
updated_at: string | null
updated_by: string | null
}
@@ -351,6 +386,7 @@ export type Database = {
id?: string
is_personal_account?: boolean
last_name?: string | null
medusa_account_id?: string | null
name: string
personal_code?: string | null
phone?: string | null
@@ -358,7 +394,6 @@ export type Database = {
primary_owner_user_id?: string
public_data?: Json
slug?: string | null
medusa_account_id?: string | null
updated_at?: string | null
updated_by?: string | null
}
@@ -373,6 +408,7 @@ export type Database = {
id?: string
is_personal_account?: boolean
last_name?: string | null
medusa_account_id?: string | null
name?: string
personal_code?: string | null
phone?: string | null
@@ -380,7 +416,6 @@ export type Database = {
primary_owner_user_id?: string
public_data?: Json
slug?: string | null
medusa_account_id?: string | null
updated_at?: string | null
updated_by?: string | null
}
@@ -393,6 +428,7 @@ export type Database = {
created_at: string
created_by: string | null
has_seen_confirmation: boolean
id: string
updated_at: string
updated_by: string | null
user_id: string
@@ -403,6 +439,7 @@ export type Database = {
created_at?: string
created_by?: string | null
has_seen_confirmation?: boolean
id?: string
updated_at?: string
updated_by?: string | null
user_id: string
@@ -413,6 +450,7 @@ export type Database = {
created_at?: string
created_by?: string | null
has_seen_confirmation?: boolean
id?: string
updated_at?: string
updated_by?: string | null
user_id?: string
@@ -1022,7 +1060,7 @@ export type Database = {
price: number
price_periods: string | null
requires_payment: boolean
sync_id: number
sync_id: string | null
updated_at: string | null
}
Insert: {
@@ -1041,7 +1079,7 @@ export type Database = {
price: number
price_periods?: string | null
requires_payment: boolean
sync_id: number
sync_id?: string | null
updated_at?: string | null
}
Update: {
@@ -1060,7 +1098,7 @@ export type Database = {
price?: number
price_periods?: string | null
requires_payment?: boolean
sync_id?: number
sync_id?: string | null
updated_at?: string | null
}
Relationships: [
@@ -1081,7 +1119,7 @@ export type Database = {
doctor_user_id: string | null
id: number
status: Database["medreport"]["Enums"]["analysis_feedback_status"]
updated_at: string
updated_at: string | null
updated_by: string | null
user_id: string
value: string | null
@@ -1093,7 +1131,7 @@ export type Database = {
doctor_user_id?: string | null
id?: number
status?: Database["medreport"]["Enums"]["analysis_feedback_status"]
updated_at?: string
updated_at?: string | null
updated_by?: string | null
user_id: string
value?: string | null
@@ -1105,7 +1143,7 @@ export type Database = {
doctor_user_id?: string | null
id?: number
status?: Database["medreport"]["Enums"]["analysis_feedback_status"]
updated_at?: string
updated_at?: string | null
updated_by?: string | null
user_id?: string
value?: string | null
@@ -1784,9 +1822,7 @@ export type Database = {
Returns: Json
}
create_team_account: {
Args:
| { account_name: string }
| { account_name: string; new_personal_code: string }
Args: { account_name: string; new_personal_code: string }
Returns: {
application_role: Database["medreport"]["Enums"]["application_role"]
city: string | null
@@ -1798,6 +1834,7 @@ export type Database = {
id: string
is_personal_account: boolean
last_name: string | null
medusa_account_id: string | null
name: string
personal_code: string | null
phone: string | null
@@ -1836,6 +1873,7 @@ export type Database = {
primary_owner_user_id: string
name: string
email: string
personal_code: string
picture_url: string
created_at: string
updated_at: string
@@ -1853,10 +1891,18 @@ export type Database = {
account_id: string
}[]
}
get_medipost_dispatch_tries: {
Args: { p_medusa_order_id: string }
Returns: number
}
get_nonce_status: {
Args: { p_id: string }
Returns: Json
}
get_order_possible_actions: {
Args: { p_medusa_order_id: string }
Returns: Json
}
get_upper_system_role: {
Args: Record<PropertyKey, never>
Returns: string
@@ -1937,6 +1983,10 @@ export type Database = {
Args: { account_id: string; user_id: string }
Returns: boolean
}
medipost_retry_dispatch: {
Args: { order_id: string }
Returns: Json
}
revoke_nonce: {
Args: { p_id: string; p_reason?: string }
Returns: boolean
@@ -2057,21 +2107,6 @@ export type Database = {
}
Returns: Json
}
medipost_retry_dispatch: {
Args: {
order_id: string
}
Returns: {
success: boolean
error: string | null
}
}
get_medipost_dispatch_tries: {
Args: {
p_medusa_order_id: string
}
Returns: number
}
}
Enums: {
analysis_feedback_status: "STARTED" | "DRAFT" | "COMPLETED"