Skip to content

Commit

Permalink
refactor: version update
Browse files Browse the repository at this point in the history
  • Loading branch information
rayriffy committed Nov 9, 2023
1 parent 292bd53 commit 3a58d02
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 36 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ COPY bun.lockb .
RUN /root/.bun/bin/bun install

# ? -------------------------

FROM gcr.io/distroless/base-debian11

WORKDIR /app
Expand Down
Binary file modified bun.lockb
Binary file not shown.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "thai-lotto-api",
"version": "1.0.16",
"module": "src/index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "bun run --hot src/index.ts"
},
"dependencies": {
"@elysiajs/cors": "^0.3.0",
"@elysiajs/swagger": "^0.4.0",
"cheerio": "^1.0.0-rc.12",
"elysia": "^0.4.15",
"elysia-rate-limit": "^1.0.3"
"@elysiajs/cors": "0.7.1",
"@elysiajs/swagger": "0.7.4",
"cheerio": "1.0.0-rc.12",
"elysia": "0.7.24",
"elysia-rate-limit": "1.2.0"
},
"devDependencies": {
"bun-types": "latest"
},
"module": "src/index.js"
}
"bun-types": "1.0.7"
}
}
54 changes: 27 additions & 27 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const app = new Elysia()
// },
})
)
.setModel(model)
.model(model)
.get('/', ({ set }) => (set.redirect = '/swagger'))
.get('/ping', () => ({
status: 'success',
Expand All @@ -67,7 +67,7 @@ const app = new Elysia()
}
},
{
transform({ params, set }) {
beforeHandle({ params, set }) {
params.page = +params.page

if (!Number.isSafeInteger(params.page)) {
Expand All @@ -78,18 +78,18 @@ const app = new Elysia()
}
}
},
params: t.Object({
page: t.Number(),
}),
response: {
200: 'lotto.overview',
400: 'api.error',
},
schema: {
detail: {
summary: 'Get lotto by page',
tags: ['lotto'],
},
params: t.Object({
page: t.Number(),
}),
response: {
200: 'lotto.overview',
400: 'api.error',
},
},
}
)
Expand Down Expand Up @@ -130,20 +130,7 @@ const app = new Elysia()
}
},
{
schema: {
detail: {
summary: 'Check lottery status by lottery number',
tags: ['lotto'],
},
params: t.Object({
id: t.String(),
}),
response: {
200: 'lotto.detail',
400: 'api.error',
},
},
transform({ params, set }) {
beforeHandle({ params, set }) {
if (!Number.isSafeInteger(Number(params.id))) {
set.status = 400
return {
Expand All @@ -152,6 +139,19 @@ const app = new Elysia()
}
}
},
params: t.Object({
id: t.String(),
}),
response: {
200: 'lotto.detail',
400: 'api.error',
},
schema: {
detail: {
summary: 'Check lottery status by lottery number',
tags: ['lotto'],
},
},
}
)
.get(
Expand Down Expand Up @@ -186,15 +186,15 @@ const app = new Elysia()
}
},
{
response: {
200: 'lotto.detail',
400: 'api.error',
},
schema: {
detail: {
summary: 'Latest price annoucement',
tags: ['lotto'],
},
response: {
200: 'lotto.detail',
400: 'api.error',
},
},
}
)
Expand Down

0 comments on commit 3a58d02

Please sign in to comment.