Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(server): rename limit to pageSize in func log api #1202

Merged
merged 1 commit into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions server/src/function/function.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ export class FunctionService {
appid: string,
params: {
page: number
limit: number
pageSize: number
requestId?: string
functionName?: string
},
) {
const { page, limit, requestId, functionName } = params
const { page, pageSize, requestId, functionName } = params
const { db, client } = await this.databaseService.findAndConnect(appid)

try {
Expand All @@ -222,8 +222,8 @@ export class FunctionService {

const data = await coll
.find(query, {
limit,
skip: (page - 1) * limit,
limit: pageSize,
skip: (page - 1) * pageSize,
sort: { _id: -1 },
})
.toArray()
Expand Down
14 changes: 7 additions & 7 deletions server/src/log/log.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,35 +49,35 @@ export class LogController {
required: false,
})
@ApiQuery({
name: 'limit',
name: 'pageSize',
type: String,
description: 'The limit number, default is 10',
description: 'The page size, default is 10',
required: false,
})
@Get('functions')
async getLogs(
@Param('appid') appid: string,
@Query('requestId') requestId?: string,
@Query('functionName') functionName?: string,
@Query('limit') limit?: number,
@Query('pageSize') pageSize?: number,
@Query('page') page?: number,
) {
page = page || 1
limit = limit || 10
pageSize = pageSize || 10

const res = await this.funcService.getLogs(appid, {
requestId,
functionName,
limit,
pageSize: pageSize,
page,
})

return ResponseUtil.ok({
list: res.data,
total: res.total,
page,
limit, // @deprecated use pageSize instead
pageSize: limit,
limit: pageSize, // @deprecated use pageSize instead
pageSize: pageSize,
})
}
}