@budibase/worker 1.1.32-alpha.2 → 1.1.32-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/worker",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "1.1.32-alpha.
|
|
4
|
+
"version": "1.1.32-alpha.3",
|
|
5
5
|
"description": "Budibase background service",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"author": "Budibase",
|
|
36
36
|
"license": "GPL-3.0",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@budibase/backend-core": "1.1.32-alpha.
|
|
39
|
-
"@budibase/pro": "1.1.32-alpha.
|
|
40
|
-
"@budibase/string-templates": "1.1.32-alpha.
|
|
41
|
-
"@budibase/types": "1.1.32-alpha.
|
|
38
|
+
"@budibase/backend-core": "1.1.32-alpha.3",
|
|
39
|
+
"@budibase/pro": "1.1.32-alpha.2",
|
|
40
|
+
"@budibase/string-templates": "1.1.32-alpha.3",
|
|
41
|
+
"@budibase/types": "1.1.32-alpha.3",
|
|
42
42
|
"@koa/router": "8.0.8",
|
|
43
43
|
"@sentry/node": "6.17.7",
|
|
44
44
|
"@techpass/passport-openidconnect": "0.3.2",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"./scripts/jestSetup.js"
|
|
102
102
|
]
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "1b7322e51adc38e71f59caa2daf057304df07771"
|
|
105
105
|
}
|
|
@@ -3,7 +3,7 @@ import { checkInviteCode } from "../../../utilities/redis"
|
|
|
3
3
|
import { sendEmail } from "../../../utilities/email"
|
|
4
4
|
import { users } from "../../../sdk"
|
|
5
5
|
import env from "../../../environment"
|
|
6
|
-
import { User, CloudAccount
|
|
6
|
+
import { User, CloudAccount } from "@budibase/types"
|
|
7
7
|
import {
|
|
8
8
|
events,
|
|
9
9
|
errors,
|
|
@@ -114,6 +114,16 @@ export const adminUser = async (ctx: any) => {
|
|
|
114
114
|
})
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
export const countByApp = async (ctx: any) => {
|
|
118
|
+
const appId = ctx.params.appId
|
|
119
|
+
try {
|
|
120
|
+
const response = await users.countUsersByApp(appId)
|
|
121
|
+
ctx.body = response
|
|
122
|
+
} catch (err: any) {
|
|
123
|
+
ctx.throw(err.status || 400, err)
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
117
127
|
export const destroy = async (ctx: any) => {
|
|
118
128
|
const id = ctx.params.id
|
|
119
129
|
|
|
@@ -64,6 +64,7 @@ router
|
|
|
64
64
|
.post("/api/global/users/search", builderOrAdmin, controller.search)
|
|
65
65
|
.delete("/api/global/users/:id", adminOnly, controller.destroy)
|
|
66
66
|
.post("/api/global/users/bulkDelete", adminOnly, controller.bulkDelete)
|
|
67
|
+
.get("/api/global/users/count/:appId", adminOnly, controller.countByApp)
|
|
67
68
|
.get("/api/global/roles/:appId")
|
|
68
69
|
.post(
|
|
69
70
|
"/api/global/users/invite",
|
package/src/sdk/users/users.ts
CHANGED
|
@@ -20,7 +20,7 @@ import { groups as groupUtils } from "@budibase/pro"
|
|
|
20
20
|
|
|
21
21
|
const PAGE_LIMIT = 8
|
|
22
22
|
|
|
23
|
-
export const allUsers = async (
|
|
23
|
+
export const allUsers = async () => {
|
|
24
24
|
const db = tenancy.getGlobalDB()
|
|
25
25
|
const response = await db.allDocs(
|
|
26
26
|
dbUtils.getGlobalUserParams(null, {
|
|
@@ -30,6 +30,13 @@ export const allUsers = async (newDb?: any) => {
|
|
|
30
30
|
return response.rows.map((row: any) => row.doc)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
export const countUsersByApp = async (appId: string) => {
|
|
34
|
+
let response: any = await usersCore.searchGlobalUsersByApp(appId, {})
|
|
35
|
+
return {
|
|
36
|
+
userCount: response.length,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
33
40
|
export const paginatedUsers = async ({
|
|
34
41
|
page,
|
|
35
42
|
email,
|