mirror of
https://github.com/djdevin/recflare.git
synced 2026-10-25 23:18:51 -07:00
[econ] stub out new consumables endpoint
This commit is contained in:
@@ -4975,6 +4975,22 @@ const app = new Hono<App>({ strict: false })
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// The consumable DEFINITIONS the client knows how to use (`?supportedVersion=2`), as
|
||||||
|
// opposed to the ones a player owns. A stub: none are served yet, so the list is empty.
|
||||||
|
// A real row is `{ ConsumableItemDesc, InitialCount, CreatedAt, ThumbnailImageName,
|
||||||
|
// FriendlyName, RoomieCategory, ConsumableToolName, ConfigurationData }`, where
|
||||||
|
// `ConfigurationData` is JSON escaped into a STRING (`"{\"MeshConfigurationData\":null,…}"`).
|
||||||
|
.get(
|
||||||
|
'/api/consumables/v1/all',
|
||||||
|
describeRoute({
|
||||||
|
tags: ['Consumables'],
|
||||||
|
summary: 'All consumable definitions (stub)',
|
||||||
|
description: 'Always [] — no consumable definitions are served yet.',
|
||||||
|
responses: { 200: json(JsonArray, 'The consumable definitions (always empty)') },
|
||||||
|
}),
|
||||||
|
(c) => c.json([])
|
||||||
|
)
|
||||||
|
|
||||||
// Unlocked consumables. [Authorize]. The consumables the player has bought (from
|
// Unlocked consumables. [Authorize]. The consumables the player has bought (from
|
||||||
// `buyItem`, stored in the `consumable` table), grouped by item into the client's
|
// `buyItem`, stored in the `consumable` table), grouped by item into the client's
|
||||||
// unlocked-consumable DTO. A player who has bought none gets an empty list.
|
// unlocked-consumable DTO. A player who has bought none gets an empty list.
|
||||||
|
|||||||
@@ -3772,6 +3772,12 @@ describe('econ endpoints', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('GET /api/consumables/v1/all is a stub: returns []', async () => {
|
||||||
|
const res = await exports.default.fetch(`${ORIGIN}/api/consumables/v1/all?supportedVersion=2`)
|
||||||
|
expect(res.status).toBe(200)
|
||||||
|
expect(await res.json()).toEqual([])
|
||||||
|
})
|
||||||
|
|
||||||
test('GET /api/consumables/v2/getUnlocked 401s without a token, returns []', async () => {
|
test('GET /api/consumables/v2/getUnlocked 401s without a token, returns []', async () => {
|
||||||
const anon = await exports.default.fetch(`${ORIGIN}/api/consumables/v2/getUnlocked`)
|
const anon = await exports.default.fetch(`${ORIGIN}/api/consumables/v2/getUnlocked`)
|
||||||
expect(anon.status).toBe(401)
|
expect(anon.status).toBe(401)
|
||||||
@@ -7329,6 +7335,7 @@ describe('econ endpoints', () => {
|
|||||||
'GET /api/challenge/v2/getCurrent',
|
'GET /api/challenge/v2/getCurrent',
|
||||||
'GET /api/checklist/v1/current',
|
'GET /api/checklist/v1/current',
|
||||||
'GET /api/checklist/v2/current',
|
'GET /api/checklist/v2/current',
|
||||||
|
'GET /api/consumables/v1/all',
|
||||||
'GET /api/consumables/v2/getUnlocked',
|
'GET /api/consumables/v2/getUnlocked',
|
||||||
'GET /api/equipment/v2/getUnlocked',
|
'GET /api/equipment/v2/getUnlocked',
|
||||||
'GET /api/gamerewards/v1/pending',
|
'GET /api/gamerewards/v1/pending',
|
||||||
|
|||||||
Reference in New Issue
Block a user