Page MenuHomeSealhub

file.ts
No OneTemporary

import { toCamelCase } from "js-convert-case";
import {
FieldHandler,
FieldHandlerResult,
} from "../shared-crud-form-fields.js";
export const file_handler: FieldHandler<
FieldHandlerResult,
Partial<FieldHandlerResult>
> = async (_, { name, is_required }, __, { is_required_expr }) => {
const tempname = toCamelCase("prepared-" + name);
return {
field: `${name}: new Fields.File(${is_required_expr}, TheFileManager)`,
initial_value_edit: `${name}: {old: item.get("${name}")}`,
pre_edit: `const ${tempname} = data.${name}.new || data.${name}.old;
if(!${tempname}){
throw new Error("Missing field: ${name}")
}`,
fallback_value_sealious: "null",
...(is_required ? { main_value_sealious: tempname } : {}),
};
};

File Metadata

Mime Type
text/x-java
Expires
Fri, Jan 24, 15:16 (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
600407
Default Alt Text
file.ts (749 B)

Event Timeline