Skip to content
Snippets Groups Projects
Commit 74194aa8 authored by raghosh's avatar raghosh
Browse files

#68: updated contributor function.

parent f228b91f
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,7 @@ module.exports = createCoreController('api::novel-condensate.novel-condensate',
const { query } = ctx;
query['populate'] = ['submittedBy', 'reviewedBy'];
let entity = await strapi.service("api::update-item.update-item").findOne(id, query);
let entity = await strapi.service("api::novel-condensate.novel-condensate").findOne(id, query);
switch (ctx.state.user.role.name) {
case 'Public':
......
......@@ -281,8 +281,15 @@ module.exports = createCoreController('api::update-item.update-item', ({ strapi
if (ctx.params.entity === 'condensate') {
const [entries] = await strapi.db.query('plugin::users-permissions.user').findWithCount({
select: ['username', 'full_name'],
populate: {
role: {
where: {
$not: {
name: 'Maintainer',
}
}
},
SubmittedUpdateItems: {
where: {
EntityId: { $contains: ctx.params.id, },
......@@ -291,17 +298,28 @@ module.exports = createCoreController('api::update-item.update-item', ({ strapi
},
}
},
orderBy: { id: 'DESC' },
select: ['username', 'full_name'],
orderBy: { id: 'DESC' },
});
const { data, meta } = await super.find(ctx);
const filteredEntries = entries.filter(f => f.role !== null)
return { entries, meta };
return { filteredEntries, meta };
} else if (ctx.params.entity === 'protein') {
const [entries] = await strapi.db.query('plugin::users-permissions.user').findWithCount({
select: ['username', 'full_name'],
populate: {
role: {
where: {
$not: {
name: 'Maintainer',
}
}
},
SubmittedUpdateItems: {
where: {
EntityId: { $eq: ctx.params.id, },
......@@ -315,9 +333,36 @@ module.exports = createCoreController('api::update-item.update-item', ({ strapi
});
const { data, meta } = await super.find(ctx);
const filteredEntries = entries.filter(f => f.role !== null)
return { filteredEntries, meta };
} else if (ctx.params.entity === 'all') {
const [entries] = await strapi.db.query('plugin::users-permissions.user').findWithCount({
return { entries, meta };
select: ['username', 'full_name'],
populate: {
role: {
where: {
$not: {
name: 'Maintainer',
}
}
},
SubmittedUpdateItems: {
where: {
Status: 'synced',
},
}
},
orderBy: { id: 'DESC' },
});
const { data, meta } = await super.find(ctx);
const filteredEntries = entries.filter(f => f.role !== null)
return { filteredEntries, meta };
}
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment