Auth guard fixes

This commit is contained in:
Dominic Ferrando
2026-08-16 03:13:56 -04:00
parent a406bb07a8
commit c5f6c25563
+6 -4
View File
@@ -80,7 +80,6 @@ export const app = new Elysia()
/^https?:\/\/([a-z0-9-]+\.)?bladeandbrawn\.com$/i, /^https?:\/\/([a-z0-9-]+\.)?bladeandbrawn\.com$/i,
// testing // testing
/^https?:\/\/([a-z0-9-]+\.)?bladeandbrawn\.webflow\.io$/i, /^https?:\/\/([a-z0-9-]+\.)?bladeandbrawn\.webflow\.io$/i,
/^https?:\/\/([a-z0-9-]+\.)?bladeandbrawn-test\.webflow\.io$/i,
// development // development
"http://localhost:5173", "http://localhost:5173",
], ],
@@ -261,7 +260,7 @@ export const app = new Elysia()
}), }),
}) })
// Authenticated // Authenticated
.guard({ authAdmin: true }) .guard({ authAdmin: true }, (app) => app
.get("/standards/config", async () => { .get("/standards/config", async () => {
return await s.Calculator.Standards.Config.get(); return await s.Calculator.Standards.Config.get();
}) })
@@ -271,6 +270,7 @@ export const app = new Elysia()
body: t.Object({ standardsConfigId: t.String() }) body: t.Object({ standardsConfigId: t.String() })
}) })
) )
)
.group("/standards", { authAdmin: true }, (app) => app .group("/standards", { authAdmin: true }, (app) => app
.post("/configs", async ({ body: { name, datasetId, params } }) => { .post("/configs", async ({ body: { name, datasetId, params } }) => {
return await s.Standards.Configs.create(name, datasetId, params); return await s.Standards.Configs.create(name, datasetId, params);
@@ -457,13 +457,14 @@ export const app = new Elysia()
}, { }, {
params: t.Object({ id: t.String() }) params: t.Object({ id: t.String() })
}) })
.guard({ authUser: true }) .guard({ authUser: true }, (app) => app
.get("/me/stats", async ({ accountId }) => { .get("/me/stats", async ({ accountId }) => {
const stats = await s.Accounts.stats(accountId); const stats = await s.Accounts.stats(accountId);
if (!stats) throw new NotFoundError("Account stats not found"); if (!stats) throw new NotFoundError("Account stats not found");
return stats; return stats;
}) })
.guard({ authAdmin: true }) )
.guard({ authAdmin: true }, (app) => app
.get("/:id", async ({ params: { id } }) => { .get("/:id", async ({ params: { id } }) => {
const account = await s.Accounts.get(id); const account = await s.Accounts.get(id);
if (!account) throw new NotFoundError("Account not found"); if (!account) throw new NotFoundError("Account not found");
@@ -472,6 +473,7 @@ export const app = new Elysia()
params: t.Object({ id: t.String() }) params: t.Object({ id: t.String() })
}) })
) )
)
// WEBHOOKS // WEBHOOKS
.post("/webhooks/printful", async ({ body, query }) => { .post("/webhooks/printful", async ({ body, query }) => {