mirror of
https://github.com/documenso/documenso.git
synced 2026-08-22 22:32:22 +10:00
feat: track when API tokens were last used
This commit is contained in:
@@ -96,6 +96,17 @@ export const getApiTokenByToken = async ({ token, bypassRateLimit = false }: Get
|
||||
});
|
||||
}
|
||||
|
||||
void prisma.apiToken
|
||||
.update({
|
||||
where: {
|
||||
id: apiToken.id,
|
||||
},
|
||||
data: {
|
||||
lastUsedAt: new Date(),
|
||||
},
|
||||
})
|
||||
.catch(() => null);
|
||||
|
||||
return {
|
||||
...apiToken,
|
||||
user,
|
||||
|
||||
@@ -22,6 +22,7 @@ export const getApiTokens = async ({ userId, teamId }: GetApiTokensOptions) => {
|
||||
name: true,
|
||||
createdAt: true,
|
||||
expires: true,
|
||||
lastUsedAt: true,
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
|
||||
Reference in New Issue
Block a user