[#2992] fixed zero-default value not being used if the field is not explicitly set when manually creating records

This commit is contained in:
Gani Georgiev
2023-07-25 20:35:29 +03:00
parent 34fe55686d
commit 1330e2e1e7
11 changed files with 6241 additions and 6054 deletions
File diff suppressed because it is too large Load Diff
+13 -8
View File
@@ -141,6 +141,13 @@ declare function routerPre(...middlewares: Array<string|echo.MiddlewareFunc>): v
// baseBinds
// -------------------------------------------------------------------
/**
* Global helper variable that contains the absolute path to the app pb_hooks directory.
*
* @group PocketBase
*/
declare var __hooks: string
// skip on* hook methods as they are registered via the global on* method
type appWithoutHooks = Omit<pocketbase.PocketBase, ` + "`on${string}`" + `>
@@ -148,6 +155,8 @@ type appWithoutHooks = Omit<pocketbase.PocketBase, ` + "`on${string}`" + `>
* ` + "`$app`" + ` is the current running PocketBase instance that is globally
* available in each .pb.js file.
*
* _Note that this variable is available only in pb_hooks context._
*
* @namespace
* @group PocketBase
*/
@@ -162,14 +171,10 @@ declare var $app: appWithoutHooks
* Example:
*
* ` + "```" + `js
* routerAdd("get", "/hello", (c) => {
* const html = $template.loadFiles(
* "views/layout.html",
* "views/content.html",
* ).render({"name": "John"})
*
* return c.html(200, html)
* })
* const html = $template.loadFiles(
* "views/layout.html",
* "views/content.html",
* ).render({"name": "John"})
* ` + "```" + `
*
* _Note that this method is available only in pb_hooks context._
+6
View File
@@ -201,6 +201,11 @@ func (p *plugin) registerHooks() error {
return nil
}
absHooksDir, err := filepath.Abs(p.config.HooksDir)
if err != nil {
return err
}
p.app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
e.Router.HTTPErrorHandler = p.normalizeServeExceptions(e.Router.HTTPErrorHandler)
return nil
@@ -225,6 +230,7 @@ func (p *plugin) registerHooks() error {
apisBinds(vm)
vm.Set("$app", p.app)
vm.Set("$template", templateRegistry)
vm.Set("__hooks", absHooksDir)
}
// initiliaze the executor vms