Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rest endpoint fires #183

Merged
merged 3 commits into from
Jan 14, 2025
Merged

Conversation

rupamkairi
Copy link
Contributor

@rupamkairi rupamkairi commented Dec 20, 2024

Rest api endpoint for fires by remoteId or siteId is created. This lists fires for the sites for last 7 Days (default span).
endpoint at /api/v1/fires.

Browser & CDN Caching for a 2 Hours, with SWR (stale-while-revalidation) for 2 Hours.
Fires data is returned in GeoJSON.
Authorisation is not needed since it is Public API.

Following is a screenshot for Data & Output
Screenshot 2025-01-10 at 14 26 43

@sagararyal

Copy link

vercel bot commented Dec 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
fire-alert ❌ Failed (Inspect) Jan 14, 2025 4:51pm

Copy link

vercel bot commented Jan 5, 2025

Deployment failed with the following error:

Preview deployments are disabled for this project.

Versioning & GeoJSON return

Api versioning introduced (path /v1, /v2).
Fires are returned as GeoJSON.

handling query parameter span fixed output format

file moved, removes /rest segment

accounted for remoteIds & CORS.
Caching setting by environment variables

Caching env variable
@@ -38,7 +38,8 @@ const server = z.object({
CRON_KEY: z.string().optional(),
NEXT_PUBLIC_LOGTAIL_SOURCE_TOKEN: z.string().optional(),
WHATSAPP_ENDPOINT_URL: z.string(),
WHATSAPP_ENDPOINT_AUTH_TOKEN: z.string()
WHATSAPP_ENDPOINT_AUTH_TOKEN: z.string(),
PUBLIC_API_CACHING: z.string().optional(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not z.boolean()?

@sagararyal
Copy link
Member

sagararyal commented Jan 14, 2025

Should plan for abstraction of api if we add more in future, but looks good.

  • Change the env schema for caching to boolean.

@rupamkairi
Copy link
Contributor Author

rupamkairi commented Jan 14, 2025

Should plan for abstraction of api if we add more in future, but looks good.

  • Change the env schema for caching to boolean.

Will do the env schema change.

But do you think the abstraction can go in separate PR, so this can be tested in integration.

@sagararyal sagararyal merged commit acc69c8 into develop Jan 14, 2025
1 of 4 checks passed
@sagararyal sagararyal deleted the feature/REST-endpoint-fires branch January 14, 2025 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants