Add eslint and fix eslint errors, other minor improvements

This commit is contained in:
Szymon Nowakowski
2024-12-25 17:26:20 +01:00
parent 8c15df8e06
commit 135d54908f
21 changed files with 911 additions and 144 deletions

View File

@@ -79,11 +79,11 @@ const app = new Elysia()
indexHTML: false,
}))
.group("/api", (app) => app
.group("/api/v1", (app) => app
// --- MARK: AUTHENTICATION --------------------------------------------
.get("/me", async ({ user }) => {
.get("/me", ({ user }) => {
if (user === null) {
return error("Unauthorized");
@@ -235,7 +235,7 @@ const app = new Elysia()
eb("composer", "like", "%" + query.author + "%"),
eb("arranger", "like", "%" + query.author + "%"),
eb("lyricist", "like", "%" + query.author + "%"),
]))
]));
}
const res = await q.execute();
@@ -249,7 +249,7 @@ const app = new Elysia()
}),
})
.get("/piece/:pieceId", async ({ db, query, params: { pieceId }, user }) => {
.get("/piece/:pieceId", async ({ db, params: { pieceId }, user }) => {
if (user === null) {
return error("Unauthorized");
@@ -277,7 +277,7 @@ const app = new Elysia()
sha256: Buffer.from(sha256).toString("hex"),
...rest,
})),
}
};
}, {
params: t.Object({
pieceId: tbranded<PieceId>(),
@@ -311,7 +311,7 @@ const app = new Elysia()
}),
params: t.Object({
pieceId: tbranded<PieceId>(),
})
}),
})
.delete("/piece/:pieceId", async ({ db, params: { pieceId }, set, user }) => {
@@ -471,13 +471,13 @@ const app = new Elysia()
pieceId: tbranded<PieceId>(),
attachmentId: tbranded<AttachmentId>(),
}),
// eslint-disable-next-line @stylistic/comma-dangle -- a comma would confuse the TS compiler here
})
)
.get("*", () => Bun.file("packages/frontend/build/index.html"))
.get("*", () => Bun.file("packages/frontend/build/index.html"));
// -------------------------------------------------------------------------
.listen(process.env.PORT || 3000);
app.listen(process.env.PORT || 3000);
export type App = typeof app;