1966 lines
58 KiB
TypeScript
Raw Normal View History

// ============================================
// 此文件由 Meoo Cloud 自动生成,请勿修改
// This file is auto-generated by Meoo Cloud, DO NOT MODIFY
// ============================================
export type Json =
| string
| number
| boolean
| null
| { [key: string]: Json | undefined }
| Json[]
export type Database = {
public: {
Tables: {
accounts_payable: {
Row: {
created_at: string
id: string
paid_amount: number
paid_quantity: number
plan_id: string
price_per_meter: number
purchaser_id: string
status: string
textile_factory_id: string
total_amount: number
total_quantity: number
unpaid_amount: number
unpaid_quantity: number
updated_at: string
}
Insert: {
created_at?: string
id?: string
paid_amount?: number
paid_quantity?: number
plan_id: string
price_per_meter?: number
purchaser_id: string
status?: string
textile_factory_id: string
total_amount?: number
total_quantity?: number
unpaid_amount?: number
unpaid_quantity?: number
updated_at?: string
}
Update: {
created_at?: string
id?: string
paid_amount?: number
paid_quantity?: number
plan_id?: string
price_per_meter?: number
purchaser_id?: string
status?: string
textile_factory_id?: string
total_amount?: number
total_quantity?: number
unpaid_amount?: number
unpaid_quantity?: number
updated_at?: string
}
Relationships: [
{
foreignKeyName: "accounts_payable_plan_id_fkey"
columns: ["plan_id"]
referencedRelation: "production_plans"
referencedColumns: ["id"]
},
{
foreignKeyName: "accounts_payable_purchaser_id_fkey"
columns: ["purchaser_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "accounts_payable_textile_factory_id_fkey"
columns: ["textile_factory_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
]
}
accounts_payable_items: {
Row: {
accounts_payable_id: string
amount: number
created_at: string
id: string
inventory_record_id: string | null
paid_at: string | null
payment_id: string | null
price_per_meter: number
quantity: number
rolls: number | null
status: string
}
Insert: {
accounts_payable_id: string
amount?: number
created_at?: string
id?: string
inventory_record_id?: string | null
paid_at?: string | null
payment_id?: string | null
price_per_meter?: number
quantity?: number
rolls?: number | null
status?: string
}
Update: {
accounts_payable_id?: string
amount?: number
created_at?: string
id?: string
inventory_record_id?: string | null
paid_at?: string | null
payment_id?: string | null
price_per_meter?: number
quantity?: number
rolls?: number | null
status?: string
}
Relationships: [
{
foreignKeyName: "accounts_payable_items_accounts_payable_id_fkey"
columns: ["accounts_payable_id"]
referencedRelation: "accounts_payable"
referencedColumns: ["id"]
},
{
foreignKeyName: "accounts_payable_items_inventory_record_id_fkey"
columns: ["inventory_record_id"]
referencedRelation: "inventory_records"
referencedColumns: ["id"]
},
{
foreignKeyName: "accounts_payable_items_payment_id_fkey"
columns: ["payment_id"]
referencedRelation: "payments"
referencedColumns: ["id"]
},
]
}
audit_logs: {
Row: {
action: string
company_id: string | null
created_at: string
details: Json | null
id: string
ip_address: string | null
resource_id: string | null
resource_type: string
user_agent: string | null
user_id: string | null
}
Insert: {
action: string
company_id?: string | null
created_at?: string
details?: Json | null
id?: string
ip_address?: string | null
resource_id?: string | null
resource_type: string
user_agent?: string | null
user_id?: string | null
}
Update: {
action?: string
company_id?: string | null
created_at?: string
details?: Json | null
id?: string
ip_address?: string | null
resource_id?: string | null
resource_type?: string
user_agent?: string | null
user_id?: string | null
}
Relationships: [
{
foreignKeyName: "audit_logs_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
]
}
companies: {
Row: {
address: string | null
contact_phone: string | null
created_at: string
id: string
name: string
role: Database["public"]["Enums"]["app_role"]
}
Insert: {
address?: string | null
contact_phone?: string | null
created_at?: string
id?: string
name: string
role: Database["public"]["Enums"]["app_role"]
}
Update: {
address?: string | null
contact_phone?: string | null
created_at?: string
id?: string
name?: string
role?: Database["public"]["Enums"]["app_role"]
}
Relationships: []
}
company_members: {
Row: {
company_id: string
created_at: string
id: string
role: string
user_id: string
}
Insert: {
company_id: string
created_at?: string
id?: string
role?: string
user_id: string
}
Update: {
company_id?: string
created_at?: string
id?: string
role?: string
user_id?: string
}
Relationships: [
{
foreignKeyName: "company_members_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
]
}
crash_reports: {
Row: {
component_stack: string | null
created_at: string
error_message: string
error_stack: string | null
id: string
status: string
updated_at: string
url: string | null
user_agent: string | null
user_description: string | null
user_id: string | null
}
Insert: {
component_stack?: string | null
created_at?: string
error_message: string
error_stack?: string | null
id?: string
status?: string
updated_at?: string
url?: string | null
user_agent?: string | null
user_description?: string | null
user_id?: string | null
}
Update: {
component_stack?: string | null
created_at?: string
error_message?: string
error_stack?: string | null
id?: string
status?: string
updated_at?: string
url?: string | null
user_agent?: string | null
user_description?: string | null
user_id?: string | null
}
Relationships: []
}
finished_product_inventory_records: {
Row: {
batch_no: string | null
company_id: string
created_at: string
finished_product_id: string
id: string
meters: number
notes: string | null
operator_id: string | null
record_type: string
related_order_id: string | null
related_order_type: string | null
rolls: number
warehouse_id: string | null
warehouse_location: string | null
washing_completion_id: string | null
}
Insert: {
batch_no?: string | null
company_id: string
created_at?: string
finished_product_id: string
id?: string
meters?: number
notes?: string | null
operator_id?: string | null
record_type: string
related_order_id?: string | null
related_order_type?: string | null
rolls?: number
warehouse_id?: string | null
warehouse_location?: string | null
washing_completion_id?: string | null
}
Update: {
batch_no?: string | null
company_id?: string
created_at?: string
finished_product_id?: string
id?: string
meters?: number
notes?: string | null
operator_id?: string | null
record_type?: string
related_order_id?: string | null
related_order_type?: string | null
rolls?: number
warehouse_id?: string | null
warehouse_location?: string | null
washing_completion_id?: string | null
}
Relationships: [
{
foreignKeyName: "finished_product_inventory_records_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "finished_product_inventory_records_finished_product_id_fkey"
columns: ["finished_product_id"]
referencedRelation: "finished_products"
referencedColumns: ["id"]
},
{
foreignKeyName: "finished_product_inventory_records_operator_id_fkey"
columns: ["operator_id"]
referencedRelation: "profiles"
referencedColumns: ["id"]
},
{
foreignKeyName: "finished_product_inventory_records_warehouse_id_fkey"
columns: ["warehouse_id"]
referencedRelation: "warehouses"
referencedColumns: ["id"]
},
{
foreignKeyName: "finished_product_inventory_records_washing_completion_id_fkey"
columns: ["washing_completion_id"]
referencedRelation: "washing_plan_completions"
referencedColumns: ["id"]
},
]
}
finished_products: {
Row: {
color: string
color_code: string | null
company_id: string
created_at: string
created_by: string | null
fabric_code: string
id: string
notes: string | null
product_id: string | null
product_name: string
rolls: number | null
shrinkage_rate: number
status: string
stock_meters: number
stock_rolls: number
unit_cost: number | null
updated_at: string
warehouse_id: string | null
warehouse_location: string | null
washed_meters: number
washing_cost: number | null
washing_plan_id: string | null
weight: number | null
}
Insert: {
color: string
color_code?: string | null
company_id: string
created_at?: string
created_by?: string | null
fabric_code: string
id?: string
notes?: string | null
product_id?: string | null
product_name: string
rolls?: number | null
shrinkage_rate?: number
status?: string
stock_meters?: number
stock_rolls?: number
unit_cost?: number | null
updated_at?: string
warehouse_id?: string | null
warehouse_location?: string | null
washed_meters?: number
washing_cost?: number | null
washing_plan_id?: string | null
weight?: number | null
}
Update: {
color?: string
color_code?: string | null
company_id?: string
created_at?: string
created_by?: string | null
fabric_code?: string
id?: string
notes?: string | null
product_id?: string | null
product_name?: string
rolls?: number | null
shrinkage_rate?: number
status?: string
stock_meters?: number
stock_rolls?: number
unit_cost?: number | null
updated_at?: string
warehouse_id?: string | null
warehouse_location?: string | null
washed_meters?: number
washing_cost?: number | null
washing_plan_id?: string | null
weight?: number | null
}
Relationships: [
{
foreignKeyName: "finished_products_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "finished_products_created_by_fkey"
columns: ["created_by"]
referencedRelation: "profiles"
referencedColumns: ["id"]
},
{
foreignKeyName: "finished_products_product_id_fkey"
columns: ["product_id"]
referencedRelation: "products"
referencedColumns: ["id"]
},
{
foreignKeyName: "finished_products_warehouse_id_fkey"
columns: ["warehouse_id"]
referencedRelation: "warehouses"
referencedColumns: ["id"]
},
{
foreignKeyName: "finished_products_washing_plan_id_fkey"
columns: ["washing_plan_id"]
referencedRelation: "washing_plans"
referencedColumns: ["id"]
},
]
}
inventory_records: {
Row: {
company_id: string | null
created_at: string
id: string
operator_id: string | null
plan_id: string
price_note: string | null
price_per_meter: number | null
quantity: number
rolls: number | null
warehouse_id: string
warehouse_location: string | null
}
Insert: {
company_id?: string | null
created_at?: string
id?: string
operator_id?: string | null
plan_id: string
price_note?: string | null
price_per_meter?: number | null
quantity?: number
rolls?: number | null
warehouse_id: string
warehouse_location?: string | null
}
Update: {
company_id?: string | null
created_at?: string
id?: string
operator_id?: string | null
plan_id?: string
price_note?: string | null
price_per_meter?: number | null
quantity?: number
rolls?: number | null
warehouse_id?: string
warehouse_location?: string | null
}
Relationships: [
{
foreignKeyName: "inventory_records_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "inventory_records_plan_id_fkey"
columns: ["plan_id"]
referencedRelation: "production_plans"
referencedColumns: ["id"]
},
{
foreignKeyName: "inventory_records_warehouse_id_fkey"
columns: ["warehouse_id"]
referencedRelation: "warehouses"
referencedColumns: ["id"]
},
]
}
notifications: {
Row: {
content: string
created_at: string | null
id: string
is_read: boolean | null
plan_id: string | null
read_at: string | null
recipient_id: string
sender_company_id: string | null
sender_id: string | null
title: string
type: string
}
Insert: {
content: string
created_at?: string | null
id?: string
is_read?: boolean | null
plan_id?: string | null
read_at?: string | null
recipient_id: string
sender_company_id?: string | null
sender_id?: string | null
title: string
type: string
}
Update: {
content?: string
created_at?: string | null
id?: string
is_read?: boolean | null
plan_id?: string | null
read_at?: string | null
recipient_id?: string
sender_company_id?: string | null
sender_id?: string | null
title?: string
type?: string
}
Relationships: [
{
foreignKeyName: "notifications_plan_id_fkey"
columns: ["plan_id"]
referencedRelation: "production_plans"
referencedColumns: ["id"]
},
{
foreignKeyName: "notifications_sender_company_id_fkey"
columns: ["sender_company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
]
}
payments: {
Row: {
amount: number
created_at: string
from_company_id: string
id: string
paid_at: string | null
plan_id: string
price_per_meter: number
quantity: number
status: Database["public"]["Enums"]["payment_status"]
to_company_id: string
}
Insert: {
amount?: number
created_at?: string
from_company_id: string
id?: string
paid_at?: string | null
plan_id: string
price_per_meter?: number
quantity?: number
status?: Database["public"]["Enums"]["payment_status"]
to_company_id: string
}
Update: {
amount?: number
created_at?: string
from_company_id?: string
id?: string
paid_at?: string | null
plan_id?: string
price_per_meter?: number
quantity?: number
status?: Database["public"]["Enums"]["payment_status"]
to_company_id?: string
}
Relationships: [
{
foreignKeyName: "payments_from_company_id_fkey"
columns: ["from_company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "payments_plan_id_fkey"
columns: ["plan_id"]
referencedRelation: "production_plans"
referencedColumns: ["id"]
},
{
foreignKeyName: "payments_to_company_id_fkey"
columns: ["to_company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
]
}
plan_factories: {
Row: {
created_at: string
factory_id: string
factory_type: Database["public"]["Enums"]["factory_type"]
id: string
plan_id: string
}
Insert: {
created_at?: string
factory_id: string
factory_type: Database["public"]["Enums"]["factory_type"]
id?: string
plan_id: string
}
Update: {
created_at?: string
factory_id?: string
factory_type?: Database["public"]["Enums"]["factory_type"]
id?: string
plan_id?: string
}
Relationships: [
{
foreignKeyName: "plan_factories_factory_id_fkey"
columns: ["factory_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "plan_factories_plan_id_fkey"
columns: ["plan_id"]
referencedRelation: "production_plans"
referencedColumns: ["id"]
},
]
}
plan_process_steps: {
Row: {
company_id: string | null
created_at: string
id: string
notes: string | null
operator_id: string | null
plan_id: string
status: Database["public"]["Enums"]["step_status"]
step_type: Database["public"]["Enums"]["step_type"]
timestamp: string | null
}
Insert: {
company_id?: string | null
created_at?: string
id?: string
notes?: string | null
operator_id?: string | null
plan_id: string
status?: Database["public"]["Enums"]["step_status"]
step_type: Database["public"]["Enums"]["step_type"]
timestamp?: string | null
}
Update: {
company_id?: string | null
created_at?: string
id?: string
notes?: string | null
operator_id?: string | null
plan_id?: string
status?: Database["public"]["Enums"]["step_status"]
step_type?: Database["public"]["Enums"]["step_type"]
timestamp?: string | null
}
Relationships: [
{
foreignKeyName: "plan_process_steps_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "plan_process_steps_plan_id_fkey"
columns: ["plan_id"]
referencedRelation: "production_plans"
referencedColumns: ["id"]
},
]
}
product_inventory_records: {
Row: {
batch_no: string
company_id: string | null
created_at: string
id: string
meters: number
notes: string | null
operator_id: string | null
product_id: string
rolls: number
warehouse_id: string | null
}
Insert: {
batch_no: string
company_id?: string | null
created_at?: string
id?: string
meters?: number
notes?: string | null
operator_id?: string | null
product_id: string
rolls?: number
warehouse_id?: string | null
}
Update: {
batch_no?: string
company_id?: string | null
created_at?: string
id?: string
meters?: number
notes?: string | null
operator_id?: string | null
product_id?: string
rolls?: number
warehouse_id?: string | null
}
Relationships: [
{
foreignKeyName: "product_inventory_records_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "product_inventory_records_product_id_fkey"
columns: ["product_id"]
referencedRelation: "products"
referencedColumns: ["id"]
},
{
foreignKeyName: "product_inventory_records_warehouse_id_fkey"
columns: ["warehouse_id"]
referencedRelation: "warehouses"
referencedColumns: ["id"]
},
]
}
product_outbound_records: {
Row: {
batch_no: string
company_id: string | null
created_at: string
id: string
meters: number
notes: string | null
operator_id: string | null
outbound_type: string
product_id: string
recipient_company_id: string | null
recipient_company_name: string | null
rolls: number
source_batch_id: string | null
washing_plan_id: string | null
}
Insert: {
batch_no?: string
company_id?: string | null
created_at?: string
id?: string
meters?: number
notes?: string | null
operator_id?: string | null
outbound_type?: string
product_id: string
recipient_company_id?: string | null
recipient_company_name?: string | null
rolls?: number
source_batch_id?: string | null
washing_plan_id?: string | null
}
Update: {
batch_no?: string
company_id?: string | null
created_at?: string
id?: string
meters?: number
notes?: string | null
operator_id?: string | null
outbound_type?: string
product_id?: string
recipient_company_id?: string | null
recipient_company_name?: string | null
rolls?: number
source_batch_id?: string | null
washing_plan_id?: string | null
}
Relationships: [
{
foreignKeyName: "product_outbound_records_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "product_outbound_records_product_id_fkey"
columns: ["product_id"]
referencedRelation: "products"
referencedColumns: ["id"]
},
{
foreignKeyName: "product_outbound_records_recipient_company_id_fkey"
columns: ["recipient_company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "product_outbound_records_source_batch_id_fkey"
columns: ["source_batch_id"]
referencedRelation: "product_inventory_records"
referencedColumns: ["id"]
},
]
}
product_price_history: {
Row: {
change_amount: number
change_reason: string | null
company_id: string
created_at: string
id: string
new_price: number
old_price: number
operator_id: string | null
operator_name: string | null
product_id: string
}
Insert: {
change_amount?: number
change_reason?: string | null
company_id: string
created_at?: string
id?: string
new_price?: number
old_price?: number
operator_id?: string | null
operator_name?: string | null
product_id: string
}
Update: {
change_amount?: number
change_reason?: string | null
company_id?: string
created_at?: string
id?: string
new_price?: number
old_price?: number
operator_id?: string | null
operator_name?: string | null
product_id?: string
}
Relationships: [
{
foreignKeyName: "product_price_history_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "product_price_history_product_id_fkey"
columns: ["product_id"]
referencedRelation: "products"
referencedColumns: ["id"]
},
]
}
product_yarn_ratios: {
Row: {
created_at: string
id: string
product_id: string
ratio: number
yarn_name: string
yarn_type: string | null
}
Insert: {
created_at?: string
id?: string
product_id: string
ratio?: number
yarn_name: string
yarn_type?: string | null
}
Update: {
created_at?: string
id?: string
product_id?: string
ratio?: number
yarn_name?: string
yarn_type?: string | null
}
Relationships: [
{
foreignKeyName: "product_yarn_ratios_product_id_fkey"
columns: ["product_id"]
referencedRelation: "products"
referencedColumns: ["id"]
},
]
}
production_plans: {
Row: {
color: string
color_code: string
completed_quantity: number
created_at: string
created_by: string | null
fabric_code: string
id: string
plan_code: string
product_name: string
production_price: number | null
purchaser_id: string
remark: string | null
start_time: string | null
status: Database["public"]["Enums"]["plan_status"]
target_quantity: number
updated_at: string
yarn_usage_per_meter: number | null
}
Insert: {
color: string
color_code?: string
completed_quantity?: number
created_at?: string
created_by?: string | null
fabric_code: string
id?: string
plan_code: string
product_name: string
production_price?: number | null
purchaser_id: string
remark?: string | null
start_time?: string | null
status?: Database["public"]["Enums"]["plan_status"]
target_quantity?: number
updated_at?: string
yarn_usage_per_meter?: number | null
}
Update: {
color?: string
color_code?: string
completed_quantity?: number
created_at?: string
created_by?: string | null
fabric_code?: string
id?: string
plan_code?: string
product_name?: string
production_price?: number | null
purchaser_id?: string
remark?: string | null
start_time?: string | null
status?: Database["public"]["Enums"]["plan_status"]
target_quantity?: number
updated_at?: string
yarn_usage_per_meter?: number | null
}
Relationships: [
{
foreignKeyName: "production_plans_purchaser_id_fkey"
columns: ["purchaser_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
]
}
production_price_history: {
Row: {
change_amount: number
change_reason: string | null
created_at: string
id: string
new_price: number
old_price: number
operator_id: string | null
operator_name: string | null
plan_id: string
}
Insert: {
change_amount?: number
change_reason?: string | null
created_at?: string
id?: string
new_price?: number
old_price?: number
operator_id?: string | null
operator_name?: string | null
plan_id: string
}
Update: {
change_amount?: number
change_reason?: string | null
created_at?: string
id?: string
new_price?: number
old_price?: number
operator_id?: string | null
operator_name?: string | null
plan_id?: string
}
Relationships: [
{
foreignKeyName: "production_price_history_plan_id_fkey"
columns: ["plan_id"]
referencedRelation: "production_plans"
referencedColumns: ["id"]
},
]
}
products: {
Row: {
color: string
color_code: string
company_id: string
created_at: string
fabric_code: string
id: string
image_url: string | null
product_name: string
production_price: number | null
raw_fabric_meters: number
raw_fabric_rolls: number
total_stock: number
total_weight: number | null
updated_at: string
warp_weight: number | null
weft_weight: number | null
weight: number
yarn_ratios: number[] | null
yarn_types: string[] | null
yarn_usage_per_meter: number
}
Insert: {
color: string
color_code?: string
company_id: string
created_at?: string
fabric_code: string
id?: string
image_url?: string | null
product_name: string
production_price?: number | null
raw_fabric_meters?: number
raw_fabric_rolls?: number
total_stock?: number
total_weight?: number | null
updated_at?: string
warp_weight?: number | null
weft_weight?: number | null
weight?: number
yarn_ratios?: number[] | null
yarn_types?: string[] | null
yarn_usage_per_meter?: number
}
Update: {
color?: string
color_code?: string
company_id?: string
created_at?: string
fabric_code?: string
id?: string
image_url?: string | null
product_name?: string
production_price?: number | null
raw_fabric_meters?: number
raw_fabric_rolls?: number
total_stock?: number
total_weight?: number | null
updated_at?: string
warp_weight?: number | null
weft_weight?: number | null
weight?: number
yarn_ratios?: number[] | null
yarn_types?: string[] | null
yarn_usage_per_meter?: number
}
Relationships: [
{
foreignKeyName: "products_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
]
}
profiles: {
Row: {
company_id: string | null
created_at: string
display_name: string | null
id: string
image_url: string | null
is_master: boolean
master_id: string | null
phone: string | null
username: string
}
Insert: {
company_id?: string | null
created_at?: string
display_name?: string | null
id: string
image_url?: string | null
is_master?: boolean
master_id?: string | null
phone?: string | null
username: string
}
Update: {
company_id?: string | null
created_at?: string
display_name?: string | null
id?: string
image_url?: string | null
is_master?: boolean
master_id?: string | null
phone?: string | null
username?: string
}
Relationships: [
{
foreignKeyName: "profiles_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
]
}
share_links: {
Row: {
click_count: number | null
created_at: string
created_by: string
expires_at: string | null
factory_type: string
id: string
plan_id: string
short_code: string
}
Insert: {
click_count?: number | null
created_at?: string
created_by: string
expires_at?: string | null
factory_type: string
id?: string
plan_id: string
short_code: string
}
Update: {
click_count?: number | null
created_at?: string
created_by?: string
expires_at?: string | null
factory_type?: string
id?: string
plan_id?: string
short_code?: string
}
Relationships: []
}
user_feedback: {
Row: {
contact: string | null
content: string
created_at: string
id: string
status: string
type: string
updated_at: string
user_id: string | null
}
Insert: {
contact?: string | null
content: string
created_at?: string
id?: string
status?: string
type: string
updated_at?: string
user_id?: string | null
}
Update: {
contact?: string | null
content?: string
created_at?: string
id?: string
status?: string
type?: string
updated_at?: string
user_id?: string | null
}
Relationships: []
}
warehouses: {
Row: {
company_id: string
created_at: string
id: string
location: string | null
name: string
type: Database["public"]["Enums"]["warehouse_type"]
}
Insert: {
company_id: string
created_at?: string
id?: string
location?: string | null
name: string
type: Database["public"]["Enums"]["warehouse_type"]
}
Update: {
company_id?: string
created_at?: string
id?: string
location?: string | null
name?: string
type?: Database["public"]["Enums"]["warehouse_type"]
}
Relationships: [
{
foreignKeyName: "warehouses_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
]
}
washing_plan_completions: {
Row: {
actual_shrinkage_rate: number
actual_washed_meters: number
actual_washing_cost: number | null
auto_imported: boolean | null
company_id: string
completed_at: string
completed_by: string | null
created_at: string
finished_product_id: string | null
id: string
notes: string | null
rolls: number
unit_cost: number | null
warehouse_id: string | null
warehouse_location: string | null
washing_date: string
washing_plan_id: string
}
Insert: {
actual_shrinkage_rate: number
actual_washed_meters: number
actual_washing_cost?: number | null
auto_imported?: boolean | null
company_id: string
completed_at?: string
completed_by?: string | null
created_at?: string
finished_product_id?: string | null
id?: string
notes?: string | null
rolls?: number
unit_cost?: number | null
warehouse_id?: string | null
warehouse_location?: string | null
washing_date: string
washing_plan_id: string
}
Update: {
actual_shrinkage_rate?: number
actual_washed_meters?: number
actual_washing_cost?: number | null
auto_imported?: boolean | null
company_id?: string
completed_at?: string
completed_by?: string | null
created_at?: string
finished_product_id?: string | null
id?: string
notes?: string | null
rolls?: number
unit_cost?: number | null
warehouse_id?: string | null
warehouse_location?: string | null
washing_date?: string
washing_plan_id?: string
}
Relationships: [
{
foreignKeyName: "washing_plan_completions_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "washing_plan_completions_completed_by_fkey"
columns: ["completed_by"]
referencedRelation: "profiles"
referencedColumns: ["id"]
},
{
foreignKeyName: "washing_plan_completions_finished_product_id_fkey"
columns: ["finished_product_id"]
referencedRelation: "finished_products"
referencedColumns: ["id"]
},
{
foreignKeyName: "washing_plan_completions_warehouse_id_fkey"
columns: ["warehouse_id"]
referencedRelation: "warehouses"
referencedColumns: ["id"]
},
{
foreignKeyName: "washing_plan_completions_washing_plan_id_fkey"
columns: ["washing_plan_id"]
referencedRelation: "washing_plans"
referencedColumns: ["id"]
},
]
}
washing_plans: {
Row: {
actual_shrinkage_rate: number | null
actual_total_cost: number | null
actual_washed_meters: number | null
company_id: string
created_at: string
created_by: string | null
estimated_shrinkage_rate: number
estimated_total_cost: number | null
estimated_washed_meters: number | null
id: string
notes: string | null
plan_code: string
planned_meters: number
product_id: string
status: string
updated_at: string
washing_date: string | null
washing_factory_id: string | null
washing_price: number
}
Insert: {
actual_shrinkage_rate?: number | null
actual_total_cost?: number | null
actual_washed_meters?: number | null
company_id: string
created_at?: string
created_by?: string | null
estimated_shrinkage_rate?: number
estimated_total_cost?: number | null
estimated_washed_meters?: number | null
id?: string
notes?: string | null
plan_code: string
planned_meters?: number
product_id: string
status?: string
updated_at?: string
washing_date?: string | null
washing_factory_id?: string | null
washing_price?: number
}
Update: {
actual_shrinkage_rate?: number | null
actual_total_cost?: number | null
actual_washed_meters?: number | null
company_id?: string
created_at?: string
created_by?: string | null
estimated_shrinkage_rate?: number
estimated_total_cost?: number | null
estimated_washed_meters?: number | null
id?: string
notes?: string | null
plan_code?: string
planned_meters?: number
product_id?: string
status?: string
updated_at?: string
washing_date?: string | null
washing_factory_id?: string | null
washing_price?: number
}
Relationships: [
{
foreignKeyName: "washing_plans_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "washing_plans_created_by_fkey"
columns: ["created_by"]
referencedRelation: "profiles"
referencedColumns: ["id"]
},
{
foreignKeyName: "washing_plans_product_id_fkey"
columns: ["product_id"]
referencedRelation: "products"
referencedColumns: ["id"]
},
{
foreignKeyName: "washing_plans_washing_factory_id_fkey"
columns: ["washing_factory_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
]
}
washing_process_steps: {
Row: {
company_id: string
created_at: string
id: string
notes: string | null
operator_id: string | null
status: string
step_type: string
timestamp: string | null
updated_at: string
washing_plan_id: string
}
Insert: {
company_id: string
created_at?: string
id?: string
notes?: string | null
operator_id?: string | null
status?: string
step_type: string
timestamp?: string | null
updated_at?: string
washing_plan_id: string
}
Update: {
company_id?: string
created_at?: string
id?: string
notes?: string | null
operator_id?: string | null
status?: string
step_type?: string
timestamp?: string | null
updated_at?: string
washing_plan_id?: string
}
Relationships: [
{
foreignKeyName: "washing_process_steps_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "washing_process_steps_operator_id_fkey"
columns: ["operator_id"]
referencedRelation: "profiles"
referencedColumns: ["id"]
},
{
foreignKeyName: "washing_process_steps_washing_plan_id_fkey"
columns: ["washing_plan_id"]
referencedRelation: "washing_plans"
referencedColumns: ["id"]
},
]
}
yarn_ratios: {
Row: {
amount_per_meter: number
company_id: string | null
created_at: string
id: string
plan_id: string
ratio: number
total_amount: number
yarn_name: string
yarn_type: string | null
}
Insert: {
amount_per_meter?: number
company_id?: string | null
created_at?: string
id?: string
plan_id: string
ratio?: number
total_amount?: number
yarn_name: string
yarn_type?: string | null
}
Update: {
amount_per_meter?: number
company_id?: string | null
created_at?: string
id?: string
plan_id?: string
ratio?: number
total_amount?: number
yarn_name?: string
yarn_type?: string | null
}
Relationships: [
{
foreignKeyName: "yarn_ratios_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "yarn_ratios_plan_id_fkey"
columns: ["plan_id"]
referencedRelation: "production_plans"
referencedColumns: ["id"]
},
]
}
yarn_stock: {
Row: {
company_id: string
id: string
min_stock: number
name: string
quantity: number
spec: string | null
unit: string
updated_at: string
warehouse_id: string | null
}
Insert: {
company_id: string
id?: string
min_stock?: number
name: string
quantity?: number
spec?: string | null
unit?: string
updated_at?: string
warehouse_id?: string | null
}
Update: {
company_id?: string
id?: string
min_stock?: number
name?: string
quantity?: number
spec?: string | null
unit?: string
updated_at?: string
warehouse_id?: string | null
}
Relationships: [
{
foreignKeyName: "yarn_stock_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "yarn_stock_warehouse_id_fkey"
columns: ["warehouse_id"]
referencedRelation: "warehouses"
referencedColumns: ["id"]
},
]
}
yarn_stock_records: {
Row: {
batch_no: string | null
company_id: string
created_at: string
id: string
notes: string | null
operator_id: string | null
plan_id: string | null
quantity: number
record_type: string
unit: string
yarn_stock_id: string | null
}
Insert: {
batch_no?: string | null
company_id: string
created_at?: string
id?: string
notes?: string | null
operator_id?: string | null
plan_id?: string | null
quantity?: number
record_type: string
unit?: string
yarn_stock_id?: string | null
}
Update: {
batch_no?: string | null
company_id?: string
created_at?: string
id?: string
notes?: string | null
operator_id?: string | null
plan_id?: string | null
quantity?: number
record_type?: string
unit?: string
yarn_stock_id?: string | null
}
Relationships: [
{
foreignKeyName: "yarn_stock_records_company_id_fkey"
columns: ["company_id"]
referencedRelation: "companies"
referencedColumns: ["id"]
},
{
foreignKeyName: "yarn_stock_records_plan_id_fkey"
columns: ["plan_id"]
referencedRelation: "production_plans"
referencedColumns: ["id"]
},
{
foreignKeyName: "yarn_stock_records_yarn_stock_id_fkey"
columns: ["yarn_stock_id"]
referencedRelation: "yarn_stock"
referencedColumns: ["id"]
},
]
}
}
Views: {
[_ in never]: never
}
Functions: {
binary_quantize: {
Args: { "": string } | { "": unknown }
Returns: unknown
}
get_current_user_company_id: {
Args: Record<PropertyKey, never>
Returns: string
}
get_user_master_company_id: {
Args: Record<PropertyKey, never>
Returns: string
}
halfvec_avg: {
Args: { "": number[] }
Returns: unknown
}
halfvec_out: {
Args: { "": unknown }
Returns: unknown
}
halfvec_send: {
Args: { "": unknown }
Returns: string
}
halfvec_typmod_in: {
Args: { "": unknown[] }
Returns: number
}
hnsw_bit_support: {
Args: { "": unknown }
Returns: unknown
}
hnsw_halfvec_support: {
Args: { "": unknown }
Returns: unknown
}
hnsw_rdsvec_support: {
Args: { "": unknown }
Returns: unknown
}
hnsw_sparsevec_support: {
Args: { "": unknown }
Returns: unknown
}
hnswhandler: {
Args: { "": unknown }
Returns: unknown
}
increment_share_link_clicks: {
Args: { code: string }
Returns: undefined
}
ivfflat_bit_support: {
Args: { "": unknown }
Returns: unknown
}
ivfflat_halfvec_support: {
Args: { "": unknown }
Returns: unknown
}
ivfflathandler: {
Args: { "": unknown }
Returns: unknown
}
ivfrabitq_vector_support: {
Args: { "": unknown }
Returns: unknown
}
l2_norm: {
Args: { "": unknown } | { "": unknown }
Returns: number
}
l2_normalize: {
Args: { "": string } | { "": unknown } | { "": unknown }
Returns: unknown
}
rds_float_normalize_i16: {
Args: { "": unknown }
Returns: unknown
}
rds_vector_norm: {
Args: { "": string }
Returns: number
}
sparsevec_out: {
Args: { "": unknown }
Returns: unknown
}
sparsevec_send: {
Args: { "": unknown }
Returns: string
}
sparsevec_typmod_in: {
Args: { "": unknown[] }
Returns: number
}
vector_avg: {
Args: { "": number[] }
Returns: string
}
vector_dims: {
Args: { "": string } | { "": unknown }
Returns: number
}
vector_norm: {
Args: { "": string }
Returns: number
}
vector_out: {
Args: { "": string }
Returns: unknown
}
vector_send: {
Args: { "": string }
Returns: string
}
vector_typmod_in: {
Args: { "": unknown[] }
Returns: number
}
}
Enums: {
app_role: "purchaser" | "textile" | "washing"
factory_type: "textile" | "washing"
payment_status: "pending" | "completed"
plan_status: "pending" | "producing" | "completed"
step_status: "pending" | "active" | "completed" | "rejected"
step_type:
| "confirm"
| "yarn_purchase"
| "dyeing"
| "machine_start"
| "fabric_warehouse"
warehouse_type: "raw_fabric" | "fabric" | "finished" | "yarn"
}
CompositeTypes: {
[_ in never]: never
}
}
}
type DefaultSchema = Database[Extract<keyof Database, "public">]
export type Tables<
DefaultSchemaTableNameOrOptions extends
| keyof (DefaultSchema["Tables"] & DefaultSchema["Views"])
| { schema: keyof Database },
TableName extends DefaultSchemaTableNameOrOptions extends {
schema: keyof Database
}
? keyof (Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] &
Database[DefaultSchemaTableNameOrOptions["schema"]]["Views"])
: never = never,
> = DefaultSchemaTableNameOrOptions extends { schema: keyof Database }
? (Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] &
Database[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends {
Row: infer R
}
? R
: never
: DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] &
DefaultSchema["Views"])
? (DefaultSchema["Tables"] &
DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends {
Row: infer R
}
? R
: never
: never
export type TablesInsert<
DefaultSchemaTableNameOrOptions extends
| keyof DefaultSchema["Tables"]
| { schema: keyof Database },
TableName extends DefaultSchemaTableNameOrOptions extends {
schema: keyof Database
}
? keyof Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"]
: never = never,
> = DefaultSchemaTableNameOrOptions extends { schema: keyof Database }
? Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
Insert: infer I
}
? I
: never
: DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"]
? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
Insert: infer I
}
? I
: never
: never
export type TablesUpdate<
DefaultSchemaTableNameOrOptions extends
| keyof DefaultSchema["Tables"]
| { schema: keyof Database },
TableName extends DefaultSchemaTableNameOrOptions extends {
schema: keyof Database
}
? keyof Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"]
: never = never,
> = DefaultSchemaTableNameOrOptions extends { schema: keyof Database }
? Database[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
Update: infer U
}
? U
: never
: DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"]
? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
Update: infer U
}
? U
: never
: never
export type Enums<
DefaultSchemaEnumNameOrOptions extends
| keyof DefaultSchema["Enums"]
| { schema: keyof Database },
EnumName extends DefaultSchemaEnumNameOrOptions extends {
schema: keyof Database
}
? keyof Database[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"]
: never = never,
> = DefaultSchemaEnumNameOrOptions extends { schema: keyof Database }
? Database[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName]
: DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"]
? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions]
: never
export type CompositeTypes<
PublicCompositeTypeNameOrOptions extends
| keyof DefaultSchema["CompositeTypes"]
| { schema: keyof Database },
CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
schema: keyof Database
}
? keyof Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"]
: never = never,
> = PublicCompositeTypeNameOrOptions extends { schema: keyof Database }
? Database[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName]
: PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"]
? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions]
: never
export const Constants = {
public: {
Enums: {
app_role: ["purchaser", "textile", "washing"],
factory_type: ["textile", "washing"],
payment_status: ["pending", "completed"],
plan_status: ["pending", "producing", "completed"],
step_status: ["pending", "active", "completed", "rejected"],
step_type: [
"confirm",
"yarn_purchase",
"dyeing",
"machine_start",
"fabric_warehouse",
],
warehouse_type: ["raw_fabric", "fabric", "finished", "yarn"],
},
},
} as const