updated schemas, fixed tests, skipping flow tests for now

This commit is contained in:
dswbx
2025-07-03 14:00:29 +02:00
parent fe1716ed01
commit 5143ee5726
23 changed files with 119 additions and 101 deletions
+20 -38
View File
@@ -23,46 +23,28 @@ export function buildMediaSchema() {
);
});
return s
.strictObject(
{
enabled: s.boolean({ default: false }),
basepath: s.string({ default: "/api/media" }),
entity_name: s.string({ default: "media" }),
storage: s
.strictObject({
body_max_size: s.number({
return s.strictObject(
{
enabled: s.boolean({ default: false }),
basepath: s.string({ default: "/api/media" }),
entity_name: s.string({ default: "media" }),
storage: s.strictObject(
{
body_max_size: s
.number({
description: "Max size of the body in bytes. Leave blank for unlimited.",
}),
})
.partial(),
adapter: s.anyOf(Object.values(adapterSchemaObject)),
},
{
default: {},
},
)
.partial();
})
.optional(),
},
{ default: {} },
),
adapter: s.anyOf(Object.values(adapterSchemaObject)).optional(),
},
{
default: {},
},
);
}
export const mediaConfigSchema = buildMediaSchema();
export type TAppMediaConfig = s.Static<typeof mediaConfigSchema>;
export type TAppMediaConfig2 = s.ObjectDefaults<(typeof mediaConfigSchema)["properties"]>;
const schema = s.strictObject(
{
enabled: s.boolean({ default: false }),
basepath: s.string({ default: "/api/media" }),
entity_name: s.string({ default: "media" }),
storage: s
.strictObject({
body_max_size: s.number({
description: "Max size of the body in bytes. Leave blank for unlimited.",
}),
})
.partial(),
},
{
default: {},
},
);
+2 -1
View File
@@ -37,7 +37,8 @@ export class Storage implements EmitsEvents {
this.#adapter = adapter;
this.config = {
...config,
body_max_size: config.body_max_size,
body_max_size:
config.body_max_size && config.body_max_size > 0 ? config.body_max_size : undefined,
};
this.emgr = emgr ?? new EventManager();