feat: add user information display in extractions table and update extraction retrieval method

This commit is contained in:
JSC
2025-08-17 01:44:38 +02:00
parent ed888dd8d1
commit 04401092bb
4 changed files with 41 additions and 4 deletions

View File

@@ -9,6 +9,7 @@ export interface ExtractionInfo {
service_id?: string
sound_id?: number
user_id: number
user_name?: string
error?: string
created_at: string
updated_at: string
@@ -56,9 +57,9 @@ export class ExtractionsService {
}
/**
* Get user's extractions
* Get all extractions
*/
async getUserExtractions(params?: GetExtractionsParams): Promise<ExtractionInfo[]> {
async getAllExtractions(params?: GetExtractionsParams): Promise<ExtractionInfo[]> {
const searchParams = new URLSearchParams()
if (params?.search) {
@@ -80,6 +81,32 @@ export class ExtractionsService {
const response = await apiClient.get<GetExtractionsResponse>(url)
return response.extractions
}
/**
* Get user's extractions
*/
async getUserExtractions(params?: GetExtractionsParams): Promise<ExtractionInfo[]> {
const searchParams = new URLSearchParams()
if (params?.search) {
searchParams.append('search', params.search)
}
if (params?.sort_by) {
searchParams.append('sort_by', params.sort_by)
}
if (params?.sort_order) {
searchParams.append('sort_order', params.sort_order)
}
if (params?.status_filter) {
searchParams.append('status_filter', params.status_filter)
}
const queryString = searchParams.toString()
const url = queryString ? `/api/v1/extractions/user?${queryString}` : '/api/v1/extractions/user'
const response = await apiClient.get<GetExtractionsResponse>(url)
return response.extractions
}
}
export const extractionsService = new ExtractionsService()