mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
feat(core): billing history pagination (#4787)
This commit is contained in:
@@ -8,10 +8,12 @@ import {
|
||||
Args,
|
||||
Field,
|
||||
ID,
|
||||
Int,
|
||||
Mutation,
|
||||
ObjectType,
|
||||
Query,
|
||||
registerEnumType,
|
||||
ResolveField,
|
||||
Resolver,
|
||||
} from '@nestjs/graphql';
|
||||
import type { User } from '@prisma/client';
|
||||
@@ -156,6 +158,17 @@ export class UserResolver {
|
||||
return user;
|
||||
}
|
||||
|
||||
@Throttle({ default: { limit: 10, ttl: 60 } })
|
||||
@ResolveField(() => Int, {
|
||||
name: 'invoiceCount',
|
||||
description: 'Get user invoice count',
|
||||
})
|
||||
async invoiceCount(@CurrentUser() user: UserType) {
|
||||
return this.prisma.userInvoice.count({
|
||||
where: { userId: user.id },
|
||||
});
|
||||
}
|
||||
|
||||
@Throttle({
|
||||
default: {
|
||||
limit: 10,
|
||||
|
||||
@@ -23,6 +23,9 @@ type UserType {
|
||||
"""User password has been set"""
|
||||
hasPassword: Boolean
|
||||
token: TokenType!
|
||||
|
||||
"""Get user invoice count"""
|
||||
invoiceCount: Int!
|
||||
subscription: UserSubscription
|
||||
invoices(take: Int = 8, skip: Int): [UserInvoice!]!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user