Skip to content

Commit 631023d

Browse files
committed
Review fixes
1 parent 0d8607a commit 631023d

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/components/zod/custom-types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ export * from './json-string';
77
export * from './entity-name';
88
export * from './tenant-settings';
99
export * from './primitive';
10-
export * from './query-string-array';
10+
export * from './string-array';
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import {z} from 'zod';
22

3-
export const queryStringArray = () => {
3+
export const stringArray = ({min = 0, max = Infinity}: {min?: number; max?: number}) => {
44
return z
55
.union([z.string(), z.array(z.string())])
6-
.transform((val) => (typeof val === 'string' ? [val] : val));
6+
.transform((val) => (typeof val === 'string' ? [val] : val))
7+
.pipe(z.array(z.string()).min(min).max(max));
78
};

src/controllers/entries/delete-entry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const requestSchema = {
1313
query: z.object({
1414
lockToken: z.string().optional(),
1515
scope: z.nativeEnum(EntryScope).optional(),
16-
types: zc.queryStringArray().optional(),
16+
types: zc.stringArray({min: 0, max: 100}).optional(),
1717
}),
1818
};
1919

0 commit comments

Comments
 (0)