sumba 2.22.0 → 2.22.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.
@@ -1,10 +1,8 @@
1
1
  export async function clearCache (id, result) {
2
2
  if (!this.app.bajoCache) return
3
- const { hash } = this.app.bajoExtra
4
3
  const { clear } = this.app.bajoCache ?? {}
5
- const { get, isEmpty } = this.app.lib._
6
- let token = get(result, 'data.token', get(result, 'oldData.token', ''))
7
- if (!isEmpty(token)) token = await hash(token)
4
+ const { get } = this.app.lib._
5
+ const token = get(result, 'data.token', get(result, 'oldData.token', ''))
8
6
  await clear({ key: `dobo|SumbaUser|getUserById|${id}` })
9
7
  await clear({ key: `dobo|SumbaUser|getUserByToken|${token}` })
10
8
  }
@@ -28,6 +28,7 @@ async function user () {
28
28
  maxLength: 100,
29
29
  virtual: true,
30
30
  getValue: async function (val, rec) {
31
+ if (!rec.salt) return
31
32
  return await this.plugin.hash(rec.salt)
32
33
  }
33
34
  }, {
@@ -63,7 +64,7 @@ async function user () {
63
64
  fields: ['email', 'siteId'],
64
65
  type: 'unique'
65
66
  }],
66
- hidden: ['password', 'token'],
67
+ hidden: ['password'],
67
68
  features: [
68
69
  'sumba:address',
69
70
  'sumba:social',
@@ -1,5 +1,5 @@
1
1
  const model = 'SumbaUser'
2
- const hidden = ['password', 'token', 'siteId', 'salt']
2
+ const hidden = ['password', 'siteId']
3
3
 
4
4
  async function get () {
5
5
  const { getRecord } = this.app.waibuDb
package/index.js CHANGED
@@ -173,8 +173,8 @@ async function factory (pkgName) {
173
173
  start = async () => {
174
174
  const { getModel } = this.app.dobo
175
175
  if (this.config.interSiteAdmins.length === 0) {
176
- const site = await getModel('SumbaSite').findOneRecord({ query: { alias: 'default' } }, { noHook: true })
177
- const user = await getModel('SumbaUser').findOneRecord({ query: { username: 'admin', siteId: site.id } }, { noHook: true })
176
+ const site = await getModel('SumbaSite').findOneRecord({ query: { alias: 'default' } }, { noMagic: true })
177
+ const user = await getModel('SumbaUser').findOneRecord({ query: { username: 'admin', siteId: site.id } }, { noMagic: true })
178
178
  this.config.interSiteAdmins.push(user.id)
179
179
  }
180
180
  }
package/lib/collect.js CHANGED
@@ -48,5 +48,5 @@ export async function collectTeam () {
48
48
  await eachPlugins(async function ({ file, dir }) {
49
49
  const { ns } = this
50
50
  await collect.call(me, { type: 'team', container: 'Routes', handler, file, ns, dir })
51
- }, { glob: 'route/team.*', prefix: this.ns })
51
+ }, { glob: 'route-guard/team.*', prefix: this.ns })
52
52
  }
package/lib/util.js CHANGED
@@ -111,10 +111,9 @@ export async function checkUserId (req, reply, source) {
111
111
  const userId = get(req, 'session.userId')
112
112
 
113
113
  const setUser = async () => {
114
- const id = get(req, 'session.userId')
115
- if (!id) return
114
+ if (!userId) return
116
115
  try {
117
- const user = await this.getUserById(id, req)
116
+ const user = await this.getUserById(userId, req)
118
117
  if (user) req.user = user
119
118
  else req.session.userId = null
120
119
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sumba",
3
- "version": "2.22.0",
3
+ "version": "2.22.1",
4
4
  "description": "Biz Suite for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## 2026-04-25
4
4
 
5
+ - [2.21.1] Bug fix on team routes collections
6
+
7
+ ## 2026-04-25
8
+
5
9
  - [2.21.0] Change options to format value using the new key set by dobo
6
10
  - [2.21.0] Remove ```options.retainOriginalValue``` since it is not needed anymore
7
11
  - [2.21.0] Remove ```property.formatValue``` from all properties