dobo 2.11.0 → 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -155,7 +155,6 @@ async function buildFromDbModel (opts = {}) {
155
155
  }
156
156
 
157
157
  const props = [...this.properties, ...extFields]
158
-
159
158
  for (const p of props) {
160
159
  if (excludedTypes.includes(p.type) || excludedNames.includes(p.name)) continue
161
160
  if (opts.partial && fields.length > 0 && !fields.includes(p.name)) continue
@@ -229,11 +228,11 @@ async function buildFromDbModel (opts = {}) {
229
228
  async function validate (body, joiModel, opts = {}) {
230
229
  const { defaultsDeep } = this.app.lib.aneka
231
230
  const { isEmpty } = this.app.lib._
232
- let { fields, extFields = [], params = {}, partial } = opts
233
-
231
+ let { extFields = [], params = {}, partial } = opts
234
232
  params = defaultsDeep(params, this.app.dobo.config.validationParams)
235
233
  const { rule = {} } = params
236
234
  delete params.rule
235
+ const fields = partial ? Object.keys(body) : [...opts.fields]
237
236
  if (isEmpty(joiModel)) joiModel = await buildFromDbModel.call(this, { fields, rule, extFields, partial })
238
237
  if (!joiModel) return { value: body }
239
238
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dobo",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "description": "DBMS for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-03-17
4
+
5
+ - [2.11.1] Bug fix on ```model.validate()```: if ```partial``` is true, set ```fields``` from ```body``` keys
6
+
3
7
  ## 2026-03-16
4
8
 
5
9
  - [2.11.0] Attachment can now listed by its type (```image```, ```video```, etc)