-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc328a2
commit b4623c7
Showing
4 changed files
with
109 additions
and
20 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/sunrise-sunset/interfaces/sunrise-sunset-response.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export interface SunriseSunsetResponse { | ||
results: { | ||
sunrise: string | ||
sunset: string | ||
solar_noon?: string | ||
day_length?: number | ||
civil_twilight_begin?: string | ||
civil_twilight_end?: string | ||
nautical_twilight_begin?: string | ||
nautical_twilight_end?: string | ||
astronomical_twilight_begin?: string | ||
astronomical_twilight_end?: string | ||
} | ||
status?: string | ||
tzid?: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export interface SunriseSunset { | ||
sunrise: string | ||
sunset: string | ||
} | ||
|
||
export interface SunriseSunsets { | ||
[date: string]: SunriseSunset | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { MangoQuery } from 'nano' | ||
|
||
export const sunriseSunsetQueryBuilder = (startDate: string, endDate: string): MangoQuery => ({ | ||
selector: { | ||
$and: [ | ||
{ | ||
_id: { | ||
$gte: startDate, | ||
}, | ||
}, | ||
{ | ||
_id: { | ||
$lte: endDate, | ||
}, | ||
}, | ||
], | ||
}, | ||
sort: [{ _id: 'asc' }], | ||
limit: 10000, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters