1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-12 05:38:12 +09:00
This commit is contained in:
MeiMei 2020-03-29 23:18:03 +09:00 committed by GitHub
parent 244ef0cb8f
commit a448172952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -60,6 +60,7 @@ export default define(meta, async (ps, user) => {
await AccessTokens.save({
id: genId(),
createdAt: new Date(),
lastUsedAt: new Date(),
appId: session.appId,
userId: user.id,
token: accessToken,

View File

@ -26,8 +26,8 @@ export default define(meta, async (ps, user) => {
switch (ps.sort) {
case '+createdAt': query.orderBy('token.createdAt', 'DESC'); 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.andWhere('token.lastUsedAt IS NOT NULL').orderBy('token.lastUsedAt', 'ASC'); break;
case '+lastUsedAt': query.orderBy('token.lastUsedAt', 'DESC'); break;
case '-lastUsedAt': query.orderBy('token.lastUsedAt', 'ASC'); break;
default: query.orderBy('token.id', 'ASC'); break;
}