diff --git a/api/app/lib/controllers/auth/index.js b/api/app/lib/controllers/auth/index.js index ac242fd..1727601 100644 --- a/api/app/lib/controllers/auth/index.js +++ b/api/app/lib/controllers/auth/index.js @@ -56,6 +56,7 @@ async function login(ctx, next) { // await transaction.commit(); } catch (error) { // await transaction.rollback(); + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = { message: typeof error == 'string' ? error : '登录失败' diff --git a/api/app/lib/controllers/metadataSearch/index.js b/api/app/lib/controllers/metadataSearch/index.js index 9832f1d..edebd92 100644 --- a/api/app/lib/controllers/metadataSearch/index.js +++ b/api/app/lib/controllers/metadataSearch/index.js @@ -15,6 +15,14 @@ function searchMeta(opts) { where['$or'] = [{ name: { $iLike: `%${keywords}%` } } ] } + const resourceCatalogOrganization = { + model: models.ResourceCatalog, + attributes: ['id', 'name'], + include: [{ + model: models.Organization, + attributes: ['id', 'name'], + }] + } const findObj = { include: [ { @@ -22,7 +30,9 @@ function searchMeta(opts) { include: [{ model: models.Tag, }] - }], + }, + resourceCatalogOrganization + ], where: { ...where, type: { $in: ['表', '库'] } @@ -35,7 +45,9 @@ function searchMeta(opts) { include: [{ model: models.Tag, }] - }], + }, + resourceCatalogOrganization + ], where: where } const findObj3 = { @@ -45,7 +57,8 @@ function searchMeta(opts) { include: [{ model: models.Tag, }] - }], + }, + ], where: where } diff --git a/api/app/lib/index.js b/api/app/lib/index.js index 9c0f409..14424bc 100644 --- a/api/app/lib/index.js +++ b/api/app/lib/index.js @@ -110,6 +110,7 @@ module.exports.models = function (dc) { MetadataDatabase.belongsTo(ResourceCatalog, { foreignKey: 'catalog', targetKey: 'id' }); RestfulApi.belongsTo(ResourceCatalog, { foreignKey: 'catalog', targetKey: 'id' }); - + MetadataFile.belongsTo(ResourceCatalog, { foreignKey: 'catalog', targetKey: 'id' }); + ResourceCatalog.belongsTo(Organization, { foreignKey: 'orgId', targetKey: 'id' }); }; diff --git a/web/client/src/sections/resourceRetrieval/containers/retrieval.js b/web/client/src/sections/resourceRetrieval/containers/retrieval.js index 9f99eed..38f7846 100644 --- a/web/client/src/sections/resourceRetrieval/containers/retrieval.js +++ b/web/client/src/sections/resourceRetrieval/containers/retrieval.js @@ -201,15 +201,19 @@ function Retrieval(props) {