Skip to content

Commit

Permalink
refactor: change default limit 500
Browse files Browse the repository at this point in the history
  • Loading branch information
cooderl committed Mar 10, 2024
1 parent 5f4d64e commit d5ae8c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
12 changes: 6 additions & 6 deletions apps/server/src/trpc/trpc.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ export class TrpcRouter {
list: this.trpcService.protectedProcedure
.input(
z.object({
limit: z.number().min(1).max(100).nullish(),
limit: z.number().min(1).max(500).nullish(),
cursor: z.string().nullish(),
}),
)
.query(async ({ input }) => {
const limit = input.limit ?? 50;
const limit = input.limit ?? 500;
const { cursor } = input;

const items = await this.prismaService.account.findMany({
Expand Down Expand Up @@ -132,12 +132,12 @@ export class TrpcRouter {
list: this.trpcService.protectedProcedure
.input(
z.object({
limit: z.number().min(1).max(100).nullish(),
limit: z.number().min(1).max(500).nullish(),
cursor: z.string().nullish(),
}),
)
.query(async ({ input }) => {
const limit = input.limit ?? 50;
const limit = input.limit ?? 500;
const { cursor } = input;

const items = await this.prismaService.feed.findMany({
Expand Down Expand Up @@ -247,13 +247,13 @@ export class TrpcRouter {
list: this.trpcService.protectedProcedure
.input(
z.object({
limit: z.number().min(1).max(100).nullish(),
limit: z.number().min(1).max(500).nullish(),
cursor: z.string().nullish(),
mpId: z.string().nullish(),
}),
)
.query(async ({ input }) => {
const limit = input.limit ?? 50;
const limit = input.limit ?? 500;
const { cursor, mpId } = input;

const items = await this.prismaService.article.findMany({
Expand Down
4 changes: 1 addition & 3 deletions apps/web/src/pages/accounts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ import { statusMap } from '@web/constants';
const AccountPage = () => {
const { isOpen, onOpen, onClose, onOpenChange } = useDisclosure();

const { refetch, data, isFetching } = trpc.account.list.useQuery({
limit: 100,
});
const { refetch, data, isFetching } = trpc.account.list.useQuery({});

const { mutateAsync: updateAccount } = trpc.account.edit.useMutation({});

Expand Down
4 changes: 1 addition & 3 deletions apps/web/src/pages/feeds/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ const Feeds = () => {

const { isOpen, onOpen, onOpenChange, onClose } = useDisclosure();
const { refetch: refetchFeedList, data: feedData } = trpc.feed.list.useQuery(
{
limit: 100,
},
{},
{
refetchOnWindowFocus: true,
},
Expand Down

0 comments on commit d5ae8c2

Please sign in to comment.