diff --git a/.bruno/sets/Get a card by set name.bru b/.bruno/sets/Get a card by set name.bru new file mode 100644 index 000000000..254c3c906 --- /dev/null +++ b/.bruno/sets/Get a card by set name.bru @@ -0,0 +1,16 @@ +meta { + name: Get a card by set name + type: http + seq: 6 +} + +get { + url: {{BASE_URL}}/v2/en/sets/Crystal%20Guardians/10 + body: none + auth: none +} + +assert { + res.status: eq 200 + res.body.id: eq ex14-10 +} diff --git a/.bruno/sets/Get a set by name.bru b/.bruno/sets/Get a set by name.bru new file mode 100644 index 000000000..1a6d62580 --- /dev/null +++ b/.bruno/sets/Get a set by name.bru @@ -0,0 +1,16 @@ +meta { + name: Get a set by name + type: http + seq: 5 +} + +get { + url: {{BASE_URL}}/v2/en/sets/Crystal%20Guardians + body: none + auth: none +} + +assert { + res.status: eq 200 + res.body.id: eq ex14 +} diff --git a/Dockerfile b/Dockerfile index 10ec65d90..37d41f546 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM docker.io/oven/bun:1-alpine as BUILD_IMAGE +FROM docker.io/oven/bun:1-alpine AS build # go to work folder WORKDIR /usr/src/app @@ -28,7 +28,7 @@ rm -rf node_modules && \ bun install --frozen-install --production # go to another VM -FROM docker.io/oven/bun:1-alpine as PROD_IMAGE +FROM docker.io/oven/bun:1-alpine AS prod # inform software to be in production ENV NODE_ENV=production @@ -40,11 +40,11 @@ USER bun WORKDIR /usr/src/app # copy from build image -COPY --chown=bun:bun --from=BUILD_IMAGE /usr/src/app/server/generated ./generated -COPY --chown=bun:bun --from=BUILD_IMAGE /usr/src/app/server/node_modules ./node_modules -COPY --chown=bun:bun --from=BUILD_IMAGE /usr/src/app/server/src ./src -COPY --chown=bun:bun --from=BUILD_IMAGE /usr/src/app/server/public ./public -COPY --chown=bun:bun --from=BUILD_IMAGE /usr/src/app/server/package.json ./package.json +COPY --chown=bun:bun --from=build /usr/src/app/server/generated ./generated +COPY --chown=bun:bun --from=build /usr/src/app/server/node_modules ./node_modules +COPY --chown=bun:bun --from=build /usr/src/app/server/src ./src +COPY --chown=bun:bun --from=build /usr/src/app/server/public ./public +COPY --chown=bun:bun --from=build /usr/src/app/server/package.json ./package.json # Expose port EXPOSE 3000 diff --git a/server/src/V2/endpoints/jsonEndpoints.ts b/server/src/V2/endpoints/jsonEndpoints.ts index a0534e60a..fcc3ddb4b 100644 --- a/server/src/V2/endpoints/jsonEndpoints.ts +++ b/server/src/V2/endpoints/jsonEndpoints.ts @@ -251,6 +251,7 @@ server */ .get('/:lang/:endpoint/:id/:subid', (req: CustomRequest, res) => { let { id, lang, endpoint, subid } = req.params + console.log(req.params) if (subid.endsWith('.json')) { subid = subid.replace('.json', '') @@ -270,7 +271,7 @@ server // allow the dev to use a non prefixed value like `10` instead of `010` for newer sets result = Card // @ts-expect-error normal behavior until the filtering is more fiable - .findOne(lang, { localId: { $or: [subid.padStart(3, '0'), subid]}, 'set.id': id })?.full() + .findOne(lang, { localId: { $or: [subid.padStart(3, '0'), subid]}, $or: [{ 'set.id': id }, { 'set.name': id }] })?.full() break } if (!result) { diff --git a/server/src/libs/QueryEngine/filter.ts b/server/src/libs/QueryEngine/filter.ts index 9ead9e643..da8775ff2 100644 --- a/server/src/libs/QueryEngine/filter.ts +++ b/server/src/libs/QueryEngine/filter.ts @@ -384,6 +384,9 @@ function filterItem(value: any, query: QueryValues): boolean { * strict value check by default */ if (!(typeof query === 'object')) { + if (typeof query === 'string' && typeof value === 'string') { + return query.toLowerCase() === value.toLowerCase() + } return query === value }