|
|
@ -109,10 +109,10 @@ export default class BaseUser { |
|
|
|
public static async getUsersList( |
|
|
|
public static async getUsersList( |
|
|
|
{ |
|
|
|
{ |
|
|
|
base_id, |
|
|
|
base_id, |
|
|
|
query, |
|
|
|
mode = 'full', |
|
|
|
}: { |
|
|
|
}: { |
|
|
|
base_id: string; |
|
|
|
base_id: string; |
|
|
|
query?: string; |
|
|
|
mode?: 'full' | 'viewer'; |
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta = Noco.ncMeta, |
|
|
|
ncMeta = Noco.ncMeta, |
|
|
|
): Promise<(Partial<User> & BaseUser)[]> { |
|
|
|
): Promise<(Partial<User> & BaseUser)[]> { |
|
|
@ -126,17 +126,17 @@ export default class BaseUser { |
|
|
|
`${MetaTable.USERS}.id`, |
|
|
|
`${MetaTable.USERS}.id`, |
|
|
|
`${MetaTable.USERS}.email`, |
|
|
|
`${MetaTable.USERS}.email`, |
|
|
|
`${MetaTable.USERS}.display_name`, |
|
|
|
`${MetaTable.USERS}.display_name`, |
|
|
|
|
|
|
|
...(mode === 'full' |
|
|
|
|
|
|
|
? [ |
|
|
|
`${MetaTable.USERS}.invite_token`, |
|
|
|
`${MetaTable.USERS}.invite_token`, |
|
|
|
`${MetaTable.USERS}.roles as main_roles`, |
|
|
|
`${MetaTable.USERS}.roles as main_roles`, |
|
|
|
`${MetaTable.USERS}.created_at as created_at`, |
|
|
|
`${MetaTable.USERS}.created_at as created_at`, |
|
|
|
`${MetaTable.PROJECT_USERS}.base_id`, |
|
|
|
`${MetaTable.PROJECT_USERS}.base_id`, |
|
|
|
`${MetaTable.PROJECT_USERS}.roles as roles`, |
|
|
|
`${MetaTable.PROJECT_USERS}.roles as roles`, |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
: []), |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (query) { |
|
|
|
|
|
|
|
queryBuilder.where('email', 'like', `%${query.toLowerCase?.()}%`); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
queryBuilder.leftJoin(MetaTable.PROJECT_USERS, function () { |
|
|
|
queryBuilder.leftJoin(MetaTable.PROJECT_USERS, function () { |
|
|
|
this.on( |
|
|
|
this.on( |
|
|
|
`${MetaTable.PROJECT_USERS}.fk_user_id`, |
|
|
|
`${MetaTable.PROJECT_USERS}.fk_user_id`, |
|
|
|