parent
244ef0cb8f
commit
a448172952
2 changed files with 3 additions and 2 deletions
|
@ -60,6 +60,7 @@ export default define(meta, async (ps, user) => {
|
||||||
await AccessTokens.save({
|
await AccessTokens.save({
|
||||||
id: genId(),
|
id: genId(),
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
|
lastUsedAt: new Date(),
|
||||||
appId: session.appId,
|
appId: session.appId,
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
token: accessToken,
|
token: accessToken,
|
||||||
|
|
|
@ -26,8 +26,8 @@ export default define(meta, async (ps, user) => {
|
||||||
switch (ps.sort) {
|
switch (ps.sort) {
|
||||||
case '+createdAt': query.orderBy('token.createdAt', 'DESC'); break;
|
case '+createdAt': query.orderBy('token.createdAt', 'DESC'); break;
|
||||||
case '-createdAt': query.orderBy('token.createdAt', 'ASC'); break;
|
case '-createdAt': query.orderBy('token.createdAt', 'ASC'); break;
|
||||||
case '+lastUsedAt': query.andWhere('token.lastUsedAt IS NOT NULL').orderBy('token.lastUsedAt', 'DESC'); break;
|
case '+lastUsedAt': query.orderBy('token.lastUsedAt', 'DESC'); break;
|
||||||
case '-lastUsedAt': query.andWhere('token.lastUsedAt IS NOT NULL').orderBy('token.lastUsedAt', 'ASC'); break;
|
case '-lastUsedAt': query.orderBy('token.lastUsedAt', 'ASC'); break;
|
||||||
default: query.orderBy('token.id', 'ASC'); break;
|
default: query.orderBy('token.id', 'ASC'); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue