Ground Bean Bro in displayed temperatures, stream replies, and add activity calendar
Test and deploy / test-and-deploy (push) Successful in 1m19s
Test and deploy / test-and-deploy (push) Successful in 1m19s
This commit is contained in:
1 parent
a72aec9f86
commit
d96ed22de1
16 files changed
+551
-484
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { activityFor } from "./activity.js";
|
||||
import { buildWorkspace } from "../shared/workspace.js";
|
||||
export async function workspaceFor(db, userId) {
|
||||
const [plans, roasts, lots, cups] = await Promise.all([
|
||||
@@ -39,6 +40,15 @@ export function registerWorkspace(
|
||||
app,
|
||||
{ db, requireAuth, csrf, requireUuidParam },
|
||||
) {
|
||||
app.get("/api/activity", requireAuth, async (req, res, next) => {
|
||||
const month = req.query.month, timeZone = req.query.timeZone || "UTC";
|
||||
if (typeof month !== "string" || !/^20\d{2}-(0[1-9]|1[0-2])$/.test(month))
|
||||
return res.status(400).json({ok:false,code:"bad_month"});
|
||||
try { new Intl.DateTimeFormat("en", {timeZone}); }
|
||||
catch { return res.status(400).json({ok:false,code:"bad_timezone"}); }
|
||||
try { res.json({ok:true,month,events:await activityFor(db,req.user.id,month,timeZone)}); }
|
||||
catch (error) { next(error); }
|
||||
});
|
||||
app.post("/api/roasts/manual", requireAuth, csrf, async (req, res, next) => {
|
||||
try {
|
||||
const id = req.body.planId;
|
||||
|
||||
Reference in new issue
Block a user