Skip to content

Commit

Permalink
fix: 修复部署时 _id 未转为 ObjectId 的问题;
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Aug 7, 2021
1 parent 0cf8d83 commit 0483301
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/devops-server/src/api/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ async function _deployOneFunction(func: CloudFunctionStruct) {
}

// if new function
data._id = new ObjectId(data._id) as any

const ret = await db.collection('__functions').insertOne(data as any)
assert(ret.insertedId, `deploy: add function ${func.name} occurred error`)
}
Expand Down
1 change: 1 addition & 0 deletions packages/devops-server/src/api/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ async function _deployOnePolicy(policy: any) {
}

// if new
data._id = new ObjectId(data._id) as any
const ret = await db.collection('__policies').insertOne(data as any)
assert(ret.insertedId, `deploy: add policy ${policy.name} occurred error`)
}
Expand Down
1 change: 1 addition & 0 deletions packages/devops-server/src/api/trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ async function _deployOneTrigger(trigger: any) {
}

// if new function
data._id = new ObjectId(data._id) as any
const ret = await db.collection('__triggers').insertOne(data as any)
assert(ret.insertedId, `deploy: add trigger ${trigger.name} occurred error`)
}
1 change: 0 additions & 1 deletion packages/devops-server/src/router/deploy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ DeployRouter.post('/in', async (req, res) => {
// 令牌验证
const token = req.body?.deploy_token
const auth = parseToken(token)
console.log(token, auth)

if (!auth) {
return res.status(401).send('Unauthorized')
Expand Down

0 comments on commit 0483301

Please sign in to comment.