This commit is contained in:
2025-03-22 11:50:44 +05:00
parent 609b94b753
commit c30a868761
4 changed files with 12 additions and 17 deletions
+6 -2
View File
@@ -13,7 +13,9 @@ export default async function createApp(
}
) {
if (auth.userId !== "hmac-user") {
return error(403, "Forbidden");
return error(403, {
error: "Forbidden",
});
}
try {
@@ -22,7 +24,9 @@ export default async function createApp(
});
if (existingApp.length) {
return error(400, "App with this name already exists");
return error(400, {
error: "App with this name already exists",
});
}
const apps = await db
@@ -2,11 +2,12 @@ import { eq } from "drizzle-orm";
import db from "../../db";
import { usersTable } from "../../db/schema";
import { error } from "elysia";
import type { AuthContext } from "../../middlewares/auth";
export default async function me(userId: string) {
export default async function me(auth: AuthContext) {
try {
const user = await db.query.usersTable.findFirst({
where: eq(usersTable.id, userId),
where: eq(usersTable.id, auth.userId),
columns: {
id: true,
email: true,