Schema work
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Julien Valverdé
2024-03-19 17:41:41 +01:00
parent 27a8fc1c9b
commit c61f5332fc
5 changed files with 85 additions and 42 deletions

View File

@@ -18,16 +18,17 @@ export function dejsonifyDecimalSchema<
>(schema: S) {
return z
.custom<JsonifiedDecimal>(identity)
.pipe(z
.string()
.transform(v => {
try {
return new Decimal(v)
}
catch (e) {
return v
}
})
.pipe(schema)
.pipe(
z
.string()
.transform(v => {
try {
return new Decimal(v)
}
catch (e) {
return v
}
})
)
.pipe(schema)
}