diff --git a/backend/api_app/controllers/companies.py b/backend/api_app/controllers/companies.py index 1ce2645..caeeebd 100644 --- a/backend/api_app/controllers/companies.py +++ b/backend/api_app/controllers/companies.py @@ -40,6 +40,7 @@ get_companies_top, get_company_adstxt_ad_domain_overview, get_company_adstxt_publisher_id_apps_overview, + get_company_adstxt_publisher_id_apps_raw, get_company_adstxt_publishers_overview, get_company_overview, get_company_parent_categories, @@ -997,7 +998,6 @@ def default_structure() -> dict: overview = CompanyPubIDOverview( totals=totals, - # devs=devs, apps=apps, ) @@ -1031,7 +1031,7 @@ async def adstxt_company_publisher_download( A list of apps related to the publisher. """ - df = get_company_adstxt_publisher_id_apps_overview( + df = get_company_adstxt_publisher_id_apps_raw( ad_domain_url=company_domain, publisher_id=publisher_id, ) diff --git a/backend/api_app/models.py b/backend/api_app/models.py index 7ebc8de..0258227 100644 --- a/backend/api_app/models.py +++ b/backend/api_app/models.py @@ -226,7 +226,6 @@ class CompanyPubIDOverview: """Companies data for a specific platform (iOS/Android).""" totals: CompanyPubIDTotals - # devs: CompanyPubIDApps apps: CompanyPubIDApps diff --git a/backend/dbcon/sql/query_company_adstxt_publisher_id.sql b/backend/dbcon/sql/query_company_adstxt_publisher_id.sql index acd762f..a446d3d 100644 --- a/backend/dbcon/sql/query_company_adstxt_publisher_id.sql +++ b/backend/dbcon/sql/query_company_adstxt_publisher_id.sql @@ -13,4 +13,5 @@ SELECT FROM adstxt_entries_store_apps WHERE ad_domain_url = :ad_domain_url - AND publisher_id = :publisher_id; + AND publisher_id = :publisher_id + AND store IS NOT NULL; diff --git a/frontend/src/routes/(categorical)/companies/[domain]/app-adstxt/publisher/[publisher_id]/download/+server.ts b/frontend/src/routes/(categorical)/companies/[domain]/app-adstxt/publisher/[publisher_id]/download/+server.ts index 14173c8..e64a90c 100644 --- a/frontend/src/routes/(categorical)/companies/[domain]/app-adstxt/publisher/[publisher_id]/download/+server.ts +++ b/frontend/src/routes/(categorical)/companies/[domain]/app-adstxt/publisher/[publisher_id]/download/+server.ts @@ -1,38 +1,19 @@ // src/routes/mypath/download/+server.ts import type { RequestHandler } from '@sveltejs/kit'; - - -async function getPublishersApps(companyDomain: string, publisher_id: string) { - const publishers_apps = fetch( - `http://localhost:8000/api/companies/${companyDomain}/adstxt/publisher/${publisher_id}/download` - ); - return publishers_apps; -} - - -const generateCSV = (publishersApps: any[]) => { - // Generate CSV using publishersApps data - return publishersApps - .map(app => [app.name, app.publisher, app.status].join(',')) - .join('\n'); +export const GET: RequestHandler = async ({ params }) => { + const domain = params.domain || ''; + const publisher_id = params.publisher_id || ''; + + const response = await fetch( + `http://localhost:8000/api/companies/${domain}/adstxt/publisher/${publisher_id}/download` + ); + + // Create response with appropriate headers + return new Response(response.body, { + headers: { + 'Content-Type': 'text/csv', + 'Content-Disposition': `attachment; filename="adstxt_${domain}_${publisher_id}.csv"` + } + }); }; - - - - -export const GET: RequestHandler = async ( { params } ) => { - const domain = params.domain || ''; - const publisher_id = params.publisher_id || ''; - - const response = await getPublishersApps(domain, publisher_id); - - // Create response with appropriate headers - return new Response(response.body, { - headers: { - 'Content-Type': 'text/csv', - 'Content-Disposition': `attachment; filename="adstxt_${domain}_${publisher_id}.csv"` - } - }); -} -