Skip to content

Commit

Permalink
Small bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Redm4x committed Feb 14, 2024
1 parent 7d3b8c5 commit 4f99af6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
8 changes: 8 additions & 0 deletions api/src/routes/v1/providers/byAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ const route = createRoute({
}
}
},
404: {
description: "Provider not found"
},
400: {
description: "Invalid address"
}
Expand All @@ -117,5 +120,10 @@ export default new OpenAPIHono().openapi(route, async (c) => {
}

const provider = await getProviderDetail(c.req.valid("param").address);

if (!provider) {
return c.text("Provider not found.", 404);
}

return c.json(provider);
});
3 changes: 3 additions & 0 deletions api/src/services/db/providerStatusService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ export const getProviderDetail = async (address: string): Promise<ProviderDetail
}
]
});

if (!provider) return null;

const providerAttributeSchemaQuery = getProviderAttributesSchema();
const auditorsQuery = getAuditors();

Expand Down
2 changes: 1 addition & 1 deletion deploy-web/src/utils/urlUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class UrlService {
static templates = (category?: string, search?: string) => `/templates${appendSearchParams({ category, search })}`;
static templateDetails = (templateId: string) => `/templates/${templateId}`;
static providers = (sort?: string) => `/providers${appendSearchParams({ sort })}`;
static providerDetail = (owner: string) => `/providers/${owner}`;
static providerDetail = (owner: string) => `/providers/${owner}${appendSearchParams({ network: getSelectedNetworkQueryParam() })}`;
static providerDetailLeases = (owner: string) => `/providers/${owner}/leases`;
static providerDetailRaw = (owner: string) => `/providers/${owner}/raw`;
static providerDetailEdit = (owner: string) => `/providers/${owner}/edit`;
Expand Down
2 changes: 1 addition & 1 deletion indexer/UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ALTER TABLE IF EXISTS public.provider
-- Set lastSnapshotId to the most recent snapshot for each providers
UPDATE "provider" p SET "lastSnapshotId" = (
SELECT ps.id FROM "providerSnapshot" ps WHERE ps."owner" = p."owner" ORDER BY "checkDate" DESC LIMIT 1
)
);
-- Update ProviderSnapshot schemas
ALTER TABLE IF EXISTS public."providerSnapshot"
Expand Down

0 comments on commit 4f99af6

Please sign in to comment.