|
|
@ -26,57 +26,63 @@ process.env[`DEBUG`] = 'xc*'; |
|
|
|
process.env[`NC_ALLOW_LOCAL_HOOKS`] = 'true'; |
|
|
|
process.env[`NC_ALLOW_LOCAL_HOOKS`] = 'true'; |
|
|
|
|
|
|
|
|
|
|
|
(async () => { |
|
|
|
(async () => { |
|
|
|
const httpServer = server.listen(process.env.PORT || 8080, async () => { |
|
|
|
if (process.env.NC_WORKER_CONTAINER === 'true') { |
|
|
|
server.use(await Noco.init({}, httpServer, server)); |
|
|
|
await await Noco.init({}, null, null); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
const httpServer = server.listen(process.env.PORT || 8080, async () => { |
|
|
|
|
|
|
|
server.use(await Noco.init({}, httpServer, server)); |
|
|
|
|
|
|
|
|
|
|
|
let admin_response; |
|
|
|
let admin_response; |
|
|
|
if (!(await User.getByEmail('user@nocodb.com'))) { |
|
|
|
if (!(await User.getByEmail('user@nocodb.com'))) { |
|
|
|
admin_response = await axios.post( |
|
|
|
admin_response = await axios.post( |
|
|
|
`http://localhost:${process.env.PORT || 8080}/api/v1/auth/user/signup`, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
email: 'user@nocodb.com', |
|
|
|
|
|
|
|
password: 'Password123.', |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
console.log(admin_response.data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < 4; i++) { |
|
|
|
|
|
|
|
if (!(await User.getByEmail(`user-${i}@nocodb.com`))) { |
|
|
|
|
|
|
|
const response = await axios.post( |
|
|
|
|
|
|
|
`http://localhost:${ |
|
|
|
`http://localhost:${ |
|
|
|
process.env.PORT || 8080 |
|
|
|
process.env.PORT || 8080 |
|
|
|
}/api/v1/auth/user/signup`,
|
|
|
|
}/api/v1/auth/user/signup`,
|
|
|
|
{ |
|
|
|
{ |
|
|
|
email: `user-${i}@nocodb.com`, |
|
|
|
email: 'user@nocodb.com', |
|
|
|
password: 'Password123.', |
|
|
|
password: 'Password123.', |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
console.log(response.data); |
|
|
|
console.log(admin_response.data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const user = await axios.get( |
|
|
|
for (let i = 0; i < 4; i++) { |
|
|
|
`http://localhost:${process.env.PORT || 8080}/api/v1/auth/user/me`, |
|
|
|
if (!(await User.getByEmail(`user-${i}@nocodb.com`))) { |
|
|
|
{ |
|
|
|
const response = await axios.post( |
|
|
|
headers: { |
|
|
|
`http://localhost:${ |
|
|
|
'xc-auth': response.data.token, |
|
|
|
process.env.PORT || 8080 |
|
|
|
|
|
|
|
}/api/v1/auth/user/signup`,
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
email: `user-${i}@nocodb.com`, |
|
|
|
|
|
|
|
password: 'Password123.', |
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
console.log(response.data); |
|
|
|
|
|
|
|
|
|
|
|
const response2 = await axios.patch( |
|
|
|
const user = await axios.get( |
|
|
|
`http://localhost:${process.env.PORT || 8080}/api/v1/users/${ |
|
|
|
`http://localhost:${process.env.PORT || 8080}/api/v1/auth/user/me`, |
|
|
|
user.data.id |
|
|
|
{ |
|
|
|
}`,
|
|
|
|
headers: { |
|
|
|
{ roles: 'org-level-creator' }, |
|
|
|
'xc-auth': response.data.token, |
|
|
|
{ |
|
|
|
}, |
|
|
|
headers: { |
|
|
|
|
|
|
|
'xc-auth': admin_response.data.token, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
}, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const response2 = await axios.patch( |
|
|
|
|
|
|
|
`http://localhost:${process.env.PORT || 8080}/api/v1/users/${ |
|
|
|
|
|
|
|
user.data.id |
|
|
|
|
|
|
|
}`,
|
|
|
|
|
|
|
|
{ roles: 'org-level-creator' }, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
headers: { |
|
|
|
|
|
|
|
'xc-auth': admin_response.data.token, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
console.log(response2.data); |
|
|
|
console.log(response2.data); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
})().catch((e) => console.log(e)); |
|
|
|
})().catch((e) => console.log(e)); |
|
|
|