Skip to content

Commit

Permalink
Small fixes for company names in new page
Browse files Browse the repository at this point in the history
  • Loading branch information
ddxv committed Jan 31, 2025
1 parent 1cfb330 commit d405949
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 38 deletions.
4 changes: 2 additions & 2 deletions backend/api_app/controllers/companies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -997,7 +998,6 @@ def default_structure() -> dict:

overview = CompanyPubIDOverview(
totals=totals,
# devs=devs,
apps=apps,
)

Expand Down Expand Up @@ -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,
)
Expand Down
1 change: 0 additions & 1 deletion backend/api_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ class CompanyPubIDOverview:
"""Companies data for a specific platform (iOS/Android)."""

totals: CompanyPubIDTotals
# devs: CompanyPubIDApps
apps: CompanyPubIDApps


Expand Down
3 changes: 2 additions & 1 deletion backend/dbcon/sql/query_company_adstxt_publisher_id.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
@@ -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"`
}
});
}

0 comments on commit d405949

Please sign in to comment.