|
|
@ -352,13 +352,8 @@ export default class BaseUser { |
|
|
|
qb.whereNot(`${MetaTable.PROJECT}.deleted`, true); |
|
|
|
qb.whereNot(`${MetaTable.PROJECT}.deleted`, true); |
|
|
|
|
|
|
|
|
|
|
|
const baseList = await qb; |
|
|
|
const baseList = await qb; |
|
|
|
if (baseList?.length) { |
|
|
|
|
|
|
|
// parse meta
|
|
|
|
|
|
|
|
for (const base of baseList) { |
|
|
|
|
|
|
|
base.meta = parseMetaProp(base); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (baseList && baseList?.length) { |
|
|
|
const castedProjectList = baseList |
|
|
|
const castedProjectList = baseList |
|
|
|
.filter((p) => !params?.type || p.type === params.type) |
|
|
|
.filter((p) => !params?.type || p.type === params.type) |
|
|
|
.sort( |
|
|
|
.sort( |
|
|
@ -366,11 +361,18 @@ export default class BaseUser { |
|
|
|
(a.order != null ? a.order : Infinity) - |
|
|
|
(a.order != null ? a.order : Infinity) - |
|
|
|
(b.order != null ? b.order : Infinity), |
|
|
|
(b.order != null ? b.order : Infinity), |
|
|
|
) |
|
|
|
) |
|
|
|
.map((m) => Base.castType(m)); |
|
|
|
.map((m) => { |
|
|
|
|
|
|
|
m.meta = parseMetaProp(m); |
|
|
|
await Promise.all(castedProjectList.map((base) => base.getSources(ncMeta))); |
|
|
|
return Base.castType(m); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await Promise.all( |
|
|
|
|
|
|
|
castedProjectList.map((base) => base.getSources(ncMeta)), |
|
|
|
|
|
|
|
); |
|
|
|
return castedProjectList; |
|
|
|
return castedProjectList; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
return []; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static async updateOrInsert( |
|
|
|
static async updateOrInsert( |
|
|
|