oak-general-business/lib/oak-app-domain/OauthUser/Storage.js

79 lines
1.9 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.desc = void 0;
const Action_1 = require("./Action");
exports.desc = {
attributes: {
userId: {
type: "ref",
ref: "user"
},
applicationId: {
notNull: true,
type: "ref",
ref: "application"
},
providerConfigId: {
notNull: true,
type: "ref",
ref: "oauthProvider"
},
providerUserId: {
notNull: true,
type: "varchar",
params: {
length: 256
}
},
rawUserInfo: {
notNull: true,
type: "object"
},
// 令牌 10-21: 不知道为什么老超出,设置大一点
accessToken: {
notNull: true,
type: "varchar",
params: {
length: 1024
}
},
refreshToken: {
type: "varchar",
params: {
length: 1024
}
},
accessExpiresAt: {
notNull: true,
type: "datetime"
},
refreshExpiresAt: {
type: "datetime"
},
stateId: {
notNull: true,
type: "ref",
ref: "oauthState"
},
loadState: {
type: "enum",
enumeration: ["unload", "loaded"]
}
},
actionType: "crud",
actions: Action_1.actions,
indexes: [
{
// 业务上可能涉及的间接授权查询,建立索引以避免全表扫描
name: 'idx_oauthUser_composite',
attributes: [{
name: "userId",
}, {
name: 'providerUserId',
}, {
name: "providerConfigId",
}]
}
]
};