Add getting comments
This commit is contained in:
8 files changed
+340
-5
No files matched your search
@@ -12,6 +12,10 @@ import { handler as leaderboardsLevelGetHandler } from './routes/leaderboards/le
|
||||
|
||||
import { handler as mapPacksGetHandler } from './routes/map-packs/get'
|
||||
|
||||
import { handler as commentsAccountGetHandler } from './routes/comments/account/get'
|
||||
import { handler as commentsAccountHistoryGetHandler } from './routes/comments/account/history/get'
|
||||
import { handler as commentsLevelGetHandler } from './routes/comments/level/get'
|
||||
|
||||
dotenv.config()
|
||||
|
||||
const app = new Elysia().use(
|
||||
@@ -120,6 +124,58 @@ app.get('/weekly-level', () => eventLevelGetHandler('1'), {
|
||||
tags: ['Levels']
|
||||
}
|
||||
})
|
||||
app.get('/comments/account', handler => commentsAccountGetHandler(handler), {
|
||||
detail: {
|
||||
description: 'The endpoint for getting account comments',
|
||||
tags: ['Accounts', 'Comments']
|
||||
},
|
||||
query: t.Object({
|
||||
id: t.String({ description: 'This is the account ID.' }),
|
||||
page: t.Optional(
|
||||
t.String({
|
||||
description:
|
||||
'The page you want to get, starts from `0`. Default is `0`.'
|
||||
})
|
||||
)
|
||||
})
|
||||
})
|
||||
app.get(
|
||||
'/comments/account/history',
|
||||
handler => commentsAccountHistoryGetHandler(handler),
|
||||
{
|
||||
detail: {
|
||||
description: 'The endpoint for getting account comment history',
|
||||
tags: ['Accounts', 'Comments']
|
||||
},
|
||||
query: t.Object({
|
||||
id: t.String({ description: 'This is the user ID.' }),
|
||||
page: t.Optional(
|
||||
t.String({
|
||||
description:
|
||||
'The page you want to get, starts from `0`. Default is `0`.'
|
||||
})
|
||||
)
|
||||
})
|
||||
}
|
||||
)
|
||||
app.get('/comments/level', handler => commentsLevelGetHandler(handler), {
|
||||
detail: {
|
||||
description: 'The endpoint for getting level comments',
|
||||
tags: ['Levels', 'Comments']
|
||||
},
|
||||
query: t.Object({
|
||||
id: t.String({ description: 'This is the level ID.' }),
|
||||
page: t.Optional(
|
||||
t.String({
|
||||
description:
|
||||
'The page you want to get, starts from `0`. Default is `0`.'
|
||||
})
|
||||
),
|
||||
mode: t.Union([t.Literal('0'), t.Literal('1')], {
|
||||
description: '0 for top, 1 for recent'
|
||||
})
|
||||
})
|
||||
})
|
||||
app.get(
|
||||
'/',
|
||||
() =>
|
||||
|
||||
Reference in new issue
Block a user