Openstatus www.openstatus.dev

๐Ÿ”ฅ Api for terraform (#1042)

* ๐Ÿ› optional field

* ๐Ÿ”ฅ fmt

* ci: apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

authored by

Thibault Le Ouay
autofix-ci[bot]
and committed by
GitHub
4ca5896c fcbecff6

+5 -2
+1
apps/server/src/v1/monitors/post.ts
··· 88 88 regions: regions ? regions.join(",") : undefined, 89 89 headers: input.headers ? JSON.stringify(input.headers) : undefined, 90 90 assertions: assert.length > 0 ? serialize(assert) : undefined, 91 + timeout: input.timeout || 45000, 91 92 }) 92 93 .returning() 93 94 .get();
+2 -1
apps/server/src/v1/monitors/put.ts
··· 46 46 const { id } = c.req.valid("param"); 47 47 const input = c.req.valid("json"); 48 48 49 + console.log("input", input); 49 50 if (!limits.periodicity.includes(input.periodicity)) { 50 51 throw new HTTPException(403, { message: "Forbidden" }); 51 52 } ··· 80 81 regions: regions ? regions.join(",") : undefined, 81 82 headers: input.headers ? JSON.stringify(input.headers) : undefined, 82 83 assertions: assert.length > 0 ? serialize(assert) : undefined, 84 + timeout: input.timeout || 45000, 83 85 }) 84 86 .where(eq(monitor.id, Number(_monitor.id))) 85 87 .returning() 86 88 .get(); 87 89 88 90 const data = MonitorSchema.parse(_newMonitor); 89 - 90 91 return c.json(data, 200); 91 92 }); 92 93 }
+2 -1
apps/server/src/v1/monitors/schema.ts
··· 170 170 }), 171 171 assertions: z 172 172 .preprocess((val) => { 173 + console.log("val", val); 173 174 try { 174 175 if (Array.isArray(val)) return val; 175 176 if (String(val).length > 0) { ··· 202 203 degradedAfter: z.number().nullish().openapi({ 203 204 description: "The time after the monitor is considered degraded", 204 205 }), 205 - timeout: z.number().nullish().openapi({ 206 + timeout: z.number().nullish().default(45000).openapi({ 206 207 description: "The timeout of the request", 207 208 }), 208 209 })