Skip to content

Commit

Permalink
Update endpoint and data schemas to include advanced weather fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
Carifio24 committed Mar 14, 2024
1 parent 96ea457 commit a156a16
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/stories/solar-eclipse-2024/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ export const SolarEclipse2024Entry = S.struct({
cloud_cover_selected_locations: LatLonArray,
info_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }),
app_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }),
advanced_weather_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }),
});

export const SolarEclipse2024Update = S.struct({
user_selected_locations: S.optional(LatLonArray, { exact: true }),
cloud_cover_selected_locations: S.optional(LatLonArray, { exact: true }),
delta_info_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }),
delta_app_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }),
delta_advanced_weather_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }),
});

export type SolarEclipse2024DataT = S.Schema.To<typeof SolarEclipse2024Entry>;
Expand Down Expand Up @@ -73,6 +75,9 @@ export async function updateSolarEclipse2024Data(userUUID: string, update: Solar
if (update.delta_app_time_ms) {
dbUpdate.app_time_ms = data.app_time_ms + update.delta_app_time_ms;
}
if (update.delta_advanced_weather_time_ms) {
dbUpdate.advanced_weather_time_ms = data.advanced_weather_time_ms + update.delta_advanced_weather_time_ms;
}
const result = await data.update(dbUpdate);
return result !== null;
}

0 comments on commit a156a16

Please sign in to comment.