Skip to content

Commit 9ad7e0b

Browse files
Merge pull request #7 from terminusdb/review-change-request
Update client
2 parents 5fd7913 + 81d122d commit 9ad7e0b

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

package-lock.json

+13-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"license": "ISC",
2020
"dependencies": {
2121
"@apollo/client": "^3.7.16",
22-
"@terminusdb/terminusdb-client": "^10.0.31",
22+
"@terminusdb/terminusdb-client": "^10.0.32",
2323
"@types/swagger-ui-express": "^4.1.3",
2424
"apollo-cache-inmemory": "^1.6.6",
2525
"apollo-client": "^2.6.10",

src/api/core/ChangeRequestDB.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class ChangeRequestDB {
9292
let docId
9393
const creator = this.user || ""
9494
const originalBranch = this.request.body.original_branch
95-
this.createCRDatabase()
95+
await this.createCRDatabase()
9696
const tmpClient = this.connectWithCurrentUser()
9797

9898
// I need to record the commit-id point

src/app.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,22 @@ app.use(
6565
);
6666

6767
app.use(addContextMiddle)
68-
app.listen(3035,function(){
68+
app.listen(3035, async () => {
6969
// when we start the server we check if the terminusCR team already exists
7070
// if it does not exists we'll create it
71-
const accessControl = new AccessControl(settings.endpoint, { key: settings.key, user: settings.user })
71+
try{
72+
const accessControl = new AccessControl(settings.endpoint, { key: settings.key, user: settings.user })
7273

73-
accessControl.createOrganization(settings.CROrg).then(result=>{
74-
console.log("The Change Request team has been created")
75-
}).catch((err:any)=>{
74+
await accessControl.createOrganization(settings.CROrg)
75+
await accessControl.manageCapability('User/admin',`Organization/${settings.CROrg}`,['Role/admin'],"grant")
76+
console.log("The Change Request team has been created")
77+
}catch(err:any){
7678
if (typeof err.data === 'object' && err.data['api:error']
7779
&& err.data['api:error']['@type'] === "api:NoUniqueIdForOrganizationName") {
7880
console.log("The Change Request team already exists")
7981
}
80-
})
81-
});
82+
}
83+
})
8284

8385
console.log("App running on port http://localhost:3035");
8486
console.log(

0 commit comments

Comments
 (0)