Skip to content

Commit 59cb3ce

Browse files
committed
refactor: moved pagination types
1 parent c1f6a53 commit 59cb3ce

4 files changed

Lines changed: 7 additions & 15 deletions

File tree

src/shared/api/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ export {
1111
DateTimeString,
1212
PaginatedResponseSchema,
1313
MetaSchema,
14-
type Meta,
15-
type PaginatedResponse,
1614
} from './schemas';
1715
export { AccessToken } from './token';
1816
export { queryClient } from './query-client';

src/shared/api/schemas/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
export { GlobalSuccess } from './global-success';
22
export { GlobalError } from './global-error';
33
export { DateTimeString } from './date-time-string';
4-
export {
5-
PaginatedResponseSchema,
6-
MetaSchema,
7-
type PaginatedResponse,
8-
type Meta,
9-
} from './pagination';
4+
export { PaginatedResponseSchema, MetaSchema } from './pagination';

src/shared/api/schemas/pagination.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@ export const MetaSchema = z.object({
99
limit: z.number(),
1010
});
1111

12-
export type Meta = z.infer<typeof MetaSchema>;
13-
1412
export const PaginatedResponseSchema = <T extends z.ZodType>(schema: T) =>
1513
z.object({
1614
items: z.array(schema),
1715
meta: MetaSchema,
1816
});
19-
20-
export type PaginatedResponse<T> = {
21-
items: T[];
22-
meta: Meta;
23-
};

src/shared/api/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,9 @@ import * as SApi from './schemas';
33

44
export type GlobalSuccess = z.infer<typeof SApi.GlobalSuccess>;
55
export type GlobalError = z.infer<typeof SApi.GlobalError>;
6+
export type PaginationMeta = z.infer<typeof SApi.MetaSchema>;
7+
8+
export type PaginatedResponse<T> = {
9+
items: T[];
10+
meta: PaginationMeta;
11+
};

0 commit comments

Comments
 (0)