(model: string)
| 1287 | |
| 1288 | @cache() |
| 1289 | private makeOmitSchema(model: string) { |
| 1290 | const fields: Record<string, ZodType> = {}; |
| 1291 | for (const [field, fieldDef] of this.getModelFields(model)) { |
| 1292 | if (!fieldDef.relation) { |
| 1293 | if (this.options.allowQueryTimeOmitOverride !== false) { |
| 1294 | // if override is allowed, use boolean |
| 1295 | fields[field] = z.boolean().optional(); |
| 1296 | } else { |
| 1297 | // otherwise only allow true |
| 1298 | fields[field] = z.literal(true).optional(); |
| 1299 | } |
| 1300 | } |
| 1301 | } |
| 1302 | |
| 1303 | this.addExtResultFields(model, fields); |
| 1304 | |
| 1305 | const result = z.strictObject(fields); |
| 1306 | this.registerSchema(`${model}OmitInput`, result); |
| 1307 | return result; |
| 1308 | } |
| 1309 | |
| 1310 | private addExtResultFields(model: string, fields: Record<string, ZodType>) { |
| 1311 | for (const plugin of this.plugins) { |
no test coverage detected