fix: update RPC calls to use company_id instead of user_id for invoice and arrival number generation (#154)
This commit is contained in:
@@ -16,12 +16,14 @@ export function trackTokenUsage(
|
||||
supabase: SupabaseClient,
|
||||
userId: string,
|
||||
extensionId: string,
|
||||
usage: TokenUsage
|
||||
usage: TokenUsage,
|
||||
companyId?: string
|
||||
): void {
|
||||
supabase
|
||||
.from('ai_usage_tracking')
|
||||
.insert({
|
||||
user_id: userId,
|
||||
company_id: companyId,
|
||||
extension_id: extensionId,
|
||||
model: usage.model,
|
||||
input_tokens: usage.inputTokens,
|
||||
|
||||
@@ -91,6 +91,7 @@ export async function uploadDocument(
|
||||
.from('document_attachments')
|
||||
.insert({
|
||||
user_id: userId,
|
||||
company_id: companyId,
|
||||
storage_path: storagePath,
|
||||
file_name: file.name,
|
||||
file_size_bytes: file.buffer.byteLength,
|
||||
|
||||
@@ -210,6 +210,7 @@ export async function processOverdueReminders(): Promise<ProcessRemindersResult>
|
||||
.insert({
|
||||
invoice_id: invoice.id,
|
||||
user_id: invoice.user_id,
|
||||
company_id: invoice.company_id,
|
||||
reminder_level: reminderLevel,
|
||||
email_to: customer.email
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user