Files
kami-parse-server/src/Controllers/types.js
Antonio Davi Macedo Coelho de Castro fd637ff4f8 Required fields and default values (#5835)
* Add field options to mongo schema metadata

* Add/fix test with fields options

* Add required validation failing test

* Add more tests

* Only set default value if field is undefined

* Fix redis test

* Fix tests

* Test for creating a new class with field options

* Validate default value type

* fix lint (weird)

* Fix lint another way

* Add tests for beforeSave trigger and solve small issue regarding the use of unset in the beforeSave trigger
2019-07-25 21:13:59 -07:00

33 lines
751 B
JavaScript

export type LoadSchemaOptions = {
clearCache: boolean,
};
export type SchemaField = {
type: string,
targetClass?: ?string,
required?: ?boolean,
defaultValue?: ?any,
};
export type SchemaFields = { [string]: SchemaField };
export type Schema = {
className: string,
fields: SchemaFields,
classLevelPermissions: ClassLevelPermissions,
indexes?: ?any,
};
export type ClassLevelPermissions = {
find?: { [string]: boolean },
count?: { [string]: boolean },
get?: { [string]: boolean },
create?: { [string]: boolean },
update?: { [string]: boolean },
delete?: { [string]: boolean },
addField?: { [string]: boolean },
readUserFields?: string[],
writeUserFields?: string[],
protectedFields?: { [string]: string[] },
};