Skip to content

Commit

Permalink
fix(sys): fix #108
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Jun 7, 2022
1 parent 2417dd3 commit c6bfc5a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/system-server/src/handler/function/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,16 @@ export async function handleGetFunctionHistory(req: Request, res: Response) {
const page = Number(req.query?.page || 1)


// const doc = await getFunctionById(app.appid, new ObjectId(func_id))
const db = DatabaseAgent.db
const docs = await db.collection(CN_FUNCTION_HISTORY)
.aggregate()
.match({
appid: app.appid,
func_id: new ObjectId(func_id),
})
.sort({ created_at: -1 })
.skip((page - 1) * limit)
.limit(limit)
.lookup({
from: CN_ACCOUNTS,
localField: 'created_by',
Expand All @@ -188,9 +190,6 @@ export async function handleGetFunctionHistory(req: Request, res: Response) {
'account.created_at': 0,
'account.updated_at': 0,
})
.skip((page - 1) * limit)
.limit(limit)
.sort({ created_at: -1 })
.toArray()

for (const doc of docs) {
Expand Down

0 comments on commit c6bfc5a

Please sign in to comment.