diff options
| author | Adam Soltys <[email protected]> | 2024-10-31 09:29:04 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-10-31 09:34:42 -0700 |
| commit | aa4cd39c943b67169def224e224bd07b815b70ec (patch) | |
| tree | 2af857ac971705f4d20eb017864f0365d0b57ea6 /routes/items.ts | |
| parent | bc9c04f6519f32d3b444d4df0b276eba960480a9 (diff) | |
| download | coinos-server-aa4cd39c943b67169def224e224bd07b815b70ec.tar.gz coinos-server-aa4cd39c943b67169def224e224bd07b815b70ec.zip | |
biome lint
Diffstat (limited to 'routes/items.ts')
| -rw-r--r-- | routes/items.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/routes/items.ts b/routes/items.ts index a7586a69..df1d86ea 100644 --- a/routes/items.ts +++ b/routes/items.ts @@ -4,12 +4,12 @@ import { bail, fail } from "$lib/utils"; export default { async list(req, res) { - let { + const { params: { id: uid }, } = req; - let items = []; - for (let id of await db.lRange(`${uid}:items`, 0, -1)) { - let item = await g(`item:${id}`); + const items = []; + for (const id of await db.lRange(`${uid}:items`, 0, -1)) { + const item = await g(`item:${id}`); if (item) items.push(item); else await db.lRem(`${uid}:items`, 0, id); } @@ -18,11 +18,11 @@ export default { }, async get(req, res) { - let { + const { params: { id }, } = req; try { - let item = await g(`item:${id}`); + const item = await g(`item:${id}`); if (!item) fail("Item not found"); res.send(item); } catch (e) { @@ -31,7 +31,7 @@ export default { }, async create(req, res) { - let { + const { body: item, user: { id }, } = req; @@ -53,12 +53,12 @@ export default { }, async del(req, res) { - let { + const { body: { item }, user: { id }, } = req; try { - let n = await db.lRem(`${id}:items`, 0, item.id); + const n = await db.lRem(`${id}:items`, 0, item.id); if (n) db.del(`item:${item.id}`); else fail("item not found"); @@ -69,14 +69,14 @@ export default { }, async sort(req, res) { - let { + const { body: { items }, user: { id }, } = req; try { await db.del(`${id}:items`); - for (let item of items) { + for (const item of items) { await db.rPush(`${id}:items`, item.id); } |
