1
This commit is contained in:
@@ -3,6 +3,17 @@ const { normalize_for_write, build_search_where } = require("../utils/query_help
|
||||
const baseModel = require("../../middleware/baseModel");
|
||||
const tokenLogic = require("../service/biz_token_logic");
|
||||
const audit = require("../utils/biz_audit");
|
||||
const biz_token_secret_cipher = require("../utils/biz_token_secret_cipher");
|
||||
|
||||
function map_tokens_for_admin_detail(token_rows) {
|
||||
return token_rows.map((t) => {
|
||||
const o = t.get ? t.get({ plain: true }) : { ...t };
|
||||
const cipher = o.secret_cipher;
|
||||
delete o.secret_cipher;
|
||||
o.plain_token = biz_token_secret_cipher.decrypt_plain_from_storage(cipher);
|
||||
return o;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
"POST /biz_user/page": async (ctx) => {
|
||||
@@ -134,13 +145,13 @@ module.exports = {
|
||||
where: { user_id: id },
|
||||
order: [["id", "DESC"]],
|
||||
limit: 200,
|
||||
attributes: ["id", "user_id", "plan_id", "token_name", "status", "expire_at", "last_used_at"],
|
||||
});
|
||||
const tokens_out = map_tokens_for_admin_detail(tokens);
|
||||
ctx.success({
|
||||
user,
|
||||
subscriptions,
|
||||
tokenCount,
|
||||
tokens,
|
||||
tokens: tokens_out,
|
||||
});
|
||||
},
|
||||
"GET /biz_user/all": async (ctx) => {
|
||||
|
||||
Reference in New Issue
Block a user