-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reuse existing types for fetching assets
- Loading branch information
Showing
3 changed files
with
18 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
import { z } from 'zod'; | ||
|
||
const assetInsertSchema = z.array( | ||
z.object({ | ||
key: z.string(), | ||
assetId: z.string(), | ||
name: z.string(), | ||
type: z.string(), | ||
url: z.string(), | ||
size: z.number(), | ||
value: z.string().optional(), | ||
}), | ||
); | ||
const assetInsertSchema = z.object({ | ||
key: z.string(), | ||
assetId: z.string(), | ||
name: z.string(), | ||
type: z.string(), | ||
url: z.string(), | ||
size: z.number(), | ||
value: z.string().optional(), | ||
}); | ||
|
||
export type AssetInsertType = z.infer<typeof assetInsertSchema>; | ||
|
||
export const protocolInsertSchema = z | ||
.object({ | ||
protocol: z.unknown(), // TODO: replace this with zod schema version of Protocol type | ||
protocolName: z.string(), | ||
newAssets: assetInsertSchema, | ||
newAssets: z.array(assetInsertSchema), | ||
existingAssetIds: z.array(z.string()), | ||
}) | ||
.passthrough(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters