Skip to content

Commit

Permalink
fix: update types
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-yarmosh committed Nov 22, 2024
1 parent 6bdfe09 commit a666a96
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default defineNuxtConfig({
compatibilityDate: '2024-07-01',
runtimeConfig: {
serverUrl: process.env.SERVER_URL || 'https://dash.globalping.io',
serverUrl: process.env.DASH_URL || 'https://dash.globalping.io',
public: {
gpAuthUrl: process.env.GP_API_URL || 'https://auth.globalping.io',
directusUrl: process.env.DIRECTUS_URL || 'https://dash-directus.globalping.io',
Expand Down Expand Up @@ -54,7 +54,7 @@ export default defineNuxtConfig({
},
$development: {
runtimeConfig: {
serverUrl: process.env.SERVER_URL || 'http://localhost:13010',
serverUrl: process.env.DASH_URL || 'http://localhost:13010',
public: {
gpAuthUrl: process.env.GP_API_URL || 'http://localhost:13110',
directusUrl: process.env.DIRECTUS_URL || 'http://localhost:18055',
Expand Down
6 changes: 3 additions & 3 deletions pages/probes.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,22 +251,22 @@
query: { filter: { userId: { _eq: user.id } } },
aggregate: { count: '*' },
})),
$directus.request<[{ sum: { amount: number }, adopted_probe: number}]>(aggregate('gp_credits_additions', {
$directus.request<[{ sum: { amount: string }, adopted_probe: string}]>(aggregate('gp_credits_additions', {
query: { filter: { github_id: { _eq: user.external_identifier || 'admin' }, adopted_probe: { _null: false }, date_created: { _gte: '$NOW(-30 day)' } } },
groupBy: [ 'adopted_probe' ],
aggregate: { sum: 'amount' },
})),
]);
const creditsByProbeId: Record<number, number> = {};
const creditsByProbeId: Record<string, number> = {};
totalCredits.value = 0;
for (const addition of creditsAdditions) {
const { adopted_probe: adoptedProbe, sum: { amount } } = addition;
totalCredits.value += Number(amount);
creditsByProbeId[adoptedProbe] = creditsByProbeId[adoptedProbe] ? creditsByProbeId[adoptedProbe] + amount : amount;
creditsByProbeId[adoptedProbe] = creditsByProbeId[adoptedProbe] ? creditsByProbeId[adoptedProbe] + Number(amount) : Number(amount);
}
credits.value = creditsByProbeId;
Expand Down
4 changes: 2 additions & 2 deletions types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ declare global {
amount: number;
comment: string;
date_created: 'datetime';
adopted_probe: number | null;
adopted_probe: string | null;
github_id: string;
};

Expand All @@ -41,7 +41,7 @@ declare global {
date_created: string;
comment?: string;
amount: number;
adopted_probe?: number | null;
adopted_probe?: string | null;
};

type Probe = {
Expand Down

0 comments on commit a666a96

Please sign in to comment.