Token stats fix

This commit is contained in:
Douglas Barone 2020-11-13 10:51:42 -04:00
parent f207092294
commit 18880905df
5 changed files with 14 additions and 8 deletions

View File

@ -84,9 +84,13 @@ const Query = {
tokenCountUsed: prisma.resetToken.count({ tokenCountUsed: prisma.resetToken.count({
where: { NOT: { usedAt: null } } where: { NOT: { usedAt: null } }
}), }),
tokenCountExpired: 0, tokenCountExpired: prisma.resetToken.count({
where: {
AND: [{ expiration: { lt: new Date() } }, { usedAt: null }]
}
}),
tokenCountNotUsed: prisma.resetToken.count({ tokenCountNotUsed: prisma.resetToken.count({
where: { usedAt: null } where: { usedAt: null, expiration: { gt: new Date() } }
}) })
} }
}, },

View File

@ -6,7 +6,9 @@ const ResetToken = {
}, },
user(_) { user(_) {
return prisma.resetToken.findOne({ where: { id: _.id } }).user() return prisma.resetToken.findOne({ where: { id: _.id } }).user()
} },
expiration: _ => _.expiration.toISOString(),
createdAt: _ => _.createdAt.toISOString()
} }
export { ResetToken } export { ResetToken }

View File

@ -46,7 +46,7 @@
<v-icon>mdi-clock-outline</v-icon> <v-icon>mdi-clock-outline</v-icon>
</v-list-item-avatar> </v-list-item-avatar>
<v-list-item-content> <v-list-item-content>
<v-list-item-title> Tokens ainda não usados </v-list-item-title> <v-list-item-title> Tokens aguardando uso </v-list-item-title>
<v-list-item-subtitle> <v-list-item-subtitle>
{{ stats.tokenCountNotUsed }} {{ stats.tokenCountNotUsed }}
</v-list-item-subtitle> </v-list-item-subtitle>

View File

@ -31,7 +31,7 @@
</v-card> </v-card>
<div class="text-center font-weight-light mt-5"> <div class="text-center font-weight-light mt-5">
Válido até Válido até
{{ tokenInfo.expiration | dateAndtime }} {{ tokenInfo.expiration | dateAndTime }}
</div> </div>
</v-col> </v-col>
</v-row> </v-row>
@ -48,7 +48,7 @@
<v-list dense class="font-weight-light text-justify"> <v-list dense class="font-weight-light text-justify">
<v-list-item> <v-list-item>
<v-list-item-avatar> <v-list-item-avatar>
<v-icon>mdi-account-card-details</v-icon> <v-icon>mdi-card-account-details</v-icon>
</v-list-item-avatar> </v-list-item-avatar>
<v-list-item-content> <v-list-item-content>
Após cadastrar sua nova senha, utilize seu CPF como login. Após cadastrar sua nova senha, utilize seu CPF como login.
@ -57,7 +57,7 @@
<v-list-item> <v-list-item>
<v-list-item-avatar> <v-list-item-avatar>
<v-icon>mdi-textbox-password</v-icon> <v-icon>mdi-form-textbox-password</v-icon>
</v-list-item-avatar> </v-list-item-avatar>
<v-list-item-content> <v-list-item-content>
A senha é de responsabilidade do usuário e não deve ser A senha é de responsabilidade do usuário e não deve ser