Skip to content

Commit

Permalink
style: format files using "tb fmt"
Browse files Browse the repository at this point in the history
  • Loading branch information
unrenamed committed Dec 25, 2023
1 parent a32db34 commit acb2c0f
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 219 deletions.
4 changes: 2 additions & 2 deletions app/robots.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MetadataRoute } from 'next'

export default function robots(): MetadataRoute.Robots {
return {
rules: {
Expand All @@ -9,4 +9,4 @@ export default function robots(): MetadataRoute.Robots {
},
sitemap: 'https://weel-unrenamed.vercel.app/sitemap.xml',
}
}
}
2 changes: 1 addition & 1 deletion components/dashboard/link/stats/referrers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useSearchParams } from "next/navigation";

export default function Referrers() {
const searchParams = useSearchParams();

const { data, isLoading, isValidating } = useSWR<
{ referrer: string; clicks: number }[]
>(`/api/links/stats/referrer?${searchParams}`, fetcher);
Expand Down
7 changes: 3 additions & 4 deletions config/tinybird/datasources/link_clicks.datasource
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
TOKEN "user token" APPEND


SCHEMA >
`bot` UInt8 `json:$.bot`,
`browser` String `json:$.browser`,
Expand All @@ -24,6 +23,6 @@ SCHEMA >
`timestamp` DateTime `json:$.timestamp`,
`ua` String `json:$.ua`

ENGINE "MergeTree"
ENGINE_PARTITION_KEY "toYear(timestamp)"
ENGINE_SORTING_KEY "bot, region, timestamp, ua"
ENGINE MergeTree
ENGINE_PARTITION_KEY toYear(timestamp)
ENGINE_SORTING_KEY bot, region, timestamp, ua
29 changes: 4 additions & 25 deletions config/tinybird/endpoints/bot.pipe
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
DESCRIPTION >
Link clicks per bot for a given period

Link clicks per bot for a given period

TOKEN "user token" READ

Expand All @@ -9,7 +8,6 @@ DESCRIPTION >
Filter clicks by given domain, key and timestamp interval if defined

SQL >

%
select *
from link_clicks
Expand All @@ -19,42 +17,25 @@ SQL >
and timestamp between {{ DateTime(start) }} and {{ DateTime(end) }}
{% end %}



NODE count_clicks_by_bot
DESCRIPTION >
Group clicks by bot column and count a total number of clicks

SQL >

%
select count(*) as clicks, bot
from filter_by_timestamp_interval
group by bot
order by clicks DESC


select count(*) as clicks, bot from filter_by_timestamp_interval group by bot order by clicks DESC

NODE endpoint
DESCRIPTION >
Return pipeline result data with API documentation and errors for dynamic parameters

SQL >

%
{% if defined(start) and not defined(end) %}
{{
error(
'You need to provide both start and end dates to filter by datetime interval'
)
}}
{{ error('You need to provide both start and end dates to filter by datetime interval') }}
{% end %}
{% if defined(end) and not defined(start) %}
{{
error(
'You need to provide both start and end dates to filter by datetime interval'
)
}}
{{ error('You need to provide both start and end dates to filter by datetime interval') }}
{% end %}
with
{{
Expand Down Expand Up @@ -91,5 +72,3 @@ SQL >
}}
select *
from count_clicks_by_bot


24 changes: 3 additions & 21 deletions config/tinybird/endpoints/browser.pipe
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
DESCRIPTION >
Link clicks per browser for a given period

Link clicks per browser for a given period

TOKEN "user token" READ

Expand All @@ -9,7 +8,6 @@ DESCRIPTION >
Filter clicks by given domain, key and timestamp interval if defined

SQL >

%
select *
from link_clicks
Expand All @@ -19,42 +17,28 @@ SQL >
and timestamp between {{ DateTime(start) }} and {{ DateTime(end) }}
{% end %}



NODE count_clicks_by_browser
DESCRIPTION >
Group clicks by browser column and count a total number of clicks

SQL >

%
select count(*) as clicks, browser as browser
from filter_by_timestamp_interval
group by browser
order by clicks DESC



NODE endpoint
DESCRIPTION >
Return pipeline result data with API documentation and errors for dynamic parameters

SQL >

%
{% if defined(start) and not defined(end) %}
{{
error(
'You need to provide both start and end dates to filter by datetime interval'
)
}}
{{ error('You need to provide both start and end dates to filter by datetime interval') }}
{% end %}
{% if defined(end) and not defined(start) %}
{{
error(
'You need to provide both start and end dates to filter by datetime interval'
)
}}
{{ error('You need to provide both start and end dates to filter by datetime interval') }}
{% end %}
with
{{
Expand Down Expand Up @@ -91,5 +75,3 @@ SQL >
}}
select *
from count_clicks_by_browser


24 changes: 3 additions & 21 deletions config/tinybird/endpoints/city.pipe
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
DESCRIPTION >
Link clicks per city for a given period

Link clicks per city for a given period

TOKEN "user token" READ

Expand All @@ -9,7 +8,6 @@ DESCRIPTION >
Filter clicks by given domain, key and timestamp interval if defined

SQL >

%
select *
from link_clicks
Expand All @@ -19,42 +17,28 @@ SQL >
and timestamp between {{ DateTime(start) }} and {{ DateTime(end) }}
{% end %}



NODE count_clicks_by_city
DESCRIPTION >
Group clicks by city column and count a total number of clicks

SQL >

%
select count(*) as clicks, city as city, country as country
from filter_by_timestamp_interval
group by city, country
order by clicks DESC



NODE endpoint
DESCRIPTION >
Return pipeline result data with API documentation and errors for dynamic parameters

SQL >

%
{% if defined(start) and not defined(end) %}
{{
error(
'You need to provide both start and end dates to filter by datetime interval'
)
}}
{{ error('You need to provide both start and end dates to filter by datetime interval') }}
{% end %}
{% if defined(end) and not defined(start) %}
{{
error(
'You need to provide both start and end dates to filter by datetime interval'
)
}}
{{ error('You need to provide both start and end dates to filter by datetime interval') }}
{% end %}
with
{{
Expand Down Expand Up @@ -91,5 +75,3 @@ SQL >
}}
select *
from count_clicks_by_city


21 changes: 3 additions & 18 deletions config/tinybird/endpoints/clicks.pipe
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
DESCRIPTION >
Total number of clicks for a given period

Total number of clicks for a given period

TOKEN "user token" READ

Expand All @@ -9,7 +8,6 @@ DESCRIPTION >
Count total number of clicks filtered by given domain, key and timestamp interval if defined

SQL >

%
select count(*) as clicks
from link_clicks
Expand All @@ -19,28 +17,17 @@ SQL >
and timestamp between {{ DateTime(start) }} and {{ DateTime(end) }}
{% end %}



NODE endpoint
DESCRIPTION >
Return pipeline result data with API documentation and errors for dynamic parameters

SQL >

%
{% if defined(start) and not defined(end) %}
{{
error(
'You need to provide both start and end dates to filter by datetime interval'
)
}}
{{ error('You need to provide both start and end dates to filter by datetime interval') }}
{% end %}
{% if defined(end) and not defined(start) %}
{{
error(
'You need to provide both start and end dates to filter by datetime interval'
)
}}
{{ error('You need to provide both start and end dates to filter by datetime interval') }}
{% end %}
with
{{
Expand Down Expand Up @@ -77,5 +64,3 @@ SQL >
}}
select *
from count_clicks


28 changes: 5 additions & 23 deletions config/tinybird/endpoints/country.pipe
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
DESCRIPTION >
Link clicks per country for a given period

Link clicks per country for a given period

TOKEN "user token" READ

Expand All @@ -9,7 +8,6 @@ DESCRIPTION >
Filter clicks by given domain, key and timestamp interval if defined

SQL >

%
select *
from link_clicks
Expand All @@ -19,42 +17,28 @@ SQL >
and timestamp between {{ DateTime(start) }} and {{ DateTime(end) }}
{% end %}



NODE count_clicks_by_country
DESCRIPTION >
Group clicks by country column and count a total number of clicks

SQL >

%
select count(*) as clicks, country as country
from filter_by_timestamp_interval
select count(*) as clicks, country as country
from filter_by_timestamp_interval
group by country
order by clicks DESC



NODE endpoint
DESCRIPTION >
Return pipeline result data with API documentation and errors for dynamic parameters

SQL >

%
{% if defined(start) and not defined(end) %}
{{
error(
'You need to provide both start and end dates to filter by datetime interval'
)
}}
{{ error('You need to provide both start and end dates to filter by datetime interval') }}
{% end %}
{% if defined(end) and not defined(start) %}
{{
error(
'You need to provide both start and end dates to filter by datetime interval'
)
}}
{{ error('You need to provide both start and end dates to filter by datetime interval') }}
{% end %}
with
{{
Expand Down Expand Up @@ -91,5 +75,3 @@ SQL >
}}
select *
from count_clicks_by_country


Loading

0 comments on commit acb2c0f

Please sign in to comment.