Extra cron logging

This commit is contained in:
Fergal Moran
2023-02-28 03:10:52 +00:00
parent 0ad595d4fd
commit 2ad058ca42
6 changed files with 86 additions and 69 deletions

1
.gitignore vendored
View File

@@ -39,3 +39,4 @@ next-env.d.ts
.private/
radio-otherway-service-account.json
serviceAccount.json
/.env.production

2
.idea/web.iml generated
View File

@@ -6,6 +6,8 @@
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/.yarn" />
<excludeFolder url="file://$MODULE_DIR$/.private" />
<excludeFolder url="file://$MODULE_DIR$/.vercel" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

View File

@@ -38,7 +38,7 @@ const Navbar = () => {
<Link
href="/signup"
id="signup"
className="font-normal normal-case font-body btn-primary btn-sm btn text-primary-content"
className="font-normal normal-case font-body btn-primary btn-sm btn"
>
<PlusSquare size={12} className="mr-2" />
Register
@@ -58,7 +58,7 @@ const Navbar = () => {
);
return (
<nav className="w-full navbar bg-secondary-content text-accent-focus">
<nav className="w-full navbar bg-primary text-base-200 shadow-lg">
<Link href="/">
<Image src="/logo.png" alt="Otherway" width={42} height={42} />
</Link>

View File

@@ -13,8 +13,18 @@ const ProfilePageComponentNotifications = () => {
Here you can setup various different forms of notifications
</p>
</div>
<div className="mt-6 space-y-6 sm:mt-5 sm:space-y-5">
<div className="space-x-3 sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-t sm:pt-5">
<HeadingSubComponent
title="Browser Notifications"
subHeading="We'll send you an alert through (this) browser when a show is about to start."
/>
<div className="mt-1 sm:col-span-2 sm:mt-0">
<div className="flex max-w-lg rounded-md shadow-sm">
</div>
</div>
</div>
<div className="space-x-3 sm:grid sm:grid-cols-3 sm:items-start sm:gap-4 sm:border-t sm:pt-5">
<HeadingSubComponent
title="Phone number"

View File

@@ -1,5 +1,5 @@
"use client";
import React from "react";
import React, { useCallback } from "react";
import { themes } from "./themes";
import { useState, useEffect } from "react";
import { IoColorPaletteOutline } from "react-icons/io5";
@@ -8,22 +8,22 @@ import { defaults } from "@/lib/constants";
const ThemeSelector = () => {
const [activeTheme, setActiveTheme] = useState(
document?.body.dataset.theme ||
localStorage.getItem("theme") ||
defaults.defaultTheme
);
typeof window !== "undefined" && localStorage.getItem("theme") ||
defaults.defaultTheme);
//
useEffect(() => {
if (document) {
document.body.dataset.theme = activeTheme;
window.localStorage.setItem("theme", activeTheme);
}
}, [activeTheme]);
const _switchTheme = (theme: string) => {
const _switchTheme = useCallback((theme: string) => {
setActiveTheme(theme);
const elem = document.activeElement as HTMLElement;
elem?.blur();
};
}, []);
return (
<div title="Change Theme" className="dropdown-end dropdown">
<div tabIndex={0} className="gap-1 normal-case btn-ghost btn">
@@ -61,13 +61,10 @@ const ThemeSelector = () => {
{theme.id}
</div>
<div className="flex flex-wrap flex-shrink-0 h-full gap-1">
<div className="w-2 rounded bg-primary">
<div className="w-2 rounded bg-secondary">
<div className="w-2 rounded bg-accent">
<div className="w-2 rounded bg-neutral"></div>
</div>
</div>
</div>
<div className="w-2 rounded bg-primary" />
<div className="w-2 rounded bg-secondary" />
<div className="w-2 rounded bg-accent" />
<div className="w-2 rounded bg-neutral" />
</div>
</div>
</div>
@@ -77,7 +74,9 @@ const ThemeSelector = () => {
</div>
</div>
</div>
);
};
)
;
}
;
export default ThemeSelector;

View File

@@ -8,14 +8,18 @@ import Settings from "@/lib/db/settings";
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
logger.debug("API:cache", "Starting cache of events");
const syncToken = await Settings.read("CalendarSyncToken");
logger.debug("API:cache", "Sync token", syncToken);
const e = await getCalendarEntries(syncToken);
logger.debug("API:cache", "Got events", e?.events);
if (!e?.events) {
res.status(204).json({ result: "No calendar entries found" });
} else {
const entries = e?.events.map((r: any) => Show.fromJson(r));
logger.debug("API:cache", "Mapping events", entries);
for (const entry of entries) {
logger.debug("Storing show", entry);
logger.debug("API:cache", "Mapping event", entry);
const showRef = doc(shows, entry.id);
await setDoc(showRef, {
title: entry.title,
@@ -33,6 +37,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
logger.error(err);
res.status(500).json({ status: "Error" });
}
res.end();
};
export default handler;